use of org.pentaho.dictionary.DictionaryConst.PROPERTY_TYPE in project pentaho-metaverse by pentaho.
the class AnnotationDrivenStepMetaAnalyzer method linkResourceFieldToNode.
private void linkResourceFieldToNode(Map<AnnotatedClassField<Metaverse.Node>, IMetaverseNode> resourceNodes, Metaverse.NodeLink nodeLink, AnnotatedClassFields annoFields) {
IMetaverseNode resourceFieldNode = null;
// see if the link is pointing to an input/output field node
StepNodes stepNodes = isOutLink(nodeLink) ? getOutputs() : getInputs();
if (stepNodes != null && !stepNodes.getFieldNames().isEmpty()) {
resourceFieldNode = stepNodes.findNode(RESOURCE, nodeLink.nodeName());
}
if (resourceFieldNode == null) {
// link is probably to a resource node that isn't an input or output field
final StepNodes newStepNodeObj = new StepNodes();
resourceNodes.entrySet().stream().filter(mapEntry -> mapEntry.getValue().getProperty(PROPERTY_TYPE).equals(RESOURCE)).forEach(mapEntry -> newStepNodeObj.addNode(RESOURCE, mapEntry.getValue().getName(), mapEntry.getValue()));
stepNodes = newStepNodeObj;
resourceFieldNode = stepNodes.findNode(RESOURCE, nodeLink.nodeName());
}
IMetaverseNode childNode = resourceFieldNode;
if (childNode != null) {
annoFields.node(nodeLink.parentNodeName()).map(resourceNodes::get).ifPresent(parentNode -> addLink(nodeLink, childNode, parentNode));
} else {
String parentNodeLink = nodeLink.parentNodelink();
String fromNode = nodeLink.nodeName();
String toNode = nodeLink.parentNodeName();
log.warn(Messages.getErrorString("ERROR.AnnotationDrivenStepMetaAnalyzer.LinkError", parentNodeLink, fromNode, toNode));
}
}
Aggregations