org.activiti.engine.impl.cmd.GetEventLogEntriesCmd Maven / Gradle / Ivy
package org.activiti.engine.impl.cmd;
import java.util.List;
import org.activiti.engine.event.EventLogEntry;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
/**
*/
public class GetEventLogEntriesCmd implements Command> {
protected String processInstanceId;
protected Long startLogNr;
protected Long pageSize;
public GetEventLogEntriesCmd() {
}
public GetEventLogEntriesCmd(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public GetEventLogEntriesCmd(Long startLogNr, Long pageSize) {
this.startLogNr = startLogNr;
this.pageSize = pageSize;
}
@Override
public List execute(CommandContext commandContext) {
if (processInstanceId != null) {
return commandContext.getEventLogEntryEntityManager().findEventLogEntriesByProcessInstanceId(processInstanceId);
} else if (startLogNr != null) {
return commandContext.getEventLogEntryEntityManager().findEventLogEntries(startLogNr, pageSize != null ? pageSize : -1);
} else {
return commandContext.getEventLogEntryEntityManager().findAllEventLogEntries();
}
}
}