All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.acme.travels.ApprovalsProcess Maven / Gradle / Ivy

There is a newer version: 1.25.0.Final
Show newest version
package org.acme.travels;

import org.jbpm.process.core.datatype.impl.type.ObjectDataType;
import org.jbpm.ruleflow.core.RuleFlowProcessFactory;
import org.drools.core.util.KieFunctions;

@org.springframework.stereotype.Component("approvals")
public class ApprovalsProcess extends org.kie.kogito.process.impl.AbstractProcess {

    @org.springframework.beans.factory.annotation.Autowired()
    public ApprovalsProcess(org.kie.kogito.app.Application app) {
        super(app, java.util.Arrays.asList());
        activate();
    }

    public ApprovalsProcess() {
    }

    @Override()
    public org.acme.travels.ApprovalsProcessInstance createInstance(org.acme.travels.ApprovalsModel value) {
        return new org.acme.travels.ApprovalsProcessInstance(this, value, this.createProcessRuntime());
    }

    public org.acme.travels.ApprovalsProcessInstance createInstance(java.lang.String businessKey, org.acme.travels.ApprovalsModel value) {
        return new org.acme.travels.ApprovalsProcessInstance(this, value, businessKey, this.createProcessRuntime());
    }

    @Override()
    public org.acme.travels.ApprovalsModel createModel() {
        return new org.acme.travels.ApprovalsModel();
    }

    public org.acme.travels.ApprovalsProcessInstance createInstance(org.kie.kogito.Model value) {
        return this.createInstance((org.acme.travels.ApprovalsModel) value);
    }

    public org.acme.travels.ApprovalsProcessInstance createInstance(java.lang.String businessKey, org.kie.kogito.Model value) {
        return this.createInstance(businessKey, (org.acme.travels.ApprovalsModel) value);
    }

    public org.acme.travels.ApprovalsProcessInstance createInstance(org.kie.api.runtime.process.WorkflowProcessInstance wpi) {
        return new org.acme.travels.ApprovalsProcessInstance(this, this.createModel(), this.createProcessRuntime(), wpi);
    }

    public org.acme.travels.ApprovalsProcessInstance createReadOnlyInstance(org.kie.api.runtime.process.WorkflowProcessInstance wpi) {
        return new org.acme.travels.ApprovalsProcessInstance(this, this.createModel(), wpi);
    }

    public org.kie.api.definition.process.Process process() {
        RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("approvals");
        factory.variable("approver", new ObjectDataType("java.lang.String"), "customTags", null);
        factory.variable("traveller", new ObjectDataType("org.acme.travels.Traveller"), "customTags", null);
        factory.variable("firstLineApproval", new ObjectDataType("java.lang.Boolean"), "customTags", null);
        factory.variable("secondLineApproval", new ObjectDataType("java.lang.Boolean"), "customTags", null);
        factory.name("approvals");
        factory.packageName("org.acme.travels");
        factory.dynamic(false);
        factory.version("1.0");
        factory.visibility("Public");
        factory.metaData("securityRoles", "employees,managers");
        factory.metaData("TargetNamespace", "http://www.jboss.org/drools");
        factory.imports("org.acme.travels.Traveller");
        org.jbpm.ruleflow.core.factory.StartNodeFactory startNode1 = factory.startNode(1);
        startNode1.name("StartProcess");
        startNode1.interrupting(true);
        startNode1.metaData("UniqueId", "StartEvent_1");
        startNode1.metaData("elementname", "StartProcess");
        startNode1.metaData("x", 45);
        startNode1.metaData("width", 0);
        startNode1.metaData("y", 45);
        startNode1.metaData("height", 0);
        startNode1.done();
        org.jbpm.ruleflow.core.factory.EndNodeFactory endNode2 = factory.endNode(2);
        endNode2.name("End");
        endNode2.terminate(false);
        endNode2.metaData("UniqueId", "EndEvent_1");
        endNode2.metaData("elementname", "End");
        endNode2.metaData("x", 579);
        endNode2.metaData("width", 36);
        endNode2.metaData("y", 45);
        endNode2.metaData("height", 36);
        endNode2.done();
        org.jbpm.ruleflow.core.factory.HumanTaskNodeFactory humanTaskNode3 = factory.humanTaskNode(3);
        humanTaskNode3.name("First Line approval");
        humanTaskNode3.workParameter("TaskName", "firstLineApproval");
        humanTaskNode3.workParameter("Priority", "1");
        humanTaskNode3.workParameter("GroupId", "managers");
        humanTaskNode3.workParameter("Skippable", "true");
        humanTaskNode3.workParameter("Locale", "en-UK");
        humanTaskNode3.workParameter("ActorId", "manager");
        humanTaskNode3.workParameter("NodeName", "First Line approval");
        humanTaskNode3.inMapping("traveller", "traveller");
        humanTaskNode3.outMapping("approved", "firstLineApproval");
        humanTaskNode3.outMapping("ActorId", "approver");
        humanTaskNode3.done();
        humanTaskNode3.metaData("UniqueId", "UserTask_1");
        humanTaskNode3.metaData("elementname", "First Line approval");
        humanTaskNode3.metaData("x", 186);
        humanTaskNode3.metaData("width", 110);
        humanTaskNode3.metaData("y", 38);
        humanTaskNode3.metaData("height", 50);
        org.jbpm.ruleflow.core.factory.HumanTaskNodeFactory humanTaskNode4 = factory.humanTaskNode(4);
        humanTaskNode4.name("Second Line approval");
        humanTaskNode4.workParameter("TaskName", "secondLineApproval");
        humanTaskNode4.workParameter("Priority", "1");
        humanTaskNode4.workParameter("GroupId", "managers");
        humanTaskNode4.workParameter("Skippable", "true");
        humanTaskNode4.workParameter("Locale", "en-UK");
        humanTaskNode4.workParameter("NodeName", "Second Line approval");
        humanTaskNode4.inMapping("ExcludedOwnerId", "approver");
        humanTaskNode4.inMapping("traveller", "traveller");
        humanTaskNode4.outMapping("approved", "secondLineApproval");
        humanTaskNode4.done();
        humanTaskNode4.metaData("UniqueId", "UserTask_2");
        humanTaskNode4.metaData("elementname", "Second Line approval");
        humanTaskNode4.metaData("x", 401);
        humanTaskNode4.metaData("width", 110);
        humanTaskNode4.metaData("y", 38);
        humanTaskNode4.metaData("height", 50);
        factory.connection(4, 2, "SequenceFlow_6");
        factory.connection(1, 3, "SequenceFlow_4");
        factory.connection(3, 4, "SequenceFlow_5");
        factory.validate();
        return factory.getProcess();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy