MIFOSX-331: merge Khusas work around calendars that was revied by Ashok.2
This commit is contained in:
+4
-4
@@ -10,11 +10,11 @@ package org.mifosplatform.infrastructure.core.data;
|
|||||||
* Immutable data object representing generic enumeration value.
|
* Immutable data object representing generic enumeration value.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class EnumOptionData {
|
public class EnumOptionData {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
private final String code;
|
private final String code;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
public EnumOptionData(final Long id, final String code, final String value) {
|
public EnumOptionData(final Long id, final String code, final String value) {
|
||||||
@@ -27,7 +27,7 @@ public class EnumOptionData {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return this.code;
|
return code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+44
-22
@@ -5,25 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.portfolio.calendar.api;
|
package org.mifosplatform.portfolio.calendar.api;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.DELETE;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.PUT;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.core.Context;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
import javax.ws.rs.core.UriInfo;
|
|
||||||
|
|
||||||
import org.mifosplatform.commands.domain.CommandWrapper;
|
import org.mifosplatform.commands.domain.CommandWrapper;
|
||||||
import org.mifosplatform.commands.service.CommandWrapperBuilder;
|
import org.mifosplatform.commands.service.CommandWrapperBuilder;
|
||||||
import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService;
|
import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||||
@@ -37,12 +18,20 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
|
|||||||
import org.mifosplatform.portfolio.calendar.data.CalendarData;
|
import org.mifosplatform.portfolio.calendar.data.CalendarData;
|
||||||
import org.mifosplatform.portfolio.calendar.domain.Calendar;
|
import org.mifosplatform.portfolio.calendar.domain.Calendar;
|
||||||
import org.mifosplatform.portfolio.calendar.domain.CalendarEntityType;
|
import org.mifosplatform.portfolio.calendar.domain.CalendarEntityType;
|
||||||
|
import org.mifosplatform.portfolio.calendar.domain.CalendarType;
|
||||||
import org.mifosplatform.portfolio.calendar.service.CalendarDropdownReadPlatformService;
|
import org.mifosplatform.portfolio.calendar.service.CalendarDropdownReadPlatformService;
|
||||||
|
import org.mifosplatform.portfolio.calendar.service.CalendarEnumerations;
|
||||||
import org.mifosplatform.portfolio.calendar.service.CalendarReadPlatformService;
|
import org.mifosplatform.portfolio.calendar.service.CalendarReadPlatformService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.UriInfo;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@Path("/{entityType}/{entityId}/calendars")
|
@Path("/{entityType}/{entityId}/calendars")
|
||||||
@Component
|
@Component
|
||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
@@ -102,7 +91,7 @@ public class CalendarsApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String retrieveCalendarsByEntity(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
public String retrieveCalendarsByEntity(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
|
||||||
@Context final UriInfo uriInfo) {
|
@Context final UriInfo uriInfo,@DefaultValue("all") @QueryParam("calendarType") String calendarType) {
|
||||||
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||||
|
|
||||||
@@ -110,15 +99,18 @@ public class CalendarsApiResource {
|
|||||||
|
|
||||||
Collection<CalendarData> calendarsData = new ArrayList<CalendarData>();
|
Collection<CalendarData> calendarsData = new ArrayList<CalendarData>();
|
||||||
|
|
||||||
|
List<EnumOptionData> calendarTypeOptions = createEnumOptionDataListFromQueryParameter(calendarType);
|
||||||
|
|
||||||
|
|
||||||
if (!associationParameters.isEmpty()) {
|
if (!associationParameters.isEmpty()) {
|
||||||
if (associationParameters.contains("parentCalendars")) {
|
if (associationParameters.contains("parentCalendars")) {
|
||||||
calendarsData.addAll(this.readPlatformService.retrieveParentCalendarsByEntity(entityId,
|
calendarsData.addAll(this.readPlatformService.retrieveParentCalendarsByEntity(entityId,
|
||||||
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue()));
|
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue(),calendarTypeOptions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarsData.addAll(this.readPlatformService.retrieveCalendarsByEntity(entityId,
|
calendarsData.addAll(this.readPlatformService.retrieveCalendarsByEntity(entityId,
|
||||||
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue()));
|
CalendarEntityType.valueOf(entityType.toUpperCase()).getValue(),calendarTypeOptions));
|
||||||
|
|
||||||
// Add recurring dates
|
// Add recurring dates
|
||||||
calendarsData = this.readPlatformService.generateRecurringDates(calendarsData);
|
calendarsData = this.readPlatformService.generateRecurringDates(calendarsData);
|
||||||
@@ -192,4 +184,34 @@ public class CalendarsApiResource {
|
|||||||
final List<EnumOptionData> remindByOptions = this.dropdownReadPlatformService.retrieveCalendarRemindByOptions();
|
final List<EnumOptionData> remindByOptions = this.dropdownReadPlatformService.retrieveCalendarRemindByOptions();
|
||||||
return new CalendarData(calendarData, entityTypeOptions, calendarTypeOptions, remindByOptions);
|
return new CalendarData(calendarData, entityTypeOptions, calendarTypeOptions, remindByOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<EnumOptionData> createEnumOptionDataListFromQueryParameter(String calendarTypeQuery) {
|
||||||
|
List<EnumOptionData> calendarTypeOptions = new ArrayList<EnumOptionData>();
|
||||||
|
// adding all calendar Types if
|
||||||
|
if(calendarTypeQuery.equalsIgnoreCase("all")){
|
||||||
|
return calendarTypeOptions;
|
||||||
|
}
|
||||||
|
// creating a list of calendar type options from the comma separated query parameter.
|
||||||
|
List<String> calendarTypeOptionsInQuery = new ArrayList<String>();
|
||||||
|
StringTokenizer st = new StringTokenizer(calendarTypeQuery, ",");
|
||||||
|
while (st.hasMoreElements()) {
|
||||||
|
calendarTypeOptionsInQuery.add(st.nextElement().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(String calType : calendarTypeOptionsInQuery){
|
||||||
|
if(calType.equalsIgnoreCase("collection")) {
|
||||||
|
calendarTypeOptions.add(CalendarEnumerations.calendarType(CalendarType.COLLECTION));
|
||||||
|
} else if(calType.equalsIgnoreCase("training")) {
|
||||||
|
calendarTypeOptions.add(CalendarEnumerations.calendarType(CalendarType.TRAINING));
|
||||||
|
} else if(calType.equalsIgnoreCase("audit")) {
|
||||||
|
calendarTypeOptions.add(CalendarEnumerations.calendarType(CalendarType.AUDIT));
|
||||||
|
} else if(calType.equalsIgnoreCase("general")) {
|
||||||
|
calendarTypeOptions.add(CalendarEnumerations.calendarType(CalendarType.GENERAL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return calendarTypeOptions;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+6
-4
@@ -5,17 +5,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.portfolio.calendar.service;
|
package org.mifosplatform.portfolio.calendar.service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
|
|
||||||
import org.mifosplatform.portfolio.calendar.data.CalendarData;
|
import org.mifosplatform.portfolio.calendar.data.CalendarData;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface CalendarReadPlatformService {
|
public interface CalendarReadPlatformService {
|
||||||
|
|
||||||
CalendarData retrieveCalendar(final Long calendarId, Long entityId, Integer entityTypeId);
|
CalendarData retrieveCalendar(final Long calendarId, Long entityId, Integer entityTypeId);
|
||||||
|
|
||||||
Collection<CalendarData> retrieveCalendarsByEntity(final Long entityId, final Integer entityTypeId);
|
Collection<CalendarData> retrieveCalendarsByEntity(final Long entityId, final Integer entityTypeId, List<EnumOptionData> calendarTypeOptions);
|
||||||
|
|
||||||
Collection<CalendarData> retrieveParentCalendarsByEntity(final Long entityId, final Integer entityTypeId);
|
Collection<CalendarData> retrieveParentCalendarsByEntity(final Long entityId, final Integer entityTypeId, List<EnumOptionData> calendarTypeOptions);
|
||||||
|
|
||||||
Collection<CalendarData> retrieveAllCalendars();
|
Collection<CalendarData> retrieveAllCalendars();
|
||||||
|
|
||||||
|
|||||||
+50
-14
@@ -9,6 +9,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
@@ -84,7 +85,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CalendarData retrieveCalendar(final Long calendarId, Long entityId, Integer entityTypeId) {
|
public CalendarData retrieveCalendar(final Long calendarId, final Long entityId, final Integer entityTypeId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final CalendarDataMapper rm = new CalendarDataMapper();
|
final CalendarDataMapper rm = new CalendarDataMapper();
|
||||||
@@ -98,24 +99,43 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<CalendarData> retrieveCalendarsByEntity(final Long entityId, final Integer entityTypeId) {
|
public Collection<CalendarData> retrieveCalendarsByEntity(final Long entityId, final Integer entityTypeId, final List<EnumOptionData> calendarTypeOptions) {
|
||||||
final CalendarDataMapper rm = new CalendarDataMapper();
|
final CalendarDataMapper rm = new CalendarDataMapper();
|
||||||
|
|
||||||
final String sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? order by c.start_date ";
|
Collection<CalendarData> result=null;
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId });
|
String sql="";
|
||||||
|
|
||||||
|
if (calendarTypeOptions == null || calendarTypeOptions.isEmpty()) {
|
||||||
|
sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? order by c.start_date ";
|
||||||
|
result = this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId });
|
||||||
|
} else if(!calendarTypeOptions.isEmpty()){
|
||||||
|
String sqlCalendarTypeOptions = createSqlValuesInString(calendarTypeOptions);
|
||||||
|
sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? and c.calendar_type_enum in (?) order by c.start_date ";
|
||||||
|
result = this.jdbcTemplate.query(sql,rm, new Object[] {entityId, entityTypeId, sqlCalendarTypeOptions});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<CalendarData> retrieveParentCalendarsByEntity(Long entityId, Integer entityTypeId) {
|
public Collection<CalendarData> retrieveParentCalendarsByEntity( final Long entityId, final Integer entityTypeId, final List<EnumOptionData> calendarTypeOptions ) {
|
||||||
|
|
||||||
final CalendarDataMapper rm = new CalendarDataMapper();
|
final CalendarDataMapper rm = new CalendarDataMapper();
|
||||||
|
Collection<CalendarData> result=null;
|
||||||
|
String sql="";
|
||||||
CalendarEntityType ceType = CalendarEntityType.fromInt(entityTypeId);
|
CalendarEntityType ceType = CalendarEntityType.fromInt(entityTypeId);
|
||||||
String parentHeirarchyCondition = getParentHierarchyCondition(ceType);
|
String parentHeirarchyCondition = getParentHierarchyCondition(ceType);
|
||||||
final String sql = rm.schema() + " " + parentHeirarchyCondition
|
|
||||||
+ " and ci.entity_type_enum = ? order by c.start_date ";
|
|
||||||
//FIXME :AA center is the parent entity of group, change this code to support more parent entity types.
|
//FIXME :AA center is the parent entity of group, change this code to support more parent entity types.
|
||||||
return this.jdbcTemplate.query(sql, rm, new Object[] { entityId, CalendarEntityType.CENTERS.getValue() });
|
if (calendarTypeOptions == null || calendarTypeOptions.isEmpty()) {
|
||||||
|
sql = rm.schema() + " " + parentHeirarchyCondition + " and ci.entity_type_enum = ? order by c.start_date ";
|
||||||
|
result = this.jdbcTemplate.query(sql, rm, new Object[] { entityId, CalendarEntityType.CENTERS.getValue() });
|
||||||
|
} else {
|
||||||
|
String sqlCalendarTypeOptions = createSqlValuesInString(calendarTypeOptions);
|
||||||
|
sql = rm.schema() + " " + parentHeirarchyCondition + " and ci.entity_type_enum = ? and c.calendar_type_enum in ? order by c.start_date ";
|
||||||
|
result = this.jdbcTemplate.query(sql,rm, new Object[] {entityId, entityTypeId, sqlCalendarTypeOptions});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,7 +154,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CalendarData generateRecurringDate(CalendarData calendarData) {
|
public CalendarData generateRecurringDate(final CalendarData calendarData) {
|
||||||
if(!calendarData.isRepeating()) return calendarData;
|
if(!calendarData.isRepeating()) return calendarData;
|
||||||
final String rrule = calendarData.getRecurrence();
|
final String rrule = calendarData.getRecurrence();
|
||||||
final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
|
final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
|
||||||
@@ -155,7 +175,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<CalendarData> generateRecurringDates(Collection<CalendarData> calendarsData) {
|
public Collection<CalendarData> generateRecurringDates(final Collection<CalendarData> calendarsData) {
|
||||||
Collection<CalendarData> recuCalendarsData = new ArrayList<CalendarData>();
|
Collection<CalendarData> recuCalendarsData = new ArrayList<CalendarData>();
|
||||||
|
|
||||||
for (CalendarData calendarData : calendarsData) {
|
for (CalendarData calendarData : calendarsData) {
|
||||||
@@ -166,7 +186,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CalendarData retrieveLoanCalendar(Long loanId) {
|
public CalendarData retrieveLoanCalendar(final Long loanId) {
|
||||||
final CalendarDataMapper rm = new CalendarDataMapper();
|
final CalendarDataMapper rm = new CalendarDataMapper();
|
||||||
|
|
||||||
final String sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? order by c.start_date ";
|
final String sql = rm.schema() + " and ci.entity_id = ? and ci.entity_type_enum = ? order by c.start_date ";
|
||||||
@@ -210,4 +230,20 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ
|
|||||||
return conditionSql;
|
return conditionSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* This method takes the List of calendarType options given in the request and creates a string to be used in the sql statement.
|
||||||
|
* for ex. (1,2,3,4)
|
||||||
|
* @param calendarTypeOptions
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String createSqlValuesInString(final List<EnumOptionData> calendarTypeOptions){
|
||||||
|
int size = calendarTypeOptions.size();
|
||||||
|
String sqlCalendarTypeOptions = "(" + calendarTypeOptions.get(0).getId().toString();
|
||||||
|
for(int i=1;i<size;i++) {
|
||||||
|
sqlCalendarTypeOptions += "," + calendarTypeOptions.get(i).getId().toString();
|
||||||
|
}
|
||||||
|
sqlCalendarTypeOptions += ")";
|
||||||
|
|
||||||
|
return sqlCalendarTypeOptions;
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
-23
@@ -101,7 +101,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final LoanProductReadPlatformService loanProductReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
final LoanProductReadPlatformService loanProductReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
||||||
final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService,
|
final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService,
|
||||||
final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService,
|
final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService,
|
||||||
final CodeValueReadPlatformService codeValueReadPlatformService, final TenantAwareRoutingDataSource dataSource, final CalendarReadPlatformService calendarReadPlatformService) {
|
final CodeValueReadPlatformService codeValueReadPlatformService, final TenantAwareRoutingDataSource dataSource,
|
||||||
|
final CalendarReadPlatformService calendarReadPlatformService) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.loanRepository = loanRepository;
|
this.loanRepository = loanRepository;
|
||||||
this.loanTransactionRepository = loanTransactionRepository;
|
this.loanTransactionRepository = loanTransactionRepository;
|
||||||
@@ -220,7 +221,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray,
|
return this.paginationHelper.fetchPage(this.jdbcTemplate, sqlCountRows, sqlBuilder.toString(), finalObjectArray,
|
||||||
this.loaanLoanMapper);
|
this.loaanLoanMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanAccountData retrieveTemplateWithClientAndProductDetails(final Long clientId, final Long productId) {
|
public LoanAccountData retrieveTemplateWithClientAndProductDetails(final Long clientId, final Long productId) {
|
||||||
|
|
||||||
@@ -471,7 +472,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
|
|
||||||
final Integer loanTypeId = JdbcSupport.getInteger(rs, "loanType");
|
final Integer loanTypeId = JdbcSupport.getInteger(rs, "loanType");
|
||||||
final EnumOptionData loanType = LoanEnumerations.loanType(loanTypeId);
|
final EnumOptionData loanType = LoanEnumerations.loanType(loanTypeId);
|
||||||
|
|
||||||
final Long fundId = JdbcSupport.getLong(rs, "fundId");
|
final Long fundId = JdbcSupport.getLong(rs, "fundId");
|
||||||
final String fundName = rs.getString("fundName");
|
final String fundName = rs.getString("fundName");
|
||||||
|
|
||||||
@@ -843,31 +844,37 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanAccountData retrieveLoanProductDetailsTemplate(Long productId) {
|
public LoanAccountData retrieveLoanProductDetailsTemplate(final Long productId) {
|
||||||
|
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
final LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveLoanProduct(productId);
|
final LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveLoanProduct(productId);
|
||||||
final Collection<EnumOptionData> loanTermFrequencyTypeOptions = loanDropdownReadPlatformService.retrieveLoanTermFrequencyTypeOptions();
|
final Collection<EnumOptionData> loanTermFrequencyTypeOptions = loanDropdownReadPlatformService
|
||||||
final Collection<EnumOptionData> repaymentFrequencyTypeOptions = loanDropdownReadPlatformService.retrieveRepaymentFrequencyTypeOptions();
|
.retrieveLoanTermFrequencyTypeOptions();
|
||||||
final Collection<EnumOptionData> interestRateFrequencyTypeOptions = loanDropdownReadPlatformService.retrieveInterestRateFrequencyTypeOptions();
|
final Collection<EnumOptionData> repaymentFrequencyTypeOptions = loanDropdownReadPlatformService
|
||||||
|
.retrieveRepaymentFrequencyTypeOptions();
|
||||||
|
final Collection<EnumOptionData> interestRateFrequencyTypeOptions = loanDropdownReadPlatformService
|
||||||
|
.retrieveInterestRateFrequencyTypeOptions();
|
||||||
final Collection<EnumOptionData> amortizationTypeOptions = loanDropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
final Collection<EnumOptionData> amortizationTypeOptions = loanDropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
||||||
final Collection<EnumOptionData> interestTypeOptions = loanDropdownReadPlatformService.retrieveLoanInterestTypeOptions();
|
final Collection<EnumOptionData> interestTypeOptions = loanDropdownReadPlatformService.retrieveLoanInterestTypeOptions();
|
||||||
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions = loanDropdownReadPlatformService.retrieveLoanInterestRateCalculatedInPeriodOptions();
|
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions = loanDropdownReadPlatformService
|
||||||
|
.retrieveLoanInterestRateCalculatedInPeriodOptions();
|
||||||
final Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
final Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
||||||
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions = this.loanDropdownReadPlatformService.retreiveTransactionProcessingStrategies();
|
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions = this.loanDropdownReadPlatformService
|
||||||
|
.retreiveTransactionProcessingStrategies();
|
||||||
final Collection<CodeValueData> loanPurposeOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanPurpose");
|
final Collection<CodeValueData> loanPurposeOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanPurpose");
|
||||||
final Collection<CodeValueData> loanCollateralOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanCollateral");
|
final Collection<CodeValueData> loanCollateralOptions = this.codeValueReadPlatformService
|
||||||
|
.retrieveCodeValuesByCode("LoanCollateral");
|
||||||
final boolean feeChargesOnly = false;
|
final boolean feeChargesOnly = false;
|
||||||
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
|
final Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
|
||||||
|
|
||||||
return LoanAccountData.loanProductWithTemplateDefaults(loanProduct, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
return LoanAccountData.loanProductWithTemplateDefaults(loanProduct, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions,
|
repaymentStrategyOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions,
|
||||||
interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, loanPurposeOptions, loanCollateralOptions);
|
interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, loanPurposeOptions, loanCollateralOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanAccountData retrieveClientDetailsTemplate(Long clientId) {
|
public LoanAccountData retrieveClientDetailsTemplate(final Long clientId) {
|
||||||
|
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
|
|
||||||
@@ -879,7 +886,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanAccountData retrieveGroupDetailsTemplate(Long groupId) {
|
public LoanAccountData retrieveGroupDetailsTemplate(final Long groupId) {
|
||||||
context.authenticatedUser();
|
context.authenticatedUser();
|
||||||
final GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
|
final GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
|
||||||
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
||||||
@@ -887,27 +894,28 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanAccountData retrieveGroupAndMembersDetailsTemplate(Long groupId) {
|
public LoanAccountData retrieveGroupAndMembersDetailsTemplate(final Long groupId) {
|
||||||
GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
|
GroupGeneralData groupAccount = this.groupReadPlatformService.retrieveOne(groupId);
|
||||||
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
final LocalDate expectedDisbursementDate = DateUtils.getLocalDateOfTenant();
|
||||||
|
|
||||||
// get group associations
|
// get group associations
|
||||||
Collection<ClientData> membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
|
Collection<ClientData> membersOfGroup = this.clientReadPlatformService.retrieveClientMembersOfGroup(groupId);
|
||||||
if (!CollectionUtils.isEmpty(membersOfGroup)) {
|
if (!CollectionUtils.isEmpty(membersOfGroup)) {
|
||||||
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup);
|
groupAccount = GroupGeneralData.withAssocations(groupAccount, membersOfGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoanAccountData.groupDefaults(groupAccount, expectedDisbursementDate);
|
return LoanAccountData.groupDefaults(groupAccount, expectedDisbursementDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<CalendarData> retrieveCalendars(Long groupId) {
|
public Collection<CalendarData> retrieveCalendars(final Long groupId) {
|
||||||
Collection<CalendarData> calendarsData = new ArrayList<CalendarData>();
|
Collection<CalendarData> calendarsData = new ArrayList<CalendarData>();
|
||||||
calendarsData.addAll(this.calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId,CalendarEntityType.GROUPS.getValue()));
|
calendarsData.addAll(this.calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId,
|
||||||
calendarsData.addAll(this.calendarReadPlatformService.retrieveCalendarsByEntity(groupId,CalendarEntityType.GROUPS.getValue()));
|
CalendarEntityType.GROUPS.getValue(), null));
|
||||||
|
calendarsData
|
||||||
|
.addAll(this.calendarReadPlatformService.retrieveCalendarsByEntity(groupId, CalendarEntityType.GROUPS.getValue(), null));
|
||||||
calendarsData = this.calendarReadPlatformService.generateRecurringDates(calendarsData);
|
calendarsData = this.calendarReadPlatformService.generateRecurringDates(calendarsData);
|
||||||
return calendarsData;
|
return calendarsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user