Package org.jbpm.formapi.shared.form

Examples of org.jbpm.formapi.shared.form.FormRepresentationDecoder.decode()


        assertNotSame("json shouldn't be empty", "", json);
       
        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);
View Full Code Here


        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);
        assertEquals("both forms should be the same in contents", form, form2);
View Full Code Here

            this.i18n = new HashMap<String, String>();
            this.i18n.putAll(i18nMap);
        }
        this.format = (String) data.get("format");
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        this.onClickScript = (FBScript) decoder.decode((Map<String, Object>) data.get("onClickScript"));
    }
   
    @Override
    public boolean equals(Object obj) {
        if (!super.equals(obj)) return false;
View Full Code Here

        List<Object> mapItems = (List<Object>) data.get("items");
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (mapItems != null) {
            for (Object obj : mapItems) {
                Map<String, Object> itemMap = (Map<String, Object>) obj;
                FormItemRepresentation item = (FormItemRepresentation) decoder
                        .decode(itemMap);
                this.items.add(item);
            }
        }
    }
View Full Code Here

        return null;
    }
   
    private static FormRepresentation toForm(String json) throws FormEncodingException {
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        FormRepresentation form = decoder.decode(json);
        return form;
    }
   
    private static TaskRef toTask(JSONObject json) {
        TaskRef retval = null;
View Full Code Here

    @DoNotUseJAXBProvider
    public Response saveForm(String jsonBody, @PathParam("pkgName") String pkgName, @Context HttpServletRequest request) {
        setContext(request.getSession().getServletContext());
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        try {
            FormRepresentation form = decoder.decode(jsonBody);
            String formId = formService.saveForm(pkgName, form);
            return Response.ok("<formId>"+formId+"</formId>", MediaType.APPLICATION_XML).
                status(Status.CREATED).build();
        } catch (FormEncodingException e) {
            return error("Problem decoding form", e);
View Full Code Here

   
   
    private URL createTemplate(String language, FormPreviewDTO dto) throws FormEncodingException, TranslatorException {
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        String json = dto.getRepresentation();
        FormRepresentation form = decoder.decode(json);
        dto.setForm(form);
        Translator translator = getTranslator(language);
        URL url = translator.translateForm(form);
        return url;
    }
View Full Code Here

        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
                String json = getText(node);
                try {
                    FormRepresentation form = decoder.decode(json);
                    retval.add(form);
                } catch (FormEncodingException e) {
                    FormRepresentation error = new FormRepresentation();
                    error.setName(i18n.Error(e.getLocalizedMessage()));
                    retval.add(error);
View Full Code Here

                        URLEncoder.encode(formId, GuvnorHelper.ENCODING) + ".formdef";
                method = helper.createGetMethod(getUrl);
                helper.setAuth(client, method);
                client.executeMethod(method);
                String json = method.getResponseBodyAsString();
                return decoder.decode(json);
            } catch (IOException e) {
                throw new FormServiceException(e);
            } catch (FormEncodingException e) {
                throw new FormServiceException(e);
            } catch (Exception e) {
View Full Code Here

                        helper.setAuth(client, processCall);
                        client.executeMethod(processCall);
                        String formJson = processCall.getResponseBodyAsString();
                        if (formJson != null && !"".equals(formJson)) {
                            FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
                            return decoder.decode(formJson);
                        }
                    } finally {
                        processCall.releaseConnection();
                    }
                }
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.