Search in sources :

Example 1 with IllegalAccessFault

use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.

the class TaskOperationServiceImpl method complete.

public void complete(URI taskIdURI, final String outputStr) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskId = validateTaskId(taskIdURI);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                Element output = DOMUtils.stringToDOM(outputStr);
                Complete completeCommand = new Complete(getCaller(), taskId, output);
                completeCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Complete(org.wso2.carbon.humantask.core.engine.commands.Complete) Element(org.w3c.dom.Element)

Example 2 with IllegalAccessFault

use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.

the class TaskOperationServiceImpl method loadTask.

public TTaskAbstract loadTask(URI taskIdURI) throws 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);
                return task;
            }
        });
        return TransformerUtils.transformTask(task, getCaller());
    } catch (Exception ex) {
        log.error(ex);
        throw new IllegalAccessFault(ex);
    }
}
Also used : IllegalAccessFault(org.wso2.carbon.humantask.client.api.IllegalAccessFault) HumanTaskEngine(org.wso2.carbon.humantask.core.engine.HumanTaskEngine) TaskDAO(org.wso2.carbon.humantask.core.dao.TaskDAO) HumanTaskDAOConnection(org.wso2.carbon.humantask.core.dao.HumanTaskDAOConnection)

Example 3 with IllegalAccessFault

use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.

the class HTQueryBuildHelperImpl method getTaskDataById.

/**
 * @param taskId
 * @return all the task details for the given taskID
 * @throws IllegalAccessFault
 * @throws IllegalArgumentFault
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws URI.MalformedURIException
 */
public String[] getTaskDataById(String taskId) throws IllegalAccessFault, IllegalArgumentFault, IllegalStateFault, IllegalOperationFault, URI.MalformedURIException {
    String[] output = { "" };
    List<String> outputList = new ArrayList<>();
    TaskDAO task;
    URI uri = new URI(taskId);
    try {
        final Long validatedTaskId = validateTaskId(uri);
        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(validatedTaskId);
                return task;
            }
        });
    } catch (Exception ex) {
        throw new IllegalAccessFault(ex);
    }
    GenericHumanRoleDAO.GenericHumanRoleType[] genericHumanRoleTypes = GenericHumanRoleDAO.GenericHumanRoleType.values();
    MessageDAO inputMessageDAO = task.getInputMessage();
    MessageDAO outputMessageDAO = task.getOutputMessage();
    String description = task.getTaskDescription("text/plain");
    String titleString = String.format("%1$-" + 25 + "s", "Task Name") + ":" + task.getName();
    outputList.add(titleString);
    for (int i = 0; i < genericHumanRoleTypes.length; i++) {
        List<OrganizationalEntityDAO> organizationalEntityDAOs = CommonTaskUtil.getOrgEntitiesForRole(task, genericHumanRoleTypes[i]);
        if (organizationalEntityDAOs.size() > 0) {
            String taskDataString = String.format("%1$-" + 25 + "s", genericHumanRoleTypes[i]) + ":";
            for (int j = 0; j < organizationalEntityDAOs.size(); j++) {
                taskDataString = taskDataString + organizationalEntityDAOs.get(j).getName() + " [" + organizationalEntityDAOs.get(j).getOrgEntityType() + "]  ";
            }
            outputList.add(taskDataString);
        }
    }
    if (description != null) {
        String taskDescriptionString = String.format("%1$-" + 25 + "s", "Task Description") + ":" + task.getTaskDescription("text/plain");
        outputList.add(taskDescriptionString);
    }
    Element inputBodyData = inputMessageDAO.getBodyData();
    if (inputBodyData != null) {
        String inputMsgStr = String.format("%1$-" + 25 + "s", "Task Input") + ":" + "\n" + DOMUtils.domToString(inputBodyData);
        outputList.add(inputMsgStr);
    }
    if (outputMessageDAO != null) {
        Element outputBodyData = outputMessageDAO.getBodyData();
        if (outputBodyData != null) {
            String outputMessageStr = String.format("%1$-" + 25 + "s", "Task Output") + ":" + "\n" + DOMUtils.domToString(outputBodyData);
            outputList.add(outputMessageStr);
        }
    }
    output = new String[outputList.size()];
    int i = 0;
    for (Object o : outputList) {
        output[i++] = o.toString();
    }
    return output;
}
Also used : IllegalAccessFault(org.wso2.carbon.humantask.client.api.IllegalAccessFault) HumanTaskEngine(org.wso2.carbon.humantask.core.engine.HumanTaskEngine) Element(org.w3c.dom.Element) URI(org.apache.axis2.databinding.types.URI) Callable(java.util.concurrent.Callable)

Example 4 with IllegalAccessFault

use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.

the class HTQueryBuildHelperImpl method getAllDeployedTasksDetails.

/**
 * @return
 * @throws IllegalAccessFault
 * @throws IllegalArgumentFault
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 */
public DeployedTaskDetail[][] getAllDeployedTasksDetails() throws Exception {
    DeployedTaskDetail[][] dtt = null;
    long[] tenantIDs = getAllTenantIDs();
    dtt = new DeployedTaskDetail[tenantIDs.length][];
    HumanTaskBaseConfiguration htc;
    int i = 0;
    for (Long tenantID : tenantIDs) {
        List<HumanTaskBaseConfiguration> htcList = getAllDeployedTasks(tenantID);
        int size = htcList.size();
        dtt[i] = new DeployedTaskDetail[size];
        for (int j = 0; j < size; j++) {
            htc = htcList.get(j);
            dtt[i][j] = new DeployedTaskDetail();
            dtt[i][j].setTenantID(tenantID.intValue());
            dtt[i][j].setTaskDefName(htc.getDefinitionName());
            dtt[i][j].setTaskName(htc.getName());
            dtt[i][j].setOperation(htc.getOperation());
            dtt[i][j].setPortName(htc.getPortName());
            dtt[i][j].setTaskCount(getTaskInstanceCountForTaskName(htc.getName().toString()));
            dtt[i][j].setConfigType(htc.getConfigurationType());
            dtt[i][j].setPackageName(htc.getPackageName());
        }
        i++;
    }
    return dtt;
}
Also used : HumanTaskBaseConfiguration(org.wso2.carbon.humantask.core.store.HumanTaskBaseConfiguration)

Example 5 with IllegalAccessFault

use of org.wso2.carbon.humantask.client.api.IllegalAccessFault in project carbon-business-process by wso2.

the class TaskOperationsImpl method complete.

/**
 * Execution of the task finished successfully.
 * @param taskIdURI : task identifier
 * @param outputStr : task outcome (String)
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void complete(final URI taskIdURI, final String outputStr) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskId = validateTaskId(taskIdURI);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                Element output = DOMUtils.stringToDOM(outputStr);
                Complete completeCommand = new Complete(getCaller(), taskId, output);
                completeCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Complete(org.wso2.carbon.humantask.core.engine.commands.Complete) 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)

Aggregations

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