You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2022/07/04 07:28:39 UTC
[fineract] branch develop updated: Fix for JPA getById method deprecation
This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 2d07e8c86 Fix for JPA getById method deprecation
2d07e8c86 is described below
commit 2d07e8c867edc4666656da964e40b8c5b66c3a54
Author: Jose Alberto Hernandez <al...@MacBook-Pro.local>
AuthorDate: Sun Jul 3 16:46:31 2022 -0500
Fix for JPA getById method deprecation
---
...ureauConfigurationWritePlatformServiceImpl.java | 2 +-
...LoanProductMappingWritePlatformServiceImpl.java | 6 ++---
...ationCreditBureauWritePlatflormServiceImpl.java | 4 ++--
.../service/AddressWritePlatformServiceImpl.java | 14 +++++------
...lientFamilyMembersWritePlatformServiceImpl.java | 28 +++++++++++-----------
.../LoanWritePlatformServiceJpaRepositoryImpl.java | 2 +-
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauConfigurationWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauConfigurationWritePlatformServiceImpl.java
index f37a07de7..ac8ac7fe3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauConfigurationWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauConfigurationWritePlatformServiceImpl.java
@@ -65,7 +65,7 @@ public class CreditBureauConfigurationWritePlatformServiceImpl implements Credit
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
- final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getById(creditBureauId);
+ final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getReferenceById(creditBureauId);
final CreditBureauConfiguration cb_config = CreditBureauConfiguration.fromJson(command, orgcb);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java
index 2519d59c8..36f10e228 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingWritePlatformServiceImpl.java
@@ -68,9 +68,9 @@ public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements C
final long lpid = command.longValueOfParameterNamed("loanProductId");
- final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getById(organisationCreditBureauId);
+ final OrganisationCreditBureau orgcb = this.organisationCreditBureauRepository.getReferenceById(organisationCreditBureauId);
- final LoanProduct lp = this.loanProductRepository.getById(lpid);
+ final LoanProduct lp = this.loanProductRepository.getReferenceById(lpid);
final CreditBureauLoanProductMapping cb_lp = CreditBureauLoanProductMapping.fromJson(command, orgcb, lp);
@@ -88,7 +88,7 @@ public class CreditBureauLoanProductMappingWritePlatformServiceImpl implements C
final Long mappingid = command.longValueOfParameterNamed("creditbureauLoanProductMappingId");
final boolean isActive = command.booleanPrimitiveValueOfParameterNamed("isActive");
- final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getById(mappingid);
+ final CreditBureauLoanProductMapping cblpmapping = this.creditBureauLoanProductMappingRepository.getReferenceById(mappingid);
cblpmapping.setIs_active(isActive);
this.creditBureauLoanProductMappingRepository.saveAndFlush(cblpmapping);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(cblpmapping.getId()).build();
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
index 724b9310d..ac8acb5d5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/OrganisationCreditBureauWritePlatflormServiceImpl.java
@@ -58,7 +58,7 @@ public class OrganisationCreditBureauWritePlatflormServiceImpl implements Organi
this.context.authenticatedUser();
this.fromApiJsonDeserializer.validateForCreate(command.json(), creditBureauId);
- final CreditBureau creditBureau = this.creditBureauRepository.getById(creditBureauId);
+ final CreditBureau creditBureau = this.creditBureauRepository.getReferenceById(creditBureauId);
final OrganisationCreditBureau organisationCreditBureau = OrganisationCreditBureau.fromJson(command, creditBureau);
@@ -78,7 +78,7 @@ public class OrganisationCreditBureauWritePlatflormServiceImpl implements Organi
final boolean isActive = command.booleanPrimitiveValueOfParameterNamed("isActive");
- final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getById(creditbureauID);
+ final OrganisationCreditBureau orgcb = organisationCreditBureauRepository.getReferenceById(creditbureauID);
orgcb.setIsActive(isActive);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
index f0ec83ef0..5c33225ad 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java
@@ -59,7 +59,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
context.authenticatedUser();
fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), false);
- final CodeValue addressTypeIdCodeValue = codeValueRepository.getById(addressTypeId);
+ final CodeValue addressTypeIdCodeValue = codeValueRepository.getReferenceById(addressTypeId);
final Client client = clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
final Address address = createAddress(jsonObject);
@@ -83,7 +83,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
fromApiJsonDeserializer.validateForCreate(jsonObject.toString(), true);
final long addressTypeId = jsonObject.get("addressTypeId").getAsLong();
- final CodeValue addressTypeIdCodeValue = codeValueRepository.getById(addressTypeId);
+ final CodeValue addressTypeIdCodeValue = codeValueRepository.getReferenceById(addressTypeId);
final Address address = createAddress(jsonObject);
addressRepository.save(address);
@@ -111,13 +111,13 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
CodeValue stateIdCodeValue = null;
if (jsonObject.get("stateProvinceId") != null) {
long stateId = jsonObject.get("stateProvinceId").getAsLong();
- stateIdCodeValue = codeValueRepository.getById(stateId);
+ stateIdCodeValue = codeValueRepository.getReferenceById(stateId);
}
CodeValue countryIdCodeValue = null;
if (jsonObject.get("countryId") != null) {
long countryId = jsonObject.get("countryId").getAsLong();
- countryIdCodeValue = codeValueRepository.getById(countryId);
+ countryIdCodeValue = codeValueRepository.getReferenceById(countryId);
}
final Address address = Address.fromJsonObject(jsonObject, stateIdCodeValue, countryIdCodeValue);
@@ -150,7 +150,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
throw new AddressNotFoundException(clientId);
}
- final Address addobj = this.addressRepository.getById(addressId);
+ final Address addobj = this.addressRepository.getReferenceById(addressId);
if (!command.stringValueOfParameterNamed("addressLine1").isEmpty()) {
@@ -198,7 +198,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
if (command.longValueOfParameterNamed("stateProvinceId") != 0) {
is_address_update = true;
stateId = command.longValueOfParameterNamed("stateProvinceId");
- stateIdobj = this.codeValueRepository.getById(stateId);
+ stateIdobj = this.codeValueRepository.getReferenceById(stateId);
addobj.setStateProvince(stateIdobj);
}
@@ -207,7 +207,7 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ
if (command.longValueOfParameterNamed("countryId") != 0) {
is_address_update = true;
countryId = command.longValueOfParameterNamed("countryId");
- countryIdObj = this.codeValueRepository.getById(countryId);
+ countryIdObj = this.codeValueRepository.getReferenceById(countryId);
addobj.setCountry(countryIdObj);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientFamilyMembersWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientFamilyMembersWritePlatformServiceImpl.java
index 6f1c305f4..4bcd83d50 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientFamilyMembersWritePlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientFamilyMembersWritePlatformServiceImpl.java
@@ -119,22 +119,22 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (command.longValueOfParameterNamed("relationshipId") != null) {
relationshipId = command.longValueOfParameterNamed("relationshipId");
- relationship = this.codeValueRepository.getById(relationshipId);
+ relationship = this.codeValueRepository.getReferenceById(relationshipId);
}
if (command.longValueOfParameterNamed("maritalStatusId") != null) {
maritalStatusId = command.longValueOfParameterNamed("maritalStatusId");
- maritalStatus = this.codeValueRepository.getById(maritalStatusId);
+ maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
}
if (command.longValueOfParameterNamed("genderId") != null) {
genderId = command.longValueOfParameterNamed("genderId");
- gender = this.codeValueRepository.getById(genderId);
+ gender = this.codeValueRepository.getReferenceById(genderId);
}
if (command.longValueOfParameterNamed("professionId") != null) {
professionId = command.longValueOfParameterNamed("professionId");
- profession = this.codeValueRepository.getById(professionId);
+ profession = this.codeValueRepository.getReferenceById(professionId);
}
if (command.dateValueOfParameterNamed("dateOfBirth") != null) {
@@ -218,22 +218,22 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (member.get("relationshipId") != null) {
relationshipId = member.get("relationshipId").getAsLong();
- relationship = this.codeValueRepository.getById(relationshipId);
+ relationship = this.codeValueRepository.getReferenceById(relationshipId);
}
if (member.get("maritalStatusId") != null) {
maritalStatusId = member.get("maritalStatusId").getAsLong();
- maritalStatus = this.codeValueRepository.getById(maritalStatusId);
+ maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
}
if (member.get("genderId") != null) {
genderId = member.get("genderId").getAsLong();
- gender = this.codeValueRepository.getById(genderId);
+ gender = this.codeValueRepository.getReferenceById(genderId);
}
if (member.get("professionId") != null) {
professionId = member.get("professionId").getAsLong();
- profession = this.codeValueRepository.getById(professionId);
+ profession = this.codeValueRepository.getReferenceById(professionId);
}
if (member.get("dateOfBirth") != null) {
@@ -295,7 +295,7 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
* command.longValueOfParameterNamed("clientFamilyMemberId"); }
*/
- ClientFamilyMembers clientFamilyMember = clientFamilyRepository.getById(familyMemberId);
+ ClientFamilyMembers clientFamilyMember = clientFamilyRepository.getReferenceById(familyMemberId);
// Client
// client=clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
@@ -337,25 +337,25 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
if (command.longValueOfParameterNamed("relationShipId") != null) {
relationshipId = command.longValueOfParameterNamed("relationShipId");
- relationship = this.codeValueRepository.getById(relationshipId);
+ relationship = this.codeValueRepository.getReferenceById(relationshipId);
clientFamilyMember.setRelationship(relationship);
}
if (command.longValueOfParameterNamed("maritalStatusId") != 0) {
maritalStatusId = command.longValueOfParameterNamed("maritalStatusId");
- maritalStatus = this.codeValueRepository.getById(maritalStatusId);
+ maritalStatus = this.codeValueRepository.getReferenceById(maritalStatusId);
clientFamilyMember.setMaritalStatus(maritalStatus);
}
if (command.longValueOfParameterNamed("genderId") != 0) {
genderId = command.longValueOfParameterNamed("genderId");
- gender = this.codeValueRepository.getById(genderId);
+ gender = this.codeValueRepository.getReferenceById(genderId);
clientFamilyMember.setGender(gender);
}
if (command.longValueOfParameterNamed("professionId") != 0) {
professionId = command.longValueOfParameterNamed("professionId");
- profession = this.codeValueRepository.getById(professionId);
+ profession = this.codeValueRepository.getReferenceById(professionId);
clientFamilyMember.setProfession(profession);
}
@@ -386,7 +386,7 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
ClientFamilyMembers clientFamilyMember = null;
if (clientFamilyMemberId != null) {
- clientFamilyMember = clientFamilyRepository.getById(clientFamilyMemberId);
+ clientFamilyMember = clientFamilyRepository.getReferenceById(clientFamilyMemberId);
clientFamilyRepository.delete(clientFamilyMember);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
index 132c0199e..b8651992d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
@@ -1788,7 +1788,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveChargeUndoBusinessEvent(loanCharge));
- LoanTransaction loanTransactionData = this.loanTransactionRepository.getById(command.entityId());
+ LoanTransaction loanTransactionData = this.loanTransactionRepository.getReferenceById(command.entityId());
changes.put("principalPortion", loanTransactionData.getPrincipalPortion());
changes.put("interestPortion", loanTransactionData.getInterestPortion(loan.getCurrency()));
changes.put("feeChargesPortion", loanTransactionData.getFeeChargesPortion(loan.getCurrency()));