Search in sources :

Example 1 with YamlFormField

use of com.walmartlabs.concord.project.yaml.model.YamlFormField in project concord by walmartlabs.

the class YamlFormConverter method convert.

public static FormDefinition convert(String name, List<YamlFormField> fields) throws YamlConverterException {
    Map<String, Object> options = null;
    List<FormField> l = new ArrayList<>();
    for (YamlFormField f : fields) {
        if (f == null || f.getName() == null) {
            throw new YamlConverterException("Empty field definition in form '" + name + "'");
        }
        if (OPTIONS_FIELD_NAME.equals(f.getName())) {
            if (options != null) {
                throw new YamlConverterException("Duplicate options definition in form '" + name + "'");
            }
            options = f.getOptions();
            continue;
        }
        l.add(convert(f));
    }
    return new FormDefinition(name, l);
}
Also used : ArrayList(java.util.ArrayList) YamlFormField(com.walmartlabs.concord.project.yaml.model.YamlFormField) YamlFormDefinition(com.walmartlabs.concord.project.yaml.model.YamlFormDefinition) FormDefinition(io.takari.bpm.model.form.FormDefinition) FormField(io.takari.bpm.model.form.FormField) YamlFormField(com.walmartlabs.concord.project.yaml.model.YamlFormField)

Aggregations

YamlFormDefinition (com.walmartlabs.concord.project.yaml.model.YamlFormDefinition)1 YamlFormField (com.walmartlabs.concord.project.yaml.model.YamlFormField)1 FormDefinition (io.takari.bpm.model.form.FormDefinition)1 FormField (io.takari.bpm.model.form.FormField)1 ArrayList (java.util.ArrayList)1