use of org.wso2.carbon.humantask.client.api.IllegalAccessFault 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;
}
use of org.wso2.carbon.humantask.client.api.IllegalAccessFault 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);
}
}
use of org.wso2.carbon.humantask.client.api.IllegalAccessFault 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);
}
}
use of org.wso2.carbon.humantask.client.api.IllegalAccessFault 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);
}
}
use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.
the class TaskOperationsImpl method activate.
/**
* Activate the task, i.e. set the task to status Ready (Administrative Operations)
* @param taskIdURI : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void activate(URI taskIdURI) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
final Long taskID = validateTaskId(taskIdURI);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
Activate activateCommand = new Activate(getCaller(), taskID);
activateCommand.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
Aggregations