use of org.wso2.carbon.humantask.client.api.IllegalStateFault in project carbon-business-process by wso2.
the class TaskOperationsImpl method setPriority.
/**
* Change the priority of the task.
* @param taskIdURI : task identifier
* @param tPriority : The WS-HumanTask Client MUST specify the integer value of the new priority.
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void setPriority(final URI taskIdURI, final TPriority tPriority) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
if (tPriority.getTPriority().intValue() < 1 || tPriority.getTPriority().intValue() > 10) {
log.warn("The priority value should be between 1 and 10. " + "Hence ignoring the provided priority :" + tPriority.getTPriority());
}
try {
final Long taskId = validateTaskId(taskIdURI);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
int newPriority = tPriority.getTPriority().intValue();
SetPriority setPriorityCommand = new SetPriority(getCaller(), taskId, newPriority);
setPriorityCommand.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 setFault.
/**
* Set the fault data of the task.
* @param taskIdURI : task identifier
* @param tFault fault – contains the fault name and fault data
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void setFault(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());
}
SetFault setFault = new SetFault(getCaller(), taskId, faultName, faultData);
setFault.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 updateComment.
/**
* Updates the identified comment with the supplied new text.
* @param taskIdURI : task identifier
* @param commentId : comment identifier
* @param s : new comment in plain text.
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void updateComment(final URI taskIdURI, final URI commentId, final String s) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
final Long taskId = validateTaskId(taskIdURI);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
UpdateComment updateCommentCommand = new UpdateComment(getCaller(), taskId, new Long(commentId.toString()), s);
updateCommentCommand.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 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);
}
}
use of org.wso2.carbon.humantask.client.api.IllegalStateFault 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;
}
Aggregations