Search in sources :

Example 16 with IllegalStateFault

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);
    }
}
Also used : SetPriority(org.wso2.carbon.humantask.core.engine.commands.SetPriority) 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)

Example 17 with IllegalStateFault

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);
    }
}
Also used : SetFault(org.wso2.carbon.humantask.core.engine.commands.SetFault) Element(org.w3c.dom.Element) 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)

Example 18 with IllegalStateFault

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);
    }
}
Also used : UpdateComment(org.wso2.carbon.humantask.core.engine.commands.UpdateComment) 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)

Example 19 with IllegalStateFault

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);
    }
}
Also used : Element(org.w3c.dom.Element) 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) Fail(org.wso2.carbon.humantask.core.engine.commands.Fail)

Example 20 with IllegalStateFault

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;
}
Also used : HumanTaskEngine(org.wso2.carbon.humantask.core.engine.HumanTaskEngine) TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO) HumanTaskDAOConnection(org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection) 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

HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)22 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)22 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)22 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)22 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)22 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)22 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)22 UserStoreException (org.wso2.carbon.user.core.UserStoreException)22 Element (org.w3c.dom.Element)8 HumanTaskCommand (org.wso2.carbon.humantask.core.engine.HumanTaskCommand)5 HumanTaskDAOConnection (org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection)3 TaskDAO (org.wso2.carbon.humantask.core.dao.TaskDAO)3 HumanTaskEngine (org.wso2.carbon.humantask.core.engine.HumanTaskEngine)3 QName (javax.xml.namespace.QName)2 URI (org.apache.axis2.databinding.types.URI)2 NodeList (org.w3c.dom.NodeList)2 Complete (org.wso2.carbon.humantask.core.engine.commands.Complete)2 Start (org.wso2.carbon.humantask.core.engine.commands.Start)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1