private static void LoadSystemProperties(MetadataSystemInformationUnit system, metsTypeMetsHdrAgent metsSystemAgent) { if (metsSystemAgent.name != null && LooksLikeSystemName(metsSystemAgent.name)) { system.Name = metsSystemAgent.name; } string type = metsSystemAgent.note?.FirstOrDefault(LooksLikeSystemType); if (type != null) { system.Type = type; } // Find first occurance of a version number defined before Type. That's probably the version ... string version = metsSystemAgent.note?.TakeWhile(n => !n.Equals(type)) .FirstOrDefault(LooksLikeSystemVersion); if (version != null) { system.Version = version; } // Find first occurance of a version number defined after Type. That's probably the type-version ... string typeVersion = metsSystemAgent.note?.SkipWhile(n => !n.Equals(type)).FirstOrDefault(LooksLikeSystemTypeVersion); if (typeVersion != null && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { system.TypeVersion = typeVersion; } }
private static void LoadSystemProperties(MetadataSystemInformationUnit system, metsTypeMetsHdrAgent[] metsSystemAgents) { foreach (metsTypeMetsHdrAgent metsSystemAgent in metsSystemAgents) { if (metsSystemAgent.name != null && LooksLikeSystemName(metsSystemAgent.name)) { system.Name = metsSystemAgent.name; continue; } string version = metsSystemAgent.note?.FirstOrDefault(LooksLikeSystemVersion); if (version != null && system.Version == null) // May be TypeVersion (found after Version) { system.Version = version; continue; } string type = metsSystemAgent.note?.FirstOrDefault(LooksLikeSystemType); if (type != null) { system.Type = type; continue; } string typeVersion = metsSystemAgent.note?.FirstOrDefault(LooksLikeSystemTypeVersion); if (typeVersion != null && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { system.TypeVersion = typeVersion; } } }
private static void LoadSystem(ArchiveMetadata archiveMetadata, metsTypeMetsHdrAgent[] metsHdrAgents) { metsTypeMetsHdrAgent metsSystemAgent = metsHdrAgents.FirstOrDefault(a => a.TYPE == metsTypeMetsHdrAgentTYPE.OTHER && a.OTHERTYPE == metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE && a.ROLE == metsTypeMetsHdrAgentROLE.ARCHIVIST ); if (metsSystemAgent == null) { return; } var system = new MetadataSystemInformationUnit(); LoadSystemProperties(system, metsSystemAgent); if (HasData(system)) { archiveMetadata.System = system; } }
private static void LoadSystem(ArchiveMetadata archiveMetadata, metsTypeMetsHdrAgent[] metsHdrAgents) { metsTypeMetsHdrAgent[] metsSystemAgents = metsHdrAgents.Where(a => a.TYPE == metsTypeMetsHdrAgentTYPE.OTHER && a.OTHERTYPE == metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE && a.ROLE == metsTypeMetsHdrAgentROLE.ARCHIVIST ).ToArray(); if (!metsSystemAgents.Any()) { return; } var system = new MetadataSystemInformationUnit(); LoadSystemProperties(system, metsSystemAgents); if (HasData(system)) { archiveMetadata.System = system; } }
private static string[] GetSystemPropertiesNotes(MetadataSystemInformationUnit system) { var notes = new List <string>(); if (!string.IsNullOrEmpty(system.Version)) { notes.Add(system.Version); } if (!string.IsNullOrEmpty(system.Type) && MetsTranslationHelper.IsValidSystemType(system.Type)) { notes.Add(system.Type); } if (!string.IsNullOrEmpty(system.TypeVersion) && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { notes.Add(system.TypeVersion); } return(notes.Any() ? notes.ToArray() : null); }
public static GuiMetaDataModel MapToArchiveSystem(MetadataSystemInformationUnit archiveSystem) { return(MapToSystem(archiveSystem)); }
public static GuiMetaDataModel MapToSystem(MetadataSystemInformationUnit system) { return(new GuiMetaDataModel(system.Name, system.Version, system.Type, system.TypeVersion, GuiObjectType.system)); }
private static void CreateHdrAgents(metsTypeMetsHdr metsHdr, ArchiveMetadata metadata) { var metsTypeMetsHdrAgents = new List <metsTypeMetsHdrAgent>(); // CREATORS: if (metadata.ArchiveCreators != null) { foreach (MetadataEntityInformationUnit metadataArchiveCreator in metadata.ArchiveCreators) { if (HasEntity(metadataArchiveCreator)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = metadataArchiveCreator.Entity }); } if (HasContactData(metadataArchiveCreator)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = metadataArchiveCreator.ContactPerson, note = new[] { metadataArchiveCreator.Address, metadataArchiveCreator.Telephone, metadataArchiveCreator.Email } }); } } } // TRANSFERRER: if (metadata.Transferer != null) { if (HasEntity(metadata.Transferer)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, name = metadata.Transferer.Entity }); } if (HasContactData(metadata.Transferer)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, name = metadata.Transferer.ContactPerson, note = new[] { metadata.Transferer.Address, metadata.Transferer.Telephone, metadata.Transferer.Email } }); } } // PRODUCER: if (metadata.Producer != null) { if (HasEntity(metadata.Producer)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = metadata.Producer.Entity }); } if (HasContactData(metadata.Producer)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = metadata.Producer.ContactPerson, note = new[] { metadata.Producer.Address, metadata.Producer.Telephone, metadata.Producer.Email } }); } } // OWNERS: if (metadata.Owners != null) { foreach (MetadataEntityInformationUnit metadataOwner in metadata.Owners) { if (HasEntity(metadataOwner)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, name = metadataOwner.Entity }); } if (HasContactData(metadataOwner)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, name = metadataOwner.ContactPerson, note = new[] { metadataOwner.Address, metadataOwner.Telephone, metadataOwner.Email } }); } } } // CREATOR: if (metadata.Creator != null) { if (HasEntity(metadata.Creator)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.CREATOR, name = metadata.Creator.Entity }); } if (HasContactData(metadata.Creator)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.CREATOR, name = metadata.Creator.ContactPerson, note = new[] { metadata.Creator.Address, metadata.Creator.Telephone, metadata.Creator.Email } }); } } // RECIPIENT: if (!string.IsNullOrEmpty(metadata.Recipient)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.PRESERVATION, name = metadata.Recipient }); } // SYSTEM: if (metadata.System != null) { MetadataSystemInformationUnit system = metadata.System; if (!string.IsNullOrEmpty(system.Name)) { var systemAgent = new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = system.Name }; systemAgent.note = GetSystemPropertiesNotes(system); metsTypeMetsHdrAgents.Add(systemAgent); } } // ARCHIVE SYSTEM: if (metadata.ArchiveSystem != null) { MetadataSystemInformationUnit archiveSystem = metadata.ArchiveSystem; if (!string.IsNullOrEmpty(archiveSystem.Name)) { var archiveSystemAgent = new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = archiveSystem.Name }; archiveSystemAgent.note = GetSystemPropertiesNotes(archiveSystem); metsTypeMetsHdrAgents.Add(archiveSystemAgent); } } if (metsTypeMetsHdrAgents.Any()) { metsHdr.agent = metsTypeMetsHdrAgents.ToArray(); } }
private static void CreateHdrAgents(metsTypeMetsHdr metsHdr, ArchiveMetadata metadata) { var metsTypeMetsHdrAgents = new List <metsTypeMetsHdrAgent>(); // CREATORS: if (metadata.ArchiveCreators != null) { foreach (MetadataEntityInformationUnit metadataArchiveCreator in metadata.ArchiveCreators) { if (!string.IsNullOrEmpty(metadataArchiveCreator.Entity)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = metadataArchiveCreator.Entity }); } if (!string.IsNullOrEmpty(metadataArchiveCreator.ContactPerson)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = metadataArchiveCreator.ContactPerson }); } if (!string.IsNullOrEmpty(metadataArchiveCreator.Telephone)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, note = new[] { metadataArchiveCreator.Telephone } }); } if (!string.IsNullOrEmpty(metadataArchiveCreator.Email)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, note = new[] { metadataArchiveCreator.Email } }); } } } // TRANSFERRER: if (metadata.Transferer != null) { if (!string.IsNullOrEmpty(metadata.Transferer.Entity)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, name = metadata.Transferer.Entity }); } if (!string.IsNullOrEmpty(metadata.Transferer.ContactPerson)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, name = metadata.Transferer.ContactPerson }); } if (!string.IsNullOrEmpty(metadata.Transferer.Telephone)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, note = new[] { metadata.Transferer.Telephone } }); } if (!string.IsNullOrEmpty(metadata.Transferer.Email)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.SUBMITTER, note = new[] { metadata.Transferer.Email } }); } } // PRODUCER: if (metadata.Producer != null) { if (!string.IsNullOrEmpty(metadata.Producer.Entity)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = metadata.Producer.Entity }); } if (!string.IsNullOrEmpty(metadata.Producer.ContactPerson)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = metadata.Producer.ContactPerson, }); } if (!string.IsNullOrEmpty(metadata.Producer.Telephone)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, note = new[] { metadata.Producer.Telephone } }); } if (!string.IsNullOrEmpty(metadata.Producer.Email)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, note = new[] { metadata.Producer.Email } }); } } // OWNERS: if (metadata.Owners != null) { foreach (MetadataEntityInformationUnit metadataOwner in metadata.Owners) { if (!string.IsNullOrEmpty(metadataOwner.Entity)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, name = metadataOwner.Entity }); } if (!string.IsNullOrEmpty(metadataOwner.ContactPerson)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, name = metadataOwner.ContactPerson }); } if (!string.IsNullOrEmpty(metadataOwner.Telephone)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, note = new[] { metadataOwner.Telephone } }); } if (!string.IsNullOrEmpty(metadataOwner.Email)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.INDIVIDUAL, ROLE = metsTypeMetsHdrAgentROLE.IPOWNER, note = new[] { metadataOwner.Email } }); } } } // RECIPIENT: if (!string.IsNullOrEmpty(metadata.Recipient)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.ORGANIZATION, ROLE = metsTypeMetsHdrAgentROLE.PRESERVATION, name = metadata.Recipient }); } // SYSTEM: if (metadata.System != null) { MetadataSystemInformationUnit system = metadata.System; if (!string.IsNullOrEmpty(system.Name)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, name = system.Name }); } if (!string.IsNullOrEmpty(system.Version)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, note = new[] { system.Version } }); } if (!string.IsNullOrEmpty(system.Type) && MetsTranslationHelper.IsValidSystemType(system.Type)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, note = new[] { system.Type } }); } if (!string.IsNullOrEmpty(system.TypeVersion) && MetsTranslationHelper.IsSystemTypeNoark5(system.Type)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.ARCHIVIST, note = new[] { system.TypeVersion } }); } } // ARCHIVE SYSTEM: if (metadata.ArchiveSystem != null) { MetadataSystemInformationUnit archiveSystem = metadata.ArchiveSystem; if (!string.IsNullOrEmpty(archiveSystem.Name)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, name = archiveSystem.Name }); } if (!string.IsNullOrEmpty(archiveSystem.Version)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, note = new[] { archiveSystem.Version } }); } if (!string.IsNullOrEmpty(archiveSystem.Type) && MetsTranslationHelper.IsValidSystemType(archiveSystem.Type)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, note = new[] { archiveSystem.Type } }); } if (!string.IsNullOrEmpty(archiveSystem.TypeVersion) && MetsTranslationHelper.IsSystemTypeNoark5(archiveSystem.Type)) { metsTypeMetsHdrAgents.Add(new metsTypeMetsHdrAgent { TYPE = metsTypeMetsHdrAgentTYPE.OTHER, OTHERTYPESpecified = true, OTHERTYPE = metsTypeMetsHdrAgentOTHERTYPE.SOFTWARE, ROLE = metsTypeMetsHdrAgentROLE.OTHER, OTHERROLESpecified = true, OTHERROLE = metsTypeMetsHdrAgentOTHERROLE.PRODUCER, note = new[] { archiveSystem.TypeVersion } }); } } if (metsTypeMetsHdrAgents.Any()) { metsHdr.agent = metsTypeMetsHdrAgents.ToArray(); } }