use of org.wso2.carbon.humantask.client.api.IllegalStateFault 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.IllegalStateFault 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.IllegalStateFault 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.IllegalStateFault 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);
}
}
use of org.wso2.carbon.humantask.client.api.IllegalStateFault in project carbon-business-process by wso2.
the class TaskOperationsImpl method addComment.
/**
* Add a comment to a task.
* @param taskIdURI : task identifier
* @param commentString : comment in plain text
* @return an identifier that can be used to later update or delete the comment.
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public URI addComment(final URI taskIdURI, final String commentString) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
validateTaskId(taskIdURI);
Validate.notEmpty(commentString, "The comment string cannot be empty");
return HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<URI>() {
public URI call() throws Exception {
AddComment addComment = new AddComment(getCaller(), new Long(taskIdURI.toString()), commentString);
addComment.execute();
CommentDAO persisted = addComment.getPersistedComment();
if (persisted != null) {
return ConverterUtil.convertToURI(persisted.getId().toString());
} else {
throw new IllegalStateFault("The persisted comment is null. " + "See error log for more details.");
}
}
});
} catch (Exception ex) {
handleException(ex);
}
return null;
}
Aggregations