예제 #1
0
 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);
        }
예제 #3
0
 public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)),
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base)));
 }
예제 #4
0
 public void RemoveOwner(OwnershipOwner owner)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(owner.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
예제 #5
0
 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)
 {
     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);
 }
예제 #10
0
        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);
        }
예제 #11
0
        //  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);
        }
        //  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);
        }
예제 #13
0
        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);
        }
예제 #14
0
 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));
        }
예제 #16
0
 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 void AddOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     AddVersion(registration, owner, null);
 }
 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 void RemoveOwner(OwnershipOwner owner)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(owner.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
 public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)), 
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base)));
 }
예제 #23
0
 public Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     throw new NotImplementedException();
 }
 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));
        }
예제 #27
0
 public Task <IEnumerable <OwnershipRegistration> > GetRegistrations(OwnershipOwner owner)
 {
     throw new NotImplementedException();
 }