@Test public void testRead() { ModsDefinition mods = ModsUtils.unmarshal(PageMapperTest.class.getResource("page_mods.xml"), ModsDefinition.class); PageMapper instance = new PageMapper(); Page result = instance.map(mods); assertNotNull(result); assertEquals("1", result.getIndex()); assertEquals("[1]", result.getNumber()); assertEquals("Blank", result.getType()); assertEquals("note", result.getNote()); List<IdentifierItem> identifiers = result.getIdentifiers(); assertEquals(2, identifiers.size()); assertEquals("issn", identifiers.get(0).getType()); assertEquals("issn value", identifiers.get(0).getValue()); assertEquals("uuid", identifiers.get(1).getType()); assertEquals("1", identifiers.get(1).getValue()); }
@Override public Page map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Page page = new Page(); page.setIdentifiers(identMap.map(mods)); page.setNumber(MapperUtils.toString(nlookup.getPageNumber(false))); page.setIndex(MapperUtils.toString(nlookup.getPageIndex(false))); Text note = nlookup.getNote(false); page.setNote(note == null ? null : note.getValue()); PartDefinition part = nlookup.getPart(false); page.setType(part == null ? null : part.getType()); return page; }
PageMapper implements Mapping.Mapper<Page> { @Override public Page map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Page page = new Page(); page.setIdentifiers(identMap.map(mods)); page.setNumber(MapperUtils.toString(nlookup.getPageNumber(false))); page.setIndex(MapperUtils.toString(nlookup.getPageIndex(false))); Text note = nlookup.getNote(false); page.setNote(note == null ? null : note.getValue()); PartDefinition part = nlookup.getPart(false); page.setType(part == null ? null : part.getType()); return page; } }
PageMapper implements Mapping.Mapper<Page> { @Override public Page map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Page page = new Page(); page.setIdentifiers(identMap.map(mods)); page.setNumber(MapperUtils.toString(nlookup.getPageNumber(false))); page.setIndex(MapperUtils.toString(nlookup.getPageIndex(false))); Text note = nlookup.getNote(false); page.setNote(note == null ? null : note.getValue()); PartDefinition part = nlookup.getPart(false); page.setType(part == null ? null : part.getType()); return page; }  }
PageMapper implements Mapping.Mapper<Page> { @Override public Page map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Page page = new Page(); page.setIdentifiers(identMap.map(mods)); page.setNumber(MapperUtils.toString(nlookup.getPageNumber(false))); page.setIndex(MapperUtils.toString(nlookup.getPageIndex(false))); Text note = nlookup.getNote(false); page.setNote(note == null ? null : note.getValue()); PartDefinition part = nlookup.getPart(false); page.setType(part == null ? null : part.getType()); return page; }  @Override Page map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, Page page); void updatePage(ModsDefinition mods, String pageIndex, String pageNumber, String pageType); }
PageMapper implements Mapping.Mapper<Page> { @Override public Page map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); Page page = new Page(); page.setIdentifiers(identMap.map(mods)); page.setNumber(MapperUtils.toString(nlookup.getPageNumber(false))); page.setIndex(MapperUtils.toString(nlookup.getPageIndex(false))); Text note = nlookup.getNote(false); page.setNote(note == null ? null : note.getValue()); PartDefinition part = nlookup.getPart(false); page.setType(part == null ? null : part.getType()); return page; }  @Override Page map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, Page page); void updatePage(ModsDefinition mods, String pageIndex, String pageNumber, String pageType);  }