Search in sources :

Example 46 with TaskDAO

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();
}
Also used : TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO)

Example 47 with TaskDAO

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);
    }
}
Also used : TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)

Example 48 with TaskDAO

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);
    }
}
Also used : TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)

Example 49 with TaskDAO

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();
}
Also used : TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO)

Example 50 with TaskDAO

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();
}
Also used : TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO)

Aggregations

TaskDAO (org.wso2.carbon.humantask.core.dao.TaskDAO)27 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)16 HumanTaskEngine (org.wso2.carbon.humantask.core.engine.HumanTaskEngine)7 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)7 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)7 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)7 UserStoreException (org.wso2.carbon.user.core.UserStoreException)7 Element (org.w3c.dom.Element)6 HumanTaskDAOConnection (org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection)6 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)6 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)6 QName (javax.xml.namespace.QName)5 HumanTaskBaseConfiguration (org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)5 TaskConfiguration (org.wso2.carbon.humantask.core.store.TaskConfiguration)5 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)4 URI (org.apache.axis2.databinding.types.URI)3 NodeList (org.w3c.dom.NodeList)3 PeopleQueryEvaluator (org.wso2.carbon.humantask.core.engine.PeopleQueryEvaluator)3 ExpressionEvaluationContext (org.wso2.carbon.humantask.core.engine.runtime.ExpressionEvaluationContext)3 EvaluationContext (org.wso2.carbon.humantask.core.engine.runtime.api.EvaluationContext)3