diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java index 8866d46a0..25f974a6b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java @@ -10,12 +10,13 @@ import java.util.HashSet; import java.util.Set; public class RescheduleLoansApiConstants { - public final static String ENTITY_NAME = "RESCHEDULELOAN"; - - // general + + public final static String ENTITY_NAME = "RESCHEDULELOAN"; + + // general public static final String localeParamName = "locale"; public static final String dateFormatParamName = "dateFormat"; - + // create action request parameters public static final String loanIdParamName = "loanId"; public static final String graceOnPrincipalParamName = "graceOnPrincipal"; @@ -28,21 +29,21 @@ public class RescheduleLoansApiConstants { public static final String rescheduleReasonCommentParamName = "rescheduleReasonComment"; public static final String submittedOnDateParamName = "submittedOnDate"; public static final String adjustedDueDateParamName = "adjustedDueDate"; - - public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, - dateFormatParamName, graceOnPrincipalParamName, graceOnInterestParamName, extraTermsParamName, - rescheduleFromDateParamName, newInterestRateParamName, rescheduleReasonIdParamName, rescheduleReasonCommentParamName, - submittedOnDateParamName, loanIdParamName, adjustedDueDateParamName, recalculateInterestParamName)); - + + public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, + graceOnPrincipalParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName, + newInterestRateParamName, rescheduleReasonIdParamName, rescheduleReasonCommentParamName, submittedOnDateParamName, + loanIdParamName, adjustedDueDateParamName, recalculateInterestParamName)); + // reject action request parameters public static final String rejectedOnDateParam = "rejectedOnDate"; - - public static final Set REJECT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, - dateFormatParamName, rejectedOnDateParam)); - + + public static final Set REJECT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, + rejectedOnDateParam)); + // approve action request parameters public static final String approvedOnDateParam = "approvedOnDate"; - - public static final Set APPROVE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, - dateFormatParamName, approvedOnDateParam)); + + public static final Set APPROVE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, + approvedOnDateParam)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java index cf3c53150..d9351a5f6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java @@ -42,109 +42,103 @@ import org.springframework.stereotype.Component; @Component @Scope("singleton") public class RescheduleLoansApiResource { - - private final DefaultToApiJsonSerializer loanRescheduleRequestToApiJsonSerializer; - private final DefaultToApiJsonSerializer loanRescheduleToApiJsonSerializer; - private final PlatformSecurityContext platformSecurityContext; - private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; - private final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService; - private final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService; - private final ApiRequestParameterHelper apiRequestParameterHelper; - - @Autowired - public RescheduleLoansApiResource( - final DefaultToApiJsonSerializer loanRescheduleRequestToApiJsonSerializer, - final PlatformSecurityContext platformSecurityContext, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService, - final ApiRequestParameterHelper apiRequestParameterHelper, - final DefaultToApiJsonSerializer loanRescheduleToApiJsonSerializer, - final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService) { - this.loanRescheduleRequestToApiJsonSerializer = loanRescheduleRequestToApiJsonSerializer; - this.platformSecurityContext = platformSecurityContext; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.loanRescheduleRequestReadPlatformService = loanRescheduleRequestReadPlatformService; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.loanRescheduleToApiJsonSerializer = loanRescheduleToApiJsonSerializer; - this.loanReschedulePreviewPlatformService = loanReschedulePreviewPlatformService; - } - - @GET - @Path("{requestId}") - @Consumes({ MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_JSON }) - public String readLoanRescheduleRequest(@Context final UriInfo uriInfo, @PathParam("requestId") final Long requestId, - @QueryParam("command") final String command) { - this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME); - - final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper - .process(uriInfo.getQueryParameters()); - - if(compareIgnoreCase(command, "previewLoanReschedule")) { - final LoanRescheduleModel loanRescheduleModel = this.loanReschedulePreviewPlatformService.previewLoanReschedule(requestId); - - return this.loanRescheduleToApiJsonSerializer.serialize(settings, loanRescheduleModel.toData(), new HashSet()); - } - - final LoanRescheduleRequestData loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService - .readLoanRescheduleRequest(requestId); - - return this.loanRescheduleRequestToApiJsonSerializer.serialize(settings, loanRescheduleRequestData); - } - - @POST + + private final DefaultToApiJsonSerializer loanRescheduleRequestToApiJsonSerializer; + private final DefaultToApiJsonSerializer loanRescheduleToApiJsonSerializer; + private final PlatformSecurityContext platformSecurityContext; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService; + private final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + + @Autowired + public RescheduleLoansApiResource(final DefaultToApiJsonSerializer loanRescheduleRequestToApiJsonSerializer, + final PlatformSecurityContext platformSecurityContext, + final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, + final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService, + final ApiRequestParameterHelper apiRequestParameterHelper, + final DefaultToApiJsonSerializer loanRescheduleToApiJsonSerializer, + final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService) { + this.loanRescheduleRequestToApiJsonSerializer = loanRescheduleRequestToApiJsonSerializer; + this.platformSecurityContext = platformSecurityContext; + this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; + this.loanRescheduleRequestReadPlatformService = loanRescheduleRequestReadPlatformService; + this.apiRequestParameterHelper = apiRequestParameterHelper; + this.loanRescheduleToApiJsonSerializer = loanRescheduleToApiJsonSerializer; + this.loanReschedulePreviewPlatformService = loanReschedulePreviewPlatformService; + } + + @GET + @Path("{requestId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String createLoanRescheduleRequest(final String apiRequestBodyAsJson) { - final CommandWrapper commandWrapper = new CommandWrapperBuilder() - .createLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME) - .withJson(apiRequestBodyAsJson) - .build(); - - final CommandProcessingResult commandProcessingResult = this.commandsSourceWritePlatformService.logCommandSource(commandWrapper); + public String readLoanRescheduleRequest(@Context final UriInfo uriInfo, @PathParam("requestId") final Long requestId, + @QueryParam("command") final String command) { + this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME); + + final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + + if (compareIgnoreCase(command, "previewLoanReschedule")) { + final LoanRescheduleModel loanRescheduleModel = this.loanReschedulePreviewPlatformService.previewLoanReschedule(requestId); + + return this.loanRescheduleToApiJsonSerializer.serialize(settings, loanRescheduleModel.toData(), new HashSet()); + } + + final LoanRescheduleRequestData loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService + .readLoanRescheduleRequest(requestId); + + return this.loanRescheduleRequestToApiJsonSerializer.serialize(settings, loanRescheduleRequestData); + } + + @POST + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String createLoanRescheduleRequest(final String apiRequestBodyAsJson) { + final CommandWrapper commandWrapper = new CommandWrapperBuilder() + .createLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME).withJson(apiRequestBodyAsJson).build(); + + final CommandProcessingResult commandProcessingResult = this.commandsSourceWritePlatformService.logCommandSource(commandWrapper); return this.loanRescheduleRequestToApiJsonSerializer.serialize(commandProcessingResult); - } - - @POST - @Path("{requestId}") - @Consumes({ MediaType.APPLICATION_JSON }) + } + + @POST + @Path("{requestId}") + @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String updateLoanRescheduleRequest(@PathParam("requestId") final Long requestId, - @QueryParam("command") final String command, final String apiRequestBodyAsJson) { - CommandWrapper commandWrapper = null; - - if(compareIgnoreCase(command, "approve")) { - commandWrapper = new CommandWrapperBuilder() - .approveLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME, requestId) - .withJson(apiRequestBodyAsJson) - .build(); - } - - else if(compareIgnoreCase(command, "reject")) { - commandWrapper = new CommandWrapperBuilder() - .rejectLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME, requestId) - .withJson(apiRequestBodyAsJson) - .build(); - } - - else { - throw new UnrecognizedQueryParamException("command", command, new Object[] { "approve", "reject" }); - } - - final CommandProcessingResult commandProcessingResult = this.commandsSourceWritePlatformService.logCommandSource(commandWrapper); - - return this.loanRescheduleRequestToApiJsonSerializer.serialize(commandProcessingResult); - } - - /** - * Compares two strings, ignoring differences in case - * - * @param firstString the first string - * @param secondString the second string - * @return true if the two strings are equal, else false - **/ - private boolean compareIgnoreCase(String firstString, String secondString) { - return StringUtils.isNotBlank(firstString) && firstString.trim().equalsIgnoreCase(secondString); - } + public String updateLoanRescheduleRequest(@PathParam("requestId") final Long requestId, @QueryParam("command") final String command, + final String apiRequestBodyAsJson) { + CommandWrapper commandWrapper = null; + + if (compareIgnoreCase(command, "approve")) { + commandWrapper = new CommandWrapperBuilder().approveLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME, requestId) + .withJson(apiRequestBodyAsJson).build(); + } + + else if (compareIgnoreCase(command, "reject")) { + commandWrapper = new CommandWrapperBuilder().rejectLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME, requestId) + .withJson(apiRequestBodyAsJson).build(); + } + + else { + throw new UnrecognizedQueryParamException("command", command, new Object[] { "approve", "reject" }); + } + + final CommandProcessingResult commandProcessingResult = this.commandsSourceWritePlatformService.logCommandSource(commandWrapper); + + return this.loanRescheduleRequestToApiJsonSerializer.serialize(commandProcessingResult); + } + + /** + * Compares two strings, ignoring differences in case + * + * @param firstString + * the first string + * @param secondString + * the second string + * @return true if the two strings are equal, else false + **/ + private boolean compareIgnoreCase(String firstString, String secondString) { + return StringUtils.isNotBlank(firstString) && firstString.trim().equalsIgnoreCase(secondString); + } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java index a3869bd55..c1235f91a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java @@ -32,345 +32,289 @@ import com.google.gson.reflect.TypeToken; @Component public class LoanRescheduleRequestDataValidator { - - private final FromJsonHelper fromJsonHelper; - private final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService; - - @Autowired - public LoanRescheduleRequestDataValidator(FromJsonHelper fromJsonHelper, - LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService) { - this.fromJsonHelper = fromJsonHelper; - this.loanRescheduleRequestReadPlatformService = loanRescheduleRequestReadPlatformService; - } - - /** - * Validates the request to create a new loan reschedule entry - * - * @param jsonCommand the JSON command object (instance of the JsonCommand class) - * @return void - **/ - public void validateForCreateAction(final JsonCommand jsonCommand, final Loan loan) { - - final String jsonString = jsonCommand.json(); - if (StringUtils.isBlank(jsonString)) { - throw new InvalidJsonException(); - } - + private final FromJsonHelper fromJsonHelper; + private final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService; + + @Autowired + public LoanRescheduleRequestDataValidator(FromJsonHelper fromJsonHelper, + LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService) { + this.fromJsonHelper = fromJsonHelper; + this.loanRescheduleRequestReadPlatformService = loanRescheduleRequestReadPlatformService; + } + + /** + * Validates the request to create a new loan reschedule entry + * + * @param jsonCommand + * the JSON command object (instance of the JsonCommand class) + * @return void + **/ + public void validateForCreateAction(final JsonCommand jsonCommand, final Loan loan) { + + final String jsonString = jsonCommand.json(); + + if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + final Type typeToken = new TypeToken>() {}.getType(); - this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, - RescheduleLoansApiConstants.CREATE_REQUEST_DATA_PARAMETERS); - - final List dataValidationErrors = new ArrayList(); - final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors) - .resource(StringUtils.lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); - + this.fromJsonHelper + .checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.CREATE_REQUEST_DATA_PARAMETERS); + + final List dataValidationErrors = new ArrayList<>(); + final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils + .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); + final JsonElement jsonElement = jsonCommand.parsedJson(); - - if(!loan.status().isActive()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.is.not.active", - "Loan is not active"); + + if (!loan.status().isActive()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.is.not.active", "Loan is not active"); } - - final Long loanId = this.fromJsonHelper.extractLongNamed( - RescheduleLoansApiConstants.loanIdParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.loanIdParamName) - .value(loanId).notNull().integerGreaterThanZero(); - - final LocalDate submittedOnDate = this.fromJsonHelper.extractLocalDateNamed( - RescheduleLoansApiConstants.submittedOnDateParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.submittedOnDateParamName) - .value(submittedOnDate).notNull(); - - if(submittedOnDate != null && loan.getDisbursementDate().isAfter(submittedOnDate)) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.submittedOnDateParamName) - .failWithCode("before.loan.disbursement.date", - "Submission date cannot be before the loan disbursement date"); + + final Long loanId = this.fromJsonHelper.extractLongNamed(RescheduleLoansApiConstants.loanIdParamName, jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.loanIdParamName).value(loanId).notNull() + .integerGreaterThanZero(); + + final LocalDate submittedOnDate = this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.submittedOnDateParamName, + jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.submittedOnDateParamName).value(submittedOnDate).notNull(); + + if (submittedOnDate != null && loan.getDisbursementDate().isAfter(submittedOnDate)) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.submittedOnDateParamName) + .failWithCode("before.loan.disbursement.date", "Submission date cannot be before the loan disbursement date"); } - + final LocalDate rescheduleFromDate = this.fromJsonHelper.extractLocalDateNamed( - RescheduleLoansApiConstants.rescheduleFromDateParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) - .value(rescheduleFromDate).notNull(); - - final Integer graceOnPrincipal = this.fromJsonHelper.extractIntegerWithLocaleNamed( - RescheduleLoansApiConstants.graceOnPrincipalParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnPrincipalParamName) - .value(graceOnPrincipal).ignoreIfNull().integerGreaterThanZero(); - - final Integer graceOnInterest = this.fromJsonHelper.extractIntegerWithLocaleNamed( - RescheduleLoansApiConstants.graceOnInterestParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnInterestParamName) - .value(graceOnInterest).ignoreIfNull().integerGreaterThanZero(); - - final Integer extraTerms = this.fromJsonHelper.extractIntegerWithLocaleNamed( - RescheduleLoansApiConstants.extraTermsParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.extraTermsParamName) - .value(extraTerms).ignoreIfNull().integerGreaterThanZero(); - - final Long rescheduleReasonId = this.fromJsonHelper.extractLongNamed( - RescheduleLoansApiConstants.rescheduleReasonIdParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleReasonIdParamName) - .value(rescheduleReasonId).notNull().integerGreaterThanZero(); - - final String rescheduleReasonComment = this.fromJsonHelper.extractStringNamed( - RescheduleLoansApiConstants.rescheduleReasonCommentParamName, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleReasonCommentParamName) - .value(rescheduleReasonComment).ignoreIfNull().notExceedingLengthOf(500); - - final LocalDate adjustedDueDate = this.fromJsonHelper.extractLocalDateNamed( - RescheduleLoansApiConstants.adjustedDueDateParamName, jsonElement); - - if(adjustedDueDate != null && rescheduleFromDate != null && adjustedDueDate.isBefore(rescheduleFromDate)) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) - .failWithCode("adjustedDueDate.before.rescheduleFromDate", - "Adjusted due date cannot be before the reschedule from date"); - } - - // at least one of the following must be provided => graceOnPrincipal, graceOnInterest, extraTerms, newInterestRate - if(!this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceOnPrincipalParamName, jsonElement) - && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceOnInterestParamName, jsonElement) - && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.extraTermsParamName, jsonElement) - && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.newInterestRateParamName, jsonElement) - && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.adjustedDueDateParamName, jsonElement)) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.graceOnPrincipalParamName) - .notNull(); - } - - if(rescheduleFromDate != null) { - LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate); - - if(installment == null) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) - .failWithCode("repayment.schedule.installment.does.not.exist", - "Repayment schedule installment does not exist"); - } - - if(installment != null && installment.isObligationsMet()) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) - .failWithCode("repayment.schedule.installment.obligation.met", - "Repayment schedule installment obligation met"); - } - - if(installment != null && installment.isPartlyPaid()) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) - .failWithCode("repayment.schedule.installment.partly.paid", - "Repayment schedule installment is partly paid"); - } - - if(installment != null) { - - if(installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("repayment.schedule.installment.has.an.outstanding.penalty.charge", - "Repayment schedule installment has an outsatnding penalty charge."); - } - - if(installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("repayment.schedule.installment.has.an.outstanding.fee.charge", - "Repayment schedule installment has an outsatnding fee charge."); - } - } - } - - if(loanId != null) { - List loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService - .readLoanRescheduleRequests(loanId, LoanStatus.APPROVED.getValue()); - - if(loanRescheduleRequestData.size() > 0) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.already.rescheduled", - "The loan can only be rescheduled once."); - } - } - - if(!dataValidationErrors.isEmpty()) { - throw new PlatformApiDataValidationException(dataValidationErrors); - } - } - - /** - * Validates a user request to approve a loan reschedule request - * - * @param jsonCommand the JSON command object (instance of the JsonCommand class) - * @return void - **/ - public void validateForApproveAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { - final String jsonString = jsonCommand.json(); + RescheduleLoansApiConstants.rescheduleFromDateParamName, jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName).value(rescheduleFromDate).notNull(); - if (StringUtils.isBlank(jsonString)) { - throw new InvalidJsonException(); + final Integer graceOnPrincipal = this.fromJsonHelper.extractIntegerWithLocaleNamed( + RescheduleLoansApiConstants.graceOnPrincipalParamName, jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnPrincipalParamName).value(graceOnPrincipal) + .ignoreIfNull().integerGreaterThanZero(); + + final Integer graceOnInterest = this.fromJsonHelper.extractIntegerWithLocaleNamed( + RescheduleLoansApiConstants.graceOnInterestParamName, jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnInterestParamName).value(graceOnInterest).ignoreIfNull() + .integerGreaterThanZero(); + + final Integer extraTerms = this.fromJsonHelper.extractIntegerWithLocaleNamed(RescheduleLoansApiConstants.extraTermsParamName, + jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.extraTermsParamName).value(extraTerms).ignoreIfNull() + .integerGreaterThanZero(); + + final Long rescheduleReasonId = this.fromJsonHelper.extractLongNamed(RescheduleLoansApiConstants.rescheduleReasonIdParamName, + jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleReasonIdParamName).value(rescheduleReasonId).notNull() + .integerGreaterThanZero(); + + final String rescheduleReasonComment = this.fromJsonHelper.extractStringNamed( + RescheduleLoansApiConstants.rescheduleReasonCommentParamName, jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleReasonCommentParamName).value(rescheduleReasonComment) + .ignoreIfNull().notExceedingLengthOf(500); + + final LocalDate adjustedDueDate = this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.adjustedDueDateParamName, + jsonElement); + + if (adjustedDueDate != null && rescheduleFromDate != null && adjustedDueDate.isBefore(rescheduleFromDate)) { + dataValidatorBuilder + .reset() + .parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) + .failWithCode("adjustedDueDate.before.rescheduleFromDate", + "Adjusted due date cannot be before the reschedule from date"); } - + + // at least one of the following must be provided => graceOnPrincipal, + // graceOnInterest, extraTerms, newInterestRate + if (!this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceOnPrincipalParamName, jsonElement) + && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.graceOnInterestParamName, jsonElement) + && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.extraTermsParamName, jsonElement) + && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.newInterestRateParamName, jsonElement) + && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.adjustedDueDateParamName, jsonElement)) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnPrincipalParamName).notNull(); + } + + if (rescheduleFromDate != null) { + LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate); + + if (installment == null) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) + .failWithCode("repayment.schedule.installment.does.not.exist", "Repayment schedule installment does not exist"); + } + + if (installment != null && installment.isObligationsMet()) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) + .failWithCode("repayment.schedule.installment.obligation.met", "Repayment schedule installment obligation met"); + } + + if (installment != null && installment.isPartlyPaid()) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName) + .failWithCode("repayment.schedule.installment.partly.paid", "Repayment schedule installment is partly paid"); + } + + if (installment != null) { + + if (installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "repayment.schedule.installment.has.an.outstanding.penalty.charge", + "Repayment schedule installment has an outsatnding penalty charge."); + } + + if (installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "repayment.schedule.installment.has.an.outstanding.fee.charge", + "Repayment schedule installment has an outsatnding fee charge."); + } + } + } + + if (loanId != null) { + List loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService + .readLoanRescheduleRequests(loanId, LoanStatus.APPROVED.getValue()); + + if (loanRescheduleRequestData.size() > 0) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.already.rescheduled", + "The loan can only be rescheduled once."); + } + } + + if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + } + + /** + * Validates a user request to approve a loan reschedule request + * + * @param jsonCommand + * the JSON command object (instance of the JsonCommand class) + * @return void + **/ + public void validateForApproveAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { + final String jsonString = jsonCommand.json(); + + if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + final Type typeToken = new TypeToken>() {}.getType(); - this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, - RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS); - - final List dataValidationErrors = new ArrayList(); - final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors) - .resource(StringUtils.lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); - + this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, + RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS); + + final List dataValidationErrors = new ArrayList<>(); + final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils + .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); + final JsonElement jsonElement = jsonCommand.parsedJson(); - - final LocalDate approvedOnDate = this.fromJsonHelper.extractLocalDateNamed( - RescheduleLoansApiConstants.approvedOnDateParam, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.approvedOnDateParam) - .value(approvedOnDate).notNull(); - - if(approvedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(approvedOnDate)) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.approvedOnDateParam) - .failWithCode("before.submission.date", - "Approval date cannot be before the request submission date."); + + final LocalDate approvedOnDate = this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.approvedOnDateParam, + jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.approvedOnDateParam).value(approvedOnDate).notNull(); + + if (approvedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(approvedOnDate)) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.approvedOnDateParam) + .failWithCode("before.submission.date", "Approval date cannot be before the request submission date."); } - + LoanRescheduleRequestStatusEnumData loanRescheduleRequestStatusEnumData = LoanRescheduleRequestEnumerations - .status(loanRescheduleRequest.getStatusEnum()); - - if(!loanRescheduleRequestStatusEnumData.isPendingApproval()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode( - "request.is.not.in.submitted.and.pending.state", - "Loan reschedule request approval is not allowed. " - + "Loan reschedule request is not in submitted and pending approval state."); + .status(loanRescheduleRequest.getStatusEnum()); + + if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "request.is.not.in.submitted.and.pending.state", + "Loan reschedule request approval is not allowed. " + + "Loan reschedule request is not in submitted and pending approval state."); } - + LocalDate rescheduleFromDate = loanRescheduleRequest.getRescheduleFromDate(); final Loan loan = loanRescheduleRequest.getLoan(); - - if(loan != null) { - Long loanId = loan.getId(); - - if(!loan.status().isActive()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.is.not.active", - "Loan is not active"); - } - - if(rescheduleFromDate != null) { - LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate); - - if(installment == null) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.repayment.schedule.installment.does.not.exist", - "Repayment schedule installment does not exist"); - } - - if(installment != null && installment.isObligationsMet()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.repayment.schedule.installment." - + "obligation.met", "Repayment schedule installment obligation met"); - } - - if(installment != null) { - - if(installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("repayment.schedule.installment.has.an.outstanding.penalty.charge", - "Repayment schedule installment has an outsatnding penalty charge."); - } - - if(installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("repayment.schedule.installment.has.an.outstanding.fee.charge", - "Repayment schedule installment has an outsatnding fee charge."); - } - } - } - - if(loanId != null) { - List loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService - .readLoanRescheduleRequests(loanId, LoanStatus.APPROVED.getValue()); - - if(loanRescheduleRequestData.size() > 0) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode("loan.already.rescheduled", - "The loan can only be rescheduled once."); - } - } - } - - if(!dataValidationErrors.isEmpty()) { - throw new PlatformApiDataValidationException(dataValidationErrors); - } - } - - /** - * Validates a user request to reject a loan reschedule request - * - * @param jsonCommand the JSON command object (instance of the JsonCommand class) - * @return void - **/ - public void validateForRejectAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { - final String jsonString = jsonCommand.json(); - if (StringUtils.isBlank(jsonString)) { - throw new InvalidJsonException(); + if (loan != null) { + Long loanId = loan.getId(); + + if (!loan.status().isActive()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.is.not.active", "Loan is not active"); + } + + if (rescheduleFromDate != null) { + LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate); + + if (installment == null) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "loan.repayment.schedule.installment.does.not.exist", "Repayment schedule installment does not exist"); + } + + if (installment != null && installment.isObligationsMet()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "loan.repayment.schedule.installment." + "obligation.met", "Repayment schedule installment obligation met"); + } + + if (installment != null) { + + if (installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "repayment.schedule.installment.has.an.outstanding.penalty.charge", + "Repayment schedule installment has an outsatnding penalty charge."); + } + + if (installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "repayment.schedule.installment.has.an.outstanding.fee.charge", + "Repayment schedule installment has an outsatnding fee charge."); + } + } + } + + if (loanId != null) { + List loanRescheduleRequestData = this.loanRescheduleRequestReadPlatformService + .readLoanRescheduleRequests(loanId, LoanStatus.APPROVED.getValue()); + + if (loanRescheduleRequestData.size() > 0) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.already.rescheduled", + "The loan can only be rescheduled once."); + } + } } - + + if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + } + + /** + * Validates a user request to reject a loan reschedule request + * + * @param jsonCommand + * the JSON command object (instance of the JsonCommand class) + * @return void + **/ + public void validateForRejectAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { + final String jsonString = jsonCommand.json(); + + if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + final Type typeToken = new TypeToken>() {}.getType(); - this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, - RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS); - - final List dataValidationErrors = new ArrayList(); - final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors) - .resource(StringUtils.lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); - + this.fromJsonHelper + .checkForUnsupportedParameters(typeToken, jsonString, RescheduleLoansApiConstants.REJECT_REQUEST_DATA_PARAMETERS); + + final List dataValidationErrors = new ArrayList<>(); + final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors).resource(StringUtils + .lowerCase(RescheduleLoansApiConstants.ENTITY_NAME)); + final JsonElement jsonElement = jsonCommand.parsedJson(); - - final LocalDate rejectedOnDate = this.fromJsonHelper.extractLocalDateNamed( - RescheduleLoansApiConstants.rejectedOnDateParam, jsonElement); - dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejectedOnDateParam) - .value(rejectedOnDate).notNull(); - - if(rejectedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(rejectedOnDate)) { - dataValidatorBuilder - .reset() - .parameter(RescheduleLoansApiConstants.rejectedOnDateParam) - .failWithCode("before.submission.date", - "Rejection date cannot be before the request submission date."); + + final LocalDate rejectedOnDate = this.fromJsonHelper.extractLocalDateNamed(RescheduleLoansApiConstants.rejectedOnDateParam, + jsonElement); + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejectedOnDateParam).value(rejectedOnDate).notNull(); + + if (rejectedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(rejectedOnDate)) { + dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rejectedOnDateParam) + .failWithCode("before.submission.date", "Rejection date cannot be before the request submission date."); } - + LoanRescheduleRequestStatusEnumData loanRescheduleRequestStatusEnumData = LoanRescheduleRequestEnumerations - .status(loanRescheduleRequest.getStatusEnum()); - - if(!loanRescheduleRequestStatusEnumData.isPendingApproval()) { - dataValidatorBuilder - .reset() - .failWithCodeNoParameterAddedToErrorCode( - "request.is.not.in.submitted.and.pending.state", - "Loan reschedule request rejection is not allowed. " - + "Loan reschedule request is not in submitted and pending approval state."); + .status(loanRescheduleRequest.getStatusEnum()); + + if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) { + dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode( + "request.is.not.in.submitted.and.pending.state", + "Loan reschedule request rejection is not allowed. " + + "Loan reschedule request is not in submitted and pending approval state."); } - - if(!dataValidationErrors.isEmpty()) { - throw new PlatformApiDataValidationException(dataValidationErrors); - } - } + + if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestStatusEnumData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestStatusEnumData.java index 1c4c54358..5a2a8b892 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestStatusEnumData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestStatusEnumData.java @@ -10,22 +10,22 @@ import org.mifosplatform.portfolio.loanaccount.domain.LoanStatus; /** * Immutable data object represent loan reschedule request status enumerations. **/ -@SuppressWarnings("unused") public class LoanRescheduleRequestStatusEnumData { - private final Long id; + + private final Long id; private final String code; private final String value; private final boolean pendingApproval; private final boolean approved; private final boolean rejected; - - /** + + /** * LoanRescheduleRequestStatusEnumData constructor * * Note: Same status types/states for loan accounts are used in here **/ public LoanRescheduleRequestStatusEnumData(Long id, String code, String value) { - this.id = id; + this.id = id; this.code = code; this.value = value; this.pendingApproval = Long.valueOf(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue()).equals(this.id); @@ -44,16 +44,16 @@ public class LoanRescheduleRequestStatusEnumData { public String value() { return this.value; } - + public boolean isPendingApproval() { - return this.pendingApproval; + return this.pendingApproval; } - + public boolean isApproved() { - return this.approved; + return this.approved; } - + public boolean isRejected() { - return this.rejected; + return this.rejected; } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java index dcc50600c..7daa37b11 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java @@ -227,7 +227,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche catch (final DataIntegrityViolationException dve) { // handle the data integrity violation - handleCreateActionDataIntegrityViolation(jsonCommand, dve); + handleDataIntegrityViolation(jsonCommand, dve); // return an empty command processing result object return CommandProcessingResult.empty(); @@ -350,7 +350,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche catch (final DataIntegrityViolationException dve) { // handle the data integrity violation - handleApproveActionDataIntegrityViolation(jsonCommand, dve); + handleDataIntegrityViolation(jsonCommand, dve); // return an empty command processing result object return CommandProcessingResult.empty(); @@ -373,7 +373,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche this.loanRescheduleRequestDataValidator.validateForRejectAction(jsonCommand, loanRescheduleRequest); final AppUser appUser = this.platformSecurityContext.authenticatedUser(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); LocalDate rejectedOnDate = jsonCommand.localDateValueOfParameterNamed("rejectedOnDate"); final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(jsonCommand.dateFormat()).withLocale( @@ -394,7 +394,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche catch (final DataIntegrityViolationException dve) { // handle the data integrity violation - handleRejectActionDataIntegrityViolation(jsonCommand, dve); + handleDataIntegrityViolation(jsonCommand, dve); // return an empty command processing result object return CommandProcessingResult.empty(); @@ -402,8 +402,8 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche } /** - * handles the data integrity violation exception caught in the create - * method + * handles the data integrity violation exception for loan reschedule write + * services * * @param jsonCommand * JSON command object @@ -412,49 +412,12 @@ public class LoanRescheduleRequestWritePlatformServiceImpl implements LoanResche * @return void **/ @SuppressWarnings("unused") - private void handleCreateActionDataIntegrityViolation(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) { + private void handleDataIntegrityViolation(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) { logger.error(dve.getMessage(), dve); - throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", + throw new PlatformDataIntegrityException("error.msg.loan.reschedule.unknown.data.integrity.issue", "Unknown data integrity issue with resource."); } - /** - * handles the data integrity violation exception caught in the reject - * method - * - * @param jsonCommand - * JSON command object - * @param dve - * data integrity violation exception - * @return void - **/ - @SuppressWarnings("unused") - private void handleRejectActionDataIntegrityViolation(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) { - - logger.error(dve.getMessage(), dve); - - throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", - "Unknown data integrity issue with resource."); - } - - /** - * handles the data integrity violation exception caught in the approve - * method - * - * @param jsonCommand - * JSON command object - * @param dve - * data integrity violation exception - * @return void - **/ - @SuppressWarnings("unused") - private void handleApproveActionDataIntegrityViolation(final JsonCommand jsonCommand, final DataIntegrityViolationException dve) { - - logger.error(dve.getMessage(), dve); - - throw new PlatformDataIntegrityException("error.msg.group.unknown.data.integrity.issue", - "Unknown data integrity issue with resource."); - } }