Search in sources :

Example 21 with IllegalArgumentFault

use of org.wso2.carbon.humantask.client.api.IllegalArgumentFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method fail.

/**
 * Execution of the task fails
 * @param taskIdURI : task identifier
 * @param tFault
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void fail(final URI taskIdURI, final TFault tFault) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskID = validateTaskId(taskIdURI);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                String faultName = null;
                Element faultData = null;
                if (tFault != null) {
                    faultName = tFault.getFaultName().toString();
                    faultData = DOMUtils.getElementFromObject(tFault.getFaultData());
                }
                Fail failCommand = new Fail(getCaller(), taskID, faultName, faultData);
                failCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Element(org.w3c.dom.Element) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException) Fail(org.wso2.carbon.humantask.core.engine.commands.Fail)

Example 22 with IllegalArgumentFault

use of org.wso2.carbon.humantask.client.api.IllegalArgumentFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method loadTask.

/**
 * Return Task Abstract details for give Task ID. (Custom API) Similar to getMyTaskAbstracts method in HumanTask API
 * @param taskIdURI : task identifier
 * @return Task Abstract
 * @throws IllegalAccessFault
 */
public TTaskAbstract loadTask(URI taskIdURI) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskId = validateTaskId(taskIdURI);
        TaskDAO task = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<TaskDAO>() {

            public TaskDAO call() throws Exception {
                HumanTaskEngine engine = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine();
                HumanTaskDAOConnection daoConn = engine.getDaoConnectionFactory().getConnection();
                TaskDAO task = daoConn.getTask(taskId);
                validateTaskTenant(task);
                authoriseToLoadTask(task);
                return task;
            }
        });
        return TransformerUtils.transformTask(task, getCaller());
    } catch (Exception ex) {
        log.error("Error occurred while loading task: " + taskIdURI, ex);
        handleException(ex);
    }
    return null;
}
Also used : HumanTaskEngine(org.wso2.carbon.humantask.core.engine.HumanTaskEngine) TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO) HumanTaskDAOConnection(org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Example 23 with IllegalArgumentFault

use of org.wso2.carbon.humantask.client.api.IllegalArgumentFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method suspend.

/**
 * Suspend the task.
 *
 * @param taskId : task identifier
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void suspend(final URI taskId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        validateTaskId(taskId);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                HumanTaskCommand suspendCommand = new Suspend(getCaller(), new Long(taskId.toString()));
                suspendCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : HumanTaskCommand(org.wso2.carbon.humantask.core.engine.HumanTaskCommand) Suspend(org.wso2.carbon.humantask.core.engine.commands.Suspend) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Example 24 with IllegalArgumentFault

use of org.wso2.carbon.humantask.client.api.IllegalArgumentFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method delegate.

/**
 * Assign the task to one user and set the task to state Reserved.
 * @param taskId : task identifier
 * @param delegatee : organizational entity (htt:tOrganizationalEntity)
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws RecipientNotAllowedException
 * @throws IllegalAccessFault
 */
public void delegate(final URI taskId, final TOrganizationalEntity delegatee) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, RecipientNotAllowedException, IllegalAccessFault {
    try {
        validateTaskId(taskId);
        if (delegatee == null) {
            throw new IllegalArgumentFault("The delegatee cannot be null!");
        }
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                List<OrganizationalEntityDAO> orgEntities = TransformerUtils.transformOrganizationalEntityList(delegatee);
                if (orgEntities.size() > 1) {
                    throw new IllegalArgumentFault("There can be only 1 delegatee of type user!");
                }
                Delegate delegateCommand = new Delegate(getCaller(), new Long(taskId.toString()), orgEntities.get(0));
                delegateCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Delegate(org.wso2.carbon.humantask.core.engine.commands.Delegate) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Example 25 with IllegalArgumentFault

use of org.wso2.carbon.humantask.client.api.IllegalArgumentFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method resume.

/**
 * Resume a suspended task.
 *
 * @param taskId : task identifier
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void resume(final URI taskId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        validateTaskId(taskId);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                HumanTaskCommand resumeCommand = new Resume(getCaller(), new Long(taskId.toString()));
                resumeCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : HumanTaskCommand(org.wso2.carbon.humantask.core.engine.HumanTaskCommand) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException) Resume(org.wso2.carbon.humantask.core.engine.commands.Resume)

Aggregations

HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)25 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)24 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)24 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)24 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)24 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)24 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)24 UserStoreException (org.wso2.carbon.user.core.UserStoreException)24 Element (org.w3c.dom.Element)9 TaskDAO (org.wso2.carbon.humantask.core.dao.TaskDAO)5 HumanTaskCommand (org.wso2.carbon.humantask.core.engine.HumanTaskCommand)5 QName (javax.xml.namespace.QName)4 HumanTaskDAOConnection (org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection)4 HumanTaskEngine (org.wso2.carbon.humantask.core.engine.HumanTaskEngine)4 HumanTaskBaseConfiguration (org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)3 URI (org.apache.axis2.databinding.types.URI)2 NodeList (org.w3c.dom.NodeList)2 IllegalArgumentFault (org.wso2.carbon.humantask.client.api.IllegalArgumentFault)2 Complete (org.wso2.carbon.humantask.core.engine.commands.Complete)2 IOException (java.io.IOException)1