diff --git a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/DimSeedDataGenerator.cs b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/DimSeedDataGenerator.cs index bcf5dc9a6..26db7ecf3 100644 --- a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/DimSeedDataGenerator.cs +++ b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/DimSeedDataGenerator.cs @@ -1966,11 +1966,16 @@ private void createPartyTypeMappings() #region person + if (partyTypes.Any(p => p.Title.Equals("Person"))) { PartyType partyType = partyTypes.FirstOrDefault(p => p.Title.Equals("Person")); - //FirstName - string complexAttrName = "MicroAgentP"; + + + #region technical contact + + string contact = "Metadata/TechnicalContacts/TechnicalContactsXmlSchemaComplexType/TechnicalContact"; + if (partyCustomAttrs.Any( pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id))) @@ -1980,7 +1985,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Name", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -1988,7 +1993,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Name", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2003,7 +2008,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Name", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2011,7 +2016,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Name", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2026,7 +2031,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Phone", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2034,7 +2039,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Phone", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2049,7 +2054,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Email", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2057,7 +2062,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Email", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2074,7 +2079,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2082,7 +2087,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2097,7 +2102,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2105,7 +2110,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2120,7 +2125,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2128,7 +2133,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2143,7 +2148,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2151,18 +2156,212 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Address", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } + #endregion adress + + #endregion + + #region content contact + + contact = "Metadata/ContentContacts/ContentContactsXmlSchemaComplexType/ContentContact"; + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Name", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Name[0]")); + + createFromPartyTypeMapping( + "Name", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "FirstName[0] LastName[0]")); + } + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Name", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Name[1]")); + + createFromPartyTypeMapping( + "Name", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "FirstName[0] LastName[0]")); + } + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("Phone") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("Phone") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Phone", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + + createFromPartyTypeMapping( + "Phone", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, new TransformationRule()); } + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("EMail") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("EMail") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Email", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + + createFromPartyTypeMapping( + "Email", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } + + #region adress + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("Street") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("Street") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Address[0]")); + + createFromPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("City") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("City") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Address[1]")); + + createFromPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("ZipCode") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("ZipCode") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Address[2]")); + + createFromPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } + + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("Country") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("Country") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule(@"\w+", "Address[3]")); + + createFromPartyTypeMapping( + "Address", LinkElementType.MetadataNestedAttributeUsage, + contact, LinkElementType.MetadataAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } #endregion adress + #endregion + #region owner releationship - string personUsage = "Person"; + string personUsage = " Metadata/Metadata/ContentMetadata/Owners/OwnersXmlSchemaComplexType/Owner/Contact/Person"; if (partyCustomAttrs.Any( pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id))) @@ -2242,7 +2441,7 @@ private void createPartyTypeMappings() { PartyType partyType = partyTypes.FirstOrDefault(p => p.Title.Equals("Organization")); //FirstName - string complexAttrName = "Metadata/Metadata/ContentMetadata/Owners/OwnersXmlSchemaComplexType/Owner/Contact/Organisation/Organisation/Name/Label/Representation/RepresentationXmlSchemaComplexType"; + string complexAttrName = "Metadata/Metadata/ContentMetadata/Owners/OwnersXmlSchemaComplexType/Owner/Contact/Organisation/Organisation/Name/Label/Representation"; if (partyCustomAttrs.Any( pAttr => pAttr.Name.Equals("Name") && pAttr.PartyType.Id.Equals(partyType.Id))) @@ -2252,7 +2451,7 @@ private void createPartyTypeMappings() createToPartyTypeMapping( "Text", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + complexAttrName, LinkElementType.MetadataNestedAttributeUsage, partyCustomAttribute, partyType, rootTo, metadataRef, mappingManager, metadataAttributeManager, @@ -2260,7 +2459,7 @@ private void createPartyTypeMappings() createFromPartyTypeMapping( "Text", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, + complexAttrName, LinkElementType.MetadataNestedAttributeUsage, partyCustomAttribute, partyType, rootFrom, metadataRef, mappingManager, metadataAttributeManager, @@ -2306,52 +2505,60 @@ private void createPartyTypeMappings() PartyType partyType = partyTypes.FirstOrDefault(p => p.Title.Equals("Person")); //FirstName - string complexAttrName = "individualNameXmlSchemaComplexType"; - - if (partyCustomAttrs.Any( - pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id))) - { - PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( - pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id)); - - createToPartyTypeMapping( - "givenName", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, - partyCustomAttribute, partyType, rootTo, metadataRef, - mappingManager, - metadataAttributeManager, - new TransformationRule()); - - createFromPartyTypeMapping( - "givenName", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, - partyCustomAttribute, partyType, rootFrom, metadataRef, - mappingManager, - metadataAttributeManager, - new TransformationRule()); - } + List complexUsages = new List(); + complexUsages.Add("Metadata/creator/agentType/individualName/"); + complexUsages.Add("Metadata/metadataProvider/metadataProviderType/individualName"); + complexUsages.Add("Metadata/associatedParty/associatedPartyType/individualName"); + complexUsages.Add("Metadata/contact/contactType/individualName"); + complexUsages.Add("Metadata/project/projectType/personnel/agentWithRoleType/individualName"); - if (partyCustomAttrs.Any( - pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id))) + foreach (var complexUsage in complexUsages) { - PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( - pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id)); - - createToPartyTypeMapping( - "surName", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, - partyCustomAttribute, partyType, rootTo, metadataRef, - mappingManager, - metadataAttributeManager, - new TransformationRule()); + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("FirstName") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "givenName", LinkElementType.MetadataNestedAttributeUsage, + complexUsage, LinkElementType.MetadataNestedAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + + createFromPartyTypeMapping( + "givenName", LinkElementType.MetadataNestedAttributeUsage, + complexUsage, LinkElementType.MetadataNestedAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } - createFromPartyTypeMapping( - "surName", LinkElementType.MetadataNestedAttributeUsage, - complexAttrName, LinkElementType.ComplexMetadataAttribute, - partyCustomAttribute, partyType, rootFrom, metadataRef, - mappingManager, - metadataAttributeManager, - new TransformationRule()); + if (partyCustomAttrs.Any( + pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id))) + { + PartyCustomAttribute partyCustomAttribute = partyCustomAttrs.FirstOrDefault( + pAttr => pAttr.Name.Equals("LastName") && pAttr.PartyType.Id.Equals(partyType.Id)); + + createToPartyTypeMapping( + "surName", LinkElementType.MetadataNestedAttributeUsage, + complexUsage, LinkElementType.MetadataNestedAttributeUsage, + partyCustomAttribute, partyType, rootTo, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + + createFromPartyTypeMapping( + "surName", LinkElementType.MetadataNestedAttributeUsage, + complexUsage, LinkElementType.MetadataNestedAttributeUsage, + partyCustomAttribute, partyType, rootFrom, metadataRef, + mappingManager, + metadataAttributeManager, + new TransformationRule()); + } } #region owner relationship @@ -2488,7 +2695,7 @@ private void createToPartyTypeMapping( string sIdComplex = complex.Attribute("id").Value; string nameComplex = complex.Attribute("name").Value; LinkElement tmpComplexElement = createLinkELementIfNotExist(mappingManager,metadataAttributeManager, Convert.ToInt64(sIdComplex), nameComplex, - complexType, LinkElementComplexity.Complex,""); + complexType, LinkElementComplexity.Complex, complexNodeName); Mapping complexMapping = MappingHelper.CreateIfNotExistMapping(tmpComplexElement, le, 1, new TransformationRule(), root, mappingManager);