Class TrueFalseNode

    • Constructor Detail

      • TrueFalseNode

        public TrueFalseNode​(String id,
                             String name,
                             FlowNode trueNode,
                             FlowNode falseNode)
        Creates a new instance.
        Parameters:
        id - the node identifier
        name - the node name
        trueNode - the node to be executed if the condition is evaluated to true.
        falseNode - the node to be executed if the condition is evaluated to false.
        Since:
        12.0.0
      • TrueFalseNode

        public TrueFalseNode​(org.json.JSONObject object,
                             FlowEntry flowEntry)
        Creates a new instance from the given JSON object.
        Parameters:
        object - the JSON object.
        flowEntry - the flow entry this node belongs to.
        Since:
        12.0.0
    • Method Detail

      • validateStateAndLog

        public boolean validateStateAndLog​(boolean checkAllNextNodes)
        Description copied from class: FlowNode
        To permit edition when JSON flow is saved incorrectly in data base, the flow node constructor by JSON parameter need allows to load flow node variables without exception when something already is wrong. So, to prevents exception on flow node execution and prevent to save flow when flow node is invalid state, this methods will check if all variables is OK and log otherwise.
        Specified by:
        validateStateAndLog in class FlowNode
        Parameters:
        checkAllNextNodes - check all next nodes nodes.
        Returns:
        true if all variable state is OK.
      • toJSONObject

        public org.json.JSONObject toJSONObject()
        Description copied from class: FlowNode
        Returns the JSON representation of this node. This method is the counterpart of #FlowNode(JSONObject) constructor.
        Overrides:
        toJSONObject in class FlowNode
        Returns:
        the JSON representation of this node.
      • getTrueNodeFromJson

        protected FlowNode getTrueNodeFromJson​(FlowEntry flowEntry,
                                               org.json.JSONObject nextNodesObj)
        Returns the true node from the next nodes JSON object.
        Parameters:
        flowEntry - the flow entry
        nextNodesObj - the next objects JSON object
        Returns:
        the true node from the next nodes JSON object.
        Since:
        12.2.0
      • getFalseNodeFromJson

        protected FlowNode getFalseNodeFromJson​(FlowEntry flowEntry,
                                                org.json.JSONObject nextNodesObj)
        Returns the false node from the next nodes JSON object.
        Parameters:
        flowEntry - the flow entry
        nextNodesObj - the next objects JSON object
        Returns:
        the false node from the next nodes JSON object.
        Since:
        12.2.0
      • addTrueNodeToJson

        protected void addTrueNodeToJson​(FlowNode trueNode,
                                         org.json.JSONObject nextNodesObj)
        Adds the true node to the next nodes JSON object.
        Parameters:
        trueNode - the true node.
        nextNodesObj - the next nodes object.
        Since:
        12.2.0
      • addFalseNodeToJson

        protected void addFalseNodeToJson​(FlowNode falseNode,
                                          org.json.JSONObject nextNodesObj)
        Adds the false node to the next nodes JSON object.
        Parameters:
        falseNode - the false node.
        nextNodesObj - the next nodes object.
        Since:
        12.2.0
      • evaluate

        public abstract boolean evaluate​(FlowContext flowContext)
                                  throws PortalException
        Evaluates the given flow context. Returns true if the context matches the condition or false otherwise.
        Parameters:
        flowContext - the context
        Returns:
        true if the context matches the condition or false otherwise.
        Throws:
        PortalException
        Since:
        12.0.0