FINERACT-2326: Refractor redundant and some deprecated code as per new Java 21 style (Phase 2)

This commit is contained in:
Aman-Mittal
2025-12-17 08:51:47 +01:00
committed by Adam Saghy
parent 695816f990
commit 4bfae0400c
21 changed files with 196 additions and 206 deletions
@@ -29,7 +29,6 @@ import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
@@ -93,9 +92,8 @@ public class ExternalAssetOwnersApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ExternalAssetOwnerRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))),
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") })
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class)))
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated")
public CommandProcessingResult transferRequestWithLoanId(@PathParam("loanId") final Long loanId,
@Parameter ExternalAssetOwnerRequest assetOwnerReq,
@QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) {
@@ -111,9 +109,8 @@ public class ExternalAssetOwnersApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = ExternalAssetOwnerRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))),
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") })
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class)))
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated")
public CommandProcessingResult transferRequestWithLoanExternalId(@PathParam("loanExternalId") final String externalLoanId,
@Parameter ExternalAssetOwnerRequest assetOwnerReq,
@QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) {
@@ -130,9 +127,8 @@ public class ExternalAssetOwnersApiResource {
@Path("/transfers/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))),
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") })
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class)))
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated")
public CommandProcessingResult transferRequestWithId(@PathParam("id") final Long id,
@QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) {
platformUserRightsContext.isAuthenticated();
@@ -145,9 +141,8 @@ public class ExternalAssetOwnersApiResource {
@Path("/transfers/external-id/{externalId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))),
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") })
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class)))
@ApiResponse(responseCode = "403", description = "Transfer cannot be initiated")
public CommandProcessingResult transferRequestWithId(@PathParam("externalId") final String externalId,
@QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) {
platformUserRightsContext.isAuthenticated();
@@ -223,7 +223,7 @@ public class ExternalAssetOwnersWriteServiceImpl implements ExternalAssetOwnersW
List<ExternalAssetOwnerTransfer> effectiveTransfers = externalAssetOwnerTransferRepository
.findEffectiveTransfersOrderByIdDesc(loanDataForExternalTransfer.getId(), DateUtils.getBusinessLocalDate());
if (effectiveTransfers.size() == 0) {
if (effectiveTransfers.isEmpty()) {
throw new ExternalAssetOwnerInitiateTransferException(
"This loan cannot be bought back, it is not owned by an external asset owner");
} else if (effectiveTransfers.size() == 2) {
@@ -55,12 +55,9 @@ public class LoanTransferabilityServiceImpl implements LoanTransferabilityServic
return true;
}
if (ExternalTransferStatus.PENDING_INTERMEDIATE == externalAssetOwnerTransfer.getStatus()) {
// When delayed settlement is enabled and asset is sold to intermediate. Need to validate.
return true;
}
// When delayed settlement is enabled and asset is sold to intermediate. Need to validate.
return ExternalTransferStatus.PENDING_INTERMEDIATE == externalAssetOwnerTransfer.getStatus();
// When delayed settlement is enabled and asset is sold from intermediate to investor. No need to validate.
return false;
}
}
@@ -63,9 +63,8 @@ public class InvestorBusinessEventSerializer extends AbstractBusinessEventWithCu
private static CurrencyDataV1 getCurrencyFromEvent(InvestorBusinessEvent event) {
MonetaryCurrency loanCurrency = event.getLoan().getCurrency();
CurrencyDataV1 currency = CurrencyDataV1.newBuilder().setCode(loanCurrency.getCode())
.setDecimalPlaces(loanCurrency.getDigitsAfterDecimal()).setInMultiplesOf(loanCurrency.getInMultiplesOf()).build();
return currency;
return CurrencyDataV1.newBuilder().setCode(loanCurrency.getCode()).setDecimalPlaces(loanCurrency.getDigitsAfterDecimal())
.setInMultiplesOf(loanCurrency.getInMultiplesOf()).build();
}
@Override