Package org.activiti.engine.delegate.event

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


  private static final String TYPE = "PROCESSINSTANCE_START";

  @Override
  public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
   
    ActivitiEntityWithVariablesEvent eventWithVariables = (ActivitiEntityWithVariablesEvent) event;
    ExecutionEntity processInstanceEntity = (ExecutionEntity) eventWithVariables.getEntity();
   
    Map<String, Object> data = new HashMap<String, Object>();
    putInMapIfNotNull(data, Fields.ID, processInstanceEntity.getId());
    putInMapIfNotNull(data, Fields.BUSINESS_KEY, processInstanceEntity.getBusinessKey());
    putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, processInstanceEntity.getProcessDefinitionId());
    putInMapIfNotNull(data, Fields.NAME, processInstanceEntity.getName());
    putInMapIfNotNull(data, Fields.CREATE_TIME, timeStamp);
   
    if (eventWithVariables.getVariables() != null && !eventWithVariables.getVariables().isEmpty()) {
      Map<String, Object> variableMap = new HashMap<String, Object>();
      for (Object variableName : eventWithVariables.getVariables().keySet()) {
        putInMapIfNotNull(variableMap, (String) variableName, eventWithVariables.getVariables().get(variableName));
      }
      putInMapIfNotNull(data, Fields.VARIABLES, variableMap);
    }
   
    return createEventLogEntry(TYPE, processInstanceEntity.getProcessDefinitionId(), processInstanceEntity.getId(), null, null, data);
View Full Code Here


public class TaskCompletedEventHandler extends AbstractTaskEventHandler {
 
  @Override
  public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {

    ActivitiEntityWithVariablesEvent eventWithVariables = (ActivitiEntityWithVariablesEvent) event;
    TaskEntity task = (TaskEntity) eventWithVariables.getEntity();
    Map<String, Object> data = handleCommonTaskFields(task);
   
    long duration = timeStamp.getTime() - task.getCreateTime().getTime();
    putInMapIfNotNull(data, Fields.DURATION, duration);
   
    if (eventWithVariables.getVariables() != null && !eventWithVariables.getVariables().isEmpty()) {
      Map<String, Object> variableMap = new HashMap<String, Object>();
      for (Object variableName : eventWithVariables.getVariables().keySet()) {
        putInMapIfNotNull(variableMap, (String) variableName, eventWithVariables.getVariables().get(variableName));
      }
      if (eventWithVariables.isLocalScope()) {
        putInMapIfNotNull(data, Fields.LOCAL_VARIABLES, variableMap);
      } else {
        putInMapIfNotNull(data, Fields.VARIABLES, variableMap);
      }
    }
View Full Code Here

TOP

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

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.