@Test public void testVal() throws Exception { ETLStatistics etlStatistics = new ETLStatistics(); String val = null; CrsSpecimenTransformer crsSpecimenTransformer = new CrsSpecimenTransformer(etlStatistics); CrsExtractor extractor = new CrsExtractor(specimenFile, etlStatistics); for (XMLRecordInfo extracted : extractor) { CommonReflectionUtil.setField(AbstractTransformer.class, crsSpecimenTransformer, "objectID", "RMNH.MAM.TT.5"); CommonReflectionUtil.setField(AbstractTransformer.class, crsSpecimenTransformer, "input", extracted); Element oaiDcElem = getDescendant(extracted.getRecord(), "oai_dc:dc"); List<Element> ncrsdatagroup = getDescendants(oaiDcElem, "ncrsdatagroup"); Element sexElement = ncrsdatagroup.get(0); Object obj = ReflectionUtil.call(crsSpecimenTransformer, "val", new Class[] {Element.class, String.class}, new Object[] {sexElement, "abcd:Sex"}); val = (String) obj; } assertNotNull(val); assertEquals("Male", val); }
private String val(Element e, String tag) { String s = DOMUtil.getDescendantValue(e, tag); if (s == null) { if (logger.isDebugEnabled()) { debug("No element <%s> under element <%s>", tag, e.getTagName()); } return null; } return ((s = s.strip()).length() == 0 ? null : s); }
CrsSpecimenTransformer extends AbstractXMLTransformer<Specimen> { private String val(Element e, String tag) { String s = DOMUtil.getDescendantValue(e, tag); if (s == null) { if (logger.isDebugEnabled()) { debug("No element <%s> under element <%s>", tag, e.getTagName()); } return null; } return ((s = s.strip()).length() == 0 ? null : s); } }
CrsSpecimenTransformer extends AbstractXMLTransformer<Specimen> { private String val(Element e, String tag) { String s = DOMUtil.getDescendantValue(e, tag); if (s == null) { if (logger.isDebugEnabled()) { debug("No element <%s> under element <%s>", tag, e.getTagName()); } return null; } return ((s = s.strip()).length() == 0 ? null : s); } CrsSpecimenTransformer(ETLStatistics stats); }
CrsSpecimenTransformer extends AbstractXMLTransformer<Specimen> { private String val(Element e, String tag) { String s = DOMUtil.getDescendantValue(e, tag); if (s == null) { if (logger.isDebugEnabled()) { debug("No element <%s> under element <%s>", tag, e.getTagName()); } return null; } return ((s = s.strip()).length() == 0 ? null : s); } CrsSpecimenTransformer(ETLStatistics stats);  }
CrsSpecimenTransformer extends AbstractXMLTransformer<Specimen> { private String val(Element e, String tag) { String s = DOMUtil.getDescendantValue(e, tag); if (s == null) { if (logger.isDebugEnabled()) { debug("No element <%s> under element <%s>", tag, e.getTagName()); } return null; } return ((s = s.strip()).length() == 0 ? null : s); } CrsSpecimenTransformer(ETLStatistics stats);   }