Search in sources :

Example 21 with BoundaryEvent

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

the class TimerDefinitionConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    IntermediateCatchEvent timer = (IntermediateCatchEvent) model.getMainProcess().getFlowElement("timer");
    assertNotNull(timer);
    TimerEventDefinition timerEvent = (TimerEventDefinition) timer.getEventDefinitions().get(0);
    assertThat(timerEvent.getCalendarName(), is("custom"));
    assertEquals("PT5M", timerEvent.getTimeDuration());
    StartEvent start = (StartEvent) model.getMainProcess().getFlowElement("theStart");
    assertNotNull(start);
    TimerEventDefinition startTimerEvent = (TimerEventDefinition) start.getEventDefinitions().get(0);
    assertThat(startTimerEvent.getCalendarName(), is("custom"));
    assertEquals("R2/PT5S", startTimerEvent.getTimeCycle());
    assertEquals("${EndDate}", startTimerEvent.getEndDate());
    BoundaryEvent boundaryTimer = (BoundaryEvent) model.getMainProcess().getFlowElement("boundaryTimer");
    assertNotNull(boundaryTimer);
    TimerEventDefinition boundaryTimerEvent = (TimerEventDefinition) boundaryTimer.getEventDefinitions().get(0);
    assertThat(boundaryTimerEvent.getCalendarName(), is("custom"));
    assertEquals("PT10S", boundaryTimerEvent.getTimeDuration());
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) StartEvent(org.activiti.bpmn.model.StartEvent) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 22 with BoundaryEvent

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

the class SubProcessConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof StartEvent);
    assertEquals("start1", flowElement.getId());
    flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    UserTask userTask = (UserTask) flowElement;
    assertTrue(userTask.getCandidateUsers().size() == 1);
    assertTrue(userTask.getCandidateGroups().size() == 1);
    assertTrue(userTask.getFormProperties().size() == 2);
    flowElement = model.getMainProcess().getFlowElement("subprocess1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess1", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    assertTrue(subProcess.getLoopCharacteristics().isSequential());
    assertEquals("10", subProcess.getLoopCharacteristics().getLoopCardinality());
    assertEquals("${assignee == \"\"}", subProcess.getLoopCharacteristics().getCompletionCondition());
    assertTrue(subProcess.getFlowElements().size() == 5);
    assertEquals(1, subProcess.getExecutionListeners().size());
    ActivitiListener listenerSubProcess = subProcess.getExecutionListeners().get(0);
    assertEquals("SubProcessTestClass", listenerSubProcess.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerSubProcess.getImplementationType());
    assertEquals("start", listenerSubProcess.getEvent());
    flowElement = model.getMainProcess().getFlowElement("boundaryEvent1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof BoundaryEvent);
    assertEquals("boundaryEvent1", flowElement.getId());
    BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
    assertNotNull(boundaryEvent.getAttachedToRef());
    assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
    assertEquals(1, boundaryEvent.getEventDefinitions().size());
    assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
    assertEquals(1, model.getMainProcess().getExecutionListeners().size());
    ActivitiListener listenerMainProcess = model.getMainProcess().getExecutionListeners().get(0);
    assertEquals("TestClass", listenerMainProcess.getImplementation());
    assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerMainProcess.getImplementationType());
    assertEquals("start", listenerMainProcess.getEvent());
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) FlowElement(org.activiti.bpmn.model.FlowElement) StartEvent(org.activiti.bpmn.model.StartEvent) UserTask(org.activiti.bpmn.model.UserTask) ActivitiListener(org.activiti.bpmn.model.ActivitiListener) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 23 with BoundaryEvent

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

the class BpmnAutoLayout method handleSequenceFlow.

protected void handleSequenceFlow() {
    Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>();
    edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
    edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
    edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
    edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
    graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
    Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>();
    boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
    boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
    boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
    boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
    boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
    graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
    for (SequenceFlow sequenceFlow : sequenceFlows.values()) {
        Object sourceVertex = generatedVertices.get(sequenceFlow.getSourceRef());
        Object targetVertex = generatedVertices.get(sequenceFlow.getTargetRef());
        String style = null;
        if (handledFlowElements.get(sequenceFlow.getSourceRef()) instanceof BoundaryEvent) {
            // Sequence flow out of boundary events are handled in a different way,
            // to make them visually appealing for the eye of the dear end user.
            style = STYLE_BOUNDARY_SEQUENCEFLOW;
        } else {
            style = STYLE_SEQUENCEFLOW;
        }
        Object sequenceFlowEdge = graph.insertEdge(cellParent, sequenceFlow.getId(), "", sourceVertex, targetVertex, style);
        generatedSequenceFlowEdges.put(sequenceFlow.getId(), sequenceFlowEdge);
    }
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) Hashtable(java.util.Hashtable) SequenceFlow(org.activiti.bpmn.model.SequenceFlow) DataObject(org.activiti.bpmn.model.DataObject)

Example 24 with BoundaryEvent

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

the class BpmnAutoLayout method handleAssociations.

protected void handleAssociations() {
    Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>();
    edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
    edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
    edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
    edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
    graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
    Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>();
    boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
    boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
    boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
    boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
    boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
    graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
    for (Association association : associations.values()) {
        Object sourceVertex = generatedVertices.get(association.getSourceRef());
        Object targetVertex = generatedVertices.get(association.getTargetRef());
        String style = null;
        if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) {
            // Sequence flow out of boundary events are handled in a different way,
            // to make them visually appealing for the eye of the dear end user.
            style = STYLE_BOUNDARY_SEQUENCEFLOW;
        } else {
            style = STYLE_SEQUENCEFLOW;
        }
        Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style);
        generatedAssociationEdges.put(association.getId(), associationEdge);
    }
}
Also used : Association(org.activiti.bpmn.model.Association) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) Hashtable(java.util.Hashtable) DataObject(org.activiti.bpmn.model.DataObject)

Example 25 with BoundaryEvent

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

the class BoundaryEventXMLConverter method writeAdditionalChildElements.

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

Aggregations

BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)31 FlowElement (org.activiti.bpmn.model.FlowElement)11 SubProcess (org.activiti.bpmn.model.SubProcess)8 StartEvent (org.activiti.bpmn.model.StartEvent)7 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)7 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)6 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)6 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)6 UserTask (org.activiti.bpmn.model.UserTask)6 ErrorEventDefinition (org.activiti.bpmn.model.ErrorEventDefinition)5 CompensateEventDefinition (org.activiti.bpmn.model.CompensateEventDefinition)4 DataObject (org.activiti.bpmn.model.DataObject)4 EventDefinition (org.activiti.bpmn.model.EventDefinition)4 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)4 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)4 Activity (org.activiti.bpmn.model.Activity)3 Association (org.activiti.bpmn.model.Association)3 CancelEventDefinition (org.activiti.bpmn.model.CancelEventDefinition)3 Event (org.activiti.bpmn.model.Event)3 FlowNode (org.activiti.bpmn.model.FlowNode)3