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);
}
}
Aggregations