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());
}
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());
}
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;
}
}
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());
}
}
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());
}
Aggregations