use of org.activiti.bpmn.model.MessageEventDefinition in project Activiti by Activiti.
the class BaseBpmnJsonConverter method addEventProperties.
protected void addEventProperties(Event event, ObjectNode propertiesNode) {
List<EventDefinition> eventDefinitions = event.getEventDefinitions();
if (eventDefinitions.size() == 1) {
EventDefinition eventDefinition = eventDefinitions.get(0);
if (eventDefinition instanceof ErrorEventDefinition) {
ErrorEventDefinition errorDefinition = (ErrorEventDefinition) eventDefinition;
if (StringUtils.isNotEmpty(errorDefinition.getErrorCode())) {
propertiesNode.put(PROPERTY_ERRORREF, errorDefinition.getErrorCode());
}
} else if (eventDefinition instanceof SignalEventDefinition) {
SignalEventDefinition signalDefinition = (SignalEventDefinition) eventDefinition;
if (StringUtils.isNotEmpty(signalDefinition.getSignalRef())) {
propertiesNode.put(PROPERTY_SIGNALREF, signalDefinition.getSignalRef());
}
} else if (eventDefinition instanceof MessageEventDefinition) {
MessageEventDefinition messageDefinition = (MessageEventDefinition) eventDefinition;
if (StringUtils.isNotEmpty(messageDefinition.getMessageRef())) {
propertiesNode.put(PROPERTY_MESSAGEREF, messageDefinition.getMessageRef());
}
} else if (eventDefinition instanceof TimerEventDefinition) {
TimerEventDefinition timerDefinition = (TimerEventDefinition) eventDefinition;
if (StringUtils.isNotEmpty(timerDefinition.getTimeDuration())) {
propertiesNode.put(PROPERTY_TIMER_DURATON, timerDefinition.getTimeDuration());
}
if (StringUtils.isNotEmpty(timerDefinition.getTimeCycle())) {
propertiesNode.put(PROPERTY_TIMER_CYCLE, timerDefinition.getTimeCycle());
}
if (StringUtils.isNotEmpty(timerDefinition.getTimeDate())) {
propertiesNode.put(PROPERTY_TIMER_DATE, timerDefinition.getTimeDate());
}
if (StringUtils.isNotEmpty(timerDefinition.getEndDate())) {
propertiesNode.put(PROPERTY_TIMER_CYCLE_END_DATE, timerDefinition.getEndDate());
}
} else if (eventDefinition instanceof TerminateEventDefinition) {
TerminateEventDefinition terminateEventDefinition = (TerminateEventDefinition) eventDefinition;
propertiesNode.put(PROPERTY_TERMINATE_ALL, terminateEventDefinition.isTerminateAll());
}
}
}
use of org.activiti.bpmn.model.MessageEventDefinition in project Activiti by Activiti.
the class BoundaryEventJsonConverter method getStencilId.
protected String getStencilId(BaseElement baseElement) {
BoundaryEvent boundaryEvent = (BoundaryEvent) baseElement;
List<EventDefinition> eventDefinitions = boundaryEvent.getEventDefinitions();
if (eventDefinitions.size() != 1) {
// return timer event as default;
return STENCIL_EVENT_BOUNDARY_TIMER;
}
EventDefinition eventDefinition = eventDefinitions.get(0);
if (eventDefinition instanceof ErrorEventDefinition) {
return STENCIL_EVENT_BOUNDARY_ERROR;
} else if (eventDefinition instanceof SignalEventDefinition) {
return STENCIL_EVENT_BOUNDARY_SIGNAL;
} else if (eventDefinition instanceof MessageEventDefinition) {
return STENCIL_EVENT_BOUNDARY_MESSAGE;
} else if (eventDefinition instanceof CancelEventDefinition) {
return STENCIL_EVENT_BOUNDARY_CANCEL;
} else if (eventDefinition instanceof CompensateEventDefinition) {
return STENCIL_EVENT_BOUNDARY_COMPENSATION;
} else {
return STENCIL_EVENT_BOUNDARY_TIMER;
}
}
use of org.activiti.bpmn.model.MessageEventDefinition 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.MessageEventDefinition 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.MessageEventDefinition 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;
}
}
Aggregations