/// <summary>
        /// Serialize the <see cref="DomainOfExpertiseGroup"/>
        /// </summary>
        /// <param name="domainOfExpertiseGroup">The <see cref="DomainOfExpertiseGroup"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(DomainOfExpertiseGroup domainOfExpertiseGroup)
        {
            var jsonObject = new JObject();

            jsonObject.Add("alias", this.PropertySerializerMap["alias"](domainOfExpertiseGroup.Alias.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), domainOfExpertiseGroup.ClassKind)));
            jsonObject.Add("definition", this.PropertySerializerMap["definition"](domainOfExpertiseGroup.Definition.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("domain", this.PropertySerializerMap["domain"](domainOfExpertiseGroup.Domain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](domainOfExpertiseGroup.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](domainOfExpertiseGroup.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("hyperLink", this.PropertySerializerMap["hyperLink"](domainOfExpertiseGroup.HyperLink.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](domainOfExpertiseGroup.Iid));
            jsonObject.Add("isDeprecated", this.PropertySerializerMap["isDeprecated"](domainOfExpertiseGroup.IsDeprecated));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](domainOfExpertiseGroup.ModifiedOn));
            jsonObject.Add("name", this.PropertySerializerMap["name"](domainOfExpertiseGroup.Name));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](domainOfExpertiseGroup.RevisionNumber));
            jsonObject.Add("shortName", this.PropertySerializerMap["shortName"](domainOfExpertiseGroup.ShortName));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](domainOfExpertiseGroup.ThingPreference));
            return(jsonObject);
        }
        /// <summary>
        /// Persist the DTO composition to the ORM layer.
        /// </summary>
        /// <param name="transaction">
        /// The transaction object.
        /// </param>
        /// <param name="partition">
        /// The database partition (schema) where the requested resource will be stored.
        /// </param>
        /// <param name="domainOfExpertiseGroup">
        /// The domainOfExpertiseGroup instance to persist.
        /// </param>
        /// <returns>
        /// True if the persistence was successful.
        /// </returns>
        private bool CreateContainment(NpgsqlTransaction transaction, string partition, DomainOfExpertiseGroup domainOfExpertiseGroup)
        {
            var results = new List <bool>();

            foreach (var alias in this.ResolveFromRequestCache(domainOfExpertiseGroup.Alias))
            {
                results.Add(this.AliasService.CreateConcept(transaction, partition, alias, domainOfExpertiseGroup));
            }

            foreach (var definition in this.ResolveFromRequestCache(domainOfExpertiseGroup.Definition))
            {
                results.Add(this.DefinitionService.CreateConcept(transaction, partition, definition, domainOfExpertiseGroup));
            }

            foreach (var hyperLink in this.ResolveFromRequestCache(domainOfExpertiseGroup.HyperLink))
            {
                results.Add(this.HyperLinkService.CreateConcept(transaction, partition, hyperLink, domainOfExpertiseGroup));
            }

            return(results.All(x => x));
        }
        public void SetUp()
        {
            this.domainOfExpertiseGroupRuleChecker = new DomainOfExpertiseGroupRuleChecker();

            this.domainOfExpertiseGroup = new DomainOfExpertiseGroup();
        }
Beispiel #4
0
        public void SetUp()
        {
            this.siteDirectory = new SiteDirectory(Guid.NewGuid(), null, null);

            var domain1 = new DomainOfExpertise(Guid.NewGuid(), null, null);

            this.siteDirectory.Domain.Add(domain1);
            var domain2 = new DomainOfExpertise(Guid.NewGuid(), null, null);

            this.siteDirectory.Domain.Add(domain2);

            var alias = new Alias(Guid.NewGuid(), null, null);

            domain1.Alias.Add(alias);

            var domainGroup1 = new DomainOfExpertiseGroup(Guid.NewGuid(), null, null);

            this.siteDirectory.DomainGroup.Add(domainGroup1);
            var domainGroup2 = new DomainOfExpertiseGroup(Guid.NewGuid(), null, null);

            this.siteDirectory.DomainGroup.Add(domainGroup2);

            var engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, null);

            this.siteDirectory.Model.Add(engineeringModelSetup);
            var iterationSetup = new IterationSetup(Guid.NewGuid(), null, null);

            engineeringModelSetup.IterationSetup.Add(iterationSetup);

            var naturalLanguage1 = new NaturalLanguage(Guid.NewGuid(), null, null);

            this.siteDirectory.NaturalLanguage.Add(naturalLanguage1);
            var naturalLanguage2 = new NaturalLanguage(Guid.NewGuid(), null, null);

            this.siteDirectory.NaturalLanguage.Add(naturalLanguage2);

            var organization1 = new Organization(Guid.NewGuid(), null, null);

            this.siteDirectory.Organization.Add(organization1);
            var organization2 = new Organization(Guid.NewGuid(), null, null);

            this.siteDirectory.Organization.Add(organization2);

            var participantRole1 = new ParticipantRole(Guid.NewGuid(), null, null);

            this.siteDirectory.ParticipantRole.Add(participantRole1);
            var participantRole2 = new ParticipantRole(Guid.NewGuid(), null, null);

            this.siteDirectory.ParticipantRole.Add(participantRole2);

            this.person1 = new Person(Guid.NewGuid(), null, null);
            this.siteDirectory.Person.Add(this.person1);
            this.person2 = new Person(Guid.NewGuid(), null, null);
            this.siteDirectory.Person.Add(this.person2);

            var personRole1 = new PersonRole(Guid.NewGuid(), null, null);

            this.siteDirectory.PersonRole.Add(personRole1);
            var personRole2 = new PersonRole(Guid.NewGuid(), null, null);

            this.siteDirectory.PersonRole.Add(personRole2);

            var siteReferenceDataLibrary1 = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null);

            this.siteDirectory.SiteReferenceDataLibrary.Add(siteReferenceDataLibrary1);
            var siteReferenceDataLibrary2 = new SiteReferenceDataLibrary(Guid.NewGuid(), null, null);

            this.siteDirectory.SiteReferenceDataLibrary.Add(siteReferenceDataLibrary2);

            this.engineeringModel = new EngineeringModel(Guid.NewGuid(), null, null);
            this.engineeringModel.EngineeringModelSetup = engineeringModelSetup;
            engineeringModelSetup.EngineeringModelIid   = this.engineeringModel.Iid;

            this.iteration = new Iteration(Guid.NewGuid(), null, null);
            this.iteration.IterationSetup = iterationSetup;
            iterationSetup.IterationIid   = this.iteration.Iid;

            this.engineeringModel.Iteration.Add(this.iteration);

            var modelReferenceDataLibrary = new ModelReferenceDataLibrary(Guid.NewGuid(), null, null);

            modelReferenceDataLibrary.RequiredRdl = siteReferenceDataLibrary1;

            engineeringModelSetup.RequiredRdl.Add(modelReferenceDataLibrary);

            var participant = new Participant(Guid.NewGuid(), null, null);

            participant.Person = this.person1;
            participant.Domain.Add(domain1);
            participant.Role = participantRole1;

            engineeringModelSetup.Participant.Add(participant);

            var elementDefinition1 = new ElementDefinition(Guid.NewGuid(), null, null);

            this.iteration.Element.Add(elementDefinition1);
            var elementDefinition2 = new ElementDefinition(Guid.NewGuid(), null, null);

            this.iteration.Element.Add(elementDefinition2);

            var elementUsage = new ElementUsage(Guid.NewGuid(), null, null);

            elementDefinition1.ContainedElement.Add(elementUsage);
            elementUsage.ElementDefinition = elementDefinition2;
        }
 /// <summary>
 /// Add an Domain Group row view model to the list of <see cref="DomainGroup"/>
 /// </summary>
 /// <param name="domainGroup">
 /// The <see cref="DomainGroup"/> that is to be added
 /// </param>
 private DomainOfExpertiseGroupRowViewModel AddDomainGroupRowViewModel(DomainOfExpertiseGroup domainGroup)
 {
     return(new DomainOfExpertiseGroupRowViewModel(domainGroup, this.Session, this));
 }