Merge pull request #405 from vishwasbabu/develop
added max length validation for datatables
This commit is contained in:
+1
-1
@@ -117,7 +117,7 @@ public final class ResultsetColumnHeaderData {
|
|||||||
return "datetime".equalsIgnoreCase(this.columnType);
|
return "datetime".equalsIgnoreCase(this.columnType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isString() {
|
public boolean isString() {
|
||||||
return isVarchar() || isChar();
|
return isVarchar() || isChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-6
@@ -1165,24 +1165,30 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
|
|||||||
} else {
|
} else {
|
||||||
paramValue = tmpDate.toString();
|
paramValue = tmpDate.toString();
|
||||||
}
|
}
|
||||||
}
|
} else if (columnHeader.isIntegerDisplayType()) {
|
||||||
|
|
||||||
if (columnHeader.isIntegerDisplayType()) {
|
|
||||||
Integer tmpInt = helper.convertToInteger(paramValue, columnHeader.getColumnName(), clientApplicationLocale);
|
Integer tmpInt = helper.convertToInteger(paramValue, columnHeader.getColumnName(), clientApplicationLocale);
|
||||||
if (tmpInt == null) {
|
if (tmpInt == null) {
|
||||||
paramValue = null;
|
paramValue = null;
|
||||||
} else {
|
} else {
|
||||||
paramValue = tmpInt.toString();
|
paramValue = tmpInt.toString();
|
||||||
}
|
}
|
||||||
}
|
} else if (columnHeader.isDecimalDisplayType()) {
|
||||||
|
|
||||||
if (columnHeader.isDecimalDisplayType()) {
|
|
||||||
BigDecimal tmpDecimal = helper.convertFrom(paramValue, columnHeader.getColumnName(), clientApplicationLocale);
|
BigDecimal tmpDecimal = helper.convertFrom(paramValue, columnHeader.getColumnName(), clientApplicationLocale);
|
||||||
if (tmpDecimal == null) {
|
if (tmpDecimal == null) {
|
||||||
paramValue = null;
|
paramValue = null;
|
||||||
} else {
|
} else {
|
||||||
paramValue = tmpDecimal.toString();
|
paramValue = tmpDecimal.toString();
|
||||||
}
|
}
|
||||||
|
} else if (columnHeader.isString()) {
|
||||||
|
if (paramValue.length() > columnHeader.getColumnLength()) {
|
||||||
|
ApiParameterError error = ApiParameterError.parameterError("validation.msg.datatable.entry.column.exceeds.maxlength",
|
||||||
|
"The column `" + columnHeader.getColumnName() + "` exceeds its defined max-length ",
|
||||||
|
columnHeader.getColumnName(), paramValue);
|
||||||
|
List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
|
dataValidationErrors.add(error);
|
||||||
|
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.",
|
||||||
|
dataValidationErrors);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user