Examples of decodeItem()


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

    private MenuItemDescription toMenuItemDescription(SaveMenuItemDTO dto, boolean strict) throws MenuServiceException {
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        String json = dto.getClone();
        MenuItemDescription menuItem = new MenuItemDescription();
        try {
            FormItemRepresentation item = decoder.decodeItem(json);
            menuItem.setItemRepresentation(item);
        } catch (FormEncodingException e) {
            if (strict) {
                throw new MenuServiceException("Couldn't load formRepresentation from dto", e);
            }
View Full Code Here

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

        effDesc2.setClassName(DoneEffect.class.getName());
        effects.add(effDesc2);
        desc.setEffects(effects);
        File file = new File(getClass().getResource("testSaveMenuItem.json").getFile());
        String json = FileUtils.readFileToString(file);
        FormItemRepresentation itemRepresentation = decoder.decodeItem(json);
        desc.setName("test component");
        desc.setItemRepresentation(itemRepresentation);
       
        String groupName = "Test Components";
        service.saveMenuItem(groupName, desc);
View Full Code Here

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

            @PathParam("pkgName") String pkgName,
            @PathParam("fItemName") String formItemName, @Context HttpServletRequest request) {
        setContext(request.getSession().getServletContext());
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        try {
            FormItemRepresentation item = decoder.decodeItem(jsonBody);
            String formItemId = formService.saveFormItem(pkgName, formItemName, item);
            return Response.ok("<formItemId>"+formItemId+"</formItemId>",
                    MediaType.APPLICATION_XML).status(Status.CREATED).build();
        } catch (FormEncodingException e) {
            return error("Problem encoding form item", e);
View Full Code Here

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

        FormItemRepresentation rep = null;
        if (list.getLength() > 0) {
            Node node = list.item(0);
            String json = getText(node);
            FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
            rep = (FormItemRepresentation) decoder.decodeItem(json);
        }
        return rep;
    }
   
    private String getText(Node node) {
View Full Code Here

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

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

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

        FormRepresentationDecoder decoder = EasyMock.createMock(FormRepresentationDecoder.class);
        FormEncodingFactory.register(FormEncodingServerFactory.getEncoder(), decoder);
        FormDefinitionService formService = EasyMock.createMock(FormDefinitionService.class);
        FormItemRepresentation item = RESTAbstractTest.createMockForm("formToBeSaved", "param1").getFormItems().iterator().next();
        FormEncodingException exception = new FormEncodingException("Something going wrong");
        EasyMock.expect(decoder.decodeItem(EasyMock.anyObject(String.class))).andThrow(exception).once();
        restService.setFormService(formService);
        ServletContext context = EasyMock.createMock(ServletContext.class);
        HttpSession session = EasyMock.createMock(HttpSession.class);
        HttpServletRequest request = EasyMock.createMock(HttpServletRequest.class);
        EasyMock.expect(request.getSession()).andReturn(session);
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.