data validation error holiday name appearing twice(fixed)
This commit is contained in:
+4
-5
@@ -1,4 +1,4 @@
|
|||||||
package org.mifosplatform.organisation.holiday.data;
|
package org.mifosplatform.organisation.holiday.data;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -47,7 +47,7 @@ public class HolidayDataValidator {
|
|||||||
.resource(HolidayApiConstants.HOLIDAY_RESOURCE_NAME);
|
.resource(HolidayApiConstants.HOLIDAY_RESOURCE_NAME);
|
||||||
|
|
||||||
final String name = this.fromApiJsonHelper.extractStringNamed(HolidayApiConstants.name, element);
|
final String name = this.fromApiJsonHelper.extractStringNamed(HolidayApiConstants.name, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.name).value(name).notBlank().notNull().notExceedingLengthOf(100);
|
baseDataValidator.reset().parameter(HolidayApiConstants.name).value(name).notNull().notExceedingLengthOf(100);
|
||||||
|
|
||||||
final LocalDate fromDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.fromDate, element);
|
final LocalDate fromDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.fromDate, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.fromDate).value(fromDate).notNull();
|
baseDataValidator.reset().parameter(HolidayApiConstants.fromDate).value(fromDate).notNull();
|
||||||
@@ -55,14 +55,13 @@ public class HolidayDataValidator {
|
|||||||
final LocalDate toDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.toDate, element);
|
final LocalDate toDate = this.fromApiJsonHelper.extractLocalDateNamed(HolidayApiConstants.toDate, element);
|
||||||
baseDataValidator.reset().parameter(HolidayApiConstants.toDate).value(toDate).notNull();
|
baseDataValidator.reset().parameter(HolidayApiConstants.toDate).value(toDate).notNull();
|
||||||
|
|
||||||
|
|
||||||
Set<Long> offices = null;
|
Set<Long> offices = null;
|
||||||
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||||
|
|
||||||
if (topLevelJsonElement.has(HolidayApiConstants.offices)&&topLevelJsonElement.get(HolidayApiConstants.offices).isJsonArray()) {
|
if (topLevelJsonElement.has(HolidayApiConstants.offices) && topLevelJsonElement.get(HolidayApiConstants.offices).isJsonArray()) {
|
||||||
|
|
||||||
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.offices).getAsJsonArray();
|
final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.offices).getAsJsonArray();
|
||||||
if(array.size()>0) {
|
if (array.size() > 0) {
|
||||||
offices = new HashSet<Long>(array.size());
|
offices = new HashSet<Long>(array.size());
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
final JsonObject officeElement = array.get(i).getAsJsonObject();
|
final JsonObject officeElement = array.get(i).getAsJsonObject();
|
||||||
|
|||||||
Reference in New Issue
Block a user