Search in sources :

Example 21 with HumanTaskRuntimeException

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

Example 22 with HumanTaskRuntimeException

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

Aggregations

HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)20 ArrayList (java.util.ArrayList)7 PeopleQueryEvaluator (org.wso2.carbon.humantask.core.engine.PeopleQueryEvaluator)4 OrganizationalEntityDAO (org.wso2.carbon.humantask.core.dao.OrganizationalEntityDAO)3 UserStoreException (org.wso2.carbon.user.core.UserStoreException)3 Calendar (java.util.Calendar)2 List (java.util.List)2 URI (org.apache.axis2.databinding.types.URI)2 GenericHumanRoleDAO (org.wso2.carbon.humantask.core.dao.GenericHumanRoleDAO)2 TaskDAO (org.wso2.carbon.humantask.core.dao.TaskDAO)2 HumanTaskEngine (org.wso2.carbon.humantask.core.engine.HumanTaskEngine)2 TaskConfiguration (org.wso2.carbon.humantask.core.store.TaskConfiguration)2 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)2 Date (java.util.Date)1 AxisFault (org.apache.axis2.AxisFault)1 AxisService (org.apache.axis2.description.AxisService)1 TArgument (org.wso2.carbon.humantask.TArgument)1 HumanTaskServerConfiguration (org.wso2.carbon.humantask.core.configuration.HumanTaskServerConfiguration)1 HumanTaskDAOConnection (org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection)1 SimpleQueryCriteria (org.wso2.carbon.humantask.core.dao.SimpleQueryCriteria)1