Resolved conflicts

This commit is contained in:
rajesh
2025-02-06 15:26:47 +05:30
31 changed files with 523 additions and 148 deletions

View File

@@ -145,7 +145,7 @@ public class FieldValidator {
break;
case GepafinConstant.NON_EMPTY_TABLES:
checkTableValidation(value, fieldId, contentResponseBean, errors);
// checkTableValidation(value, fieldId, contentResponseBean, errors);
break;
default:
@@ -157,11 +157,51 @@ public class FieldValidator {
return this;
}
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) {
public FieldValidator validateCustomTableValidation(String value, String customRule, String fieldId, ContentResponseBean contentResponseBean) {
if (customRule == null || value == null) {
return this; // No custom rule to validate
}
switch (customRule) {
case GepafinConstant.NON_EMPTY_TABLES:
try {
checkTableValidation(value, fieldId, contentResponseBean, errors);
} catch (Exception e) {
throw new RuntimeException(e);
}
break;
default:
// If the custom rule is unknown, just log or add an error (optional)
errors.add(MessageFormat.format(Translator.toLocale(GepafinConstant.VALIDATION_FIELD_CUSTOM), fieldId, customRule));
break;
}
return this;
}
private static void checkTableValidation(String value, String fieldId, ContentResponseBean contentResponseBean, List<String> errors) throws Exception {
Map<String, Boolean> stateFieldMap= new HashMap<>();
String tableType = contentResponseBean.getSettings().stream()
.filter(setting ->GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getName) // Extract the name
.findFirst() // Get the first matching result
.orElse(null); // Default to null if no match
if (tableType!=null){
try {
Object object = PdfUtils.extractRows(value);;
value= Utils.convertToString(object);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
contentResponseBean.getSettings().stream()
.filter(setting -> "table_columns".equals(setting.getName())) // Check for "table_columns"
.filter(setting -> "table_columns".equals(setting.getName()) || GepafinConstant.CRITERIA_TABLE_COLUMNS.equals(setting.getName())) // Check for "table_columns"
.map(SettingResponseBean::getValue)
.filter(Objects::nonNull) // Ensure value is not null
.filter(settingValue -> settingValue instanceof Map) // Ensure value is a Map