added holiday status to response

This commit is contained in:
ashok-conflux
2013-12-11 17:20:09 +05:30
parent e7f0e60555
commit 1371a3f775
4 changed files with 24 additions and 7 deletions
+12 -2
View File
@@ -9816,7 +9816,12 @@ GET https://DomainName/api/v1/holidays?officeId=1
2013, 2013,
10, 10,
26 26
] ],
"status": {
"id": 100,
"code": "holidayStatusType.pending.for.activation",
"value": "Pending for activation"
}
} }
] ]
</code> </code>
@@ -9923,7 +9928,12 @@ GET https://DomainName/api/v1/holidays/{holidayId}
2013, 2013,
10, 10,
26 26
] ],
"status": {
"id": 100,
"code": "holidayStatusType.active",
"value": "Active"
}
} }
</code> </code>
</div> </div>
@@ -22,10 +22,11 @@ public class HolidayApiConstants {
public static final String officeIdParamName = "officeId"; public static final String officeIdParamName = "officeId";
public static final String repaymentsRescheduledToParamName = "repaymentsRescheduledTo"; public static final String repaymentsRescheduledToParamName = "repaymentsRescheduledTo";
public static final String processed = "processed"; public static final String processed = "processed";
public static final String status = "status";
public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName, public static final Set<String> HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName, repaymentsRescheduledToParamName)); dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName, repaymentsRescheduledToParamName));
public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName, public static final Set<String> HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName, nameParamName,
fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName, dateFormatParamName)); fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName, dateFormatParamName, status));
} }
@@ -1,6 +1,7 @@
package org.mifosplatform.organisation.holiday.data; package org.mifosplatform.organisation.holiday.data;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
public class HolidayData { public class HolidayData {
@@ -18,9 +19,11 @@ public class HolidayData {
private final LocalDate repaymentsRescheduledTo; private final LocalDate repaymentsRescheduledTo;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final Long officeId; private final Long officeId;
@SuppressWarnings("unused")
private final EnumOptionData status;
public HolidayData(final Long id, final String name, final String description, final LocalDate fromDate, final LocalDate toDate, public HolidayData(final Long id, final String name, final String description, final LocalDate fromDate, final LocalDate toDate,
final LocalDate repaymentsRescheduledTo) { final LocalDate repaymentsRescheduledTo, final EnumOptionData status) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.description = description; this.description = description;
@@ -28,6 +31,6 @@ public class HolidayData {
this.toDate = toDate; this.toDate = toDate;
this.repaymentsRescheduledTo = repaymentsRescheduledTo; this.repaymentsRescheduledTo = repaymentsRescheduledTo;
this.officeId = null; this.officeId = null;
this.status = status;
} }
} }
@@ -9,6 +9,7 @@ import java.util.Collection;
import java.util.Date; import java.util.Date;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext; import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
@@ -39,7 +40,7 @@ public class HolidayReadPlatformServiceImpl implements HolidayReadPlatformServic
public HolidayMapper() { public HolidayMapper() {
final StringBuilder sqlBuilder = new StringBuilder(200); final StringBuilder sqlBuilder = new StringBuilder(200);
sqlBuilder.append("h.id as id, h.name as name, h.description as description, h.from_date as fromDate, h.to_date as toDate, "); sqlBuilder.append("h.id as id, h.name as name, h.description as description, h.from_date as fromDate, h.to_date as toDate, ");
sqlBuilder.append("h.repayments_rescheduled_to as repaymentsScheduleTO "); sqlBuilder.append("h.repayments_rescheduled_to as repaymentsScheduleTO, h.status_enum as statusEnum ");
sqlBuilder.append("from m_holiday h "); sqlBuilder.append("from m_holiday h ");
this.schema = sqlBuilder.toString(); this.schema = sqlBuilder.toString();
} }
@@ -56,8 +57,10 @@ public class HolidayReadPlatformServiceImpl implements HolidayReadPlatformServic
final LocalDate fromDate = JdbcSupport.getLocalDate(rs, "fromDate"); final LocalDate fromDate = JdbcSupport.getLocalDate(rs, "fromDate");
final LocalDate toDate = JdbcSupport.getLocalDate(rs, "toDate"); final LocalDate toDate = JdbcSupport.getLocalDate(rs, "toDate");
final LocalDate repaymentsScheduleTO = JdbcSupport.getLocalDate(rs, "repaymentsScheduleTO"); final LocalDate repaymentsScheduleTO = JdbcSupport.getLocalDate(rs, "repaymentsScheduleTO");
final Integer statusEnum = JdbcSupport.getInteger(rs, "statusEnum");
final EnumOptionData status = HolidayEnumerations.holidayStatusType(statusEnum);
return new HolidayData(id, name, description, fromDate, toDate, repaymentsScheduleTO); return new HolidayData(id, name, description, fromDate, toDate, repaymentsScheduleTO, status);
} }
} }