protected void handleMessageEventDefinition(BpmnModel bpmnModel, Process process, Event event, EventDefinition eventDefinition, List<ValidationError> errors) { MessageEventDefinition messageEventDefinition = (MessageEventDefinition) eventDefinition; if (StringUtils.isEmpty(messageEventDefinition.getMessageRef())) { if (StringUtils.isEmpty(messageEventDefinition.getMessageExpression())) { // message ref should be filled in addError(errors, Problems.MESSAGE_EVENT_MISSING_MESSAGE_REF, process, event, "attribute 'messageRef' is required"); } } else if (!bpmnModel.containsMessageId(messageEventDefinition.getMessageRef())) { // message ref should exist addError(errors, Problems.MESSAGE_EVENT_INVALID_MESSAGE_REF, process, event, "Invalid 'messageRef': no message with that id can be found in the model"); } }
public void setValues(MessageEventDefinition otherDefinition) { super.setValues(otherDefinition); setMessageRef(otherDefinition.getMessageRef()); setMessageExpression(otherDefinition.getMessageExpression()); } }
public void setValues(MessageEventDefinition otherDefinition) { super.setValues(otherDefinition); setMessageRef(otherDefinition.getMessageRef()); setMessageExpression(otherDefinition.getMessageExpression()); } }
@Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String messageName = null; if (StringUtils.isNotEmpty(messageEventDefinition.getMessageRef())) { messageName = messageEventDefinition.getMessageRef(); } else { Expression messageExpression = CommandContextUtil.getProcessEngineConfiguration(commandContext).getExpressionManager() .createExpression(messageEventDefinition.getMessageExpression()); messageName = messageExpression.getValue(execution).toString(); } CommandContextUtil.getEventSubscriptionEntityManager(commandContext).insertMessageEvent(messageName, executionEntity); if (CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventDispatcher().isEnabled()) { CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventDispatcher() .dispatchEvent(FlowableEventBuilder.createMessageEvent(FlowableEngineEventType.ACTIVITY_MESSAGE_WAITING, executionEntity.getActivityId(), messageName, null, executionEntity.getId(), executionEntity.getProcessInstanceId(), executionEntity.getProcessDefinitionId())); } }
@Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String messageName = null; if (StringUtils.isNotEmpty(messageEventDefinition.getMessageRef())) { messageName = messageEventDefinition.getMessageRef(); } else { Expression messageExpression = CommandContextUtil.getProcessEngineConfiguration(commandContext).getExpressionManager() .createExpression(messageEventDefinition.getMessageExpression()); messageName = messageExpression.getValue(execution).toString(); } CommandContextUtil.getEventSubscriptionEntityManager(commandContext).insertMessageEvent(messageName, executionEntity); if (CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventDispatcher().isEnabled()) { CommandContextUtil.getProcessEngineConfiguration(commandContext).getEventDispatcher() .dispatchEvent(FlowableEventBuilder.createMessageEvent(FlowableEngineEventType.ACTIVITY_MESSAGE_WAITING, executionEntity.getActivityId(), messageName, null, executionEntity.getId(), executionEntity.getProcessInstanceId(), executionEntity.getProcessDefinitionId())); } }