public bool HasOwner(OwnershipRegistration registration, OwnershipOwner owner) { return(Graph.ContainsTriple(new Triple( Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Owner), Graph.CreateUriNode(owner.GetUri(Base))))); }
public async Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner) { OwnershipRecord record = await Load(); record.RemoveOwnerFromRegistration(registration, owner); await Save(record); }
public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner) { Graph.Retract( Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Owner), Graph.CreateUriNode(owner.GetUri(Base))); }
public void RemoveOwner(OwnershipOwner owner) { foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(owner.GetUri(Base))).ToList()) { Graph.Retract(triple); } }
public async Task AddOwner(OwnershipRegistration registration, OwnershipOwner owner) { CloudTableClient client = _account.CreateCloudTableClient(); CloudTable table = client.GetTableReference(OwnershipTableName); TableOperation operation = TableOperation.InsertOrReplace(new TypedEntity(registration.GetKey(), owner.GetKey(), OwnerType)); await table.ExecuteAsync(operation); }
public async Task AddOwner(OwnershipRegistration registration, OwnershipOwner owner) { OwnershipRecord record = await Load(); record.AddOwner(registration, owner); await Save(record); }
public async Task AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version) { OwnershipRecord record = await Load(); record.AddVersion(registration, owner, version); await Save(record); }
public async Task AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version) { CloudTableClient client = _account.CreateCloudTableClient(); CloudTable table = client.GetTableReference(OwnershipTableName); TableBatchOperation batch = new TableBatchOperation(); batch.InsertOrReplace(new TypedEntity(registration.GetKey(), owner.GetKey(), OwnerType)); batch.InsertOrReplace(new TypedEntity(registration.GetKey(), version, PackageType)); await table.ExecuteBatchAsync(batch); }
// updates public void AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version) { INode registrationNode = Graph.CreateUriNode(registration.GetUri(Base)); INode ownerNode = Graph.CreateUriNode(owner.GetUri(Base)); INode recordNode = Graph.CreateUriNode(GetRecordUri()); Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.Record)); Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode); Graph.Assert(recordNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode); Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordRegistration)); Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Namespace), Graph.CreateLiteralNode(registration.Namespace)); Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Id), Graph.CreateLiteralNode(registration.Id)); Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Owner), ownerNode); if (version != null) { Graph.Assert(registrationNode, Graph.CreateUriNode(Schema.Predicates.Version), Graph.CreateLiteralNode(version)); } Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Type), Graph.CreateUriNode(Schema.DataTypes.RecordOwner)); Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.NameIdentifier), Graph.CreateLiteralNode(owner.NameIdentifier)); if (owner.Name != null) { Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Name), Graph.CreateLiteralNode(owner.Name)); } if (owner.GivenName != null) { Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.GivenName), Graph.CreateLiteralNode(owner.GivenName)); } if (owner.Surname != null) { Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Surname), Graph.CreateLiteralNode(owner.Surname)); } if (owner.Email != null) { Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Email), Graph.CreateLiteralNode(owner.Email)); } if (owner.Iss != null) { Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Iss), Graph.CreateLiteralNode(owner.Iss)); } Graph.Assert(ownerNode, Graph.CreateUriNode(Schema.Predicates.Registration), registrationNode); }
public IEnumerable <OwnershipRegistration> GetRegistrations(OwnershipOwner owner) { IList <OwnershipRegistration> result = new List <OwnershipRegistration>(); foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(owner.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Registration))) { string ns = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Namespace)).First().Object.ToString(); string id = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Id)).First().Object.ToString(); result.Add(new OwnershipRegistration { Namespace = ns, Id = id }); } return(result); }
public Task <bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner) { return(ExistsAsync(_account, registration.GetKey(), owner.GetKey())); }
public async Task <IEnumerable <OwnershipRegistration> > GetRegistrations(OwnershipOwner owner) { OwnershipRecord record = await Load(); return(record.GetRegistrations(owner)); }
public void AddOwner(OwnershipRegistration registration, OwnershipOwner owner) { AddVersion(registration, owner, null); }
public Task<bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner) { return ExistsAsync(_account, registration.GetKey(), owner.GetKey()); }
public bool HasOwner(OwnershipRegistration registration, OwnershipOwner owner) { return Graph.ContainsTriple(new Triple( Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Owner), Graph.CreateUriNode(owner.GetUri(Base)))); }
public IEnumerable<OwnershipRegistration> GetRegistrations(OwnershipOwner owner) { IList<OwnershipRegistration> result = new List<OwnershipRegistration>(); foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(owner.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Registration))) { string ns = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Namespace)).First().Object.ToString(); string id = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.Id)).First().Object.ToString(); result.Add(new OwnershipRegistration { Namespace = ns, Id = id }); } return result; }
public Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner) { throw new NotImplementedException(); }
public Task<IEnumerable<OwnershipRegistration>> GetRegistrations(OwnershipOwner owner) { throw new NotImplementedException(); }
public async Task <bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner) { OwnershipRecord record = await Load(); return(record.HasOwner(registration, owner)); }
public Task <IEnumerable <OwnershipRegistration> > GetRegistrations(OwnershipOwner owner) { throw new NotImplementedException(); }