@Test public void testRead() { ModsDefinition mods = ModsUtils.unmarshal(MonographMapperTest.class.getResource("monograph_mods.xml"), ModsDefinition.class); MonographMapper instance = new MonographMapper(); Monograph result = instance.map(mods); assertNotNull(result); }
@Override public Monograph map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Monograph result = new Monograph(); IdentifierMapper identMap = new IdentifierMapper(); result.setIdentifiers(identMap.map(mods)); LocationDefinition location = nlookup.getLocation(false); if (location != null) { PhysicalLocationDefinition physicalLocation = nlookup.getPhysicalLocation(false); result.setSigla(physicalLocation == null ? null : physicalLocation.getValue()); result.setShelfLocators(ArrayMapper.toStringPlusLanguageItemList(location.getShelfLocator())); } OriginInfoMapper originInfoMap = new OriginInfoMapper(); List<OriginInfoMapper.OriginInfoItem> origins = originInfoMap.map(mods); result.setPublishers(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PUBLISHER)); result.setPrinters(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PRINTER)); TitleInfoMapper titleMap = new TitleInfoMapper(mods); result.setTitles(ArrayMapper.toStringItemList(titleMap.getTitles())); result.setSubtitles(ArrayMapper.toStringItemList(titleMap.getSubtitles())); result.setAlternativeTitles(ArrayMapper.toStringItemList(titleMap.getAlternativeTitles())); result.setKeyTitles(ArrayMapper.toStringItemList(titleMap.getKeyTitles())); NameMapper nameMap = new NameMapper(); List<NameItem> allNames = nameMap.map(mods); result.setAuthors(NameMapper.filter(allNames, true, NameItem.NameRole.AUTHOR)); result.setContributors(NameMapper.filter(allNames, true, NameItem.NameRole.CONTRIBUTOR)); LanguageMapper languageMap = new LanguageMapper(); result.setLanguages(languageMap.map(mods)); ClassificationMapper classificationMap = new ClassificationMapper(); result.setClassifications(classificationMap.mapPairs(mods)); SubjectMapper subjectMap = new SubjectMapper(mods); result.setKeywords(ArrayMapper.toStringItemList(subjectMap.getKeywords())); PhysicalDescriptionMapper physicalDescriptionMap = new PhysicalDescriptionMapper(); List<ArrayItem> pdItems = physicalDescriptionMap.map(mods); result.setPhysicalDescriptions(PhysicalDescriptionMapper.toPairs(pdItems)); result.setPreservationTreatment(PhysicalDescriptionMapper.getPreservationTreatment(pdItems)); result.setPreservationStateOfArt(PhysicalDescriptionMapper.getPreservationStateOfArt(pdItems)); StringPlusLanguage recordOrigin = nlookup.getRecordOrigin(false); result.setRecordOrigin(recordOrigin == null ? null : recordOrigin.getValue()); NoteDefinition note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }
MonographMapper implements Mapper<Monograph> { @Override public Monograph map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Monograph result = new Monograph(); IdentifierMapper identMap = new IdentifierMapper(); result.setIdentifiers(identMap.map(mods)); LocationDefinition location = nlookup.getLocation(false); if (location != null) { PhysicalLocationDefinition physicalLocation = nlookup.getPhysicalLocation(false); result.setSigla(physicalLocation == null ? null : physicalLocation.getValue()); result.setShelfLocators(ArrayMapper.toStringPlusLanguageItemList(location.getShelfLocator())); } OriginInfoMapper originInfoMap = new OriginInfoMapper(); List<OriginInfoMapper.OriginInfoItem> origins = originInfoMap.map(mods); result.setPublishers(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PUBLISHER)); result.setPrinters(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PRINTER)); TitleInfoMapper titleMap = new TitleInfoMapper(mods); result.setTitles(ArrayMapper.toStringItemList(titleMap.getTitles())); result.setSubtitles(ArrayMapper.toStringItemList(titleMap.getSubtitles())); result.setAlternativeTitles(ArrayMapper.toStringItemList(titleMap.getAlternativeTitles())); result.setKeyTitles(ArrayMapper.toStringItemList(titleMap.getKeyTitles())); NameMapper nameMap = new NameMapper(); List<NameItem> allNames = nameMap.map(mods); result.setAuthors(NameMapper.filter(allNames, true, NameItem.NameRole.AUTHOR)); result.setContributors(NameMapper.filter(allNames, true, NameItem.NameRole.CONTRIBUTOR)); LanguageMapper languageMap = new LanguageMapper(); result.setLanguages(languageMap.map(mods)); ClassificationMapper classificationMap = new ClassificationMapper(); result.setClassifications(classificationMap.mapPairs(mods)); SubjectMapper subjectMap = new SubjectMapper(mods); result.setKeywords(ArrayMapper.toStringItemList(subjectMap.getKeywords())); PhysicalDescriptionMapper physicalDescriptionMap = new PhysicalDescriptionMapper(); List<ArrayItem> pdItems = physicalDescriptionMap.map(mods); result.setPhysicalDescriptions(PhysicalDescriptionMapper.toPairs(pdItems)); result.setPreservationTreatment(PhysicalDescriptionMapper.getPreservationTreatment(pdItems)); result.setPreservationStateOfArt(PhysicalDescriptionMapper.getPreservationStateOfArt(pdItems)); StringPlusLanguage recordOrigin = nlookup.getRecordOrigin(false); result.setRecordOrigin(recordOrigin == null ? null : recordOrigin.getValue()); NoteDefinition note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; } }
MonographMapper implements Mapper<Monograph> { @Override public Monograph map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Monograph result = new Monograph(); IdentifierMapper identMap = new IdentifierMapper(); result.setIdentifiers(identMap.map(mods)); LocationDefinition location = nlookup.getLocation(false); if (location != null) { PhysicalLocationDefinition physicalLocation = nlookup.getPhysicalLocation(false); result.setSigla(physicalLocation == null ? null : physicalLocation.getValue()); result.setShelfLocators(ArrayMapper.toStringPlusLanguageItemList(location.getShelfLocator())); } OriginInfoMapper originInfoMap = new OriginInfoMapper(); List<OriginInfoMapper.OriginInfoItem> origins = originInfoMap.map(mods); result.setPublishers(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PUBLISHER)); result.setPrinters(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PRINTER)); TitleInfoMapper titleMap = new TitleInfoMapper(mods); result.setTitles(ArrayMapper.toStringItemList(titleMap.getTitles())); result.setSubtitles(ArrayMapper.toStringItemList(titleMap.getSubtitles())); result.setAlternativeTitles(ArrayMapper.toStringItemList(titleMap.getAlternativeTitles())); result.setKeyTitles(ArrayMapper.toStringItemList(titleMap.getKeyTitles())); NameMapper nameMap = new NameMapper(); List<NameItem> allNames = nameMap.map(mods); result.setAuthors(NameMapper.filter(allNames, true, NameItem.NameRole.AUTHOR)); result.setContributors(NameMapper.filter(allNames, true, NameItem.NameRole.CONTRIBUTOR)); LanguageMapper languageMap = new LanguageMapper(); result.setLanguages(languageMap.map(mods)); ClassificationMapper classificationMap = new ClassificationMapper(); result.setClassifications(classificationMap.mapPairs(mods)); SubjectMapper subjectMap = new SubjectMapper(mods); result.setKeywords(ArrayMapper.toStringItemList(subjectMap.getKeywords())); PhysicalDescriptionMapper physicalDescriptionMap = new PhysicalDescriptionMapper(); List<ArrayItem> pdItems = physicalDescriptionMap.map(mods); result.setPhysicalDescriptions(PhysicalDescriptionMapper.toPairs(pdItems)); result.setPreservationTreatment(PhysicalDescriptionMapper.getPreservationTreatment(pdItems)); result.setPreservationStateOfArt(PhysicalDescriptionMapper.getPreservationStateOfArt(pdItems)); StringPlusLanguage recordOrigin = nlookup.getRecordOrigin(false); result.setRecordOrigin(recordOrigin == null ? null : recordOrigin.getValue()); NoteDefinition note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  }
MonographMapper implements Mapper<Monograph> { @Override public Monograph map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Monograph result = new Monograph(); IdentifierMapper identMap = new IdentifierMapper(); result.setIdentifiers(identMap.map(mods)); LocationDefinition location = nlookup.getLocation(false); if (location != null) { PhysicalLocationDefinition physicalLocation = nlookup.getPhysicalLocation(false); result.setSigla(physicalLocation == null ? null : physicalLocation.getValue()); result.setShelfLocators(ArrayMapper.toStringPlusLanguageItemList(location.getShelfLocator())); } OriginInfoMapper originInfoMap = new OriginInfoMapper(); List<OriginInfoMapper.OriginInfoItem> origins = originInfoMap.map(mods); result.setPublishers(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PUBLISHER)); result.setPrinters(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PRINTER)); TitleInfoMapper titleMap = new TitleInfoMapper(mods); result.setTitles(ArrayMapper.toStringItemList(titleMap.getTitles())); result.setSubtitles(ArrayMapper.toStringItemList(titleMap.getSubtitles())); result.setAlternativeTitles(ArrayMapper.toStringItemList(titleMap.getAlternativeTitles())); result.setKeyTitles(ArrayMapper.toStringItemList(titleMap.getKeyTitles())); NameMapper nameMap = new NameMapper(); List<NameItem> allNames = nameMap.map(mods); result.setAuthors(NameMapper.filter(allNames, true, NameItem.NameRole.AUTHOR)); result.setContributors(NameMapper.filter(allNames, true, NameItem.NameRole.CONTRIBUTOR)); LanguageMapper languageMap = new LanguageMapper(); result.setLanguages(languageMap.map(mods)); ClassificationMapper classificationMap = new ClassificationMapper(); result.setClassifications(classificationMap.mapPairs(mods)); SubjectMapper subjectMap = new SubjectMapper(mods); result.setKeywords(ArrayMapper.toStringItemList(subjectMap.getKeywords())); PhysicalDescriptionMapper physicalDescriptionMap = new PhysicalDescriptionMapper(); List<ArrayItem> pdItems = physicalDescriptionMap.map(mods); result.setPhysicalDescriptions(PhysicalDescriptionMapper.toPairs(pdItems)); result.setPreservationTreatment(PhysicalDescriptionMapper.getPreservationTreatment(pdItems)); result.setPreservationStateOfArt(PhysicalDescriptionMapper.getPreservationStateOfArt(pdItems)); StringPlusLanguage recordOrigin = nlookup.getRecordOrigin(false); result.setRecordOrigin(recordOrigin == null ? null : recordOrigin.getValue()); NoteDefinition note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  @Override Monograph map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, Monograph monograph); }
MonographMapper implements Mapper<Monograph> { @Override public Monograph map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Monograph result = new Monograph(); IdentifierMapper identMap = new IdentifierMapper(); result.setIdentifiers(identMap.map(mods)); LocationDefinition location = nlookup.getLocation(false); if (location != null) { PhysicalLocationDefinition physicalLocation = nlookup.getPhysicalLocation(false); result.setSigla(physicalLocation == null ? null : physicalLocation.getValue()); result.setShelfLocators(ArrayMapper.toStringPlusLanguageItemList(location.getShelfLocator())); } OriginInfoMapper originInfoMap = new OriginInfoMapper(); List<OriginInfoMapper.OriginInfoItem> origins = originInfoMap.map(mods); result.setPublishers(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PUBLISHER)); result.setPrinters(OriginInfoMapper.filter(origins, true, PublisherItem.Role.PRINTER)); TitleInfoMapper titleMap = new TitleInfoMapper(mods); result.setTitles(ArrayMapper.toStringItemList(titleMap.getTitles())); result.setSubtitles(ArrayMapper.toStringItemList(titleMap.getSubtitles())); result.setAlternativeTitles(ArrayMapper.toStringItemList(titleMap.getAlternativeTitles())); result.setKeyTitles(ArrayMapper.toStringItemList(titleMap.getKeyTitles())); NameMapper nameMap = new NameMapper(); List<NameItem> allNames = nameMap.map(mods); result.setAuthors(NameMapper.filter(allNames, true, NameItem.NameRole.AUTHOR)); result.setContributors(NameMapper.filter(allNames, true, NameItem.NameRole.CONTRIBUTOR)); LanguageMapper languageMap = new LanguageMapper(); result.setLanguages(languageMap.map(mods)); ClassificationMapper classificationMap = new ClassificationMapper(); result.setClassifications(classificationMap.mapPairs(mods)); SubjectMapper subjectMap = new SubjectMapper(mods); result.setKeywords(ArrayMapper.toStringItemList(subjectMap.getKeywords())); PhysicalDescriptionMapper physicalDescriptionMap = new PhysicalDescriptionMapper(); List<ArrayItem> pdItems = physicalDescriptionMap.map(mods); result.setPhysicalDescriptions(PhysicalDescriptionMapper.toPairs(pdItems)); result.setPreservationTreatment(PhysicalDescriptionMapper.getPreservationTreatment(pdItems)); result.setPreservationStateOfArt(PhysicalDescriptionMapper.getPreservationStateOfArt(pdItems)); StringPlusLanguage recordOrigin = nlookup.getRecordOrigin(false); result.setRecordOrigin(recordOrigin == null ? null : recordOrigin.getValue()); NoteDefinition note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  @Override Monograph map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, Monograph monograph);  }