tidy up typical response parameters for loan GET requests.

This commit is contained in:
Keith Woodlock
2012-09-14 17:09:25 +01:00
parent 63e0f8e64b
commit 712ba4d69e
@@ -94,18 +94,10 @@ public class LoansApiResource {
@Autowired @Autowired
private StaffReadPlatformService staffReadPlatformService; private StaffReadPlatformService staffReadPlatformService;
@GET private final static Set<String> typicalResponseParameters = new HashSet<String>(
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveDetailsForNewLoanApplicationStepOne(
@QueryParam("clientId") final Long clientId,
@QueryParam("productId") final Long productId,
@Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "externalId", "clientId", "clientName", "fundId", "fundName", Arrays.asList("id", "externalId", "clientId", "clientName", "fundId", "fundName",
"loanProductId", "loanProductName", "loanProductDescription", "loanProductId", "loanProductName", "loanProductDescription",
"loanOfficerName", "loanOfficerId",
"currency", "principal", "currency", "principal",
"inArrearsTolerance", "numberOfRepayments", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "repaymentEvery", "interestRatePerPeriod",
@@ -117,10 +109,17 @@ public class LoansApiResource {
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "expectedFirstRepaymentOnDate", "interestChargedFromDate",
"closedOnDate", "expectedMaturityDate", "closedOnDate", "expectedMaturityDate",
"status", "status",
"lifeCycleStatusDate", "summary", "repaymentSchedule", "lifeCycleStatusDate"));
"loanRepayments", "permissions", "convenienceData", "charges",
"loanOfficerOptions") @GET
); @Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveDetailsForNewLoanApplicationStepOne(
@QueryParam("clientId") final Long clientId,
@QueryParam("productId") final Long productId,
@Context final UriInfo uriInfo) {
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { if (responseParameters.isEmpty()) {
@@ -156,7 +155,6 @@ public class LoansApiResource {
final boolean convenienceDataRequired = false; final boolean convenienceDataRequired = false;
Collection<ChargeData> charges = loanBasicDetails.getCharges(); Collection<ChargeData> charges = loanBasicDetails.getCharges();
// populate loan officers if query param is passed in
Collection<StaffData> allowedLoanOfficers = this.staffReadPlatformService.retrieveAllLoanOfficersByOffice(loanBasicDetails.getClientOfficeId()); Collection<StaffData> allowedLoanOfficers = this.staffReadPlatformService.retrieveAllLoanOfficersByOffice(loanBasicDetails.getClientOfficeId());
final LoanAccountData newLoanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, null, null, null, charges, final LoanAccountData newLoanAccount = new LoanAccountData(loanBasicDetails, convenienceDataRequired, null, null, null, charges,
@@ -175,17 +173,6 @@ public class LoansApiResource {
@PathParam("loanId") final Long loanId, @PathParam("loanId") final Long loanId,
@Context final UriInfo uriInfo) { @Context final UriInfo uriInfo) {
Set<String> typicalResponseParameters = new HashSet<String>(
Arrays.asList("id", "externalId", "clientId", "clientName", "fundId", "fundName", "loanProductId", "loanProductName", "loanProductDescription",
"currency",
"principal", "inArrearsTolerance", "numberOfRepayments",
"repaymentEvery", "interestRatePerPeriod", "annualInterestRate",
"repaymentFrequencyType", "interestRateFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType",
"submittedOnDate", "approvedOnDate", "expectedDisbursementDate", "actualDisbursementDate",
"expectedFirstRepaymentOnDate", "interestChargedFromDate", "closedOnDate", "expectedMaturityDate",
"status", "lifeCycleStatusDate", "loanOfficerName", "loanOfficerId")
);
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters); responseParameters.addAll(typicalResponseParameters);