@Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
/** * Gets all {@link InlineHintModel} instances that are directly associated with the given {@link FileReferenceModel} */ public Iterable<InlineHintModel> getHintsForFileReference(FileReferenceModel reference) { GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(reference.getElement()); inlineHintPipeline.in(InlineHintModel.FILE_LOCATION_REFERENCE); inlineHintPipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(InlineHintModel.TYPE)); return new FramedVertexIterable<>(getGraphContext().getFramed(), inlineHintPipeline.toList(), InlineHintModel.class); }
/** * Gets all {@link InlineHintModel} instances that are directly associated with the given {@link FileReferenceModel} */ public Iterable<InlineHintModel> getHintsForFileReference(FileReferenceModel reference) { GraphTraversal<Vertex, Vertex> inlineHintPipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(reference.getElement()); inlineHintPipeline.in(InlineHintModel.FILE_LOCATION_REFERENCE); inlineHintPipeline.has(WindupVertexFrame.TYPE_PROP, Text.textContains(InlineHintModel.TYPE)); return new FramedVertexIterable<>(getGraphContext().getFramed(), inlineHintPipeline.toList(), InlineHintModel.class); }
@Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
/** * Set the payload to the fileModel of the given instance even though the variable is not directly referencing it. This is mainly to simplify the * creation of the rule, when the FileModel itself is not being iterated but just a model referencing it. * */ @Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
/** * Set the payload to the fileModel of the given instance even though the variable is not directly referencing it. This is mainly to simplify the * creation of the rule, when the FileModel itself is not being iterated but just a model referencing it. * */ @Override public FileModel resolvePayload(GraphRewrite event, EvaluationContext context, WindupVertexFrame payload) { checkVariableName(event, context); if (payload instanceof FileReferenceModel) { return ((FileReferenceModel) payload).getFile(); } if (payload instanceof FileModel) { return (FileModel) payload; } return null; }
/** * Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute * specified in specific order. This method handles the {@link FileContent#from(String)} attribute. */ private void fromInput(List<FileModel> vertices, GraphRewrite event) { if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName())) { for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName())) { if (windupVertexFrame instanceof FileModel) vertices.add((FileModel) windupVertexFrame); if (windupVertexFrame instanceof FileReferenceModel) vertices.add(((FileReferenceModel) windupVertexFrame).getFile()); } } }
private XmlFileModel getXmlFileModelFromVertex(WindupVertexFrame vertexFrame) { final XmlFileModel xml; if (vertexFrame instanceof FileReferenceModel) { xml = (XmlFileModel) ((FileReferenceModel) vertexFrame).getFile(); } else if (vertexFrame instanceof XmlFileModel) { xml = (XmlFileModel) vertexFrame; } else { throw new WindupException("XmlFile was called on the wrong graph type ( " + vertexFrame.toPrettyString() + ")"); } return xml; }
/** * Generating the input vertices is quite complex. Therefore there are multiple methods that handles the input vertices based on the attribute * specified in specific order. This method handles the {@link File#from(String)} attribute. */ private void fromInput(List<FileModel> vertices, GraphRewrite event) { if (vertices.isEmpty() && StringUtils.isNotBlank(getInputVariablesName())) { for (WindupVertexFrame windupVertexFrame : Variables.instance(event).findVariable(getInputVariablesName())) { if (windupVertexFrame instanceof FileModel) vertices.add((FileModel) windupVertexFrame); if (windupVertexFrame instanceof FileReferenceModel) vertices.add(((FileReferenceModel) windupVertexFrame).getFile()); } } }
payload = ((FileReferenceModel) payload).getFile();
payload = ((FileReferenceModel) payload).getFile();
/** * Set the payload to the fileModel of the given instance even though the variable is not directly of it's type. This is mainly to simplify the * creation of the rule, when the FileModel itself is not being iterated but just a model referencing it. * */ @Override public void perform(GraphRewrite event, EvaluationContext context) { checkVariableName(event, context); WindupVertexFrame payload = resolveVariable(event, getVariableName()); if (payload instanceof FileReferenceModel) { FileModel file = ((FileReferenceModel) payload).getFile(); perform(event, context, (XmlFileModel) file); } else { super.perform(event, context); } }
payload = ((FileReferenceModel) payload).getFile();
payload = ((FileReferenceModel) payload).getFile();
for (WindupVertexFrame frame : frames) FileModel fileModel = ((FileReferenceModel) frame).getFile(); Iterable<JavaClassModel> javaClasses = null; if (fileModel instanceof AbstractJavaSourceModel)
for (WindupVertexFrame frame : frames) FileModel fileModel = ((FileReferenceModel) frame).getFile(); Iterable<JavaClassModel> javaClasses = null; if (fileModel instanceof AbstractJavaSourceModel)