Java Code Examples for org.flowable.bpmn.model.BpmnModel#getSignals()
The following examples show how to use
org.flowable.bpmn.model.BpmnModel#getSignals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SignalValidator.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public void validate(BpmnModel bpmnModel, List<ValidationError> errors) { Collection<Signal> signals = bpmnModel.getSignals(); if (signals != null && !signals.isEmpty()) { for (Signal signal : signals) { if (StringUtils.isEmpty(signal.getId())) { addError(errors, Problems.SIGNAL_MISSING_ID, signal, "Signal must have an id"); } if (StringUtils.isEmpty(signal.getName())) { addError(errors, Problems.SIGNAL_MISSING_NAME, signal, "Signal must have a name"); } if (!StringUtils.isEmpty(signal.getName()) && duplicateName(signals, signal.getId(), signal.getName())) { addError(errors, Problems.SIGNAL_DUPLICATE_NAME, signal, "Duplicate signal name found"); } if (signal.getScope() != null && !signal.getScope().equals(Signal.SCOPE_GLOBAL) && !signal.getScope().equals(Signal.SCOPE_PROCESS_INSTANCE)) { addError(errors, Problems.SIGNAL_INVALID_SCOPE, signal, "Invalid value for 'scope'. Only values 'global' and 'processInstance' are supported"); } } } }
Example 2
Source File: SignalExpressionConverterTest.java From flowable-engine with Apache License 2.0 | 6 votes |
private void validateModel(BpmnModel model) { Collection<Signal> signals = model.getSignals(); assertThat(signals).hasSize(1); Signal signal = signals.iterator().next(); assertThat(signal.getId()).isEqualTo("signal1"); List<StartEvent> startEvents = model.getMainProcess().findFlowElementsOfType(StartEvent.class); assertThat(startEvents).hasSize(1); StartEvent startEvent = startEvents.get(0); assertThat(startEvent.getEventDefinitions()).hasSize(1); assertThat(startEvent.getEventDefinitions().get(0)) .isInstanceOfSatisfying(SignalEventDefinition.class, signalEventDefinition -> { assertThat(signalEventDefinition.getSignalExpression()).isEqualTo("${someExpressionThatReturnsSignalId}"); }); }
Example 3
Source File: BpmnJsonConverterUtil.java From flowable-engine with Apache License 2.0 | 5 votes |
public static void convertSignalDefinitionsToJson(BpmnModel bpmnModel, ObjectNode propertiesNode) { if (bpmnModel.getSignals() != null) { ArrayNode signalDefinitions = objectMapper.createArrayNode(); for (Signal signal : bpmnModel.getSignals()) { ObjectNode signalNode = signalDefinitions.addObject(); signalNode.put(PROPERTY_SIGNAL_DEFINITION_ID, signal.getId()); signalNode.put(PROPERTY_SIGNAL_DEFINITION_NAME, signal.getName()); signalNode.put(PROPERTY_SIGNAL_DEFINITION_SCOPE, signal.getScope()); } propertiesNode.set(PROPERTY_SIGNAL_DEFINITIONS, signalDefinitions); } }
Example 4
Source File: SignalConverterTest.java From flowable-engine with Apache License 2.0 | 4 votes |
private void validateModel(BpmnModel model) { Collection<Signal> signals = model.getSignals(); assertThat(signals).hasSize(2); }