Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.MessageEventDefinition


    SignalEventDefinition signalEvent = (SignalEventDefinition)extractEventDefinition(signalElement);
    assertFalse(signalElement.isCancelActivity());
    assertEquals("signalRef", signalEvent.getSignalRef());
   
    BoundaryEvent messageElement = (BoundaryEvent)model.getMainProcess().getFlowElement("messageEvent");
    MessageEventDefinition messageEvent = (MessageEventDefinition)extractEventDefinition(messageElement);
    assertFalse(messageElement.isCancelActivity());
    assertEquals("messageRef", messageEvent.getMessageRef());
   
    BoundaryEvent timerElement = (BoundaryEvent)model.getMainProcess().getFlowElement("timerEvent");
    TimerEventDefinition timerEvent = (TimerEventDefinition)extractEventDefinition(timerElement);
    assertFalse(timerElement.isCancelActivity());
    assertEquals("PT5M", timerEvent.getTimeDuration());
View Full Code Here


    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());
   
  }
View Full Code Here

        if (StringUtils.isNotEmpty(errorDefinition.getErrorCode())) {
          propertiesNode.put(PROPERTY_ERRORREF, errorDefinition.getErrorCode());
        }
       
      } else if (eventDefinition instanceof MessageEventDefinition) {
        MessageEventDefinition messageDefinition = (MessageEventDefinition) eventDefinition;
        if (StringUtils.isNotEmpty(messageDefinition.getMessageRef())) {
          String messageRef = messageDefinition.getMessageRef();
          // remove the namespace from the message id if set
          if (messageRef.startsWith(model.getTargetNamespace())) {
            messageRef = messageRef.replace(model.getTargetNamespace(), "");
            messageRef = messageRef.replaceFirst(":", "");
          } else {
View Full Code Here

 
  protected void convertJsonToMessageDefinition(JsonNode objectNode, Event event) {
    String messageRef = getPropertyValueAsString(PROPERTY_MESSAGEREF, objectNode);
   
    if (StringUtils.isNotEmpty(messageRef)) {
      MessageEventDefinition eventDefinition = new MessageEventDefinition();
      eventDefinition.setMessageRef(messageRef);
      event.getEventDefinitions().add(eventDefinition);
    }
  }
View Full Code Here

  }
 
  public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
    if (parentElement instanceof Event == false) return;
   
    MessageEventDefinition eventDefinition = new MessageEventDefinition();
    BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);
    eventDefinition.setMessageRef(xtr.getAttributeValue(null, ATTRIBUTE_MESSAGE_REF));
   
    if(!StringUtils.isEmpty(eventDefinition.getMessageRef())) {
     
      int indexOfP = eventDefinition.getMessageRef().indexOf(':');
      if (indexOfP != -1) {
        String prefix = eventDefinition.getMessageRef().substring(0, indexOfP);
        String resolvedNamespace = model.getNamespace(prefix);
        eventDefinition.setMessageRef(resolvedNamespace + ":" + eventDefinition.getMessageRef().substring(indexOfP + 1));
      } else {
        eventDefinition.setMessageRef(model.getTargetNamespace() + ":" + eventDefinition.getMessageRef());
      }
    
    }
   
    BpmnXMLUtil.parseChildElements(ELEMENT_EVENT_MESSAGEDEFINITION, eventDefinition, xtr, model);
View Full Code Here

              Signal signal = new Signal(signalEvent.getSignalRef(), signalEvent.getSignalRef());
              model.addSignal(signal);
            }

          } else if (eventDefinition instanceof MessageEventDefinition) {
            MessageEventDefinition messageEvent = (MessageEventDefinition) eventDefinition;
            if (model.containsMessageId(messageEvent.getMessageRef()) == false) {
              Message message = new Message(messageEvent.getMessageRef(), messageEvent.getMessageRef(), null);
              model.addMessage(message);
            }
          }
        }
      }
View Full Code Here

public class MessageEventDefinitionWithExtensionElementsTest {

  @Test
  public void testParseMessagedDefinitionWithExtension() {
    BpmnParse bpmnParseMock = Mockito.mock(BpmnParse.class);
    MessageEventDefinition messageEventDefinitionMock = Mockito.mock(MessageEventDefinition.class);
    BpmnModel bpmnModelMock = Mockito.mock(BpmnModel.class);
    Message messageMock = Mockito.mock(Message.class);
    @SuppressWarnings("unchecked")
    Map<String,List<ExtensionElement>> extensionElementMap = Mockito.mock(Map.class);
   
    Mockito.when(bpmnParseMock.getBpmnModel()).thenReturn(bpmnModelMock);
    Mockito.when(messageEventDefinitionMock.getMessageRef()).thenReturn("messageId");
    Mockito.when(bpmnModelMock.containsMessageId("messageId")).thenReturn(true);
    Mockito.when(bpmnModelMock.getMessage("messageId")).thenReturn(messageMock);
    Mockito.when(messageMock.getName()).thenReturn("MessageWithExtensionElements");
    Mockito.when(messageMock.getExtensionElements()).thenReturn(extensionElementMap);
   
View Full Code Here

    }
  }

  protected void handleMessageEventDefinition(BpmnModel bpmnModel, Process process, Event event,
      EventDefinition eventDefinition, List<ValidationError> errors) {
    MessageEventDefinition messageEventDefinition = (MessageEventDefinition) eventDefinition;

    if (StringUtils.isEmpty(messageEventDefinition.getMessageRef())) {
      // 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");
    }
  }
View Full Code Here

              if (otherBoundaryEvent.getAttachedToRefId() != null && otherBoundaryEvent.getAttachedToRefId().equals(boundaryEvent.getAttachedToRefId())) {
                if (otherBoundaryEvent.getEventDefinitions() != null && !otherBoundaryEvent
                                        .getEventDefinitions().isEmpty()) {
                  EventDefinition otherEventDefinition = otherBoundaryEvent.getEventDefinitions().get(0);
                  if (otherEventDefinition instanceof MessageEventDefinition) {
                    MessageEventDefinition currentMessageEventDefinition = (MessageEventDefinition) eventDefinition;
                    MessageEventDefinition otherMessageEventDefinition = (MessageEventDefinition) otherEventDefinition;
                    if (otherMessageEventDefinition.getMessageRef() != null
                        && otherMessageEventDefinition.getMessageRef().equals(currentMessageEventDefinition.getMessageRef())) {
                      addError(errors, Problems.MESSAGE_EVENT_MULTIPLE_ON_BOUNDARY_SAME_MESSAGE_ID, process, boundaryEvent, "Multiple message events with same message id not supported");
                    }
                  }
                }
              }
View Full Code Here

    super(fp, "MessageCatchingEvent", "Add message intermediate catching event");
  }

  public Object[] create(ICreateContext context) {
    IntermediateCatchEvent catchEvent = new IntermediateCatchEvent();
    MessageEventDefinition eventDef = new MessageEventDefinition();
    catchEvent.getEventDefinitions().add(eventDef);
    addObjectToContainer(context, catchEvent, "MessageCatchEvent");

    // return newly created business object(s)
    return new Object[] { catchEvent };
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.MessageEventDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.