/**
*
*/
package net.conselldemallorca.helium.jbpm3.command;
import org.jbpm.JbpmContext;
import org.jbpm.command.AbstractBaseCommand;
import org.jbpm.taskmgmt.exe.TaskInstance;
/**
* Command per suspendre una tasca jBPM
*
* @author Limit Tecnologies <limit@limit.es>
*/
public class SuspendTaskInstanceCommand extends AbstractBaseCommand {
private static final long serialVersionUID = -1908847549444051495L;
private long id;
public SuspendTaskInstanceCommand(
long id) {
super();
this.id = id;
}
public Object execute(JbpmContext jbpmContext) throws Exception {
TaskInstance taskInstance = jbpmContext.getTaskInstance(id);
taskInstance.suspend();
return taskInstance;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Override
public String getAdditionalToStringInformation() {
return "id=" + id;
}
//methods for fluent programming
public SuspendTaskInstanceCommand id(long id) {
setId(id);
return this;
}
}