officeId attribute is added in HolidayApiConstants class

This commit is contained in:
goutham-M
2013-06-19 11:50:02 +05:30
parent 10ad444668
commit 7c91a3a83b
3 changed files with 3 additions and 2 deletions
@@ -18,6 +18,7 @@ public class HolidayApiConstants {
public static final String toDate = "toDate";
public static final String description = "description";
public static final String offices = "offices";
public static final String officeId = "officeId";
public static final Set<String> HOLIDAY_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
dateFormatParamName, name, fromDate, toDate, description, offices));
@@ -65,7 +65,7 @@ public class HolidayDataValidator {
offices = new HashSet<Long>(array.size());
for (int i = 0; i < array.size(); i++) {
final JsonObject officeElement = array.get(i).getAsJsonObject();
final Long officeId = this.fromApiJsonHelper.extractLongNamed("officeId", officeElement);
final Long officeId = this.fromApiJsonHelper.extractLongNamed(HolidayApiConstants.officeId, officeElement);
baseDataValidator.reset().parameter(HolidayApiConstants.offices).value(officeId).notNull();
offices.add(officeId);
}
@@ -71,7 +71,7 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit
offices = new HashSet<Office>(array.size());
for (int i = 0; i < array.size(); i++) {
final JsonObject officeElement = array.get(i).getAsJsonObject();
final Long officeId = this.fromApiJsonHelper.extractLongNamed("officeId", officeElement);
final Long officeId = this.fromApiJsonHelper.extractLongNamed(HolidayApiConstants.officeId, officeElement);
final Office office = this.officeRepository.findOne(officeId);
if (office == null) { throw new OfficeNotFoundException(officeId); }
offices.add(office);