Package org.activiti.engine.delegate.event

Examples of org.activiti.engine.delegate.event.ActivitiMessageEvent


*/
public class ActivityMessageEventHandler extends AbstractDatabaseEventLoggerEventHandler {
 
  @Override
  public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
    ActivitiMessageEvent messageEvent = (ActivitiMessageEvent) event;
   
    Map<String, Object> data = new HashMap<String, Object>();
    putInMapIfNotNull(data, Fields.ACTIVITY_ID, messageEvent.getActivityId());
    putInMapIfNotNull(data, Fields.ACTIVITY_NAME, messageEvent.getActivityName());
    putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, messageEvent.getProcessDefinitionId());
    putInMapIfNotNull(data, Fields.PROCESS_INSTANCE_ID, messageEvent.getProcessInstanceId());
    putInMapIfNotNull(data, Fields.EXECUTION_ID, messageEvent.getExecutionId());
    putInMapIfNotNull(data, Fields.ACTIVITY_TYPE, messageEvent.getActivityType());
    putInMapIfNotNull(data, Fields.BEHAVIOR_CLASS, messageEvent.getBehaviorClass());
   
    putInMapIfNotNull(data, Fields.MESSAGE_NAME, messageEvent.getMessageName());
    putInMapIfNotNull(data, Fields.MESSAGE_DATA, messageEvent.getMessageData());
   
    return createEventLogEntry(messageEvent.getProcessDefinitionId(), messageEvent.getProcessInstanceId(),
        messageEvent.getExecutionId(), null, data);
  }
View Full Code Here


    runtimeService.messageEventReceived("messageName", executionWithMessage.getId());
    assertEquals(2, listener.getEventsReceived().size());

    // First, a message-event is expected
    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiMessageEvent);
    ActivitiMessageEvent messageEvent = (ActivitiMessageEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED, messageEvent.getType());
    assertEquals("shipOrder", messageEvent.getActivityId());
    assertEquals(executionWithMessage.getId(), messageEvent.getExecutionId());
    assertEquals(executionWithMessage.getProcessInstanceId(), messageEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), messageEvent.getProcessDefinitionId());
    assertEquals("messageName", messageEvent.getMessageName());
    assertNull(messageEvent.getMessageData());

    // Next, an signal-event is expected, as a result of the message
    assertTrue(listener.getEventsReceived().get(1) instanceof ActivitiSignalEvent);
    ActivitiSignalEvent signalEvent = (ActivitiSignalEvent) listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ACTIVITY_SIGNALED, signalEvent.getType());
View Full Code Here

    // not signaled, but executed instead
    assertEquals(1, listener.getEventsReceived().size());

    // A message-event is expected
    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiMessageEvent);
    ActivitiMessageEvent messageEvent = (ActivitiMessageEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED, messageEvent.getType());
    assertEquals("catchMessage", messageEvent.getActivityId());
    assertEquals(executionWithMessage.getId(), messageEvent.getExecutionId());
    assertEquals(executionWithMessage.getProcessInstanceId(), messageEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), messageEvent.getProcessDefinitionId());
    assertEquals("messageName", messageEvent.getMessageName());
    assertNull(messageEvent.getMessageData());
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.delegate.event.ActivitiMessageEvent

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.