public Form deserializeForm(Node nodeForm, String path, Map<String, Properties> resources) throws Exception { if (!nodeForm.getNodeName().equals(NODE_FORM)) return null; Form form = formManager.createForm(""); form.setId( Long.valueOf( StringEscapeUtils.unescapeXml( nodeForm.getAttributes().getNamedItem(ATTR_ID).getNodeValue()))); Set<Field> fields = new TreeSet<Field>(); NodeList childNodes = nodeForm.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (node.getNodeName().equals(NODE_PROPERTY)) { String propName = node.getAttributes().getNamedItem(ATTR_NAME).getNodeValue(); String value = StringEscapeUtils.unescapeXml( node.getAttributes().getNamedItem(ATTR_VALUE).getNodeValue()); if ("subject".equals(propName)) { form.setSubject(value); } else if ("name".equals(propName)) { form.setName(value); } else if ("displayMode".equals(propName)) { form.setDisplayMode(value); } else if ("labelMode".equals(propName)) { form.setLabelMode(value); } else if ("showMode".equals(propName)) { form.setShowMode(value); } else if ("status".equals(propName)) { form.setStatus(Long.valueOf(value)); } else if ("formTemplate".equals(propName)) { form.setFormTemplate(value); } } else if (node.getNodeName().equals(NODE_FIELD)) { Field field = deserializeField(form, node, resources); field.setForm(form); fields.add(field); } else if (node.getNodeName().equals(NODE_DATA_HOLDER)) { String holderId = getNodeAttributeValue(node, ATTR_ID); String holderInputId = getNodeAttributeValue(node, ATTR_INPUT_ID); String holderOutId = getNodeAttributeValue(node, ATTR_OUT_ID); String holderType = getNodeAttributeValue(node, ATTR_TYPE); String holderValue = getNodeAttributeValue(node, ATTR_VALUE); String holderRenderColor = getNodeAttributeValue(node, ATTR_NAME); String holderSupportedType = getNodeAttributeValue(node, ATTR_SUPPORTED_TYPE); if (!StringUtils.isEmpty(holderId) && !StringUtils.isEmpty(holderType) && !StringUtils.isEmpty(holderValue)) { DataHolderBuildConfig config = new DataHolderBuildConfig( holderId, holderInputId, holderOutId, holderRenderColor, holderValue); config.addAttribute("path", path); if (!StringUtils.isEmpty(holderSupportedType)) config.addAttribute(ATTR_SUPPORTED_TYPE, holderSupportedType); DataHolder holder = dataHolderManager.createDataHolderByType(holderType, config); if (!StringUtils.isEmpty(holderId)) form.setDataHolder(holder); } } } if (fields != null) form.setFormFields(fields); return form; }