@Test public void testCreateDc() { String xml = "<mods version='3.5' xmlns='http: + "<titleInfo>" + "<nonSort>NS1</nonSort><title>T1</title><subTitle>S1</subTitle><partName>PNam1</partName><partNumber>PNum1</partNumber>" + "</titleInfo>" + "<titleInfo>" + "<title>T2</title><subTitle>S2</subTitle>" + "</titleInfo>" + "<name usage = 'primary' type='personal'>" + "<namePart>Archivist</namePart>" + "<namePart type='family'>Novotny</namePart>" + "<namePart type='given'>Tomas</namePart>" + "<namePart type='date'>12.9.1999</namePart>" + "<role><roleTerm>cre</roleTerm></role></name>" + "</mods>"; ModsDefinition mods = ModsUtils.unmarshalModsType(new StreamSource(new StringReader(xml))); NdkPeriodicalMapper mapper = new NdkPeriodicalMapper(); NdkMapper.Context ctx = new NdkMapper.Context("uuid:testId"); OaiDcType result = mapper.createDc(mods, ctx); assertEquals("NS1 T1: S1", result.getTitles().get(0).getValue()); assertEquals("T2: S2", result.getTitles().get(1).getValue()); assertEquals("PNum1", result.getDescriptions().get(0).getValue()); assertEquals("PNam1", result.getDescriptions().get(1).getValue()); assertEquals("Archivist Novotny, Tomas, 12.9.1999", result.getCreators().get(0).getValue()); }
@Override protected OaiDcType createDc(ModsDefinition mods, Context ctx) { OaiDcType dc = super.createDc(mods, ctx); String partNumber = findPartNumber(mods); String dateIssued = findDateIssued(mods); if (partNumber != null) { dc.getDescriptions().add(new ElementType(partNumber, null)); } if (dateIssued != null) { dc.getDates().add(new ElementType(dateIssued, null)); } addName(mods.getName(), dc.getCreators()); addElementType(dc.getTypes(), getDcType()); return dc; }
NdkPeriodicalVolumeMapper extends RdaNdkMapper { @Override protected OaiDcType createDc(ModsDefinition mods, Context ctx) { OaiDcType dc = super.createDc(mods, ctx); String partNumber = findPartNumber(mods); String dateIssued = findDateIssued(mods); if (partNumber != null) { dc.getDescriptions().add(new ElementType(partNumber, null)); } if (dateIssued != null) { dc.getDates().add(new ElementType(dateIssued, null)); } addName(mods.getName(), dc.getCreators()); addElementType(dc.getTypes(), getDcType()); return dc; } }
NdkPeriodicalVolumeMapper extends RdaNdkMapper { @Override protected OaiDcType createDc(ModsDefinition mods, Context ctx) { OaiDcType dc = super.createDc(mods, ctx); String partNumber = findPartNumber(mods); String dateIssued = findDateIssued(mods); if (partNumber != null) { dc.getDescriptions().add(new ElementType(partNumber, null)); } if (dateIssued != null) { dc.getDates().add(new ElementType(dateIssued, null)); } addName(mods.getName(), dc.getCreators()); addElementType(dc.getTypes(), getDcType()); return dc; }  }
NdkPeriodicalVolumeMapper extends RdaNdkMapper { @Override protected OaiDcType createDc(ModsDefinition mods, Context ctx) { OaiDcType dc = super.createDc(mods, ctx); String partNumber = findPartNumber(mods); String dateIssued = findDateIssued(mods); if (partNumber != null) { dc.getDescriptions().add(new ElementType(partNumber, null)); } if (dateIssued != null) { dc.getDates().add(new ElementType(dateIssued, null)); } addName(mods.getName(), dc.getCreators()); addElementType(dc.getTypes(), getDcType()); return dc; }  @Override void createMods(ModsDefinition mods, Context ctx); }
NdkPeriodicalVolumeMapper extends RdaNdkMapper { @Override protected OaiDcType createDc(ModsDefinition mods, Context ctx) { OaiDcType dc = super.createDc(mods, ctx); String partNumber = findPartNumber(mods); String dateIssued = findDateIssued(mods); if (partNumber != null) { dc.getDescriptions().add(new ElementType(partNumber, null)); } if (dateIssued != null) { dc.getDates().add(new ElementType(dateIssued, null)); } addName(mods.getName(), dc.getCreators()); addElementType(dc.getTypes(), getDcType()); return dc; }  @Override void createMods(ModsDefinition mods, Context ctx);  }