Search in sources :

Example 1 with Node

use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.

the class ResultDAGConverter method addDateAttribute.

public static void addDateAttribute(DirectedAcyclicGraph<Node, Edge> graph, Node parentNode, String key, Date date, ORB orb) {
    Any any = orb.create_any();
    AbsTimeHelper.insert(any, getAbsTime(date));
    Node node = new Node(0, NodeType.ATTRIBUTE_NODE, key, any);
    graph.addVertex(node);
    graph.addEdge(parentNode, node);
}
Also used : Node(org.codice.alliance.nsili.common.UCO.Node) Any(org.omg.CORBA.Any)

Example 2 with Node

use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.

the class ResultDAGConverter method addExploitationInfoPart.

public static List<String> addExploitationInfoPart(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
    List<String> addedAttributes = new ArrayList<>();
    Any exploitationInfoAny = orb.create_any();
    Node exploitationInfoNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_EXPLOITATION_INFO, exploitationInfoAny);
    graph.addVertex(exploitationInfoNode);
    graph.addEdge(partNode, exploitationInfoNode);
    String attribute = parentAttrName + NsiliConstants.NSIL_EXPLOITATION_INFO;
    addIntAttribute(graph, metacard.getAttribute(Isr.EXPLOITATION_LEVEL), orb, resultAttributes, addedAttributes, exploitationInfoNode, attribute, NsiliConstants.LEVEL);
    addAutoGeneratedAttribute(graph, metacard, orb, resultAttributes, addedAttributes, exploitationInfoNode, attribute);
    addSubjQualityAttribute(graph, metacard, orb, resultAttributes, addedAttributes, exploitationInfoNode, attribute);
    if (addedAttributes.isEmpty()) {
        graph.removeEdge(partNode, exploitationInfoNode);
        graph.removeVertex(exploitationInfoNode);
    }
    return addedAttributes;
}
Also used : Node(org.codice.alliance.nsili.common.UCO.Node) ArrayList(java.util.ArrayList) Any(org.omg.CORBA.Any)

Example 3 with Node

use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.

the class ResultDAGConverter method addCoverageNodeWithAttributes.

public static List<String> addCoverageNodeWithAttributes(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
    List<String> addedAttributes = new ArrayList<>();
    Any any = orb.create_any();
    String attribute = parentAttrName + NsiliConstants.NSIL_COVERAGE;
    Node coverageNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_COVERAGE, any);
    if (metacardContainsGeoInfo(metacard)) {
        graph.addVertex(coverageNode);
        graph.addEdge(partNode, coverageNode);
        addStrAttribute(graph, metacard.getAttribute(Core.LOCATION), orb, resultAttributes, addedAttributes, coverageNode, attribute, NsiliConstants.ADVANCED_GEOSPATIAL);
        addSpatialGeoRefBoxAttribute(graph, metacard, orb, resultAttributes, addedAttributes, attribute, coverageNode);
    }
    addTemporalAttributes(graph, metacard, orb, resultAttributes, addedAttributes, attribute, coverageNode);
    addValStrAttribute(graph, metacard.getAttribute(Location.COUNTRY_CODE), orb, resultAttributes, addedAttributes, coverageNode, attribute, NsiliConstants.SPATIAL_COUNTRY_CODE);
    return addedAttributes;
}
Also used : Node(org.codice.alliance.nsili.common.UCO.Node) ArrayList(java.util.ArrayList) Any(org.omg.CORBA.Any)

Example 4 with Node

use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.

the class ResultDAGConverter method addShortAttribute.

public static void addShortAttribute(DirectedAcyclicGraph<Node, Edge> graph, Node parentNode, String key, Short shortVal, ORB orb) {
    Any any = orb.create_any();
    any.insert_short(shortVal);
    Node node = new Node(0, NodeType.ATTRIBUTE_NODE, key, any);
    graph.addVertex(node);
    graph.addEdge(parentNode, node);
}
Also used : Node(org.codice.alliance.nsili.common.UCO.Node) Any(org.omg.CORBA.Any)

Example 5 with Node

use of org.codice.alliance.nsili.common.UCO.Node in project alliance by codice.

the class ResultDAGConverter method addRfiPart.

public static List<String> addRfiPart(DirectedAcyclicGraph<Node, Edge> graph, Node partNode, Metacard metacard, ORB orb, String parentAttrName, List<String> resultAttributes) {
    List<String> addedAttributes = new ArrayList<>();
    Any rfiAny = orb.create_any();
    Node rfiNode = new Node(0, NodeType.ENTITY_NODE, NsiliConstants.NSIL_RFI, rfiAny);
    graph.addVertex(rfiNode);
    graph.addEdge(partNode, rfiNode);
    String attribute = parentAttrName + NsiliConstants.NSIL_RFI;
    addStrAttribute(graph, metacard.getAttribute(Isr.REQUEST_FOR_INFORMATION_FOR_ACTION), orb, resultAttributes, addedAttributes, rfiNode, attribute, NsiliConstants.FOR_ACTION);
    addStrAttribute(graph, metacard.getAttribute(Isr.REQUEST_FOR_INFORMATION_FOR_INFORMATION), orb, resultAttributes, addedAttributes, rfiNode, attribute, NsiliConstants.FOR_INFORMATION);
    addStrAttribute(graph, metacard.getAttribute(Isr.REQUEST_FOR_INFORMATION_SERIAL_NUMBER), orb, resultAttributes, addedAttributes, rfiNode, attribute, NsiliConstants.SERIAL_NUMBER);
    addStatusAttribute(graph, metacard, orb, resultAttributes, addedAttributes, rfiNode, attribute);
    addWorkflowStatusAttribute(graph, metacard, orb, resultAttributes, addedAttributes, rfiNode, attribute);
    return addedAttributes;
}
Also used : Node(org.codice.alliance.nsili.common.UCO.Node) ArrayList(java.util.ArrayList) Any(org.omg.CORBA.Any)

Aggregations

Node (org.codice.alliance.nsili.common.UCO.Node)109 Any (org.omg.CORBA.Any)61 Edge (org.codice.alliance.nsili.common.UCO.Edge)31 ArrayList (java.util.ArrayList)23 DirectedAcyclicGraph (org.jgrapht.experimental.dag.DirectedAcyclicGraph)23 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)21 DAG (org.codice.alliance.nsili.common.UCO.DAG)21 Test (org.junit.Test)20 File (java.io.File)12 IOException (java.io.IOException)12 PrintStream (java.io.PrintStream)11 DepthFirstIterator (org.jgrapht.traverse.DepthFirstIterator)6 Attribute (ddf.catalog.data.Attribute)5 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 Metacard (ddf.catalog.data.Metacard)1 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)1 BufferedInputStream (java.io.BufferedInputStream)1 FileOutputStream (java.io.FileOutputStream)1 Serializable (java.io.Serializable)1