Package org.activiti.engine.delegate.event

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


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


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

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

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

    assertNotNull(processInstance);

    assertEquals(3, listener.getEventsReceived().size());
   
    // Start-event activity started
    ActivitiActivityEvent activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("theStart", activityEvent.getActivityId());
    assertEquals(processInstance.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    // Start-event finished
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("theStart", activityEvent.getActivityId());
    assertEquals(processInstance.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    // Usertask started
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(2);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("shipOrder", activityEvent.getActivityId());
    assertEquals(processInstance.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    // Complete usertask
    listener.clearEventsReceived();
    Task task = taskService.createTaskQuery()
        .processInstanceId(processInstance.getId())
        .singleResult();
    assertNotNull(task);
    taskService.complete(task.getId());
   
    // Subprocess execution is created
    Execution execution = runtimeService.createExecutionQuery().parentId(processInstance.getId()).singleResult();
    assertNotNull(execution);
    assertEquals(5, listener.getEventsReceived().size());
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("shipOrder", activityEvent.getActivityId());
    assertEquals(processInstance.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("subProcess", activityEvent.getActivityId());
    assertEquals(execution.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(2);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("subProcessStart", activityEvent.getActivityId());
    assertEquals(execution.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(3);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("subProcessStart", activityEvent.getActivityId());
    assertEquals(execution.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(4);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("subTask", activityEvent.getActivityId());
    assertEquals(execution.getId(), activityEvent.getExecutionId());
    assertEquals(processInstance.getProcessInstanceId(), activityEvent.getProcessInstanceId());
    assertEquals(processInstance.getProcessDefinitionId(), activityEvent.getProcessDefinitionId());
    listener.clearEventsReceived();
   
    // Check gateway and intermediate throw event
    Task subTask = taskService.createTaskQuery().executionId(execution.getId()).singleResult();
    assertNotNull(subTask);
   
    taskService.complete(subTask.getId());
   
    assertEquals(10, listener.getEventsReceived().size());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("subTask", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(1);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("gateway", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(2);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("gateway", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(3);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("throwMessageEvent", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(4);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("throwMessageEvent", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(5);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("endSubProcess", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(6);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("endSubProcess", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(7);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("subProcess", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(8);
    assertEquals(ActivitiEventType.ACTIVITY_STARTED, activityEvent.getType());
    assertEquals("theEnd", activityEvent.getActivityId());
   
    activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(9);
    assertEquals(ActivitiEventType.ACTIVITY_COMPLETED, activityEvent.getType());
    assertEquals("theEnd", activityEvent.getActivityId());
  }
View Full Code Here

   
    assertEquals(2, listener.getEventsReceived().size());

    // A compensate-event is expected
    assertTrue(listener.getEventsReceived().get(0) instanceof ActivitiActivityEvent);
    ActivitiActivityEvent activityEvent = (ActivitiActivityEvent) listener.getEventsReceived().get(0);
    assertEquals(ActivitiEventType.ACTIVITY_COMPENSATE, activityEvent.getType());
    assertEquals("compensate", activityEvent.getActivityId());
    // A new execution is created for the compensation-event, this should be visible in the event
    assertFalse(processInstance.getId().equals(activityEvent.getExecutionId()));
    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());
View Full Code Here

TOP

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

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.