@Test public void testRead() throws Exception { ModsDefinition mods = ModsUtils.unmarshal(PeriodicalVolumeMapperTest.class.getResource("volume_mods.xml"), ModsDefinition.class); PeriodicalVolumeMapper instance = new PeriodicalVolumeMapper(); PeriodicalVolume result = instance.map(mods); assertNotNull(result); assertEquals("1", result.getVolumeNumber()); assertEquals("1893", result.getYear()); assertEquals("nekvalitní a poškozená předloha;", result.getNote()); }
@Override public PeriodicalVolume map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); PeriodicalVolume volume = new PeriodicalVolume(); volume.setIdentifiers(identMap.map(mods)); if (nlookup.getPart(false) != null) { DateDefinition year = nlookup.getDate(false); volume.setYear(year == null ? null : year.getValue()); volume.setVolumeNumber(MapperUtils.toString(nlookup.getNumber(false))); Text note = nlookup.getNote(false); volume.setNote(note == null ? null : note.getValue()); } return volume; }
PeriodicalVolumeMapper implements Mapper<PeriodicalVolume> { @Override public PeriodicalVolume map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); PeriodicalVolume volume = new PeriodicalVolume(); volume.setIdentifiers(identMap.map(mods)); if (nlookup.getPart(false) != null) { DateDefinition year = nlookup.getDate(false); volume.setYear(year == null ? null : year.getValue()); volume.setVolumeNumber(MapperUtils.toString(nlookup.getNumber(false))); Text note = nlookup.getNote(false); volume.setNote(note == null ? null : note.getValue()); } return volume; } }
PeriodicalVolumeMapper implements Mapper<PeriodicalVolume> { @Override public PeriodicalVolume map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); PeriodicalVolume volume = new PeriodicalVolume(); volume.setIdentifiers(identMap.map(mods)); if (nlookup.getPart(false) != null) { DateDefinition year = nlookup.getDate(false); volume.setYear(year == null ? null : year.getValue()); volume.setVolumeNumber(MapperUtils.toString(nlookup.getNumber(false))); Text note = nlookup.getNote(false); volume.setNote(note == null ? null : note.getValue()); } return volume; }  }
PeriodicalVolumeMapper implements Mapper<PeriodicalVolume> { @Override public PeriodicalVolume map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); PeriodicalVolume volume = new PeriodicalVolume(); volume.setIdentifiers(identMap.map(mods)); if (nlookup.getPart(false) != null) { DateDefinition year = nlookup.getDate(false); volume.setYear(year == null ? null : year.getValue()); volume.setVolumeNumber(MapperUtils.toString(nlookup.getNumber(false))); Text note = nlookup.getNote(false); volume.setNote(note == null ? null : note.getValue()); } return volume; }  @Override PeriodicalVolume map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, PeriodicalVolume volume); }
PeriodicalVolumeMapper implements Mapper<PeriodicalVolume> { @Override public PeriodicalVolume map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); PeriodicalVolume volume = new PeriodicalVolume(); volume.setIdentifiers(identMap.map(mods)); if (nlookup.getPart(false) != null) { DateDefinition year = nlookup.getDate(false); volume.setYear(year == null ? null : year.getValue()); volume.setVolumeNumber(MapperUtils.toString(nlookup.getNumber(false))); Text note = nlookup.getNote(false); volume.setNote(note == null ? null : note.getValue()); } return volume; }  @Override PeriodicalVolume map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, PeriodicalVolume volume);  }