WIP filtering loans

This commit is contained in:
John Woodlock
2012-05-27 20:38:35 +10:00
parent 25484f8409
commit 64849cba7b
4 changed files with 275 additions and 160 deletions
@@ -11,7 +11,7 @@ import org.joda.time.LocalDate;
import org.joda.time.Months; import org.joda.time.Months;
@XmlRootElement(name = "loan") @XmlRootElement(name = "loan")
@JsonFilter("myFilter") @JsonFilter("loanFilter")
public class LoanAccountData { public class LoanAccountData {
private boolean open; private boolean open;
@@ -2,11 +2,13 @@ package org.mifosng.data;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.map.annotate.JsonFilter;
import org.joda.time.DateMidnight; import org.joda.time.DateMidnight;
import org.joda.time.Days; import org.joda.time.Days;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
@XmlRootElement @XmlRootElement
@JsonFilter("loanRepaymentFilter")
public class LoanRepaymentData { public class LoanRepaymentData {
private Long id; private Long id;
@@ -45,59 +45,81 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class LoansApiResource { public class LoansApiResource {
private String allowedFieldList = "";
private String filterName = "myFilter"; private String filterName = "myFilter";
private String allowedFieldList = "";
@Autowired @Autowired
private LoanReadPlatformService loanReadPlatformService; private LoanReadPlatformService loanReadPlatformService;
@Autowired @Autowired
private LoanWritePlatformService loanWritePlatformService; private LoanWritePlatformService loanWritePlatformService;
@Autowired @Autowired
private CalculationPlatformService calculationPlatformService; private CalculationPlatformService calculationPlatformService;
@Autowired @Autowired
private ApiDataConversionService apiDataConversionService; private ApiDataConversionService apiDataConversionService;
@Autowired @Autowired
private ApiJSONFormattingService jsonFormattingService; private ApiJSONFormattingService jsonFormattingService;
@GET @GET
@Path("template") @Path("template")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public String retrieveDetailsForNewLoanApplicationStepOne(@QueryParam("clientId") final Long clientId, @QueryParam("productId") final Long productId, @Context UriInfo uriInfo) { public String retrieveDetailsForNewLoanApplicationStepOne(
@QueryParam("clientId") final Long clientId,
@QueryParam("productId") final Long productId,
@Context UriInfo uriInfo) {
NewLoanWorkflowStepOneData workflowData = this.loanReadPlatformService.retrieveClientAndProductDetails(clientId, productId); NewLoanWorkflowStepOneData workflowData = this.loanReadPlatformService
.retrieveClientAndProductDetails(clientId, productId);
String selectedFields = ""; String selectedFields = "";
return this.jsonFormattingService.convertRequest(workflowData, filterName, return this.jsonFormattingService.convertRequest(workflowData,
allowedFieldList, selectedFields, uriInfo.getQueryParameters()); filterName, allowedFieldList, selectedFields,
uriInfo.getQueryParameters());
} }
@GET @GET
@Path("{loanId}") @Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public String retrieveLoanAccountDetails(@PathParam("loanId") final Long loanId, @Context UriInfo uriInfo) { public String retrieveLoanAccountDetails(
@PathParam("loanId") final Long loanId, @Context UriInfo uriInfo) {
LoanAccountData loanAccount = this.loanReadPlatformService.retrieveLoanAccountDetails(loanId); LoanAccountData loanAccount = this.loanReadPlatformService
.retrieveLoanAccountDetails(loanId);
String specificFilterName = "loanFilter";
String selectedFields = ""; String selectedFields = "";
return this.jsonFormattingService.convertRequest(loanAccount, filterName, return this.jsonFormattingService.convertRequest(loanAccount,
allowedFieldList, selectedFields, uriInfo.getQueryParameters()); specificFilterName, allowedFieldList, selectedFields,
uriInfo.getQueryParameters());
} }
@POST @POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response calculateLoanSchedule(@QueryParam("command") final String commandParam, final SubmitLoanApplicationCommand command) { public Response calculateLoanSchedule(
@QueryParam("command") final String commandParam,
final SubmitLoanApplicationCommand command) {
LocalDate expectedDisbursementDate = apiDataConversionService.convertFrom(command.getExpectedDisbursementDateFormatted(), "expectedDisbursementDateFormatted", command.getDateFormat()); LocalDate expectedDisbursementDate = apiDataConversionService
LocalDate repaymentsStartingFromDate = apiDataConversionService.convertFrom(command.getRepaymentsStartingFromDateFormatted(), "repaymentsStartingFromDateFormatted", command.getDateFormat()); .convertFrom(command.getExpectedDisbursementDateFormatted(),
LocalDate interestCalculatedFromDate = apiDataConversionService.convertFrom(command.getInterestCalculatedFromDateFormatted(), "interestCalculatedFromDateFormatted", command.getDateFormat()); "expectedDisbursementDateFormatted",
LocalDate submittedOnDate = apiDataConversionService.convertFrom(command.getSubmittedOnDateFormatted(), "submittedOnDateFormatted", command.getDateFormat()); command.getDateFormat());
LocalDate repaymentsStartingFromDate = apiDataConversionService
.convertFrom(command.getRepaymentsStartingFromDateFormatted(),
"repaymentsStartingFromDateFormatted",
command.getDateFormat());
LocalDate interestCalculatedFromDate = apiDataConversionService
.convertFrom(command.getInterestCalculatedFromDateFormatted(),
"interestCalculatedFromDateFormatted",
command.getDateFormat());
LocalDate submittedOnDate = apiDataConversionService.convertFrom(
command.getSubmittedOnDateFormatted(),
"submittedOnDateFormatted", command.getDateFormat());
command.setExpectedDisbursementDate(expectedDisbursementDate); command.setExpectedDisbursementDate(expectedDisbursementDate);
command.setRepaymentsStartingFromDate(repaymentsStartingFromDate); command.setRepaymentsStartingFromDate(repaymentsStartingFromDate);
command.setInterestCalculatedFromDate(interestCalculatedFromDate); command.setInterestCalculatedFromDate(interestCalculatedFromDate);
@@ -105,64 +127,89 @@ public class LoansApiResource {
// FIXME - pass in locale through query string or in 'request body' // FIXME - pass in locale through query string or in 'request body'
Locale clientApplicationLocale = Locale.UK; Locale clientApplicationLocale = Locale.UK;
BigDecimal principal = this.apiDataConversionService.convertFrom(command.getPrincipalFormatted(), "principalFormatted", clientApplicationLocale); BigDecimal principal = this.apiDataConversionService.convertFrom(
BigDecimal interestRatePerPeriod = this.apiDataConversionService.convertFrom(command.getInterestRatePerPeriodFormatted(), "interestRatePerPeriodFormatted", clientApplicationLocale); command.getPrincipalFormatted(), "principalFormatted",
BigDecimal inArrearsToleranceAmount = this.apiDataConversionService.convertFrom(command.getInArrearsToleranceAmountFormatted(), "inArrearsToleranceAmountFormatted", clientApplicationLocale); clientApplicationLocale);
BigDecimal interestRatePerPeriod = this.apiDataConversionService
.convertFrom(command.getInterestRatePerPeriodFormatted(),
"interestRatePerPeriodFormatted",
clientApplicationLocale);
BigDecimal inArrearsToleranceAmount = this.apiDataConversionService
.convertFrom(command.getInArrearsToleranceAmountFormatted(),
"inArrearsToleranceAmountFormatted",
clientApplicationLocale);
command.setPrincipal(principal); command.setPrincipal(principal);
command.setInterestRatePerPeriod(interestRatePerPeriod); command.setInterestRatePerPeriod(interestRatePerPeriod);
command.setInArrearsToleranceAmount(inArrearsToleranceAmount); command.setInArrearsToleranceAmount(inArrearsToleranceAmount);
CalculateLoanScheduleCommand calculateLoanScheduleCommand = command.toCalculateLoanScheduleCommand(); CalculateLoanScheduleCommand calculateLoanScheduleCommand = command
LoanSchedule loanSchedule = this.calculationPlatformService.calculateLoanSchedule(calculateLoanScheduleCommand); .toCalculateLoanScheduleCommand();
LoanSchedule loanSchedule = this.calculationPlatformService
.calculateLoanSchedule(calculateLoanScheduleCommand);
// for now just auto generating the loan schedule and setting support for 'manual' loan schedule creation later. // for now just auto generating the loan schedule and setting support
// for 'manual' loan schedule creation later.
command.setLoanSchedule(loanSchedule); command.setLoanSchedule(loanSchedule);
if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("calculateLoanSchedule")) { if (StringUtils.isNotBlank(commandParam)
&& commandParam.trim()
.equalsIgnoreCase("calculateLoanSchedule")) {
return Response.ok().entity(loanSchedule).build(); return Response.ok().entity(loanSchedule).build();
} }
EntityIdentifier identifier = this.loanWritePlatformService.submitLoanApplication(command); EntityIdentifier identifier = this.loanWritePlatformService
.submitLoanApplication(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@DELETE @DELETE
@Path("{loanId}") @Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response deleteLoanApplication(@PathParam("loanId") final Long loanId) { public Response deleteLoanApplication(@PathParam("loanId") final Long loanId) {
EntityIdentifier identifier = this.loanWritePlatformService.deleteLoan(loanId); EntityIdentifier identifier = this.loanWritePlatformService
.deleteLoan(loanId);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@POST @POST
@Path("{loanId}") @Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response stateTransitions(@PathParam("loanId") final Long loanId, public Response stateTransitions(@PathParam("loanId") final Long loanId,
@QueryParam("command") final String commandParam, @QueryParam("command") final String commandParam,
final LoanStateTransitionCommand command) { final LoanStateTransitionCommand command) {
LocalDate eventDate = this.apiDataConversionService.convertFrom(command.getEventDateFormatted(), "eventDateFormatted", command.getDateFormat()); LocalDate eventDate = this.apiDataConversionService.convertFrom(
command.getEventDateFormatted(), "eventDateFormatted",
command.getDateFormat());
command.setLoanId(loanId); command.setLoanId(loanId);
command.setEventDate(eventDate); command.setEventDate(eventDate);
if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("reject")) { if (StringUtils.isNotBlank(commandParam)
EntityIdentifier identifier = this.loanWritePlatformService.rejectLoan(command); && commandParam.trim().equalsIgnoreCase("reject")) {
EntityIdentifier identifier = this.loanWritePlatformService
.rejectLoan(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} else if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("withdrewbyclient")) { } else if (StringUtils.isNotBlank(commandParam)
EntityIdentifier identifier = this.loanWritePlatformService.withdrawLoan(command); && commandParam.trim().equalsIgnoreCase("withdrewbyclient")) {
EntityIdentifier identifier = this.loanWritePlatformService
.withdrawLoan(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} else if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("approve")) { } else if (StringUtils.isNotBlank(commandParam)
EntityIdentifier identifier = this.loanWritePlatformService.approveLoanApplication(command); && commandParam.trim().equalsIgnoreCase("approve")) {
EntityIdentifier identifier = this.loanWritePlatformService
.approveLoanApplication(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} else if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("disburse")) { } else if (StringUtils.isNotBlank(commandParam)
EntityIdentifier identifier = this.loanWritePlatformService.disburseLoan(command); && commandParam.trim().equalsIgnoreCase("disburse")) {
EntityIdentifier identifier = this.loanWritePlatformService
.disburseLoan(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@@ -171,17 +218,25 @@ public class LoansApiResource {
@POST @POST
@Path("{loanId}/undo") @Path("{loanId}/undo")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response undoStateTransitions(@PathParam("loanId") final Long loanId, @QueryParam("command") final String commandParam) { public Response undoStateTransitions(
@PathParam("loanId") final Long loanId,
@QueryParam("command") final String commandParam) {
if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("undoapproval")) { if (StringUtils.isNotBlank(commandParam)
UndoLoanApprovalCommand undoCommand = new UndoLoanApprovalCommand(loanId); && commandParam.trim().equalsIgnoreCase("undoapproval")) {
EntityIdentifier identifier = this.loanWritePlatformService.undoLoanApproval(undoCommand); UndoLoanApprovalCommand undoCommand = new UndoLoanApprovalCommand(
loanId);
EntityIdentifier identifier = this.loanWritePlatformService
.undoLoanApproval(undoCommand);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} else if (StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase("undodisbursal")) { } else if (StringUtils.isNotBlank(commandParam)
UndoLoanDisbursalCommand undoCommand = new UndoLoanDisbursalCommand(loanId); && commandParam.trim().equalsIgnoreCase("undodisbursal")) {
EntityIdentifier identifier = this.loanWritePlatformService.undloLoanDisbursal(undoCommand); UndoLoanDisbursalCommand undoCommand = new UndoLoanDisbursalCommand(
loanId);
EntityIdentifier identifier = this.loanWritePlatformService
.undloLoanDisbursal(undoCommand);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@@ -190,69 +245,107 @@ public class LoansApiResource {
@POST @POST
@Path("{loanId}/transactions") @Path("{loanId}/transactions")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response executeLoanTransaction(@PathParam("loanId") final Long loanId, @QueryParam("transactionType") final String transactionType, final LoanTransactionCommand command) { public Response executeLoanTransaction(
@PathParam("loanId") final Long loanId,
@QueryParam("transactionType") final String transactionType,
final LoanTransactionCommand command) {
command.setLoanId(loanId); command.setLoanId(loanId);
LocalDate transactionDate = apiDataConversionService.convertFrom(command.getTransactionDateFormatted(), "transactionDateFormatted", command.getDateFormat()); LocalDate transactionDate = apiDataConversionService.convertFrom(
command.getTransactionDateFormatted(),
"transactionDateFormatted", command.getDateFormat());
command.setTransactionDate(transactionDate); command.setTransactionDate(transactionDate);
BigDecimal transactionAmount = apiDataConversionService.convertFrom(command.getTransactionAmountFormatted(), "transactionAmountFormatted", Locale.UK); BigDecimal transactionAmount = apiDataConversionService.convertFrom(
command.getTransactionAmountFormatted(),
"transactionAmountFormatted", Locale.UK);
command.setTransactionAmount(transactionAmount); command.setTransactionAmount(transactionAmount);
if (StringUtils.isNotBlank(transactionType) && transactionType.trim().equalsIgnoreCase("waiver")) { if (StringUtils.isNotBlank(transactionType)
EntityIdentifier identifier = this.loanWritePlatformService.waiveLoanAmount(command); && transactionType.trim().equalsIgnoreCase("waiver")) {
EntityIdentifier identifier = this.loanWritePlatformService
.waiveLoanAmount(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
EntityIdentifier identifier = this.loanWritePlatformService.makeLoanRepayment(command); EntityIdentifier identifier = this.loanWritePlatformService
.makeLoanRepayment(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@GET @GET
@Path("{loanId}/transactions/template") @Path("{loanId}/transactions/template")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response retrieveNewRepaymentDetails(@PathParam("loanId") final Long loanId, @QueryParam("type") final String transactionType, @Context UriInfo uriInfo) { public String retrieveNewRepaymentDetails(
@PathParam("loanId") final Long loanId,
@QueryParam("type") final String transactionType,
@Context UriInfo uriInfo) {
if (StringUtils.isNotBlank(transactionType) && transactionType.trim().equalsIgnoreCase("waiver")) { String specificFilterName = "loanFilter";
LoanRepaymentData loanWaiverData = this.loanReadPlatformService.retrieveNewLoanWaiverDetails(loanId); String selectedFields = "";
return Response.ok().entity(loanWaiverData).build(); if (StringUtils.isNotBlank(transactionType)
&& transactionType.trim().equalsIgnoreCase("waiver")) {
LoanRepaymentData loanWaiverData = this.loanReadPlatformService
.retrieveNewLoanWaiverDetails(loanId);
return this.jsonFormattingService.convertRequest(loanWaiverData,
specificFilterName, allowedFieldList, selectedFields,
uriInfo.getQueryParameters());
} }
LoanRepaymentData loanRepaymentData = this.loanReadPlatformService.retrieveNewLoanRepaymentDetails(loanId); LoanRepaymentData loanRepaymentData = this.loanReadPlatformService
return Response.ok().entity(loanRepaymentData).build(); .retrieveNewLoanRepaymentDetails(loanId);
return this.jsonFormattingService.convertRequest(loanRepaymentData,
specificFilterName, allowedFieldList, selectedFields,
uriInfo.getQueryParameters());
} }
@GET @GET
@Path("{loanId}/transactions/{repaymentId}") @Path("{loanId}/transactions/{repaymentId}")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON })
public Response retrieveRepaymentDetails(@PathParam("loanId") final Long loanId, @PathParam("repaymentId") final Long repaymentId) { public String retrieveRepaymentDetails(
@PathParam("loanId") final Long loanId,
@PathParam("repaymentId") final Long repaymentId,
@Context UriInfo uriInfo) {
LoanRepaymentData loanRepaymentData = this.loanReadPlatformService.retrieveLoanRepaymentDetails(loanId, repaymentId); LoanRepaymentData loanRepaymentData = this.loanReadPlatformService
.retrieveLoanRepaymentDetails(loanId, repaymentId);
return Response.ok().entity(loanRepaymentData).build(); String specificFilterName = "loanFilter";
String selectedFields = "";
return this.jsonFormattingService.convertRequest(loanRepaymentData,
specificFilterName, allowedFieldList, selectedFields,
uriInfo.getQueryParameters());
} }
@PUT @PUT
@Path("{loanId}/transactions/{repaymentId}") @Path("{loanId}/transactions/{repaymentId}")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response adjustLoanTransaction(@PathParam("loanId") final Long loanId, @PathParam("repaymentId") final Long repaymentId, final AdjustLoanTransactionCommand command) { public Response adjustLoanTransaction(
@PathParam("loanId") final Long loanId,
@PathParam("repaymentId") final Long repaymentId,
final AdjustLoanTransactionCommand command) {
command.setLoanId(loanId); command.setLoanId(loanId);
command.setRepaymentId(repaymentId); command.setRepaymentId(repaymentId);
LocalDate transactionDate = apiDataConversionService.convertFrom(command.getTransactionDateFormatted(), "transactionDateFormatted", command.getDateFormat()); LocalDate transactionDate = apiDataConversionService.convertFrom(
command.getTransactionDateFormatted(),
"transactionDateFormatted", command.getDateFormat());
command.setTransactionDate(transactionDate); command.setTransactionDate(transactionDate);
BigDecimal transactionAmount = apiDataConversionService.convertFrom(command.getTransactionAmountFormatted(), "transactionAmountFormatted", Locale.UK); BigDecimal transactionAmount = apiDataConversionService.convertFrom(
command.getTransactionAmountFormatted(),
"transactionAmountFormatted", Locale.UK);
command.setTransactionAmount(transactionAmount); command.setTransactionAmount(transactionAmount);
EntityIdentifier identifier = this.loanWritePlatformService.adjustLoanTransaction(command); EntityIdentifier identifier = this.loanWritePlatformService
.adjustLoanTransaction(command);
return Response.ok().entity(identifier).build(); return Response.ok().entity(identifier).build();
} }
@@ -121,6 +121,29 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
filterFields.add(st.nextToken().trim()); filterFields.add(st.nextToken().trim());
} }
if (filterName.equals("loanFilter")) {
Set<String> loanRepaymentFields = new HashSet<String>();
if (filterType.equals("I")) {
return new SimpleFilterProvider().addFilter(
filterName,
SimpleBeanPropertyFilter
.filterOutAllExcept(filterFields)).addFilter(
"loanRepaymentFilter",
SimpleBeanPropertyFilter
.serializeAllExcept(loanRepaymentFields));
}
return new SimpleFilterProvider().addFilter(filterName,
SimpleBeanPropertyFilter.serializeAllExcept(filterFields))
.addFilter(
"loanRepaymentFilter",
SimpleBeanPropertyFilter
.serializeAllExcept(loanRepaymentFields));
}
if (filterName.equals("myFilter")) { if (filterName.equals("myFilter")) {
if (filterType.equals("I")) { if (filterType.equals("I")) {
@@ -130,9 +153,8 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
} }
return new SimpleFilterProvider().addFilter(filterName, return new SimpleFilterProvider().addFilter(filterName,
SimpleBeanPropertyFilter SimpleBeanPropertyFilter.serializeAllExcept(filterFields));
.serializeAllExcept(filterFields));
} }
if (filterName.equals("roleFilter")) { if (filterName.equals("roleFilter")) {
@@ -156,13 +178,12 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
} }
return new SimpleFilterProvider().addFilter( return new SimpleFilterProvider().addFilter(filterName,
filterName, SimpleBeanPropertyFilter.serializeAllExcept(filterFields))
SimpleBeanPropertyFilter .addFilter(
.serializeAllExcept(filterFields)).addFilter( "permissionFilter",
"permissionFilter", SimpleBeanPropertyFilter
SimpleBeanPropertyFilter .filterOutAllExcept(permissionFields));
.filterOutAllExcept(permissionFields));
} }
// ADDED BY KEITH - list permissions didnt seem to be working right. // ADDED BY KEITH - list permissions didnt seem to be working right.
@@ -175,13 +196,12 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
permissionFields.add("code"); permissionFields.add("code");
permissionFields.add("groupType"); permissionFields.add("groupType");
return new SimpleFilterProvider().addFilter( return new SimpleFilterProvider().addFilter(filterName,
filterName, SimpleBeanPropertyFilter.filterOutAllExcept(filterFields))
SimpleBeanPropertyFilter .addFilter(
.filterOutAllExcept(filterFields)).addFilter( "permissionFilter",
"permissionFilter", SimpleBeanPropertyFilter
SimpleBeanPropertyFilter .filterOutAllExcept(permissionFields));
.filterOutAllExcept(permissionFields));
} }
if (filterName.equals("userFilter")) { if (filterName.equals("userFilter")) {
@@ -218,19 +238,19 @@ public class ApiJSONFormattingServiceImpl implements ApiJSONFormattingService {
} }
return new SimpleFilterProvider() return new SimpleFilterProvider()
.addFilter( .addFilter(
filterName, filterName,
SimpleBeanPropertyFilter SimpleBeanPropertyFilter
.serializeAllExcept(filterFields)) .serializeAllExcept(filterFields))
.addFilter( .addFilter(
"roleFilter", "roleFilter",
SimpleBeanPropertyFilter SimpleBeanPropertyFilter
.filterOutAllExcept(roleFields)) .filterOutAllExcept(roleFields))
.addFilter( .addFilter(
"permissionFilter", "permissionFilter",
SimpleBeanPropertyFilter SimpleBeanPropertyFilter
.filterOutAllExcept(permissionFields)); .filterOutAllExcept(permissionFields));
} }
return filters; return filters;