Class TrueFalseNode
- java.lang.Object
-
- lumis.portal.analytics.automationflow.FlowNode
-
- lumis.portal.analytics.automationflow.condition.TrueFalseNode
-
- Direct Known Subclasses:
AbstractUserInJourneyChoiceNode
,FilterByEventAttributeNode
,FilterBySegmentationNode
public abstract class TrueFalseNode extends FlowNode
- Since:
- 12.0.0
- Version:
- $Revision: 23535 $ $Date: 2020-01-14 13:18:39 -0300 (Tue, 14 Jan 2020) $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class lumis.portal.analytics.automationflow.FlowNode
FlowNode.FlowNodeExecutionResult
-
-
Constructor Summary
Constructors Constructor Description TrueFalseNode(String id, String name, FlowNode trueNode, FlowNode falseNode)
Creates a new instance.TrueFalseNode(org.json.JSONObject object, FlowEntry flowEntry)
Creates a new instance from the given JSON object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addFalseNodeToJson(FlowNode falseNode, org.json.JSONObject nextNodesObj)
Adds the false node to the next nodes JSON object.protected void
addTrueNodeToJson(FlowNode trueNode, org.json.JSONObject nextNodesObj)
Adds the true node to the next nodes JSON object.abstract boolean
evaluate(FlowContext flowContext)
Evaluates the given flow context.FlowNode.FlowNodeExecutionResult
execute(FlowContext flowContext)
Executes this node and returns the next node to be executed.protected FlowNode
getFalseNodeFromJson(FlowEntry flowEntry, org.json.JSONObject nextNodesObj)
Returns the false node from the next nodes JSON object.Collection<FlowNode>
getFollowUps()
Returns all possible follow up nodes.protected FlowNode
getTrueNodeFromJson(FlowEntry flowEntry, org.json.JSONObject nextNodesObj)
Returns the true node from the next nodes JSON object.org.json.JSONObject
toJSONObject()
Returns the JSON representation of this node.boolean
validateStateAndLog(boolean checkAllNextNodes)
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.-
Methods inherited from class lumis.portal.analytics.automationflow.FlowNode
getAndValidateNotAnonymousUser, getFlowEntry, getId, getName, getNodeLogLabel, init, logError, logError
-
-
-
-
Constructor Detail
-
TrueFalseNode
public TrueFalseNode(String id, String name, FlowNode trueNode, FlowNode falseNode)
Creates a new instance.- Parameters:
id
- the node identifiername
- the node nametrueNode
- the node to be executed if the condition is evaluated totrue
.falseNode
- the node to be executed if the condition is evaluated tofalse
.- 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 classFlowNode
- 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 classFlowNode
- 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 entrynextNodesObj
- 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 entrynextNodesObj
- 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
-
execute
public FlowNode.FlowNodeExecutionResult execute(FlowContext flowContext) throws PortalException
Description copied from class:FlowNode
Executes this node and returns the next node to be executed.- Specified by:
execute
in classFlowNode
- Parameters:
flowContext
- the flow context- Returns:
- the next node to be executed
- Throws:
PortalException
-
evaluate
public abstract boolean evaluate(FlowContext flowContext) throws PortalException
Evaluates the given flow context. Returnstrue
if the context matches the condition orfalse
otherwise.- Parameters:
flowContext
- the context- Returns:
true
if the context matches the condition orfalse
otherwise.- Throws:
PortalException
- Since:
- 12.0.0
-
getFollowUps
public Collection<FlowNode> getFollowUps()
Description copied from class:FlowNode
Returns all possible follow up nodes.- Overrides:
getFollowUps
in classFlowNode
- Returns:
- all possible follow up nodes.
-
-