public void readFields(Element formElement, FormEntity form)
throws DaoTaskException {
for (Iterator<Element> i = formElement.elementIterator(); i.hasNext(); ) {
Element element = i.next();
if (element.getName().equals("field")) {
FieldEntity field = new FieldEntity();
field.setFormId(form.getId());
field.setName(element.attributeValue("name"));
field.setTitle(element.attributeValue("title"));
try {
field.setFieldType(FieldType.valueOf(element
.attributeValue("fieldType")));
}
catch (Exception e) {
field.setFieldType(FieldType.TEXT);
}
field.setMandatory(XmlUtil.readBooleanAttr(element,
"mandatory", false));
field.setValues(element.attributeValue("values"));
field.setDefaultValue(element.attributeValue("defaultValue"));
field.setHeight(XmlUtil.readIntAttr(element, "height", 0));
field.setWidth(XmlUtil.readIntAttr(element, "width", 20));
field.setIndex(XmlUtil.readIntAttr(element, "index", 0));
getDaoTaskAdapter().fieldSave(field);
}
}
}