org.jboss.seam.navigation.TaskControl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jboss-seam Show documentation
Show all versions of jboss-seam Show documentation
Seam core module for Seam framework integrated with JSF2
package org.jboss.seam.navigation;
import org.jboss.seam.bpm.BusinessProcess;
import org.jboss.seam.core.Expressions.ValueExpression;
public class TaskControl {
private boolean isBeginTask;
private boolean isStartTask;
private boolean isEndTask;
private ValueExpression taskId;
private ValueExpression transition;
public TaskControl() {
super();
}
public void beginOrEndTask() {
if (endTask()) {
BusinessProcess.instance().validateTask();
BusinessProcess.instance().endTask(transition == null ? null : transition.getValue());
}
if (beginTask() || startTask()) {
if (taskId == null || taskId.getValue() == null) {
throw new NullPointerException("task id may not be null");
}
BusinessProcess.instance().resumeTask(taskId.getValue());
}
if (startTask()) {
BusinessProcess.instance().startTask();
}
}
private boolean beginTask() {
return isBeginTask && taskId.getValue() != null;
}
private boolean startTask() {
return isStartTask && taskId.getValue() != null;
}
private boolean endTask() {
return isEndTask;
}
public boolean isBeginTask() {
return isBeginTask;
}
public void setBeginTask(boolean isBeginTask) {
this.isBeginTask = isBeginTask;
}
public boolean isEndTask() {
return isEndTask;
}
public void setEndTask(boolean isEndTask) {
this.isEndTask = isEndTask;
}
public boolean isStartTask() {
return isStartTask;
}
public void setStartTask(boolean isStartTask) {
this.isStartTask = isStartTask;
}
public void setTaskId(ValueExpression taskId) {
this.taskId = taskId;
}
public ValueExpression getTaskId() {
return taskId;
}
public ValueExpression getTransition() {
return transition;
}
public void setTransition(ValueExpression transition) {
this.transition = transition;
}
}