use of org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException in project carbon-business-process by wso2.
the class Activate method checkPreConditions.
/**
* Checks the Pre-conditions before executing the task operation.
*/
@Override
protected void checkPreConditions() {
checkForValidTask();
TaskDAO task = getTask();
if (task.getActivationTime() == null) {
throw new HumanTaskRuntimeException(String.format("The task[id:%d] does not have a defined activation time.", task.getId()));
}
if (task.getActivationTime().before(new Date())) {
throw new HumanTaskRuntimeException(String.format("The task[id:%d] activation time has already expired.", task.getId()));
}
if (CommonTaskUtil.getOrgEntitiesForRole(task, GenericHumanRoleDAO.GenericHumanRoleType.POTENTIAL_OWNERS).size() < 1) {
throw new HumanTaskIllegalStateException(String.format("The are no matching users for the " + "task's[id:%d] potential owners", task.getId()));
}
}
use of org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException in project carbon-business-process by wso2.
the class Skip method checkPreConditions.
/**
* Checks the Pre-conditions before executing the task operation.
*/
@Override
protected void checkPreConditions() {
TaskDAO task = getTask();
checkForValidTask();
if (!task.isSkipable()) {
throw new HumanTaskRuntimeException(String.format("The task[id:%d] is not a skippable task.", task.getId()));
}
}
Aggregations