public FormField getFieldByBinding(String binding) { return fields.stream().filter(f -> f.getBinding().equals(binding)).findFirst().get(); }
public FormField getField(String fieldId) { return fields.stream().filter(f -> f.getId().equals(fieldId)).findFirst().get(); }
if (field.getNestedForm() != null && !field.getNestedForm().isEmpty()) { } else if (field.getCreationForm() != null) { String fieldType = inputTypes.get(field.getCode()); if (fieldType != null) { String jsType = getFieldType(field.getType()); item.setId(field.getId()); item.setName(nonNull(field.getName())); item.setLabel(nonNull(field.getLabel())); item.setPlaceHolder(nonNull(field.getPlaceHolder())); item.setType(fieldType); item.setValue(""); item.setOptions(field.getOptions()); item.setPattern(getValidationPatternByType(field.getType())); if (inputs.get(field.getBinding()) != null) { item.setValue(inputs.get(field.getBinding()).toString()); if (outputs.get(field.getBinding()) != null) { item.setValue(outputs.get(field.getBinding()).toString()); item.setReadOnly(field.isReadOnly()); item.setRequired(field.isRequired()); appendFieldJSON(jsonTemplate, fieldType, field.getBinding(), field.getId(), jsType); } else {
FormField field = new FormField(); field.setId(UUID.randomUUID().toString()); field.setBinding(entry.getKey()); field.setCode(entry.getValue().contains("Boolean")?"CheckBox" :"TextBox"); field.setLabel(entry.getKey()); field.setName(entry.getKey()); field.setType(entry.getValue()); item.setFieldId(field.getId()); item.setFormId(form.getId());
FormInstance nestedForm = topLevelForm.getNestedForm(field.getCreationForm()); if (nestedForm == null) { throw new RuntimeException("Unable to find creation form with form id " + field.getCreationForm()); for (TableInfo tableInfo : field.getTableInfo()) { String jsType = getFieldType(nestedField.getType()); tableInfo.setType(jsType); Object bindingData = outputs.get(field.getBinding()); if (bindingData == null) { bindingData = inputs.get(field.getBinding()); mappedData.put("table_" + field.getId() + "_" + index, data); index++; String loadDataScript = "tableData.set('table_" + field.getId() +"', new Map(Object.entries(JSON.parse('" + jsonData + "'))));"; scriptDataList.add(loadDataScript); scriptDataList.add(buildFunctionWithBody("formData_" + field.getId(), " return " + creationJsonTemplate.toString() + ";")); parameters.put("tableColumns", field.getTableInfo()); parameters.put("tableData", bindingData); parameters.put("fieldId", field.getId()); parameters.put("label", field.getLabel()); parameters.put("type", field.getType()); parameters.put("creationForm", output); output = renderTemplate(TABLE_LAYOUT_TEMPLATE, parameters);
StringBuilder content) { FormInstance nestedForm = topLevelForm.getNestedForm(field.getNestedForm()); if (nestedForm == null) { throw new RuntimeException("Unable to find nested form with form id " + field.getNestedForm()); Object binding = outputs.get(field.getBinding()); if (binding == null) { binding = inputs.get(field.getBinding()); Map<String, Object> nestedDataExtracted = reader.extractValues(binding); nestedInputs.putAll(nestedDataExtracted);
FormField field = new FormField(); field.setId(UUID.randomUUID().toString()); field.setBinding(entry.getKey()); field.setCode(entry.getValue().contains("Boolean")?"CheckBox" :"TextBox"); field.setLabel(entry.getKey()); field.setName(entry.getKey()); field.setType(entry.getValue()); field.setReadOnly(true); item.setFieldId(field.getId()); item.setFormId(form.getId()); FormField field = new FormField(); field.setId(UUID.randomUUID().toString()); field.setBinding(entry.getKey()); field.setCode(entry.getValue().contains("Boolean")?"CheckBox" :"TextBox"); field.setLabel(entry.getKey()); field.setName(entry.getKey()); field.setType(entry.getValue()); item.setFieldId(field.getId()); item.setFormId(form.getId());