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

io.zeebe.model.bpmn.impl.instance.ProcessImpl Maven / Gradle / Ivy

There is a newer version: 0.16.4
Show newest version
/*
 * Copyright © 2017 camunda services GmbH ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.zeebe.model.bpmn.impl.instance;

import java.util.*;

import javax.xml.bind.annotation.*;

import io.zeebe.model.bpmn.BpmnConstants;
import io.zeebe.model.bpmn.instance.*;
import org.agrona.DirectBuffer;

public class ProcessImpl extends FlowElementImpl implements Workflow
{
    private boolean isExecutable = true;

    private List sequenceFlows = new ArrayList<>();
    private List startEvents = new ArrayList<>();
    private List endEvents = new ArrayList<>();
    private List serviceTasks = new ArrayList<>();
    private List exclusiveGateways = new ArrayList<>();

    private StartEvent initialStartEvent;
    private final List flowElements = new ArrayList<>();
    private final Map flowElementMap = new HashMap<>();

    @XmlAttribute(name = BpmnConstants.BPMN_ATTRIBUTE_IS_EXECUTABLE)
    public void setExecutable(boolean isExecutable)
    {
        this.isExecutable = isExecutable;
    }

    @Override
    public boolean isExecutable()
    {
        return isExecutable;
    }

    @XmlElement(name = BpmnConstants.BPMN_ELEMENT_SEQUENCE_FLOW, namespace = BpmnConstants.BPMN20_NS)
    public void setSequenceFlows(List sequenceFlows)
    {
        this.sequenceFlows = sequenceFlows;
    }

    public List getSequenceFlows()
    {
        return sequenceFlows;
    }

    @XmlElement(name = BpmnConstants.BPMN_ELEMENT_START_EVENT, namespace = BpmnConstants.BPMN20_NS)
    public void setStartEvents(List startEvents)
    {
        this.startEvents = startEvents;
    }

    public List getStartEvents()
    {
        return startEvents;
    }

    @XmlElement(name = BpmnConstants.BPMN_ELEMENT_END_EVENT, namespace = BpmnConstants.BPMN20_NS)
    public void setEndEvents(List endEvents)
    {
        this.endEvents = endEvents;
    }

    public List getEndEvents()
    {
        return endEvents;
    }

    @XmlElement(name = BpmnConstants.BPMN_ELEMENT_SERVICE_TASK, namespace = BpmnConstants.BPMN20_NS)
    public void setServiceTasks(List serviceTasks)
    {
        this.serviceTasks = serviceTasks;
    }

    public List getServiceTasks()
    {
        return serviceTasks;
    }

    @XmlElement(name = BpmnConstants.BPMN_ELEMENT_EXCLUSIVE_GATEWAY, namespace = BpmnConstants.BPMN20_NS)
    public void setExclusiveGateways(List exclusiveGateways)
    {
        this.exclusiveGateways = exclusiveGateways;
    }

    public List getExclusiveGateways()
    {
        return exclusiveGateways;
    }

    @Override
    public DirectBuffer getBpmnProcessId()
    {
        return getIdAsBuffer();
    }

    @XmlTransient
    public void setInitialStartEvent(StartEvent initialStartEvent)
    {
        this.initialStartEvent = initialStartEvent;
    }

    @Override
    public StartEvent getInitialStartEvent()
    {
        return initialStartEvent;
    }

    @Override
    public List getFlowElements()
    {
        return flowElements;
    }

    @SuppressWarnings("unchecked")
    @Override
    public  T findFlowElementById(DirectBuffer id)
    {
        return (T) flowElementMap.get(id);
    }

    @Override
    public Map getFlowElementMap()
    {
        return flowElementMap;
    }

    @Override
    public String toString()
    {
        final StringBuilder builder = new StringBuilder();
        builder.append("Workflow [isExecutable=");
        builder.append(isExecutable);
        builder.append(", bpmnProcessId=");
        builder.append(getId());
        builder.append(", name=");
        builder.append(getName());
        builder.append("]");
        return builder.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy