Search in sources :

Example 6 with StartEvent

use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.

the class BaseBpmnXMLConverter method writeFormProperties.

protected boolean writeFormProperties(FlowElement flowElement, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
    List<FormProperty> propertyList = null;
    if (flowElement instanceof UserTask) {
        propertyList = ((UserTask) flowElement).getFormProperties();
    } else if (flowElement instanceof StartEvent) {
        propertyList = ((StartEvent) flowElement).getFormProperties();
    }
    if (propertyList != null) {
        for (FormProperty property : propertyList) {
            if (StringUtils.isNotEmpty(property.getId())) {
                if (didWriteExtensionStartElement == false) {
                    xtw.writeStartElement(ELEMENT_EXTENSIONS);
                    didWriteExtensionStartElement = true;
                }
                xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FORMPROPERTY, ACTIVITI_EXTENSIONS_NAMESPACE);
                writeDefaultAttribute(ATTRIBUTE_FORM_ID, property.getId(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_NAME, property.getName(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_TYPE, property.getType(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_EXPRESSION, property.getExpression(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_VARIABLE, property.getVariable(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_DEFAULT, property.getDefaultExpression(), xtw);
                writeDefaultAttribute(ATTRIBUTE_FORM_DATEPATTERN, property.getDatePattern(), xtw);
                if (property.isReadable() == false) {
                    writeDefaultAttribute(ATTRIBUTE_FORM_READABLE, ATTRIBUTE_VALUE_FALSE, xtw);
                }
                if (property.isWriteable() == false) {
                    writeDefaultAttribute(ATTRIBUTE_FORM_WRITABLE, ATTRIBUTE_VALUE_FALSE, xtw);
                }
                if (property.isRequired()) {
                    writeDefaultAttribute(ATTRIBUTE_FORM_REQUIRED, ATTRIBUTE_VALUE_TRUE, xtw);
                }
                for (FormValue formValue : property.getFormValues()) {
                    if (StringUtils.isNotEmpty(formValue.getId())) {
                        xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_VALUE, ACTIVITI_EXTENSIONS_NAMESPACE);
                        xtw.writeAttribute(ATTRIBUTE_ID, formValue.getId());
                        xtw.writeAttribute(ATTRIBUTE_NAME, formValue.getName());
                        xtw.writeEndElement();
                    }
                }
                xtw.writeEndElement();
            }
        }
    }
    return didWriteExtensionStartElement;
}
Also used : FormValue(org.activiti.bpmn.model.FormValue) FormProperty(org.activiti.bpmn.model.FormProperty) UserTask(org.activiti.bpmn.model.UserTask) StartEvent(org.activiti.bpmn.model.StartEvent)

Example 7 with StartEvent

use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.

the class StartEventXMLConverter method writeAdditionalAttributes.

@Override
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    StartEvent startEvent = (StartEvent) element;
    writeQualifiedAttribute(ATTRIBUTE_EVENT_START_INITIATOR, startEvent.getInitiator(), xtw);
    writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, startEvent.getFormKey(), xtw);
}
Also used : AlfrescoStartEvent(org.activiti.bpmn.model.alfresco.AlfrescoStartEvent) StartEvent(org.activiti.bpmn.model.StartEvent)

Example 8 with StartEvent

use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.

the class StartEventXMLConverter method convertXMLToElement.

@Override
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
    String formKey = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_FORMKEY);
    StartEvent startEvent = null;
    if (StringUtils.isNotEmpty(formKey)) {
        if (model.getStartEventFormTypes() != null && model.getStartEventFormTypes().contains(formKey)) {
            startEvent = new AlfrescoStartEvent();
        }
    }
    if (startEvent == null) {
        startEvent = new StartEvent();
    }
    BpmnXMLUtil.addXMLLocation(startEvent, xtr);
    startEvent.setInitiator(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_EVENT_START_INITIATOR));
    startEvent.setFormKey(formKey);
    parseChildElements(getXMLElementName(), startEvent, model, xtr);
    return startEvent;
}
Also used : AlfrescoStartEvent(org.activiti.bpmn.model.alfresco.AlfrescoStartEvent) StartEvent(org.activiti.bpmn.model.StartEvent) AlfrescoStartEvent(org.activiti.bpmn.model.alfresco.AlfrescoStartEvent)

Example 9 with StartEvent

use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.

the class StartEventXMLConverter method writeAdditionalChildElements.

@Override
protected void writeAdditionalChildElements(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
    StartEvent startEvent = (StartEvent) element;
    writeEventDefinitions(startEvent, startEvent.getEventDefinitions(), model, xtw);
}
Also used : AlfrescoStartEvent(org.activiti.bpmn.model.alfresco.AlfrescoStartEvent) StartEvent(org.activiti.bpmn.model.StartEvent)

Example 10 with StartEvent

use of org.activiti.bpmn.model.StartEvent in project Activiti by Activiti.

the class AbstractActivitiTestCase method createTwoTasksTestProcess.

public BpmnModel createTwoTasksTestProcess() {
    BpmnModel model = new BpmnModel();
    org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process();
    model.addProcess(process);
    process.setId("twoTasksProcess");
    process.setName("The two tasks process");
    StartEvent startEvent = new StartEvent();
    startEvent.setId("start");
    process.addFlowElement(startEvent);
    UserTask userTask = new UserTask();
    userTask.setName("The First Task");
    userTask.setId("task1");
    userTask.setAssignee("kermit");
    process.addFlowElement(userTask);
    UserTask userTask2 = new UserTask();
    userTask2.setName("The Second Task");
    userTask2.setId("task2");
    userTask2.setAssignee("kermit");
    process.addFlowElement(userTask2);
    EndEvent endEvent = new EndEvent();
    endEvent.setId("theEnd");
    process.addFlowElement(endEvent);
    process.addFlowElement(new SequenceFlow("start", "task1"));
    process.addFlowElement(new SequenceFlow("start", "task2"));
    process.addFlowElement(new SequenceFlow("task1", "theEnd"));
    process.addFlowElement(new SequenceFlow("task2", "theEnd"));
    return model;
}
Also used : SequenceFlow(org.activiti.bpmn.model.SequenceFlow) StartEvent(org.activiti.bpmn.model.StartEvent) UserTask(org.activiti.bpmn.model.UserTask) EndEvent(org.activiti.bpmn.model.EndEvent) BpmnModel(org.activiti.bpmn.model.BpmnModel)

Aggregations

StartEvent (org.activiti.bpmn.model.StartEvent)35 UserTask (org.activiti.bpmn.model.UserTask)18 FlowElement (org.activiti.bpmn.model.FlowElement)14 SubProcess (org.activiti.bpmn.model.SubProcess)8 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)7 BpmnModel (org.activiti.bpmn.model.BpmnModel)7 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)7 EndEvent (org.activiti.bpmn.model.EndEvent)6 FormProperty (org.activiti.bpmn.model.FormProperty)6 HashMap (java.util.HashMap)5 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)5 ValuedDataObject (org.activiti.bpmn.model.ValuedDataObject)5 ArrayList (java.util.ArrayList)4 FormValue (org.activiti.bpmn.model.FormValue)4 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)4 AlfrescoStartEvent (org.activiti.bpmn.model.alfresco.AlfrescoStartEvent)4 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)4 ActivitiListener (org.activiti.bpmn.model.ActivitiListener)3 Process (org.activiti.bpmn.model.Process)3 Date (java.util.Date)2