Search in sources :

Example 1 with SetOutput

use of org.wso2.carbon.humantask.core.engine.commands.SetOutput in project carbon-business-process by wso2.

the class TaskOperationsImpl method setOutput.

/**
 * Set the data for the part of the task's output message.
 *
 * @param taskIdURI : task identifier
 * @param ncName    : PartName
 * @param o
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void setOutput(URI taskIdURI, NCName ncName, Object o) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskId = validateTaskId(taskIdURI);
        if (ncName != null && o != null) {
            final String outputName = ncName.toString();
            final Element outputData = DOMUtils.stringToDOM((String) o);
            HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

                public Object call() throws Exception {
                    SetOutput setOutputCommand = new SetOutput(getCaller(), taskId, outputName, outputData);
                    setOutputCommand.execute();
                    return null;
                }
            });
        } else {
            log.error("The output data for setOutput operation cannot be empty");
            throw new IllegalArgumentFault("The output data cannot be empty!");
        }
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Element(org.w3c.dom.Element) SetOutput(org.wso2.carbon.humantask.core.engine.commands.SetOutput) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Aggregations

Element (org.w3c.dom.Element)1 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)1 SetOutput (org.wso2.carbon.humantask.core.engine.commands.SetOutput)1 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)1 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)1 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)1 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)1 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)1 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)1 UserStoreException (org.wso2.carbon.user.core.UserStoreException)1