FINERACT-2169: Refactor interest rate chart slab api;

This commit is contained in:
viktorpavlenko
2025-04-23 11:24:47 +02:00
committed by Adam Saghy
parent 3687391148
commit 2ec05beea6
9 changed files with 120 additions and 147 deletions
@@ -19,19 +19,9 @@
package org.apache.fineract.portfolio.interestratechart.api; package org.apache.fineract.portfolio.interestratechart.api;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME; import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.INTERESTRATE_CHART_SLAB_RESOURCE_NAME;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeFromParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.amountRangeToParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.annualInterestRateParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.currencyCodeParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.descriptionParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.fromPeriodParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.incentivesParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.periodTypeParamName;
import static org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants.toPeriodParamName;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.parameters.RequestBody;
@@ -49,10 +39,7 @@ import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.UriInfo; import jakarta.ws.rs.core.UriInfo;
import java.util.Arrays; import java.util.List;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -62,8 +49,8 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData; import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartStabRequest;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService; import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -78,19 +65,13 @@ public class InterestRateChartSlabsApiResource {
private final DefaultToApiJsonSerializer<InterestRateChartSlabData> toApiJsonSerializer; private final DefaultToApiJsonSerializer<InterestRateChartSlabData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper; private final ApiRequestParameterHelper apiRequestParameterHelper;
private static final Set<String> INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(InterestRateChartSlabApiConstants.localeParamName, InterestRateChartSlabApiConstants.idParamName,
descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
@GET @GET
@Path("template") @Path("template")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public String template(@Context final UriInfo uriInfo, @PathParam("chartId") @Parameter(description = "chartId") final Long chartId) { public InterestRateChartSlabData template(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId) {
InterestRateChartSlabData chartSlab = this.interestRateChartSlabReadPlatformService.retrieveTemplate(); return this.interestRateChartSlabReadPlatformService.retrieveTemplate();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, chartSlab, INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS);
} }
@GET @GET
@@ -98,16 +79,10 @@ public class InterestRateChartSlabsApiResource {
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve all Slabs", description = "Retrieve list of slabs associated with a chart\n" + "\n" @Operation(summary = "Retrieve all Slabs", description = "Retrieve list of slabs associated with a chart\n" + "\n"
+ "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs") + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs")
@ApiResponses({ public List<InterestRateChartSlabData> retrieveAll(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId) {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class)))) })
public String retrieveAll(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME);
Collection<InterestRateChartSlabData> chartSlabs = this.interestRateChartSlabReadPlatformService.retrieveAll(chartId); return this.interestRateChartSlabReadPlatformService.retrieveAll(chartId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, chartSlabs, INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS);
} }
@GET @GET
@@ -116,9 +91,7 @@ public class InterestRateChartSlabsApiResource {
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Retrieve a Slab", description = "Retrieve a slab associated with an Interest rate chart\n" + "\n" @Operation(summary = "Retrieve a Slab", description = "Retrieve a slab associated with an Interest rate chart\n" + "\n"
+ "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs/1\n") + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs/1\n")
@ApiResponses({ public InterestRateChartSlabData retrieveOne(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.GetInterestRateChartsChartIdChartSlabsResponse.class))) })
public String retrieveOne(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId, @Context final UriInfo uriInfo) { @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); this.context.authenticatedUser().validateHasReadPermission(INTERESTRATE_CHART_SLAB_RESOURCE_NAME);
@@ -129,7 +102,7 @@ public class InterestRateChartSlabsApiResource {
chartSlab = this.interestRateChartSlabReadPlatformService.retrieveWithTemplate(chartSlab); chartSlab = this.interestRateChartSlabReadPlatformService.retrieveWithTemplate(chartSlab);
} }
return this.toApiJsonSerializer.serialize(settings, chartSlab, INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS); return chartSlab;
} }
@POST @POST
@@ -138,18 +111,16 @@ public class InterestRateChartSlabsApiResource {
@Operation(summary = "Create a Slab", description = "Creates a new interest rate slab for an interest rate chart.\n" @Operation(summary = "Create a Slab", description = "Creates a new interest rate slab for an interest rate chart.\n"
+ "Mandatory Fields\n" + "periodType, fromPeriod, annualInterestRate\n" + "Optional Fields\n" + "toPeriod and description\n" + "Mandatory Fields\n" + "periodType, fromPeriod, annualInterestRate\n" + "Optional Fields\n" + "toPeriod and description\n"
+ "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs") + "Example Requests:\n" + "\n" + "interestratecharts/1/chartslabs")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsRequest.class))) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartStabRequest.class)))
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PostInterestRateChartsChartIdChartSlabsResponse.class))) })
public String create(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, public CommandProcessingResult create(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@Parameter(hidden = true) final String apiRequestBodyAsJson) { @Parameter(hidden = true) InterestRateChartStabRequest interestRateChartStabRequest) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().createInterestRateChartSlab(chartId) final CommandWrapper commandRequest = new CommandWrapperBuilder().createInterestRateChartSlab(chartId)
.withJson(apiRequestBodyAsJson).build(); .withJson(toApiJsonSerializer.serialize(interestRateChartStabRequest)).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
} }
@PUT @PUT
@@ -157,19 +128,17 @@ public class InterestRateChartSlabsApiResource {
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update a Slab", description = "It updates the Slab from chart") @Operation(summary = "Update a Slab", description = "It updates the Slab from chart")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdRequest.class))) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = InterestRateChartStabRequest.class)))
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.PutInterestRateChartsChartIdChartSlabsChartSlabIdResponse.class))) })
public String update(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, public CommandProcessingResult update(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId, @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId,
@Parameter(hidden = true) final String apiRequestBodyAsJson) { @Parameter(hidden = true) InterestRateChartStabRequest request) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateInterestRateChartSlab(chartId, chartSlabId) final CommandWrapper commandRequest = new CommandWrapperBuilder().updateInterestRateChartSlab(chartId, chartSlabId)
.withJson(apiRequestBodyAsJson).build(); .withJson(toApiJsonSerializer.serialize(request)).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
} }
@DELETE @DELETE
@@ -179,10 +148,9 @@ public class InterestRateChartSlabsApiResource {
@Operation(summary = "Delete a Slab", description = "Delete a Slab from a chart") @Operation(summary = "Delete a Slab", description = "Delete a Slab from a chart")
@ApiResponses({ @ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.DeleteInterestRateChartsChartIdChartSlabsResponse.class))) }) @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InterestRateChartSlabsApiResourceSwagger.DeleteInterestRateChartsChartIdChartSlabsResponse.class))) })
public String delete(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId, public CommandProcessingResult delete(@PathParam("chartId") @Parameter(description = "chartId") final Long chartId,
@PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId) { @PathParam("chartSlabId") @Parameter(description = "chartSlabId") final Long chartSlabId) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteInterestRateChartSlab(chartId, chartSlabId).build(); final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteInterestRateChartSlab(chartId, chartSlabId).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
} }
} }
@@ -29,92 +29,6 @@ final class InterestRateChartSlabsApiResourceSwagger {
private InterestRateChartSlabsApiResourceSwagger() {} private InterestRateChartSlabsApiResourceSwagger() {}
@Schema(description = "GetInterestRateChartsChartIdChartSlabsResponse")
public static final class GetInterestRateChartsChartIdChartSlabsResponse {
private GetInterestRateChartsChartIdChartSlabsResponse() {}
static final class GetInterestRateChartsChartIdChartSlabsIncentives {
private GetInterestRateChartsChartIdChartSlabsIncentives() {}
static final class GetInterestRateChartsChartIdChartSlabsEntityType {
private GetInterestRateChartsChartIdChartSlabsEntityType() {}
@Schema(example = "2")
public Long id;
@Schema(example = "InterestIncentiveEntityType.customer")
public Integer code;
@Schema(example = "Customer")
public Integer description;
}
static final class GetInterestRateChartsChartIdChartSlabsAttributeName {
private GetInterestRateChartsChartIdChartSlabsAttributeName() {}
@Schema(example = "2")
public Long id;
@Schema(example = "InterestIncentiveAttributeName.gender")
public Integer code;
@Schema(example = "Gender")
public Integer description;
}
static final class GetInterestRateChartsChartIdChartSlabsConditionType {
private GetInterestRateChartsChartIdChartSlabsConditionType() {}
@Schema(example = "2")
public Long id;
@Schema(example = "incentiveConditionType.equal")
public Integer code;
@Schema(example = "equal")
public Integer description;
}
static final class GetInterestRateChartsChartIdChartSlabsIncentiveType {
private GetInterestRateChartsChartIdChartSlabsIncentiveType() {}
@Schema(example = "3")
public Long id;
@Schema(example = "InterestIncentiveType.incentive")
public Integer code;
@Schema(example = "Incentive")
public Integer description;
}
@Schema(example = "1")
public Long id;
public GetInterestRateChartsChartIdChartSlabsEntityType entityType;
public GetInterestRateChartsChartIdChartSlabsAttributeName attributeName;
public GetInterestRateChartsChartIdChartSlabsConditionType conditionType;
@Schema(example = "11")
public Integer attributeValue;
@Schema(example = "FEMALE")
public String attributeValueDesc;
public GetInterestRateChartsChartIdChartSlabsIncentiveType incentiveType;
@Schema(example = "-1.000000")
public Float amount;
}
@Schema(example = "1")
public Long id;
@Schema(example = "5% interest from 1 day till 180 days of deposit")
public String description;
public InterestRateChartsApiResourceSwagger.GetInterestRateChartsTemplateResponse.GetInterestRateChartsTemplatePeriodTypes periodTypes;
@Schema(example = "1")
public Integer fromPeriod;
@Schema(example = "180")
public Integer toPeriod;
@Schema(example = "5")
public Double annualInterestRate;
public InterestRateChartsApiResourceSwagger.GetInterestRateChartsResponse.GetInterestRateChartsCurrency currency;
public Set<GetInterestRateChartsChartIdChartSlabsIncentives> incentives;
}
@Schema(description = "PostInterestRateChartsChartIdChartSlabsRequest") @Schema(description = "PostInterestRateChartsChartIdChartSlabsRequest")
public static final class PostInterestRateChartsChartIdChartSlabsRequest { public static final class PostInterestRateChartsChartIdChartSlabsRequest {
@@ -0,0 +1,39 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.interestratechart.data;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class InterestIncentiveRequest implements Serializable {
private Long id;
private String description;
private Integer entityType;
private Integer attributeName;
private Integer conditionType;
private String attributeValue;
private Integer incentiveType;
private BigDecimal amount;
}
@@ -0,0 +1,45 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.interestratechart.data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class InterestRateChartStabRequest implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String locale;
private String currencyCode;
private String description;
private Integer periodType;
private Integer fromPeriod;
private Integer toPeriod;
private BigDecimal amountRangeFrom;
private BigDecimal amountRangeTo;
private BigDecimal annualInterestRate;
private List<InterestIncentiveRequest> incentives;
}
@@ -213,7 +213,7 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha
} }
@Override @Override
public Collection<InterestRateChartData> extractData(ResultSet rs) throws SQLException, DataAccessException { public List<InterestRateChartData> extractData(ResultSet rs) throws SQLException, DataAccessException {
List<InterestRateChartData> chartDataList = new ArrayList<>(); List<InterestRateChartData> chartDataList = new ArrayList<>();
@@ -18,12 +18,12 @@
*/ */
package org.apache.fineract.portfolio.interestratechart.service; package org.apache.fineract.portfolio.interestratechart.service;
import java.util.Collection; import java.util.List;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData; import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
public interface InterestRateChartSlabReadPlatformService { public interface InterestRateChartSlabReadPlatformService {
Collection<InterestRateChartSlabData> retrieveAll(Long chartId); List<InterestRateChartSlabData> retrieveAll(Long chartId);
InterestRateChartSlabData retrieveOne(Long chartId, Long chartSlabId); InterestRateChartSlabData retrieveOne(Long chartId, Long chartSlabId);
@@ -55,7 +55,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat
private final CodeValueReadPlatformService codeValueReadPlatformService; private final CodeValueReadPlatformService codeValueReadPlatformService;
@Override @Override
public Collection<InterestRateChartSlabData> retrieveAll(Long chartId) { public List<InterestRateChartSlabData> retrieveAll(Long chartId) {
this.context.authenticatedUser(); this.context.authenticatedUser();
final String sql = "select " + this.chartSlabExtractor.schema() + " where ircd.interest_rate_chart_id = ? order by ircd.id"; final String sql = "select " + this.chartSlabExtractor.schema() + " where ircd.interest_rate_chart_id = ? order by ircd.id";
return this.jdbcTemplate.query(sql, this.chartSlabExtractor, new Object[] { chartId }); // NOSONAR return this.jdbcTemplate.query(sql, this.chartSlabExtractor, new Object[] { chartId }); // NOSONAR
@@ -172,7 +172,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat
} }
public static final class InterestRateChartSlabExtractor implements ResultSetExtractor<Collection<InterestRateChartSlabData>> { public static final class InterestRateChartSlabExtractor implements ResultSetExtractor<List<InterestRateChartSlabData>> {
InterestRateChartSlabsMapper chartSlabsMapper; InterestRateChartSlabsMapper chartSlabsMapper;
InterestIncentiveMapper incentiveMapper = new InterestIncentiveMapper(); InterestIncentiveMapper incentiveMapper = new InterestIncentiveMapper();
@@ -189,7 +189,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat
} }
@Override @Override
public Collection<InterestRateChartSlabData> extractData(ResultSet rs) throws SQLException, DataAccessException { public List<InterestRateChartSlabData> extractData(ResultSet rs) throws SQLException, DataAccessException {
List<InterestRateChartSlabData> chartDataList = new ArrayList<>(); List<InterestRateChartSlabData> chartDataList = new ArrayList<>();
@@ -169,7 +169,7 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D
} }
public static final class DepositAccountInterestRateChartExtractor public static final class DepositAccountInterestRateChartExtractor
implements ResultSetExtractor<Collection<DepositAccountInterestRateChartData>> { implements ResultSetExtractor<List<DepositAccountInterestRateChartData>> {
DepositAccountInterestRateChartMapper chartMapper = new DepositAccountInterestRateChartMapper(); DepositAccountInterestRateChartMapper chartMapper = new DepositAccountInterestRateChartMapper();
InterestRateChartSlabExtractor chartSlabsMapper = new InterestRateChartSlabExtractor(); InterestRateChartSlabExtractor chartSlabsMapper = new InterestRateChartSlabExtractor();
@@ -206,7 +206,7 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D
} }
@Override @Override
public Collection<DepositAccountInterestRateChartData> extractData(ResultSet rs) throws SQLException, DataAccessException { public List<DepositAccountInterestRateChartData> extractData(ResultSet rs) throws SQLException, DataAccessException {
List<DepositAccountInterestRateChartData> chartDataList = new ArrayList<>(); List<DepositAccountInterestRateChartData> chartDataList = new ArrayList<>();
@@ -18,10 +18,13 @@
*/ */
package org.apache.fineract.portfolio.interestratechart.data; package org.apache.fineract.portfolio.interestratechart.data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import lombok.Getter;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
@@ -29,7 +32,11 @@ import org.apache.fineract.organisation.monetary.data.CurrencyData;
/** /**
* Immutable data object representing a InterestRateChartSlab. * Immutable data object representing a InterestRateChartSlab.
*/ */
public final class InterestRateChartSlabData { @Getter
public final class InterestRateChartSlabData implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private final Long id; private final Long id;
private final String description; private final String description;