Search in sources :

Example 56 with Variable

use of io.automatiko.engine.workflow.base.core.context.variable.Variable in project automatiko-engine by automatiko-io.

the class ForEachNode method setVariable.

public void setVariable(String variableName, DataType type) {
    this.variableName = variableName;
    VariableScope variableScope = (VariableScope) getCompositeNode().getDefaultContext(VariableScope.VARIABLE_SCOPE);
    List<Variable> variables = variableScope.getVariables();
    if (variables == null) {
        variables = new ArrayList<Variable>();
        variableScope.setVariables(variables);
    }
    Variable variable = new Variable();
    variable.setId((String) getMetaData().getOrDefault("MIInput", variableName));
    variable.setName(variableName);
    variable.setType(type);
    variables.add(variable);
}
Also used : Variable(io.automatiko.engine.workflow.base.core.context.variable.Variable) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope)

Example 57 with Variable

use of io.automatiko.engine.workflow.base.core.context.variable.Variable in project automatiko-engine by automatiko-io.

the class ForEachNode method setOutputVariable.

public void setOutputVariable(String variableName, DataType type) {
    this.outputVariableName = variableName;
    VariableScope variableScope = (VariableScope) getCompositeNode().getDefaultContext(VariableScope.VARIABLE_SCOPE);
    List<Variable> variables = variableScope.getVariables();
    if (variables == null) {
        variables = new ArrayList<Variable>();
        variableScope.setVariables(variables);
    }
    Variable variable = new Variable();
    variable.setId((String) getMetaData().getOrDefault("MIOutput", variableName));
    variable.setName(variableName);
    variable.setType(type);
    variables.add(variable);
    Variable tmpvariable = new Variable();
    tmpvariable.setId("foreach_output");
    tmpvariable.setName("foreach_output");
    tmpvariable.setType(type);
    variables.add(tmpvariable);
}
Also used : Variable(io.automatiko.engine.workflow.base.core.context.variable.Variable) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope)

Aggregations

Variable (io.automatiko.engine.workflow.base.core.context.variable.Variable)57 VariableScope (io.automatiko.engine.workflow.base.core.context.variable.VariableScope)27 Map (java.util.Map)22 HashMap (java.util.HashMap)18 StringLiteralExpr (com.github.javaparser.ast.expr.StringLiteralExpr)16 ObjectDataType (io.automatiko.engine.workflow.base.core.datatype.impl.type.ObjectDataType)16 ArrayList (java.util.ArrayList)14 NameExpr (com.github.javaparser.ast.expr.NameExpr)12 Matcher (java.util.regex.Matcher)12 VariableScopeInstance (io.automatiko.engine.workflow.base.instance.context.variable.VariableScopeInstance)11 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)10 MethodCallExpr (com.github.javaparser.ast.expr.MethodCallExpr)9 ClassOrInterfaceType (com.github.javaparser.ast.type.ClassOrInterfaceType)9 ActionNode (io.automatiko.engine.workflow.process.core.node.ActionNode)9 EndNode (io.automatiko.engine.workflow.process.core.node.EndNode)9 List (java.util.List)9 ReturnStmt (com.github.javaparser.ast.stmt.ReturnStmt)8 DataAssociation (io.automatiko.engine.workflow.process.core.node.DataAssociation)8 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)8 ExecutableProcess (io.automatiko.engine.workflow.process.executable.core.ExecutableProcess)8