use of org.wso2.carbon.humantask.client.api.IllegalAccessFault 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;
}
use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.
the class TaskOperationsImpl method deleteFault.
/**
* Deletes the fault name and fault data of the task.
* @param taskIdURI : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void deleteFault(final 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 {
DeleteFault deleteFaultCommand = new DeleteFault(getCaller(), taskId);
deleteFaultCommand.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 skip.
/**
* Skip the task.
* @param taskIdURI : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void skip(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 {
Skip skipCommand = new Skip(getCaller(), taskId);
skipCommand.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 TaskOperationServiceImpl method start.
public void start(final URI taskId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
validateTaskId(taskId);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
Start startCommand = new Start(getCaller(), new Long(taskId.toString()));
startCommand.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 HTQueryBuildHelperImpl method getTaskInstanceCountsByState.
/**
* @param taskName
* @return
* @throws IllegalAccessFault
* @throws IllegalArgumentFault
* @throws IllegalStateFault
* @throws IllegalOperationFault
*/
public String[] getTaskInstanceCountsByState(String taskName) throws Exception {
int statusCount = 0;
TPredefinedStatus.Enum[] statuses;
int statusesSize = TPredefinedStatus.Enum.table.lastInt();
statuses = new TPredefinedStatus.Enum[statusesSize];
String[] statusCounts = new String[statusesSize];
for (int i = 0; i < statusesSize; i++) {
statuses[i] = TPredefinedStatus.Enum.forInt(i + 1);
}
Boolean isTaskName = false;
Pattern p = Pattern.compile("-[0-9]+$");
Matcher m = p.matcher(taskName);
isTaskName = m.find();
if (isTaskName) {
for (int i = 0; i < statuses.length; i++) {
statusCount = getTaskCountsForStateAndTaskName(taskName, statuses[i]);
statusCounts[i] = " " + statuses[i].toString() + " " + statusCount;
}
} else {
for (int i = 0; i < statuses.length; i++) {
statusCount = getTaskCountsForStateAndTaskDefName(taskName, statuses[i]);
statusCounts[i] = " " + statuses[i].toString() + " " + statusCount;
}
}
return statusCounts;
}
Aggregations