Java Code Examples for org.activiti.bpmn.model.BpmnModel#getMessages()

The following examples show how to use org.activiti.bpmn.model.BpmnModel#getMessages() . 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: BpmnJsonConverterUtil.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public static void convertMessagesToJson(BpmnModel bpmnModel, ObjectNode propertiesNode) {
  if (bpmnModel.getMessages() != null) {
    ArrayNode messageDefinitions = objectMapper.createArrayNode();
    for (Message message : bpmnModel.getMessages()) {
      ObjectNode messageNode = messageDefinitions.addObject();
      messageNode.put(PROPERTY_MESSAGE_DEFINITION_ID, message.getId());
      messageNode.put(PROPERTY_MESSAGE_DEFINITION_NAME, message.getName());
    }
    propertiesNode.set(PROPERTY_MESSAGE_DEFINITIONS, messageDefinitions);
  }
}
 
Example 2
Source File: WebServiceActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void createMessages(BpmnModel bpmnModel) {
  for (Message messageElement : bpmnModel.getMessages()) {
    if (messageDefinitionMap.containsKey(messageElement.getId()) == false) {
      MessageDefinition messageDefinition = new MessageDefinition(messageElement.getId());
      if (StringUtils.isNotEmpty(messageElement.getItemRef())) {
        if (itemDefinitionMap.containsKey(messageElement.getItemRef())) {
          ItemDefinition itemDefinition = itemDefinitionMap.get(messageElement.getItemRef());
          messageDefinition.setItemDefinition(itemDefinition);
        }
      }
      
      messageDefinitionMap.put(messageDefinition.getId(), messageDefinition);
    }
  }
}
 
Example 3
Source File: MessageValidator.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void validate(BpmnModel bpmnModel, List<ValidationError> errors) {
  if (bpmnModel.getMessages() != null && !bpmnModel.getMessages().isEmpty()) {
    for (Message message : bpmnModel.getMessages()) {

      // Item ref
      if (StringUtils.isNotEmpty(message.getItemRef())) {
        if (!bpmnModel.getItemDefinitions().containsKey(message.getItemRef())) {
          addError(errors, Problems.MESSAGE_INVALID_ITEM_REF, null, message, "Item reference is invalid: not found");
        }
      }

    }
  }
}