Package org.activiti.engine.delegate.event

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


*/
public class ActivitySignaledEventHandler extends AbstractDatabaseEventLoggerEventHandler {
 
  @Override
  public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
    ActivitiSignalEvent signalEvent = (ActivitiSignalEvent) event;
   
    Map<String, Object> data = new HashMap<String, Object>();
    putInMapIfNotNull(data, Fields.ACTIVITY_ID, signalEvent.getActivityId());
    putInMapIfNotNull(data, Fields.ACTIVITY_NAME, signalEvent.getActivityName());
    putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, signalEvent.getProcessDefinitionId());
    putInMapIfNotNull(data, Fields.PROCESS_INSTANCE_ID, signalEvent.getProcessInstanceId());
    putInMapIfNotNull(data, Fields.EXECUTION_ID, signalEvent.getExecutionId());
    putInMapIfNotNull(data, Fields.ACTIVITY_TYPE, signalEvent.getActivityType());
    putInMapIfNotNull(data, Fields.BEHAVIOR_CLASS, signalEvent.getBehaviorClass());
   
    putInMapIfNotNull(data, Fields.SIGNAL_NAME, signalEvent.getSignalName());
    putInMapIfNotNull(data, Fields.SIGNAL_DATA, signalEvent.getSignalData());
   
    return createEventLogEntry(signalEvent.getProcessDefinitionId(), signalEvent.getProcessInstanceId(),
        signalEvent.getExecutionId(), null, data);
  }
View Full Code Here


    assertNotNull(executionWithSignal);

    runtimeService.signal(executionWithSignal.getId());
    assertEquals(1, listener.getEventsReceived().size());
    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiSignalEvent);
    ActivitiSignalEvent signalEvent = (ActivitiSignalEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_SIGNALED, signalEvent.getType());
    assertEquals("receivePayment", signalEvent.getActivityId());
    assertEquals(executionWithSignal.getId(), signalEvent.getExecutionId());
    assertEquals(executionWithSignal.getProcessInstanceId(), signalEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
    assertNull(signalEvent.getSignalName());
    assertNull(signalEvent.getSignalData());
    listener.clearEventsReceived();

    // Check signal using event, and pass in additional payload
    Execution executionWithSignalEvent = runtimeService.createExecutionQuery().activityId("shipOrder").singleResult();
    runtimeService.signalEventReceived("alert", executionWithSignalEvent.getId(),
        Collections.singletonMap("test", (Object) "test"));
    assertEquals(1, listener.getEventsReceived().size());
    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiSignalEvent);
    signalEvent = (ActivitiSignalEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_SIGNALED, signalEvent.getType());
    assertEquals("shipOrder", signalEvent.getActivityId());
    assertEquals(executionWithSignalEvent.getId(), signalEvent.getExecutionId());
    assertEquals(executionWithSignalEvent.getProcessInstanceId(), signalEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
    assertEquals("alert", signalEvent.getSignalName());
    assertNotNull(signalEvent.getSignalData());
    listener.clearEventsReceived();
   
    assertDatabaseEventPresent(ActivitiEventType.ACTIVITY_SIGNALED);
  }
View Full Code Here

    taskService.complete(task.getId());
    assertEquals(1L, listener.getEventsReceived().size());

    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiSignalEvent);
    ActivitiSignalEvent signalEvent = (ActivitiSignalEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_SIGNALED, signalEvent.getType());
    assertEquals("shipOrder", signalEvent.getActivityId());
    assertEquals(executionWithSignalEvent.getId(), signalEvent.getExecutionId());
    assertEquals(executionWithSignalEvent.getProcessInstanceId(), signalEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
    assertEquals("alert", signalEvent.getSignalName());
    assertNull(signalEvent.getSignalData());
  }
View Full Code Here

    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());
    assertEquals("shipOrder", signalEvent.getActivityId());
    assertEquals(executionWithMessage.getId(), signalEvent.getExecutionId());
    assertEquals(executionWithMessage.getProcessInstanceId(), signalEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
    assertEquals("messageName", signalEvent.getSignalName());
    assertNull(signalEvent.getSignalData());
   
    assertDatabaseEventPresent(ActivitiEventType.ACTIVITY_MESSAGE_RECEIVED);
  }
View Full Code Here

    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    // Also, a signal-event is received, representing the boundary-event being executed.
    assertTrue(listener.getEventsReceived().get(1) instanceof ActivitiSignalEvent);
    ActivitiSignalEvent signalEvent = (ActivitiSignalEvent) listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ACTIVITY_SIGNALED, signalEvent.getType());
    assertEquals("throwCompensation", signalEvent.getActivityId());
    assertEquals(processInstance.getId(), signalEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), signalEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), signalEvent.getProcessDefinitionId());
    assertEquals("compensationDone", signalEvent.getSignalName());
    assertNull(signalEvent.getSignalData());
   
    // Check if the process is still alive
    processInstance = runtimeService.createProcessInstanceQuery()
        .processInstanceId(processInstance.getId())
        .singleResult();
View Full Code Here

TOP

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

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.