Search in sources :

Example 1 with WorkflowProcessImpl

use of io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl in project automatiko-engine by automatiko-io.

the class FunctionImportHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
    final String name = attrs.getValue("name");
    emptyAttributeCheck(localName, "name", name, parser);
    java.util.List<String> list = process.getFunctionImports();
    if (list == null) {
        list = new ArrayList<String>();
        process.setFunctionImports(list);
    }
    list.add(name);
    return null;
}
Also used : WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl)

Example 2 with WorkflowProcessImpl

use of io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl in project automatiko-engine by automatiko-io.

the class AbstractProcess method activate.

@Override
public void activate() {
    if (this.activated) {
        return;
    }
    configure();
    WorkflowProcessImpl p = (WorkflowProcessImpl) process();
    List<StartNode> startNodes = p.getTimerStart();
    if (startNodes != null && !startNodes.isEmpty()) {
        this.processRuntime = createProcessRuntime();
        for (StartNode startNode : startNodes) {
            if (startNode != null && startNode.getTimer() != null) {
                String timerId = processRuntime.getJobsService().scheduleProcessJob(ProcessJobDescription.of(configureTimerInstance(startNode.getTimer()), this));
                startTimerInstances.add(timerId);
            }
        }
    }
    this.activated = true;
}
Also used : StartNode(io.automatiko.engine.workflow.process.core.node.StartNode) WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl)

Example 3 with WorkflowProcessImpl

use of io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl in project automatiko-engine by automatiko-io.

the class ProcessToExecModelGenerator method generateUserTaskModel.

public List<UserTaskModelMetaData> generateUserTaskModel(WorkflowProcess process, boolean templateSupported) {
    String packageName = process.getPackageName();
    List<UserTaskModelMetaData> usertaskModels = new ArrayList<>();
    VariableScope variableScope = (VariableScope) ((io.automatiko.engine.workflow.base.core.Process) process).getDefaultContext(VariableScope.VARIABLE_SCOPE);
    for (Node node : ((WorkflowProcessImpl) process).getNodesRecursively()) {
        if (node instanceof HumanTaskNode) {
            HumanTaskNode humanTaskNode = (HumanTaskNode) node;
            VariableScope nodeVariableScope = (VariableScope) ((ContextContainer) humanTaskNode.getParentContainer()).getDefaultContext(VariableScope.VARIABLE_SCOPE);
            if (nodeVariableScope == null) {
                nodeVariableScope = variableScope;
            }
            usertaskModels.add(new UserTaskModelMetaData(packageName, variableScope, nodeVariableScope, humanTaskNode, process.getId(), ModelMetaData.version(process.getVersion()), templateSupported));
        }
    }
    return usertaskModels;
}
Also used : Node(io.automatiko.engine.api.definition.process.Node) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode) ArrayList(java.util.ArrayList) WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl) VariableScope(io.automatiko.engine.workflow.base.core.context.variable.VariableScope) HumanTaskNode(io.automatiko.engine.workflow.process.core.node.HumanTaskNode)

Example 4 with WorkflowProcessImpl

use of io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl in project automatiko-engine by automatiko-io.

the class SwimlaneHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
    final String name = attrs.getValue("name");
    emptyAttributeCheck(localName, "name", name, parser);
    SwimlaneContext swimlaneContext = (SwimlaneContext) process.getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE);
    if (swimlaneContext != null) {
        Swimlane swimlane = new Swimlane();
        swimlane.setName(name);
        swimlaneContext.addSwimlane(swimlane);
    } else {
        throw new SAXParseException("Could not find default swimlane context.", parser.getLocator());
    }
    return null;
}
Also used : SwimlaneContext(io.automatiko.engine.workflow.base.core.context.swimlane.SwimlaneContext) Swimlane(io.automatiko.engine.workflow.base.core.context.swimlane.Swimlane) SAXParseException(org.xml.sax.SAXParseException) WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl)

Example 5 with WorkflowProcessImpl

use of io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl in project automatiko-engine by automatiko-io.

the class GlobalHandler method start.

public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
    parser.startElementBuilder(localName, attrs);
    WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent();
    final String identifier = attrs.getValue("identifier");
    final String type = attrs.getValue("type");
    emptyAttributeCheck(localName, "identifier", identifier, parser);
    emptyAttributeCheck(localName, "type", type, parser);
    Map<String, String> map = process.getGlobals();
    if (map == null) {
        map = new HashMap<String, String>();
        process.setGlobals(map);
    }
    map.put(identifier, type);
    return null;
}
Also used : WorkflowProcessImpl(io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl)

Aggregations

WorkflowProcessImpl (io.automatiko.engine.workflow.process.core.impl.WorkflowProcessImpl)8 Node (io.automatiko.engine.api.definition.process.Node)1 Swimlane (io.automatiko.engine.workflow.base.core.context.swimlane.Swimlane)1 SwimlaneContext (io.automatiko.engine.workflow.base.core.context.swimlane.SwimlaneContext)1 VariableScope (io.automatiko.engine.workflow.base.core.context.variable.VariableScope)1 HumanTaskNode (io.automatiko.engine.workflow.process.core.node.HumanTaskNode)1 StartNode (io.automatiko.engine.workflow.process.core.node.StartNode)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SAXParseException (org.xml.sax.SAXParseException)1