use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class DeleteOutput method execute.
@Override
public void execute() {
authorise();
TaskDAO task = getTask();
checkPreConditions();
checkState();
task.deleteOutput();
processTaskEvent();
checkPostConditions();
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Exit method checkState.
/**
* Perform the state checks before executing the task operation.
*/
@Override
protected void checkState() {
TaskDAO task = getTask();
boolean isInFinalState = false;
if (TaskStatus.EXITED.equals(task.getStatus()) || TaskStatus.ERROR.equals(task.getStatus()) || TaskStatus.FAILED.equals(task.getStatus()) || TaskStatus.OBSOLETE.equals(task.getStatus()) || TaskStatus.COMPLETED.equals(task.getStatus())) {
isInFinalState = true;
}
if (isInFinalState) {
String errMsg = String.format("User[%s] cannot perform [%s] operation on task[%d] as the task is in state[%s]. " + "[%s] operation can be performed only on tasks not in states[%s,%s,%s,%s,%s]", getOperationInvoker().getName(), Exit.class, task.getId(), task.getStatus(), Exit.class, TaskStatus.EXITED, TaskStatus.ERROR, TaskStatus.FAILED, TaskStatus.OBSOLETE, TaskStatus.COMPLETED);
log.error(errMsg);
throw new HumanTaskIllegalStateException(errMsg);
}
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Exit method checkPostConditions.
/**
* Checks the post-conditions after executing the task operation.
*/
@Override
protected void checkPostConditions() {
TaskDAO task = getTask();
if (!TaskStatus.EXITED.equals(task.getStatus())) {
String errMsg = String.format("The task[id:%d] did not exit successfully as " + "it's state is still in [%s]", task.getId(), task.getStatus());
log.error(errMsg);
throw new HumanTaskIllegalStateException(errMsg);
}
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class Fail method execute.
/**
* The method to execute the business logic for the specific command.
*/
@Override
public void execute() {
authorise();
TaskDAO task = getTask();
checkPreConditions();
checkState();
task.fail(faultName, faultElement);
sendFaultProtocolMessage(task);
processTaskEvent();
checkPostConditions();
}
use of org.wso2.carbon.humantask.core.dao.TaskDAO in project carbon-business-process by wso2.
the class SetFault method execute.
/**
* The method to execute the business logic for the specific command.
*/
@Override
public void execute() {
authorise();
TaskDAO task = getTask();
checkPreConditions();
checkState();
task.persistFault(faultName, faultElement);
processTaskEvent();
checkPostConditions();
}
Aggregations