public List <string> ExportContextItems(List <ContextItem> contextItems, string isoIDRef, string groupName, string prefix) { List <string> errors = new List <string>(); ISOLinkGroup linkGroup = LinkList.LinkGroups.FirstOrDefault(lg => lg.LinkGroupType == ISOEnumerations.ISOLinkGroupType.ManufacturerProprietary && lg.ManufacturerGLN == AgGatewayGLN && lg.LinkGroupDesignator == groupName); if (linkGroup == null) { linkGroup = new ISOLinkGroup() { LinkGroupType = ISOEnumerations.ISOLinkGroupType.ManufacturerProprietary, ManufacturerGLN = AgGatewayGLN, LinkGroupDesignator = groupName, Links = new List <ISOLink>() }; linkGroup.LinkGroupId = BaseMapper.GenerateId(0, "LGP", _lgpID++); //Special ID invocation here due to class relationships LinkList.LinkGroups.Add(linkGroup); } foreach (ContextItem rootContextItem in contextItems) { Tuple <List <ISOLink>, List <string> > linksWithErrors = GetLinksForContextItem(isoIDRef, rootContextItem, prefix); linkGroup.Links.AddRange(linksWithErrors.Item1); errors.AddRange(linksWithErrors.Item2); } return(errors); }
public void ExportUniqueIDs(CompoundIdentifier id, string isoIDRef) { foreach (UniqueId uid in id.UniqueIds) { //Find or create the right LinkGroup ISOLinkGroup linkGroup = null; if (uid.Source == IsoSource) { //No need to export temporary ISO ids continue; } if (uid.IdType == IdTypeEnum.UUID) { //Add to global UUID list linkGroup = LinkList.LinkGroups.FirstOrDefault(lg => lg.LinkGroupType == ISOEnumerations.ISOLinkGroupType.UUID); if (linkGroup == null) { linkGroup = new ISOLinkGroup() { LinkGroupType = ISOEnumerations.ISOLinkGroupType.UUID, LinkGroupDesignator = "UUIDs", Links = new List <ISOLink>() }; linkGroup.LinkGroupId = BaseMapper.GenerateId(0, "LGP", _lgpID++); //Special ID invocation here due to class relationships LinkList.LinkGroups.Add(linkGroup); } } else if (uid.IdType == IdTypeEnum.URI) { //Add to global URI list linkGroup = LinkList.LinkGroups.FirstOrDefault(lg => lg.LinkGroupType == ISOEnumerations.ISOLinkGroupType.UniqueResolvable); if (linkGroup == null) { linkGroup = new ISOLinkGroup() { LinkGroupType = ISOEnumerations.ISOLinkGroupType.UniqueResolvable, LinkGroupDesignator = "URIs", Links = new List <ISOLink>() }; linkGroup.LinkGroupId = BaseMapper.GenerateId(0, "LGP", _lgpID++); //Special ID invocation here due to class relationships LinkList.LinkGroups.Add(linkGroup); } } else { //Save to the AgGateway GLN. The link source is the designator linkGroup = LinkList.LinkGroups.FirstOrDefault(lg => lg.LinkGroupType == ISOEnumerations.ISOLinkGroupType.ManufacturerProprietary && lg.ManufacturerGLN == AgGatewayGLN); if (linkGroup == null) { linkGroup = new ISOLinkGroup() { LinkGroupType = ISOEnumerations.ISOLinkGroupType.ManufacturerProprietary, ManufacturerGLN = AgGatewayGLN, LinkGroupDesignator = UnclassifiedLinkGroupDesignator, Links = new List <ISOLink>() }; linkGroup.LinkGroupId = BaseMapper.GenerateId(0, "LGP", _lgpID++); //Special ID invocation here due to class relationships LinkList.LinkGroups.Add(linkGroup); } } //Add the link ISOLink link = new ISOLink(); link.ObjectIdRef = isoIDRef; link.LinkValue = uid.Id; link.LinkDesignator = uid.Source; linkGroup.Links.Add(link); } }