Package org.jbpm.formbuilder.shared.task

Examples of org.jbpm.formbuilder.shared.task.TaskRef


            }
        });
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                TaskRef trimmedIo = new TaskRef();
                trimmedIo.setPackageName(row.getIoRef().getPackageName());
                trimmedIo.setProcessId(row.getIoRef().getProcessId());
                trimmedIo.setProcessName(row.getIoRef().getProcessName());
                trimmedIo.setTaskId(row.getIoRef().getTaskId());
                trimmedIo.setInputs(new ArrayList<TaskPropertyRef>(getSelectedInputs()));
                trimmedIo.setOutputs(new ArrayList<TaskPropertyRef>(getSelectedOutputs()));
                FormRepresentation form = server.toBasicForm(trimmedIo);
                bus.fireEvent(new UpdateFormViewEvent(form));
                hide();
            }
        });
View Full Code Here


        try {
            if ( profile != null && "designer".equals(profile)) {
                String userTask = request.getParameter("userTask");
                String processName = request.getParameter("processName");
                String bpmn2Process = IOUtils.toString(request.getReader());
                TaskRef task = taskService.getBPMN2Task(bpmn2Process, processName, userTask);
                if (task != null) {
                    //get associated form if it exists
                    FormRepresentation form = formService.getAssociatedForm(task.getPackageName(), task);
                    if (form != null) {
                        json.addProperty("formjson", encoder.encode(form));
                    }
                    json.add("task", toJsonObject(task));
                    json.addProperty("packageName", task.getPackageName());
                }
            } else {
                throw new Exception("Unknown profile for POST: " + profile);
            }
            request.setAttribute("jsonData", new Gson().toJson(json));
View Full Code Here

        FormRepresentation form = decoder.decode(json);
        return form;
    }
   
    private static TaskRef toTask(JSONObject json) {
        TaskRef retval = null;
        if (json != null) {
            retval = new TaskRef();
            retval.setInputs(getIOData(json.get("inputs").isArray()));
            retval.setOutputs(getIOData(json.get("outputs").isArray()));
            Map<String, String> metaData = new HashMap<String, String>();
            JSONObject jsonMetaData = json.get("metaData") == null ? null : json.get("metaData").isObject();
            if (jsonMetaData != null) {
                for (String key : jsonMetaData.keySet()) {
                    metaData.put(key, jsonMetaData.get(key).isString().stringValue());
                }
            }
            retval.setMetaData(metaData);
            if (json.get("packageName") != null && json.get("packageName").isString() != null) {
                retval.setPackageName(json.get("packageName").isString().stringValue());
            }
            if (json.get("processId") != null && json.get("processId").isString() != null) {
                retval.setProcessId(json.get("processId").isString().stringValue());
            }
            if (json.get("taskId") != null && json.get("taskId").isString() != null) {
                retval.setTaskId(json.get("taskId").isString().stringValue());
            }
        }
        return retval;
    }
View Full Code Here

        NodeList list = xml.getElementsByTagName("task");
        if (list != null) {
            retval = new ArrayList<TaskRef>(list.getLength());
            for (int index = 0; index < list.getLength(); index++) {
                Element elem = (Element) list.item(index);
                TaskRef ref = new TaskRef();
                ref.setProcessId(elem.getAttribute("processId"));
                ref.setTaskId(elem.getAttribute("taskName"));
                ref.setInputs(extractTaskIO(elem.getElementsByTagName("input")));
                ref.setOutputs(extractTaskIO(elem.getElementsByTagName("output")));
                NodeList mdList = elem.getElementsByTagName("metaData");
                if (mdList != null) {
                    Map<String, String> metaData = new HashMap<String, String>();
                    for (int i = 0; i < mdList.getLength(); i++) {
                        Element mdElem = (Element) mdList.item(i);
                        metaData.put(mdElem.getAttribute("key"), mdElem.getAttribute("value"));
                    }
                    ref.setMetaData(metaData);
                }
                retval.add(ref);
            }
        }
        return retval;
View Full Code Here

        procName = null;
        pkgName = null;
    }
   
    public void addTask(TaskRef task) {
        TaskRef oldTask = tasksMap.get(task.getTaskName());
        if (oldTask != null) {
            tasks.remove(oldTask);
            for (TaskPropertyRef input : task.getInputs()) {
                oldTask.addInput(input.getName(), input.getSourceExpresion());
            }
            for (TaskPropertyRef output : task.getOutputs()) {
                oldTask.addOutput(output.getName(), output.getSourceExpresion());
            }
            Map<String, String> metaData = oldTask.getMetaData();
            metaData.putAll(task.getMetaData());
            oldTask.setMetaData(metaData);
            task = oldTask;
        }
        task.setProcessId(this.procId);
        task.setPackageName(this.pkgName);
        tasks.add(task);
View Full Code Here

                    task.addOutput(id, "${" + id + "}");
                }
                return;
            }
        }
        TaskRef ref = new TaskRef();
        ref.setTaskId(processInputName);
        ref.setPackageName(this.pkgName);
        ref.setProcessId(this.procId);
        ref.addOutput(id, "${" + id + "}");
        tasks.add(ref);
        tasksMap.put(ref.getTaskName(), ref);
    }
View Full Code Here

            subNode = subNode.getNextSibling();
        }
        NamedNodeMap map = xmlNode.getParentNode().getAttributes();
        Node nodeName = map.getNamedItem("name");
        String name = nodeName.getNodeValue();
        TaskRef task = new TaskRef();
        task.setTaskId(name);
        List<TaskPropertyRef> inputs = new ArrayList<TaskPropertyRef>(dataInputs.size());
        for (Map.Entry<String, String> in : dataInputs.entrySet()) {
            TaskPropertyRef prop = new TaskPropertyRef();
            prop.setName(in.getValue());
            prop.setSourceExpresion(in.getValue());
            inputs.add(prop);
        }
        task.setInputs(inputs);
        List<TaskPropertyRef> outputs = new ArrayList<TaskPropertyRef>(dataOutputs.size());
        for (Map.Entry<String, String> out : dataOutputs.entrySet()) {
            TaskPropertyRef prop = new TaskPropertyRef();
            prop.setName(out.getValue());
            prop.setSourceExpresion(out.getValue());
            outputs.add(prop);
        }
        task.setOutputs(outputs);
        this.taskRepository.addTask(task);
    }
View Full Code Here

    }

    @Override
    public TaskRef getBPMN2Task(String bpmn2ProcessContent, String processName, String userTask)
            throws TaskServiceException {
        TaskRef retval = null;
        List<TaskRef> tasks = getProcessTasks(bpmn2ProcessContent, processName);
        if (tasks != null) {
            for (TaskRef task : tasks) {
                if (task.getTaskName().equals(userTask)) {
                    retval = task;
View Full Code Here

        List<TaskRef> tasks = service.getTasksByName("somePackage", processId, taskId);
        EasyMock.verify(client);
       
        assertNotNull("tasks shouldn't be null", tasks);
        assertEquals("tasks should have one item", tasks.size(), 1);
        TaskRef task = tasks.iterator().next();
        assertNotNull("sampleTask shouldn't be null", task);
        assertNotNull("processId shouldn't be null", task.getProcessId());
        assertFalse("processId shouldn't be empty", "".equals(task.getProcessId()));
        assertNotNull("taskId shouldn't be null", task.getTaskId());
        assertFalse("taskId shouldn't be empty", "".equals(task.getTaskId()));
        assertEquals("taskId should be the same as task.taskId", task.getTaskId(), taskId);
        assertEquals("processId should be the same as task.processId", task.getProcessId(), processId);
    }
View Full Code Here

            andAnswer(new MockAnswer(responses, new IllegalArgumentException("unexpected call"))).times(4);
        service.getHelper().setClient(client);
        String taskId = "Review";
       
        EasyMock.replay(client);
        TaskRef task = service.getTaskByUUID("somePackage", taskId, uuid1);
        EasyMock.verify(client);
       
        assertNotNull("task shouldn't be null", task);
        assertNotNull("processId shouldn't be null", task.getProcessId());
        assertFalse("processId shouldn't be empty", "".equals(task.getProcessId()));
        assertNotNull("taskId shouldn't be null", task.getTaskId());
        assertFalse("taskId shouldn't be empty", "".equals(task.getTaskId()));
        assertEquals("taskId should be the same as task.taskId", task.getTaskId(), taskId);
    }
View Full Code Here

TOP

Related Classes of org.jbpm.formbuilder.shared.task.TaskRef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.