if ("array".equals(type) && "attachment".equals(jsonField.getSchema().getItems())) {
continue; // you can't make attachments required and we don't support uploads.
}
DynamicFormField field = new DynamicFormField();
field.setRequired(jsonField.isRequired());
if (jsonField.isRequired()) {
field.setError("required", "This field cannot be empty.");
}
field.setName(entry.getKey());
field.setLabel(jsonField.getName());
field.setActive(true);
field.setEditable(true);
if (jsonField.getAllowedValues() != null && !jsonField.getAllowedValues().isEmpty()) {
if (MULTISELECT.equals(jsonField.getSchema().getCustom())) {
field.setSupportsMultivalue(true);
}
if (MULTI_CHECKBOX.equals(jsonField.getSchema().getCustom())) {
field.setSupportsMultivalue(true);
field.setType("checklist");
} else if (CASCADING_SELECT.equals(jsonField.getSchema().getCustom())) {
field.setType("select");
} else {
field.setType("select");
}
field.setOptionsMap(jsonField.getOptionsMap());
} else if (type.equals("timetracking")) {
LOG.debug("Adding timetracking fields (x2)");
DynamicFormField originalEstimate = new DynamicFormField();
originalEstimate.setRequired(jsonField.isRequired());
originalEstimate.setName("timetracking_originalestimate");
originalEstimate.setLabel("Original Estimate");
originalEstimate.setActive(true);
originalEstimate.setEditable(true);
originalEstimate.setValidate(TIMETRACKING_REGEX);
originalEstimate.setType("text");
originalEstimate.setPlaceholder(PLACEHOLDER_TEXT);
originalEstimate.setError("pattern", TIMETRACKING_ERROR);
originalEstimate.setError("required", "This field cannot be empty.");
fieldList.add(originalEstimate);
DynamicFormField remainingEstimate = new DynamicFormField();
remainingEstimate.setRequired(jsonField.isRequired());
remainingEstimate.setName("timetracking_remainingestimate");
remainingEstimate.setLabel("Remaining Estimate");
remainingEstimate.setActive(true);
remainingEstimate.setValidate(TIMETRACKING_REGEX);
remainingEstimate.setPlaceholder(PLACEHOLDER_TEXT);
remainingEstimate.setEditable(true);
remainingEstimate.setType("text");
remainingEstimate.setError("required", "This field cannot be empty.");
remainingEstimate.setError("pattern", TIMETRACKING_ERROR);
fieldList.add(remainingEstimate);
continue;
} else if (type.equals("string")) {
if (URL_TYPE.equals(jsonField.getSchema().getCustom())) {