protected String renderProcessForm(ProcessDefinition process, InputStream template, Map<String, Object> renderContext) { String result = null; try { Form form = formSerializationManager.loadFormFromXML(template); Map ctx = new HashMap(); ctx.put("process", process); // Adding forms to context while forms are'nt available on marshaller classloader FormRenderContext context = formRenderContextManager.newContext(form, process.getDeploymentId(), ctx, new HashMap<String, Object>()); formRenderContentMarshaller.addContentMarshaller(context.getUID(), (ContentMarshallerContext) renderContext.get("marshallerContext")); result = context.getUID(); } catch (Exception e) { log.warn("Error rendering form: ", e); } return result; }
protected String renderTaskForm(Task task, InputStream template, Map<String, Object> renderContext) { String result = null; try { Form form = formSerializationManager.loadFormFromXML(template); Map inputs = new HashMap(); Map outputs; if (task.getTaskData().getOutputContentId() == -1) outputs = new HashMap(); else outputs = (Map) renderContext.get("outputs"); Map m = (Map) renderContext.get("inputs"); if (m != null) inputs.putAll(m); inputs.put("task", task); // Adding forms to context while forms are'nt available on marshaller classloader FormRenderContext context = formRenderContextManager.newContext(form, task.getTaskData().getDeploymentId(), inputs, outputs); formRenderContentMarshaller.addContentMarshaller(context.getUID(), (ContentMarshallerContext) renderContext.get("marshallerContext")); String status = task.getTaskData().getStatus().name(); boolean readonly = !"InProgress".equals(status); context.setReadonly(readonly); result = context.getUID(); } catch (Exception e) { log.warn("Error rendering form: ", e); } return result; }
@Override public FormModelerFormRenderingSettings render(ProcessRenderingSettings settings) { if (!StringUtils.isEmpty(settings.getFormContent())) { try { Form form = formSerializationManager.loadFormFromXML(settings.getFormContent()); Map ctx = new HashMap(); ctx.put("process", settings.getProcess()); // Adding forms to context while forms are'nt available on marshaller classloader FormRenderContext context = formRenderContextManager.newContext(form, settings.getServerTemplateId(), ctx, new HashMap<>()); formRenderContentMarshaller.addContentMarshaller(context.getUID(), settings.getMarshallerContext()); return new FormModelerFormRenderingSettings(context.getUID()); } catch (Exception e) { log.warn("Error rendering form: ", e); } } return null; }
FormRenderContext context = formRenderContextManager.newContext(form, settings.getServerTemplateId(), inputs,