use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class ResultDAGConverter method addReportPart.
public static List<String> addReportPart(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
List<String> addedAttributes = new ArrayList<>();
Any reportAny = orb.create_any();
Node reportNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_REPORT, reportAny);
graph.addVertex(reportNode);
graph.addEdge(partNode, reportNode);
String attribute = parentAttrName + NsiliConstants.NSIL_REPORT;
addStrAttribute(graph, metacard.getAttribute(Isr.REPORT_SERIAL_NUMBER), orb, resultAttributes, addedAttributes, reportNode, attribute, NsiliConstants.ORIGINATORS_REQ_SERIAL_NUM);
addTypeAttribute(graph, metacard, orb, resultAttributes, addedAttributes, reportNode, attribute);
addStrAttribute(graph, metacard.getAttribute(Isr.REPORT_INFO_RATING), orb, resultAttributes, addedAttributes, reportNode, attribute, NsiliConstants.INFORMATION_RATING);
addPriorityAttribute(graph, metacard, orb, resultAttributes, addedAttributes, reportNode, attribute);
addedAttributes.addAll(addIntRepPart(graph, reportNode, metacard, orb, attribute + ":", resultAttributes));
addedAttributes.addAll(addEntityPart(graph, reportNode, metacard, orb, attribute + ":", resultAttributes));
return addedAttributes;
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class ResultDAGConverter method addIntRepPart.
public static List<String> addIntRepPart(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
List<String> addedAttributes = new ArrayList<>();
Any intRepAny = orb.create_any();
Node intRepNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_INTREP, intRepAny);
graph.addVertex(intRepNode);
graph.addEdge(partNode, intRepNode);
String attribute = parentAttrName + NsiliConstants.NSIL_INTREP;
if (shouldAdd(buildAttr(attribute, NsiliConstants.SITUATION_TYPE), resultAttributes)) {
Attribute situationTypeAttr = metacard.getAttribute(Isr.REPORT_SITUATION_TYPE);
if (situationTypeAttr != null) {
String situationType = getIntRepSituationType(situationTypeAttr.getValue());
if (situationType != null) {
addStringAttribute(graph, intRepNode, NsiliConstants.SITUATION_TYPE, situationType, orb);
addedAttributes.add(buildAttr(attribute, NsiliConstants.SITUATION_TYPE));
}
}
}
return addedAttributes;
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGConverter method printDAG.
public static void printDAG(DAG dag) {
if (dag.nodes != null && dag.edges != null) {
Map<Integer, Node> nodeMap = ResultDAGConverter.createNodeMap(dag.nodes);
DirectedAcyclicGraph<Node, Edge> graph = getNodeEdgeDirectedAcyclicGraph(dag, nodeMap);
DepthFirstIterator<Node, Edge> depthFirstIterator = new DepthFirstIterator<>(graph);
Node rootNode = null;
while (depthFirstIterator.hasNext()) {
depthFirstIterator.setCrossComponentTraversal(false);
Node node = depthFirstIterator.next();
if (rootNode == null) {
rootNode = node;
}
DijkstraShortestPath<Node, Edge> path = new DijkstraShortestPath<>(graph, rootNode, node);
printNode(node, (int) Math.round(path.getPathLength()));
}
}
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGConverter method isNodeChildOfStart.
/**
* Determines if the end node is a child of the start node.
*
* @param graph - The complete graph.
* @param start - Starting node.
* @param end - Child node to check
* @return true if the end node is a child of the start node in the provided graph.
*/
private static boolean isNodeChildOfStart(DirectedAcyclicGraph<Node, Edge> graph, Node start, Node end) {
boolean endNodeInTree = false;
DepthFirstIterator<Node, Edge> depthFirstIterator = new DepthFirstIterator<>(graph, start);
while (depthFirstIterator.hasNext()) {
Node currNode = depthFirstIterator.next();
if (currNode.id == end.id) {
endNodeInTree = true;
}
}
return endNodeInTree;
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGConverterTest method addRFINode.
private void addRFINode(DirectedAcyclicGraph<Node, Edge> graph, Node parentNode) {
Any rfiAny = orb.create_any();
Node rfiNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_RFI, rfiAny);
graph.addVertex(rfiNode);
graph.addEdge(parentNode, rfiNode);
ResultDAGConverter.addStringAttribute(graph, rfiNode, NsiliConstants.FOR_ACTION, RFI_FOR_ACTION, orb);
ResultDAGConverter.addStringAttribute(graph, rfiNode, NsiliConstants.FOR_INFORMATION, RFI_FOR_INFORMATION, orb);
ResultDAGConverter.addStringAttribute(graph, rfiNode, NsiliConstants.SERIAL_NUMBER, RFI_SERIAL_NUM, orb);
ResultDAGConverter.addStringAttribute(graph, rfiNode, NsiliConstants.STATUS, RFI_STATUS, orb);
ResultDAGConverter.addStringAttribute(graph, rfiNode, NsiliConstants.WORKFLOW_STATUS, RFI_WORKFLOW_STATUS, orb);
}
Aggregations