org.activiti.engine.impl.event.logger.handler.ProcessInstanceEndedEventHandler Maven / Gradle / Ivy
The newest version!
package org.activiti.engine.impl.event.logger.handler;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.EventLogEntryEntity;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import java.util.HashMap;
import java.util.Map;
/**
*/
public class ProcessInstanceEndedEventHandler extends AbstractDatabaseEventLoggerEventHandler {
private static final String TYPE = "PROCESSINSTANCE_END";
@Override
public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
ExecutionEntity processInstanceEntity = getEntityFromEvent();
Map data = new HashMap();
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.END_TIME, timeStamp);
return createEventLogEntry(TYPE, processInstanceEntity.getProcessDefinitionId(), processInstanceEntity.getId(), null, null, data);
}
}