XmlFileFrom(String variable) { this.xmlFile = new XmlFile(); xmlFile.setInputVariablesName(variable); }
final FrameCreationContext frameCreationContext) return evaluate(event, context, new XmlFileEvaluationStrategy()
@Override protected String getVarname() { return getOutputVariablesName(); }
private boolean evaluate(final GraphRewrite event, final EvaluationContext context, final XmlFileEvaluationStrategy evaluationStrategy) { try { ExecutionStatistics.get().begin("XmlFile.evaluate"); initValidators(event,context,evaluationStrategy); final List<WindupVertexFrame> finalResults = new ArrayList<>(); final GraphContext graphContext = event.getGraphContext(); Iterable<? extends WindupVertexFrame> startVertices = getStartingVertices(event,graphContext); for (WindupVertexFrame iterated : startVertices) { XmlFileModel xml = getXmlFileModelFromVertex(iterated); if(xmlFilePassRestrictions(event,context,xml)) { registerAndSubmitResultsFor(xml, finalResults,evaluationStrategy, event, context); } } setResults(event, getOutputVariablesName(), finalResults); return !finalResults.isEmpty(); } finally { ExecutionStatistics.get().end("XmlFile.evaluate"); } }
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("XmlFile"); if (getInputVariablesName() != null) { builder.append(".inputVariable(" + getInputVariablesName() + ")"); } if (xpathValidator.getXpathString() != null) { builder.append(".matches(" + xpathValidator.getXpathString() + ")"); } if (fileNameValidator.getFileNamePattern() != null) { builder.append(".inFile(" + fileNameValidator.getFileNamePattern().toString() + ")"); } if (dtdValidator.getPublicId() != null) { builder.append(".withDTDPublicId(" + dtdValidator.getPublicId() + ")"); } builder.append(".as(" + getOutputVariablesName() + ")"); return builder.toString(); }
/** * Create a new {@link XmlFile} that matches on the provided DTD id regular expression. */ public static XmlFileDTD withDTDPublicId(String publicIdRegex) { XmlFile xmlFile = new XmlFile(); xmlFile.publicId = publicIdRegex; return xmlFile; }
/** * Set the xpath of this {@link XmlFile}. */ public XmlFileXpath matchesXpath(String xpath) { this.xmlFile.setXpath(xpath); return this.xmlFile; }
if (StringUtils.isNotBlank(from)) XmlFileFrom xmlFileFrom = XmlFile.from(from); xmlFile = xmlFileFrom.matchesXpath(xpath); xmlFile = XmlFile.matchesXpath(xpath);
/** * Output the results using the provided variable name. */ public ConditionBuilder as(String variable) { Assert.notNull(variable, "Variable name must not be null."); this.setOutputVariablesName(variable); return this; }
public XmlFile resultMatches(String regex) { this.xmlFile.setXpathResultMatch(regex); return this.xmlFile; } }
@Override public void modelSubmitted(WindupVertexFrame model) { Maps.addListValue(this.variables, getVarname(), model); }
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("XmlFile"); if (getInputVariablesName() != null) { builder.append(".inputVariable(" + getInputVariablesName() + ")"); } if (xpathString != null) { builder.append(".matches(" + xpathString + ")"); } if (fileNamePattern != null) { builder.append(".inFile(" + fileNamePattern.toString() + ")"); } if (publicId != null) { builder.append(".withDTDPublicId(" + publicId + ")"); } builder.append(".as(" + getInputVariablesName() + ")"); return builder.toString(); }
XmlFileXpath xmlFile = XmlFile.matchesXpath(xpath); if(resultMatch !=null) { xmlFile.resultMatches(resultMatch);
XmlFileModel.class); Iterable<? extends WindupVertexFrame> allXmls; if (getInputVariablesName() == null || getInputVariablesName().equals("")) allXmls = Variables.instance(event).findVariable(getInputVariablesName()); Variables.instance(event).setVariable(getOutputVariablesName(), resultLocations); ExecutionStatistics.get().end("XmlFile.evaluate"); return !resultLocations.isEmpty();
/** * Create a new {@link XmlFile} {@link Condition}. */ public static XmlFileXpath matchesXpath(String xpath) { return new XmlFile(xpath); }
/** * Set the xpath of this {@link XmlFile}. */ public XmlFileXpath matchesXpath(String xpath) { this.xmlFile.setXpath(xpath); return this.xmlFile; }
/** * Output the results using the provided variable name. */ public ConditionBuilder as(String variable) { Assert.notNull(variable, "Variable name must not be null."); this.setOutputVariablesName(variable); return this; }
public XmlFile resultMatches(String regex) { this.xmlFile.setXpathResultMatch(regex); return this.xmlFile; } }
@Override @SuppressWarnings("rawtypes") public void modelSubmitted(WindupVertexFrame model) { Maps.addListValue(this.variables, getVarname(), model); }
private Iterable<? extends WindupVertexFrame> getStartingVertices(GraphRewrite event,GraphContext graphContext) { GraphService<XmlFileModel> xmlResourceService = new GraphService<>(graphContext, XmlFileModel.class); Iterable<? extends WindupVertexFrame> allXmls; if (getInputVariablesName() == null || getInputVariablesName().isEmpty()) { allXmls = xmlResourceService.findAll(); } else { allXmls = Variables.instance(event).findVariable(getInputVariablesName()); } return allXmls; }