use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class NsiliCommonUtils method setUCOEdgeIds.
/**
* Set the UCO.Node IDs in DFS order to conform to the NSILI spec. The root of the node will be 0.
*
* @param graph - the graph representation of the DAG
*/
public static void setUCOEdgeIds(Graph<Node, Edge> graph) {
if (graph != null) {
int id = 0;
DepthFirstIterator<Node, Edge> depthFirstIterator = new DepthFirstIterator<>(graph);
while (depthFirstIterator.hasNext()) {
Node node = depthFirstIterator.next();
node.id = id;
id++;
}
}
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGGenerator method addCardAttributes.
private static void addCardAttributes(Node node, Graph<Node, Edge> graph, ORB orb) {
Node attribute;
attribute = constructAttributeNode(NsiliConstants.IDENTIFIER_UUID, UUID.randomUUID().toString(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.DATE_TIME_MODIFIED, TIME, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.SOURCE_DATE_TIME_MODIFIED, TIME, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.PUBLISHER, PUBLISHER, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.SOURCE_LIBRARY, SOURCE_LIBRARY, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGGenerator method generateNSILDAG.
private static DAG generateNSILDAG(ORB orb, String partType, String commonType, String title) {
DAG metacard = new DAG();
Graph<Node, Edge> graph = new DirectedAcyclicGraph<>(Edge.class);
Node[] nodeRefs = constructNSILProduct(orb, graph, 1, commonType);
constructNSILPart(nodeRefs[0], nodeRefs[1], nodeRefs[3], orb, graph, partType, title);
constructNSILPart(nodeRefs[0], nodeRefs[1], nodeRefs[3], orb, graph, NsiliConstants.NSIL_COVERAGE, title);
constructNSILPart(nodeRefs[0], nodeRefs[1], nodeRefs[3], orb, graph, NsiliConstants.NSIL_EXPLOITATION_INFO, title);
constructNSILAssociation(nodeRefs[0], nodeRefs[2], orb, graph, 1);
NsiliCommonUtils.setUCOEdgeIds(graph);
NsiliCommonUtils.setUCOEdges(nodeRefs[0], graph);
metacard.nodes = NsiliCommonUtils.getNodeArrayFromGraph(graph);
metacard.edges = NsiliCommonUtils.getEdgeArrayFromGraph(graph);
return metacard;
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGGenerator method constructNSILAssociation.
/**
* Constructs a NSIL_ASSOCIATION subgraph with all optional nodes, as well as all mandatory
* attributes for these nodes. A NSIL_PRODUCT can contain 0...n NSIL_ASSOCIATIONS. All
* NSIL_ASSOCIATIONS contain an edge to the NSIL_CARD node. A NSIL_ASSOCIATION can contain 1...n
* NSIL_DESTINATIONS.
*
* @param nsilProduct - a reference to the root node to link to the DAG graph
* @param nsilCard - a reference to the NSIL_CARD to link to the NSIL_ASSOCIATION subgraph
* @param orb - a reference to the orb to create UCO objects
* @param graph - the graph representation of the DAG
* @param numDestinations - the number of NSIL_DESTINATION nodes to create
*/
private static void constructNSILAssociation(Node nsilProduct, Node nsilCard, ORB orb, Graph<Node, Edge> graph, int numDestinations) {
List<String> associationNodes = Arrays.asList(NsiliConstants.NSIL_RELATION, NsiliConstants.NSIL_SOURCE);
List<Node> nodePartNodes = getEntityListFromStringList(associationNodes, orb);
Node root = constructEntityNode(NsiliConstants.NSIL_ASSOCIATION, orb);
graph.addVertex(root);
graph.addEdge(nsilProduct, root);
for (Node n : nodePartNodes) {
graph.addVertex(n);
}
graph.addEdge(root, nodePartNodes.get(1));
for (int i = 0; i < numDestinations; i++) {
Node nsilDestination = constructEntityNode(NsiliConstants.NSIL_DESTINATION, orb);
graph.addVertex(nsilDestination);
graph.addEdge(root, nsilDestination);
Node card = constructEntityNode(NsiliConstants.NSIL_CARD, orb);
graph.addVertex(card);
graph.addEdge(nsilDestination, card);
addCardAttributes(card, graph, orb);
}
}
use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.
the class DAGGenerator method constructNSILPart.
/**
* Constructs a NSIL_PART with all optional nodes, and all mandatory attributes of those nodes
* according to the STANAG 4459 spec. A NISL_PRODUCT in NSIL_ALL_VIEW can contain 0...n
* NSIL_PARTS. A NISL_PART will have an edge pointing to NSIL_SECURITY and NSIL_COMMON
*
* @param nsilProduct - a reference to the root node to link to the DAG graph
* @param nsilSecurity - a reference to NSIL_SECURITY to link to the NSIL_PART subgraph
* @param orb - a reference to the orb to create UCO objects
* @param graph - the graph representation of the DAG
*/
private static void constructNSILPart(Node nsilProduct, Node nsilSecurity, Node nsilCommon, ORB orb, Graph<Node, Edge> graph, String partType, String title) {
Node root = constructEntityNode(NsiliConstants.NSIL_PART, orb);
graph.addVertex(root);
graph.addEdge(nsilProduct, root);
graph.addEdge(root, nsilSecurity);
graph.addEdge(root, nsilCommon);
Node attribute;
attribute = constructAttributeNode(NsiliConstants.PART_IDENTIFIER, "", orb);
graph.addVertex(attribute);
graph.addEdge(root, attribute);
Node node = constructEntityNode(partType, orb);
graph.addVertex(node);
graph.addEdge(root, node);
switch(partType) {
case NsiliConstants.NSIL_COVERAGE:
attribute = constructAttributeNode(NsiliConstants.SPATIAL_COUNTRY_CODE, "USA", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.SPATIAL_GEOGRAPHIC_REF_BOX, getRandomRectangle(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.TEMPORAL_START, TIME, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.TEMPORAL_END, TIME, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_CXP:
attribute = constructAttributeNode(NsiliConstants.STATUS, "CURRENT", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_EXPLOITATION_INFO:
attribute = constructAttributeNode(NsiliConstants.LEVEL, (short) 2, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.AUTO_GENERATED, false, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.SUBJ_QUALITY_CODE, "POOR", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_GMTI:
attribute = constructAttributeNode(NsiliConstants.IDENTIFIER_JOB, 123.1, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.NUMBER_OF_TARGET_REPORTS, 1, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_IMAGERY:
attribute = constructAttributeNode(NsiliConstants.CATEGORY, NsiliImageryType.VIS.toString(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.DECOMPRESSION_TECHNIQUE, NsiliImageryDecompressionTech.NC.toString(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.IDENTIFIER, ORGANIZATION + "1", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.NUMBER_OF_BANDS, 1, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.TITLE, title, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_MESSAGE:
attribute = constructAttributeNode(NsiliConstants.RECIPIENT, ORGANIZATION + "2", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.MESSAGE_BODY, "This is a message", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.MESSAGE_TYPE, XMPP, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_REPORT:
attribute = constructAttributeNode(NsiliConstants.ORIGINATORS_REQ_SERIAL_NUM, "1234", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.PRIORITY, "IMMEDIATE", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.TYPE, "ISRSPOTREP", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_RFI:
attribute = constructAttributeNode(NsiliConstants.FOR_ACTION, "Haiti", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.FOR_INFORMATION, "USA,Canada,Planet Mars", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.SERIAL_NUMBER, "12345", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.STATUS, "APPROVED", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.WORKFLOW_STATUS, "COMPLETED", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_TASK:
attribute = constructAttributeNode(NsiliConstants.COMMENTS, "This is a comment", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.STATUS, "PLANNED", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_TDL:
attribute = constructAttributeNode(NsiliConstants.ACTIVITY, (short) 1, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.MESSAGE_NUM, "J2.2", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.PLATFORM, (short) 2, orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.TRACK_NUM, "EK627", orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
case NsiliConstants.NSIL_VIDEO:
attribute = constructAttributeNode(NsiliConstants.CATEGORY, NsiliImageryType.IR.toString(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
attribute = constructAttributeNode(NsiliConstants.ENCODING_SCHEME, NsiliVideoEncodingScheme.V264ON2.getSpecName(), orb);
graph.addVertex(attribute);
graph.addEdge(node, attribute);
break;
default:
// no action
break;
}
}
Aggregations