Search in sources :

Example 1 with RecipientNotAllowedException

use of org.wso2.carbon.humantask.client.api.RecipientNotAllowedException 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) ArrayList(java.util.ArrayList) List(java.util.List) IllegalArgumentFault(org.wso2.carbon.humantask.client.api.IllegalArgumentFault) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) RecipientNotAllowedException(org.wso2.carbon.humantask.client.api.RecipientNotAllowedException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 IllegalArgumentFault (org.wso2.carbon.humantask.client.api.IllegalArgumentFault)1 RecipientNotAllowedException (org.wso2.carbon.humantask.client.api.RecipientNotAllowedException)1 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)1 Delegate (org.wso2.carbon.humantask.core.engine.commands.Delegate)1 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)1 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)1 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)1 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)1 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)1 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)1 UserStoreException (org.wso2.carbon.user.core.UserStoreException)1