Esempio n. 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)))));
 }
Esempio n. 2
0
 public bool HasVersion(OwnershipRegistration registration, string version)
 {
     return(Graph.ContainsTriple(new Triple(
                                     Graph.CreateUriNode(registration.GetUri(Base)),
                                     Graph.CreateUriNode(Schema.Predicates.Version),
                                     Graph.CreateLiteralNode(version))));
 }
        public async Task Remove(OwnershipRegistration registration)
        {
            OwnershipRecord record = await Load();

            record.RemoveRegistration(registration);
            await Save(record);
        }
Esempio n. 4
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)));
 }
Esempio n. 5
0
        //  queries

        public bool HasRegistration(OwnershipRegistration registration)
        {
            return(Graph.ContainsTriple(new Triple(
                                            Graph.CreateUriNode(GetRecordUri()),
                                            Graph.CreateUriNode(Schema.Predicates.Registration),
                                            Graph.CreateUriNode(registration.GetUri(Base)))));
        }
        public async Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner)
        {
            OwnershipRecord record = await Load();

            record.RemoveOwnerFromRegistration(registration, owner);
            await Save(record);
        }
 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 void RemoveRegistration(OwnershipRegistration registration)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(registration.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
Esempio n. 9
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 AddVersion(OwnershipRegistration registration, OwnershipOwner owner, string version)
        {
            OwnershipRecord record = await Load();

            record.AddVersion(registration, owner, version);
            await Save(record);
        }
        public async Task AddOwner(OwnershipRegistration registration, OwnershipOwner owner)
        {
            OwnershipRecord record = await Load();

            record.AddOwner(registration, owner);
            await Save(record);
        }
Esempio n. 12
0
 public void RemoveVersion(OwnershipRegistration registration, string version)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)),
         Graph.CreateUriNode(Schema.Predicates.Version),
         Graph.CreateLiteralNode(version));
 }
Esempio n. 13
0
 public void RemoveRegistration(OwnershipRegistration registration)
 {
     foreach (Triple triple in Graph.GetTriples(Graph.CreateUriNode(registration.GetUri(Base))).ToList())
     {
         Graph.Retract(triple);
     }
 }
 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);
 }
Esempio n. 15
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);
        }
Esempio n. 16
0
        public IEnumerable <string> GetVersions(OwnershipRegistration registration)
        {
            IList <string> result = new List <string>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Version)))
            {
                string version = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.ObjectId)).First().Object.ToString();

                result.Add(version);
            }

            return(result);
        }
Esempio n. 17
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);
        }
Esempio n. 19
0
        public IEnumerable <OwnershipOwner> GetOwners(OwnershipRegistration registration)
        {
            IList <OwnershipOwner> result = new List <OwnershipOwner>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Owner)))
            {
                string nameIdentifier = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.NameIdentifier)).First().Object.ToString();

                result.Add(new OwnershipOwner {
                    NameIdentifier = nameIdentifier
                });
            }

            return(result);
        }
Esempio n. 20
0
 public Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     throw new NotImplementedException();
 }
        public IEnumerable<OwnershipOwner> GetOwners(OwnershipRegistration registration)
        {
            IList<OwnershipOwner> result = new List<OwnershipOwner>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Owner)))
            {
                string nameIdentifier = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.NameIdentifier)).First().Object.ToString();

                result.Add(new OwnershipOwner { NameIdentifier = nameIdentifier });
            }

            return result;
        }
        public IEnumerable<string> GetVersions(OwnershipRegistration registration)
        {
            IList<string> result = new List<string>();

            foreach (Triple triple in Graph.GetTriplesWithSubjectPredicate(Graph.CreateUriNode(registration.GetUri(Base)), Graph.CreateUriNode(Schema.Predicates.Version)))
            {
                string version = Graph.GetTriplesWithSubjectPredicate(triple.Object, Graph.CreateUriNode(Schema.Predicates.ObjectId)).First().Object.ToString();

                result.Add(version);
            }

            return result;
        }
 public bool HasVersion(OwnershipRegistration registration, string version)
 {
     return Graph.ContainsTriple(new Triple(
         Graph.CreateUriNode(registration.GetUri(Base)), 
         Graph.CreateUriNode(Schema.Predicates.Version), 
         Graph.CreateLiteralNode(version)));
 }
 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 Task<bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     return ExistsAsync(_account, registration.GetKey(), owner.GetKey());
 }
 public Task<IEnumerable<string>> GetVersions(OwnershipRegistration registration)
 {
     throw new NotImplementedException();
 }
 public void AddOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     AddVersion(registration, owner, null);
 }
 public void RemoveVersion(OwnershipRegistration registration, string version)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)), 
         Graph.CreateUriNode(Schema.Predicates.Version), 
         Graph.CreateLiteralNode(version));
 }
Esempio n. 29
0
 public Task <bool> HasRegistration(OwnershipRegistration registration)
 {
     return(ExistsAsync(_account, registration.GetKey()));
 }
Esempio n. 30
0
 public Task <bool> HasVersion(OwnershipRegistration registration, string version)
 {
     return(ExistsAsync(_account, registration.GetKey(), version));
 }
Esempio n. 31
0
 public void AddOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     AddVersion(registration, owner, null);
 }
 public Task<bool> HasVersion(OwnershipRegistration registration, string version)
 {
     return ExistsAsync(_account, registration.GetKey(), version);
 }
        public async Task <bool> HasVersion(OwnershipRegistration registration, string version)
        {
            OwnershipRecord record = await Load();

            return(record.HasVersion(registration, version));
        }
 public Task RemoveOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     throw new NotImplementedException();
 }
 public Task RemoveVersion(OwnershipRegistration registration, string version)
 {
     throw new NotImplementedException();
 }
 public Task<bool> HasRegistration(OwnershipRegistration registration)
 {
     return ExistsAsync(_account, registration.GetKey());
 }
Esempio n. 37
0
 public Task RemoveVersion(OwnershipRegistration registration, string version)
 {
     throw new NotImplementedException();
 }
        public async Task <IEnumerable <string> > GetVersions(OwnershipRegistration registration)
        {
            OwnershipRecord record = await Load();

            return(record.GetVersions(registration));
        }
 public void RemoveOwnerFromRegistration(OwnershipRegistration registration, OwnershipOwner owner)
 {
     Graph.Retract(
         Graph.CreateUriNode(registration.GetUri(Base)), 
         Graph.CreateUriNode(Schema.Predicates.Owner),
         Graph.CreateUriNode(owner.GetUri(Base)));
 }
        //  queries

        public bool HasRegistration(OwnershipRegistration registration)
        {
            return Graph.ContainsTriple(new Triple(
                Graph.CreateUriNode(GetRecordUri()),
                Graph.CreateUriNode(Schema.Predicates.Registration),
                Graph.CreateUriNode(registration.GetUri(Base))));
        }
 public Task<IEnumerable<OwnershipOwner>> GetOwners(OwnershipRegistration registration)
 {
     throw new NotImplementedException();
 }
Esempio n. 42
0
 public Task <IEnumerable <OwnershipOwner> > GetOwners(OwnershipRegistration registration)
 {
     throw new NotImplementedException();
 }
Esempio n. 43
0
 public Task <bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner)
 {
     return(ExistsAsync(_account, registration.GetKey(), owner.GetKey()));
 }
        public async Task <bool> HasOwner(OwnershipRegistration registration, OwnershipOwner owner)
        {
            OwnershipRecord record = await Load();

            return(record.HasOwner(registration, owner));
        }
Esempio n. 45
0
 public Task <IEnumerable <string> > GetVersions(OwnershipRegistration registration)
 {
     throw new NotImplementedException();
 }