@Override public void processMeta(XmlMetadata file) { if (controlDoc == null){ // some action and } else { // real work here if (this.xpathExp == null){ // make this an assertion test } else { Document testDoc = getDocFragment(xpathExp, file); if (testDoc != null) { if (isdifferent(testDoc, controlDoc)) { // process for print formating (identify specific) LOG.debug("XML differences found"); } else { // remove this from list of things to report. LOG.debug("Remove from list. XML has default settings"); LinkedList < AbstractDecoration > dList = new LinkedList<AbstractDecoration>(file.getDecorations()); try { file.getDecorations().remove(dList.removeLast()); } catch (NoSuchElementException ne){ LOG.debug("Nothing removed. Decoration list is empty."); } } } } } return; }
@Override protected void chainDecorators(XmlMetadata meta) { LOG.debug("chainDecorators: " + meta); // this is only called when the XPathGate is true. Classification result = new Classification(); result.setDescription(matchDescription); result.setEffort(effort); result.setPattern(this.xpathExpression); meta.getDecorations().add(result); super.chainDecorators(meta); } }
@Override public void processMeta(XmlMetadata file) { String relativeDirectory = StringUtils.substringBeforeLast(file.getFilePointer().getAbsolutePath(), File.separator); String fileName = StringUtils.substringAfterLast(file.getFilePointer().getAbsolutePath(), File.separator); fileName = StringUtils.replace(fileName, ".", "-"); fileName = fileName + outputExtension; File relativeFile = new File(relativeDirectory + File.separator + fileName); Source xmlSource = new DOMSource(file.getParsedDocument()); Result xmlResult = new StreamResult(relativeFile); try { xsltTransformer.transform(xmlSource, xmlResult); Link linkResult = new Link(); linkResult.setDescription(outputDescription); linkResult.setLink(fileName); linkResult.setEffort(effort); if (LOG.isDebugEnabled()) { LOG.debug("Created link: " + ReflectionToStringBuilder.toString(linkResult)); } file.getDecorations().add(linkResult); } catch (TransformerException e) { LOG.error("Exception transforming XML.", e); } }
protected void createSummaryMeta(final XmlMetadata meta, String description, String match) { Summary result = new Summary(); result.setDescription(description); result.setPattern(match); result.setEffort(effort); for (ResultProcessor hint : hints) { hint.process(result); } meta.getDecorations().add(result); }
protected void createLineNumberMeta(final XmlMetadata meta, Integer lineNumber, String descripiton, Node match) { XmlLine result = new XmlLine(); result.setDescription(matchDescription); result.setLineNumber(lineNumber); result.setEffort(effort); result.setMatchedNode(match); for (ResultProcessor hint : hints) { hint.process(result); } meta.getDecorations().add(result); }
@Override public void processMeta(XmlMetadata file) { Doctype docType = (Doctype) file.getParsedDocument().getUserData(LocationAwareContentHandler.DOCTYPE_KEY_NAME); if (docType != null && matchesAny(docType)) { Classification cr = new Classification(); cr.setDescription(matchDescription); cr.setEffort(effort); file.getDecorations().add(cr); // if it is of a certain type, recurse to the child processors chainDecorators(file); } }
simpleHint.setMarkdown("Create a local interface for the Entity bean to support Container Managed Relationship (CMR)."); result.getHints().add(simpleHint); meta.getDecorations().add(result); meta.getDecorations().add(result);
protected void createLineNumberMeta(final XmlMetadata meta, Integer lineNumber, String descripiton, Node match) { XmlLine result = new XmlLine(); result.setDescription(descripiton); try { result.setPattern(convertNode(match)); } catch (TransformerException e) { e.printStackTrace(); } result.setMatchedNode(match); result.setLineNumber(lineNumber); result.setEffort(effort); for (ResultProcessor hint : hints) { hint.process(result); } meta.getDecorations().add(result); }