Fixed vaidation errors for createupdate application API.
This commit is contained in:
@@ -399,7 +399,7 @@ public class FormDao {
|
|||||||
String fieldId = contentResponseBean.getId();
|
String fieldId = contentResponseBean.getId();
|
||||||
String fieldLabel=contentResponseBean.getLabel();
|
String fieldLabel=contentResponseBean.getLabel();
|
||||||
Object object=formFieldMap.get(fieldId);
|
Object object=formFieldMap.get(fieldId);
|
||||||
String value =Utils.convertToString(object);
|
String value =Utils.convertToStringForFormFieldValue(object);
|
||||||
if(value == null && isApplicationFormExist) {
|
if(value == null && isApplicationFormExist) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,6 +407,29 @@ public class Utils {
|
|||||||
return input.toString();
|
return input.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String convertToStringForFormFieldValue(Object input) {
|
||||||
|
if (input == null) {
|
||||||
|
return null; // Return string "null" for null input
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof String) {
|
||||||
|
return (String) input; // Return the string directly if input is a string
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof Collection<?>) {
|
||||||
|
// Handle collections (List, Set, etc.)
|
||||||
|
return convertCollectionToString((Collection<?>) input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input instanceof Map<?, ?>) {
|
||||||
|
// Handle maps
|
||||||
|
return convertMapToString((Map<?, ?>) input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For other types (like Integer, Boolean, etc.), use toString()
|
||||||
|
return input.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private static String convertCollectionToString(Collection<?> collection) {
|
private static String convertCollectionToString(Collection<?> collection) {
|
||||||
try {
|
try {
|
||||||
return mapper.writeValueAsString(collection); // Convert the collection to a JSON string
|
return mapper.writeValueAsString(collection); // Convert the collection to a JSON string
|
||||||
|
|||||||
Reference in New Issue
Block a user