Class FlowUtil


  • public class FlowUtil
    extends Object
    Utilities for dealing with Flow.
    Since:
    12.0.0
    Version:
    $Revision: 23402 $ $Date: 2019-12-06 19:07:56 -0300 (Fri, 06 Dec 2019) $
    • Constructor Detail

      • FlowUtil

        public FlowUtil()
    • Method Detail

      • getFlowFromJson

        public static Flow getFlowFromJson​(org.json.JSONObject flowJson,
                                           FlowEntry flowEntry)
        Returns a Flow by parsing the given JSONObject.
        Parameters:
        flowJson - the flow in JSON format.
        flowEntry - the flow entry this node belongs to.
        Returns:
        a Flow.
        Since:
        12.0.0
      • getJsonFromFlow

        public static org.json.JSONObject getJsonFromFlow​(Flow flow)
        Returns a JSONObject by converting the given Flow.
        Parameters:
        flow - the Flow
        Returns:
        the JSONObject.
        Since:
        12.0.0
      • addSingleNextNodeOnJson

        public static void addSingleNextNodeOnJson​(FlowNode nextNode,
                                                   org.json.JSONObject nodeJson)
        Adds the next node on node JSON. This method will add the given next node within the given JSON object usig a nextNode key.
        Parameters:
        nextNode - the next node to be stored.
        nodeJson - the node JSON that will receive the next node.
        Since:
        12.0.0
        See Also:
        #getSingleNextNodeInJson(JSONObject)
      • addNextNodeOnJson

        public static void addNextNodeOnJson​(FlowNode nextNode,
                                             String objectKey,
                                             org.json.JSONObject nodeJson)
        Adds the given next node on node JSON using the given objectKey parameter as the object's key.
        Parameters:
        nextNode - the next node to be stored.
        objectKey - the property JSON for store next node.
        nodeJson - the node JSON that will receive the next node.
        Since:
        12.0.0
      • getSingleNextNodeInJson

        public static FlowNode getSingleNextNodeInJson​(org.json.JSONObject nodeJson,
                                                       FlowEntry flowEntry)
        Returns the next node from the given JSON object, using the nextNode key to get it.
        Parameters:
        nodeJson - the JSON object.
        flowEntry - the flow entry this node belongs to.
        Returns:
        the next node from the given JSON object, using the nextNode key to get it.
        Since:
        12.0.0
        See Also:
        addSingleNextNodeOnJson(FlowNode, JSONObject)
      • getNextNodeInJson

        public static FlowNode getNextNodeInJson​(org.json.JSONObject nodeJson,
                                                 String objectKey,
                                                 FlowEntry flowEntry)
        Returns the next node from the given JSON object, using the given objectKey parameter as object key.
        Parameters:
        nodeJson - the parent next flow node.
        objectKey - property that holds next flow node.
        flowEntry - the flow entry this node belongs to.
        Returns:
        the next flow node, or null if there is no next flow node.
        Since:
        12.0.0
      • findNode

        public static FlowNode findNode​(String id,
                                        Flow flow)
        Returns the node of the given flow with the given identifier or null if there's no such node.
        Parameters:
        id - the node identifier.
        flow - the flow.
        Returns:
        the node of the given flow with the given identifier or null if there's no such node.
        Since:
        12.1.0