Search in sources :

Example 11 with SignalEventDefinition

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

the class BoundaryEventConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    BoundaryEvent errorElement = (BoundaryEvent) model.getMainProcess().getFlowElement("errorEvent");
    ErrorEventDefinition errorEvent = (ErrorEventDefinition) extractEventDefinition(errorElement);
    //always true
    assertTrue(errorElement.isCancelActivity());
    assertEquals("errorRef", errorEvent.getErrorCode());
    assertEquals("sid-F21E9F4D-EA19-44DF-B1D3-14663A809CAE", errorElement.getAttachedToRefId());
    BoundaryEvent signalElement = (BoundaryEvent) model.getMainProcess().getFlowElement("signalEvent");
    SignalEventDefinition signalEvent = (SignalEventDefinition) extractEventDefinition(signalElement);
    assertFalse(signalElement.isCancelActivity());
    assertEquals("signalRef", signalEvent.getSignalRef());
    assertEquals("sid-F21E9F4D-EA19-44DF-B1D3-14663A809CAE", errorElement.getAttachedToRefId());
    BoundaryEvent messageElement = (BoundaryEvent) model.getMainProcess().getFlowElement("messageEvent");
    MessageEventDefinition messageEvent = (MessageEventDefinition) extractEventDefinition(messageElement);
    assertFalse(messageElement.isCancelActivity());
    assertEquals("messageRef", messageEvent.getMessageRef());
    assertEquals("sid-F21E9F4D-EA19-44DF-B1D3-14663A809CAE", errorElement.getAttachedToRefId());
    BoundaryEvent timerElement = (BoundaryEvent) model.getMainProcess().getFlowElement("timerEvent");
    TimerEventDefinition timerEvent = (TimerEventDefinition) extractEventDefinition(timerElement);
    assertFalse(timerElement.isCancelActivity());
    assertEquals("PT5M", timerEvent.getTimeDuration());
    assertEquals("sid-F21E9F4D-EA19-44DF-B1D3-14663A809CAE", errorElement.getAttachedToRefId());
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ErrorEventDefinition(org.activiti.bpmn.model.ErrorEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 12 with SignalEventDefinition

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

the class CatchEventConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement timerElement = model.getMainProcess().getFlowElement("timer_evt");
    EventDefinition timerEvent = extractEventDefinition(timerElement);
    assertTrue(timerEvent instanceof TimerEventDefinition);
    TimerEventDefinition ted = (TimerEventDefinition) timerEvent;
    assertEquals("PT5M", ted.getTimeDuration());
    FlowElement signalElement = model.getMainProcess().getFlowElement("signal_evt");
    EventDefinition signalEvent = extractEventDefinition(signalElement);
    assertTrue(signalEvent instanceof SignalEventDefinition);
    SignalEventDefinition sed = (SignalEventDefinition) signalEvent;
    assertEquals("signal_ref", sed.getSignalRef());
    FlowElement messageElement = model.getMainProcess().getFlowElement("message_evt");
    EventDefinition messageEvent = extractEventDefinition(messageElement);
    assertTrue(messageEvent instanceof MessageEventDefinition);
    MessageEventDefinition med = (MessageEventDefinition) messageEvent;
    assertEquals("message_ref", med.getMessageRef());
}
Also used : FlowElement(org.activiti.bpmn.model.FlowElement) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 13 with SignalEventDefinition

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

the class CatchEventJsonConverter method getStencilId.

protected String getStencilId(BaseElement baseElement) {
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) baseElement;
    List<EventDefinition> eventDefinitions = catchEvent.getEventDefinitions();
    if (eventDefinitions.size() != 1) {
        // return timer event as default;
        return STENCIL_EVENT_CATCH_TIMER;
    }
    EventDefinition eventDefinition = eventDefinitions.get(0);
    if (eventDefinition instanceof MessageEventDefinition) {
        return STENCIL_EVENT_CATCH_MESSAGE;
    } else if (eventDefinition instanceof SignalEventDefinition) {
        return STENCIL_EVENT_CATCH_SIGNAL;
    } else {
        return STENCIL_EVENT_CATCH_TIMER;
    }
}
Also used : IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition)

Example 14 with SignalEventDefinition

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

the class BoundaryEventParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, BoundaryEvent boundaryEvent) {
    ActivityImpl parentActivity = findActivity(bpmnParse, boundaryEvent.getAttachedToRefId());
    if (parentActivity == null) {
        logger.warn("Invalid reference in boundary event. Make sure that the referenced activity is defined in the same scope as the boundary event " + boundaryEvent.getId());
        return;
    }
    ActivityImpl nestedActivity = createActivityOnScope(bpmnParse, boundaryEvent, BpmnXMLConstants.ELEMENT_EVENT_BOUNDARY, parentActivity);
    bpmnParse.setCurrentActivity(nestedActivity);
    EventDefinition eventDefinition = null;
    if (!boundaryEvent.getEventDefinitions().isEmpty()) {
        eventDefinition = boundaryEvent.getEventDefinitions().get(0);
    }
    if (eventDefinition instanceof TimerEventDefinition || eventDefinition instanceof org.activiti.bpmn.model.ErrorEventDefinition || eventDefinition instanceof SignalEventDefinition || eventDefinition instanceof CancelEventDefinition || eventDefinition instanceof MessageEventDefinition || eventDefinition instanceof org.activiti.bpmn.model.CompensateEventDefinition) {
        bpmnParse.getBpmnParserHandlers().parseElement(bpmnParse, eventDefinition);
    } else {
        logger.warn("Unsupported boundary event type for boundary event " + boundaryEvent.getId());
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition) CancelEventDefinition(org.activiti.bpmn.model.CancelEventDefinition) EventDefinition(org.activiti.bpmn.model.EventDefinition) MessageEventDefinition(org.activiti.bpmn.model.MessageEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition) TimerEventDefinition(org.activiti.bpmn.model.TimerEventDefinition)

Example 15 with SignalEventDefinition

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

the class CompleteConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof UserTask);
    assertEquals("userTask1", flowElement.getId());
    flowElement = model.getMainProcess().getFlowElement("catchsignal");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof IntermediateCatchEvent);
    assertEquals("catchsignal", flowElement.getId());
    IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
    assertEquals(1, catchEvent.getEventDefinitions().size());
    assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
    SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
    assertEquals("testSignal", signalEvent.getSignalRef());
    flowElement = model.getMainProcess().getFlowElement("subprocess");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof SubProcess);
    assertEquals("subprocess", flowElement.getId());
    SubProcess subProcess = (SubProcess) flowElement;
    flowElement = subProcess.getFlowElement("receiveTask");
    assertNotNull(flowElement);
    assertTrue(flowElement instanceof ReceiveTask);
    assertEquals("receiveTask", flowElement.getId());
}
Also used : SubProcess(org.activiti.bpmn.model.SubProcess) ReceiveTask(org.activiti.bpmn.model.ReceiveTask) FlowElement(org.activiti.bpmn.model.FlowElement) IntermediateCatchEvent(org.activiti.bpmn.model.IntermediateCatchEvent) UserTask(org.activiti.bpmn.model.UserTask) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition)

Aggregations

SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)21 EventDefinition (org.activiti.bpmn.model.EventDefinition)13 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)11 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)7 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)6 FlowElement (org.activiti.bpmn.model.FlowElement)6 ErrorEventDefinition (org.activiti.bpmn.model.ErrorEventDefinition)4 CancelEventDefinition (org.activiti.bpmn.model.CancelEventDefinition)3 Event (org.activiti.bpmn.model.Event)3 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)3 SubProcess (org.activiti.bpmn.model.SubProcess)3 ThrowEvent (org.activiti.bpmn.model.ThrowEvent)3 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)3 CompensateEventDefinition (org.activiti.bpmn.model.CompensateEventDefinition)2 Message (org.activiti.bpmn.model.Message)2 ReceiveTask (org.activiti.bpmn.model.ReceiveTask)2 Signal (org.activiti.bpmn.model.Signal)2 UserTask (org.activiti.bpmn.model.UserTask)2 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1