use of org.wso2.carbon.apimgt.api.model.Identifier in project carbon-business-process by wso2.
the class TaskOperationsImpl method claim.
/**
* Claim responsibility for a task, i.e. set the task to status Reserved
* @param taskIdURI : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void claim(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 {
HumanTaskCommand claim = new Claim(getCaller(), taskId);
claim.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project carbon-business-process by wso2.
the class TaskOperationsImpl method start.
/**
* Start the task
* @param taskId : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
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.apimgt.api.model.Identifier in project carbon-business-process by wso2.
the class TaskOperationsImpl method release.
/**
* Release the task, i.e. set the task back to status Ready.
* @param taskId : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void release(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 releaseCommand = new Release(getCaller(), new Long(taskId.toString()));
releaseCommand.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project carbon-business-process by wso2.
the class TaskOperationsImpl method deleteComment.
/**
* Deletes the identified comment.
* @param taskIdURI : task identifier
* @param commentId : comment identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void deleteComment(final URI taskIdURI, final URI commentId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
final Long taskId = validateTaskId(taskIdURI);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
DeleteComment deleteComment = new DeleteComment(getCaller(), taskId, new Long(commentId.toString()));
deleteComment.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
use of org.wso2.carbon.apimgt.api.model.Identifier in project carbon-business-process by wso2.
the class TaskOperationsImpl method addAttachment.
/**
* Add attachment to a task. Returns an identifier for the attachment.
* @param taskIdentifier : task identifier
* @param name : attachment name
* @param accessType : access type
* @param contentType : content type
* @param attachment : attachment ID (String)
* @return
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public boolean addAttachment(URI taskIdentifier, String name, String accessType, String contentType, Object attachment) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
final Long taskId = validateTaskId(taskIdentifier);
final String attachmentID = (String) attachment;
try {
Boolean isAdded = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Boolean>() {
public Boolean call() throws Exception {
HumanTaskEngine engine = HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine();
HumanTaskDAOConnection daoConn = engine.getDaoConnectionFactory().getConnection();
TaskDAO taskDAO = daoConn.getTask(taskId);
validateTaskTenant(taskDAO);
try {
boolean isAdded = taskDAO.addAttachment(TransformerUtils.generateAttachmentDAOFromID(taskDAO, attachmentID));
if (!isAdded) {
throw new HumanTaskException("Attachment with id: " + attachmentID + "was not associated " + "task with id:" + taskId);
}
return isAdded;
} catch (HumanTaskException ex) {
String errMsg = "getAttachmentInfos operation failed. Reason: ";
log.error(errMsg + ex.getLocalizedMessage(), ex);
throw ex;
}
}
});
return isAdded;
} catch (Exception ex) {
handleException(ex);
}
return false;
}
Aggregations