📄 invocationlogimpl.java
字号:
package org.jbpm.model.log.impl;
import java.util.*;
import org.jbpm.*;
import org.jbpm.model.execution.*;
import org.jbpm.model.execution.impl.*;
import org.jbpm.model.log.*;
import org.jbpm.service.*;
public class InvocationLogImpl implements InvocationLog, Comparable {
private Long id = null;
private String actorId = null;
private TokenImpl token = null;
private Date date = null;
private ServiceMethod serviceMethod = null;
private List executionLogs = null;
private Boolean isUndoable = null;
public InvocationLogImpl() {}
public InvocationLogImpl( ServiceMethod serviceMethod ) {
this.date = new Date();
this.serviceMethod = serviceMethod;
if ( ( serviceMethod != ServiceMethod.UNDO )
&& ( serviceMethod != ServiceMethod.START_PROCESS_INSTANCE ) ) {
this.isUndoable = Boolean.TRUE;
} else {
this.isUndoable = Boolean.FALSE;
}
}
public InvocationLogImpl( ServiceMethod serviceMethod, String actorId ) {
this( serviceMethod );
this.actorId = actorId;
}
public InvocationLogImpl( ServiceMethod serviceMethod, String actorId, TokenImpl token ) {
this( serviceMethod, actorId );
this.actorId = actorId;
this.token = token;
// this.assignedActorId = token.getActorId();
// this.stateBeforeInvocation = (StateImpl) token.getState();
}
public Long getId() { return this.id; }
public void setId(Long id) { this.id = id; }
public String getActorId() { return this.actorId; }
public void setActorId(String actorId) { this.actorId = actorId; }
public Token getToken() { return this.token; }
public void setToken(TokenImpl token) { this.token = token; }
public ProcessInstance getProcessInstance() {
ProcessInstance processInstance = null;
if ( token != null ) {
processInstance = token.getProcessInstance();
}
return processInstance;
}
public Date getDate() { return this.date; }
public void setDate(Date date) { this.date = date; }
public ServiceMethod getServiceMethod() { return this.serviceMethod; }
public void setServiceMethod(ServiceMethod serviceMethod) { this.serviceMethod = serviceMethod; }
public List getExecutionLogs() { return this.executionLogs; }
public void setExecutionLogs(List executionLogs) { this.executionLogs = executionLogs; }
public void addExecutionLog( ExecutionLogImpl log ) {
if ( executionLogs == null ) {
executionLogs = new ArrayList();
}
log.setInvocationLog( this );
log.setIndex( new Integer( executionLogs.size() ) );
executionLogs.add( log );
}
public Boolean getIsUndoable() { return this.isUndoable; }
public void setIsUndoable(Boolean isUndoable) { this.isUndoable = isUndoable; }
public int compareTo(Object o) {
return date.compareTo( ((InvocationLogImpl)o).date );
}
public void undo(ExecutionContextImpl executionContext) throws ExecutionException {
// prepare the execution context
executionContext.setToken( token );
// loop over all execution logs
List reversedExecutionLogs = new ArrayList( executionLogs );
Collections.reverse(reversedExecutionLogs);
Iterator iter = reversedExecutionLogs.iterator();
while (iter.hasNext()) {
ExecutionLogImpl executionLog = (ExecutionLogImpl) iter.next();
executionLog.undo( executionContext );
}
// a log can only be undone once...
isUndoable = Boolean.FALSE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -