Package org.jbpm.formapi.shared.form

Examples of org.jbpm.formapi.shared.form.FormRepresentationEncoder.encode()


        assertNotSame("json shouldn't be empty", "", json);
       
       
        FormRepresentation form = decoder.decode(json);
        assertNotNull("form shouldn't be null", form);
        String json2 = encoder.encode(form);
        FormRepresentation form2 = decoder.decode(json2);
        assertNotNull("json2 shouldn't be null", json2);
        assertNotSame("json2 shouldn't be empty", "", json2);
       
        assertNotNull("form2 shouldn't be null", form2);
View Full Code Here


        FormRepresentationEncoder encoder = FormEncodingClientFactory.getEncoder();
        FormRepresentationDecoder decoder = FormEncodingClientFactory.getDecoder();
       
        FormRepresentation form = decoder.decode(json);
        assertNotNull("form shouldn't be null", form);
        String json2 = encoder.encode(form);
        FormRepresentation form2 = decoder.decode(json2);
        assertNotNull("json2 shouldn't be null", json2);
        assertNotSame("json2 shouldn't be empty", "", json2);
       
        assertNotNull("form2 shouldn't be null", form2);
View Full Code Here

                String packageName = taskService.getContainingPackage(uuid);
                FormRepresentation form = formService.getFormByUUID(packageName, uuid);
                json.addProperty("uuid", uuid);
                json.addProperty("packageName", packageName);
                if (form != null) {
                    json.addProperty("formjson", encoder.encode(form));
                }
            }else {
                throw new Exception("Unknown profile for GET: " + profile);
            }
            request.setAttribute("jsonData", new Gson().toJson(json));
View Full Code Here

                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 {
View Full Code Here

    }
   
    public FormItemDefDTO(String formItemId, FormItemRepresentation formItem) throws FormEncodingException {
        FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
        this._formItemId = formItemId;
        this._json = encoder.encode(formItem);
    }
   
    @XmlElement
    public String getJson() {
        return _json;
View Full Code Here

        // jaxb needs a default constructor
    }
   
    public FormDefDTO(FormRepresentation form) throws FormEncodingException {
        FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
        this._json = encoder.encode(form);
    }
   
    @XmlElement
    public String getJson() {
        return _json;
View Full Code Here

    }
   
    protected void exportForm(FormRepresentation form) {
        FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
        try {
            String formAsJson = encoder.encode(form);
            setClientExportForm(formAsJson);
        } catch (FormEncodingException e) {
            bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.CouldntExportAsJson(), e));
        }
    }
View Full Code Here

     */
    public String asXml(FormRepresentation form, Map<String, Object> inputs) throws FormEncodingException {
        StringBuilder builder = new StringBuilder();
        builder.append("<formPreview>");
        FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
        String json = encoder.encode(form);
        builder.append("<representation><![CDATA[").append(json).append("]]></representation>");
        if (inputs != null) {
            for (Map.Entry<String, Object> entry : inputs.entrySet()) {
                String key = entry.getKey();
                Object obj = entry.getValue();
View Full Code Here

            String url = helper.getApiSearchUrl(pkgName);
            boolean isUpdate = getForm(pkgName, form.getName()) != null;
            String finalUrl = url + URLEncoder.encode(form.getName(), GuvnorHelper.ENCODING) + ".formdef";
            method = isUpdate ? helper.createPutMethod(finalUrl) : helper.createPostMethod(finalUrl);
            FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
            method.setRequestEntity(new StringRequestEntity(encoder.encode(form), null, null));
            method.setRequestHeader("Checkin-Comment", form.getDocumentation());
            helper.setAuth(client, method);
            client.executeMethod(method);
            if (!"OK".equalsIgnoreCase(method.getResponseBodyAsString())) {
                throw new FormServiceException("Remote guvnor error: " + method.getResponseBodyAsString());
View Full Code Here

        try {
            String url = helper.getApiSearchUrl(pkgName);
            String finalUrl = url + URLEncoder.encode(builder.toString(), GuvnorHelper.ENCODING) + ".json";
            method = isUpdate ? helper.createPutMethod(finalUrl) : helper.createPostMethod(finalUrl);
            FormRepresentationEncoder encoder = FormEncodingFactory.getEncoder();
            method.setRequestEntity(new StringRequestEntity(encoder.encode(formItem), null, null));
            method.setRequestHeader("Checkin-Comment", "Committing " + formItemName);
            helper.setAuth(client, method);
            client.executeMethod(method);
            return formItemName;
        } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.