diff --git a/build.gradle b/build.gradle index 85d70129a..89f8a9ccd 100644 --- a/build.gradle +++ b/build.gradle @@ -205,6 +205,7 @@ allprojects { dependency "commons-codec:commons-codec:1.15" dependency "org.bouncycastle:bcpkix-jdk15to18:1.70" dependency "org.bouncycastle:bcprov-jdk15to18:1.70" + dependency "org.projectlombok:lombok:1.18.22" dependency ('org.apache.activemq:activemq-broker:5.17.0') { @@ -561,7 +562,9 @@ configure(project.fineractJavaProjects) { "AlmostJavadoc", "InvalidBlockTag", "JavaUtilDate", // TODO FINERACT-1298 - "ReturnValueIgnored" + "ReturnValueIgnored", + "SameNameButDifferent", // Until errorprone recognizes Lombok + "MultiVariableDeclaration" // Until errorprone recognizes Lombok ) error( "DefaultCharset", @@ -572,7 +575,6 @@ configure(project.fineractJavaProjects) { "UnnecessaryParentheses", "MultipleTopLevelClasses", "MixedMutabilityReturnType", - "MultiVariableDeclaration", "AssertEqualsArgumentOrderChecker", "EmptySetMultibindingContributions", "BigDecimalEquals", @@ -586,7 +588,6 @@ configure(project.fineractJavaProjects) { "StreamResourceLeak", "TruthIncompatibleType", "ByteBufferBackingArray", - "SameNameButDifferent", "OrphanedFormatString", "CatchAndPrintStackTrace", "ObjectToString", diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 248b016a2..abd858d54 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -132,6 +132,9 @@ dependencies { 'org.apache.httpcomponents:httpclient' ) + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + // testCompile dependencies are ONLY used in src/test, not src/main. // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! // diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java index 36fed534e..bc591ab8f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java @@ -31,12 +31,12 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import lombok.RequiredArgsConstructor; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.commands.service.CommandWrapperBuilder; import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -44,19 +44,12 @@ import org.springframework.stereotype.Component; @Component @Scope("singleton") @Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n") +@RequiredArgsConstructor public class AccrualAccountingApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final DefaultToApiJsonSerializer apiJsonSerializerService; - @Autowired - public AccrualAccountingApiResource(final DefaultToApiJsonSerializer apiJsonSerializerService, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = apiJsonSerializerService; - - } - @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/handler/ExecutePeriodicAccrualCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/handler/ExecutePeriodicAccrualCommandHandler.java index 0b02be9fa..adf8bbc6e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/handler/ExecutePeriodicAccrualCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/handler/ExecutePeriodicAccrualCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.accrual.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.accrual.service.AccrualAccountingWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "PERIODICACCRUALACCOUNTING", action = "EXECUTE") +@RequiredArgsConstructor public class ExecutePeriodicAccrualCommandHandler implements NewCommandSourceHandler { private final AccrualAccountingWritePlatformService writePlatformService; - @Autowired - public ExecutePeriodicAccrualCommandHandler(final AccrualAccountingWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java index 37ba52a4e..f527ebecf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.accrual.api.AccrualAccountingConstants; import org.apache.fineract.infrastructure.core.data.ApiParameterError; @@ -41,23 +42,19 @@ import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserial import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s. */ @Component +@RequiredArgsConstructor public final class AccrualAccountingDataValidator { - private final FromJsonHelper fromApiJsonHelper; private static final Set LOAN_PERIODIC_REQUEST_DATA_PARAMETERS = new HashSet<>( Arrays.asList(accrueTillParamName, AccrualAccountingConstants.localeParamName, AccrualAccountingConstants.dateFormatParamName)); - @Autowired - public AccrualAccountingDataValidator(final FromJsonHelper fromApiJsonfromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper; - } + private final FromJsonHelper fromApiJsonHelper; public void validateLoanPeriodicAccrualData(final String json) { if (StringUtils.isBlank(json)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java index 521c809bf..3ce56a237 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/service/AccrualAccountingWritePlatformServiceImpl.java @@ -25,6 +25,7 @@ import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConsta import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.accrual.serialization.AccrualAccountingDataValidator; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.ApiParameterError; @@ -33,22 +34,15 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; import org.apache.fineract.infrastructure.core.exception.MultiException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualPlatformService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class AccrualAccountingWritePlatformServiceImpl implements AccrualAccountingWritePlatformService { private final LoanAccrualPlatformService loanAccrualPlatformService; private final AccrualAccountingDataValidator accountingDataValidator; - @Autowired - public AccrualAccountingWritePlatformServiceImpl(final LoanAccrualPlatformService loanAccrualPlatformService, - final AccrualAccountingDataValidator accountingDataValidator) { - this.loanAccrualPlatformService = loanAccrualPlatformService; - this.accountingDataValidator = accountingDataValidator; - } - @Override public CommandProcessingResult executeLoansPeriodicAccrual(JsonCommand command) { this.accountingDataValidator.validateLoanPeriodicAccrualData(command.json()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java index df3fea82a..8c1cdda44 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java @@ -43,6 +43,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.data.GLClosureData; import org.apache.fineract.accounting.closure.service.GLClosureReadPlatformService; import org.apache.fineract.commands.domain.CommandWrapper; @@ -54,7 +55,6 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.apache.fineract.organisation.office.service.OfficeReadPlatformService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -65,7 +65,7 @@ import org.springframework.stereotype.Component; + "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n" + "The identifer of the branch for which accounting has been closed\n" + "comments\n" + "Description associated with an Accounting closure") - +@RequiredArgsConstructor public class GLClosuresApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -74,25 +74,12 @@ public class GLClosuresApiResource { private final String resourceNameForPermission = "GLCLOSURE"; + private final PlatformSecurityContext context; private final GLClosureReadPlatformService glClosureReadPlatformService; - private final OfficeReadPlatformService officeReadPlatformService; private final DefaultToApiJsonSerializer apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper; - private final PlatformSecurityContext context; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; - - @Autowired - public GLClosuresApiResource(final PlatformSecurityContext context, final GLClosureReadPlatformService glClosureReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final OfficeReadPlatformService officeReadPlatformService) { - this.context = context; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = toApiJsonSerializer; - this.glClosureReadPlatformService = glClosureReadPlatformService; - this.officeReadPlatformService = officeReadPlatformService; - } + private final OfficeReadPlatformService officeReadPlatformService; @GET @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/command/GLClosureCommand.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/command/GLClosureCommand.java index 3b0b82682..300039e5d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/command/GLClosureCommand.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/command/GLClosureCommand.java @@ -21,6 +21,8 @@ package org.apache.fineract.accounting.closure.command; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams; import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; @@ -29,21 +31,15 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati /** * Immutable command for adding an accounting closure */ +@RequiredArgsConstructor +@Getter public class GLClosureCommand { - @SuppressWarnings("unused") private final Long id; private final Long officeId; private final LocalDate closingDate; private final String comments; - public GLClosureCommand(final Long id, final Long officeId, final LocalDate closingDate, final String comments) { - this.id = id; - this.officeId = officeId; - this.closingDate = closingDate; - this.comments = comments; - } - public void validateForCreate() { final List dataValidationErrors = new ArrayList<>(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/data/GLClosureData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/data/GLClosureData.java index 69845144f..d4bd072f7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/data/GLClosureData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/data/GLClosureData.java @@ -21,6 +21,9 @@ package org.apache.fineract.accounting.closure.data; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collection; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; import org.apache.fineract.organisation.office.data.OfficeData; /** @@ -28,59 +31,23 @@ import org.apache.fineract.organisation.office.data.OfficeData; * * Note: no getter/setters required as google-gson will produce json from fields of object. */ +@RequiredArgsConstructor +@Getter public class GLClosureData { - @SuppressWarnings("unused") private final Long id; - @SuppressWarnings("unused") private final Long officeId; - @SuppressWarnings("unused") private final String officeName; - @SuppressWarnings("unused") private final LocalDate closingDate; - @SuppressWarnings("unused") private final boolean deleted; - @SuppressWarnings("unused") private final LocalDate createdDate; - @SuppressWarnings("unused") private final LocalDate lastUpdatedDate; - @SuppressWarnings("unused") private final Long createdByUserId; - @SuppressWarnings("unused") private final String createdByUsername; - @SuppressWarnings("unused") private final Long lastUpdatedByUserId; - @SuppressWarnings("unused") private final String lastUpdatedByUsername; - @SuppressWarnings("unused") private final String comments; + @Setter private Collection allowedOffices = new ArrayList<>(); - - public GLClosureData(final Long id, final Long officeId, final String officeName, final LocalDate closingDate, final boolean deleted, - final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername, - final Long lastUpdatedByUserId, final String lastUpdatedByUsername, final String comments) { - this.id = id; - this.officeId = officeId; - this.officeName = officeName; - this.closingDate = closingDate; - this.deleted = deleted; - this.createdDate = createdDate; - this.lastUpdatedDate = lastUpdatedDate; - this.createdByUserId = createdByUserId; - this.createdByUsername = createdByUsername; - this.lastUpdatedByUserId = lastUpdatedByUserId; - this.lastUpdatedByUsername = lastUpdatedByUsername; - this.comments = comments; - this.allowedOffices = null; - } - - public final Collection getAllowedOffices() { - return this.allowedOffices; - } - - public void setAllowedOffices(final Collection allowedOffices) { - this.allowedOffices = allowedOffices; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/CreateGLClosureCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/CreateGLClosureCommandHandler.java index d4f1422cf..86a94460d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/CreateGLClosureCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/CreateGLClosureCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.closure.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLCLOSURE", action = "CREATE") +@RequiredArgsConstructor public class CreateGLClosureCommandHandler implements NewCommandSourceHandler { private final GLClosureWritePlatformService writePlatformService; - @Autowired - public CreateGLClosureCommandHandler(final GLClosureWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/DeleteGLClosureCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/DeleteGLClosureCommandHandler.java index 47e1ce23b..3fab97518 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/DeleteGLClosureCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/DeleteGLClosureCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.closure.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLCLOSURE", action = "DELETE") +@RequiredArgsConstructor public class DeleteGLClosureCommandHandler implements NewCommandSourceHandler { private final GLClosureWritePlatformService closureWritePlatformService; - @Autowired - public DeleteGLClosureCommandHandler(final GLClosureWritePlatformService guarantorWritePlatformService) { - this.closureWritePlatformService = guarantorWritePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/UpdateGLClosureCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/UpdateGLClosureCommandHandler.java index 3b512f085..498620646 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/UpdateGLClosureCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/handler/UpdateGLClosureCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.closure.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLCLOSURE", action = "UPDATE") +@RequiredArgsConstructor public class UpdateGLClosureCommandHandler implements NewCommandSourceHandler { private final GLClosureWritePlatformService writePlatformService; - @Autowired - public UpdateGLClosureCommandHandler(final GLClosureWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java index ef4f31a01..5d13a3fb9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java @@ -24,6 +24,7 @@ import java.lang.reflect.Type; import java.time.LocalDate; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams; import org.apache.fineract.accounting.closure.command.GLClosureCommand; @@ -32,22 +33,17 @@ import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJson import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s. */ @Component +@RequiredArgsConstructor public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer { private final FromJsonHelper fromApiJsonHelper; - @Autowired - public GLClosureCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper; - } - @Override public GLClosureCommand commandFromApiJson(final String json) { if (StringUtils.isBlank(json)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java index 2853c51b9..b1678b9af 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureReadPlatformServiceImpl.java @@ -23,25 +23,21 @@ import java.sql.SQLException; import java.time.LocalDate; import java.util.Arrays; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.data.GLClosureData; import org.apache.fineract.accounting.closure.exception.GLClosureNotFoundException; import org.apache.fineract.infrastructure.core.domain.JdbcSupport; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformService { private final JdbcTemplate jdbcTemplate; - @Autowired - public GLClosureReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - private static final class GLClosureMapper implements RowMapper { public String schema() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java index 325f7ecb9..f566915a6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java @@ -21,6 +21,8 @@ package org.apache.fineract.accounting.closure.service; import java.time.LocalDate; import java.util.Date; import java.util.Map; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams; import org.apache.fineract.accounting.closure.command.GLClosureCommand; import org.apache.fineract.accounting.closure.domain.GLClosure; @@ -38,9 +40,6 @@ import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityEx import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.organisation.office.domain.Office; import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.NonTransientDataAccessException; import org.springframework.orm.jpa.JpaSystemException; @@ -48,22 +47,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service +@RequiredArgsConstructor +@Slf4j public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosureWritePlatformService { - private static final Logger LOG = LoggerFactory.getLogger(GLClosureWritePlatformServiceJpaRepositoryImpl.class); - private final GLClosureRepository glClosureRepository; private final OfficeRepositoryWrapper officeRepositoryWrapper; private final GLClosureCommandFromApiJsonDeserializer fromApiJsonDeserializer; - @Autowired - public GLClosureWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository, - final OfficeRepositoryWrapper officeRepositoryWrapper, final GLClosureCommandFromApiJsonDeserializer fromApiJsonDeserializer) { - this.glClosureRepository = glClosureRepository; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - } - @Transactional @Override public CommandProcessingResult createGLClosure(final JsonCommand command) { @@ -154,7 +145,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure DateUtils.getDateTimeZoneOfTenant())); } - LOG.error("Error occured.", dve); + log.error("Error occured.", dve); throw new PlatformDataIntegrityException("error.msg.glClosure.unknown.data.integrity.issue", "Unknown data integrity issue with resource GL Closure: " + realCause.getMessage()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingDropdownReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingDropdownReadPlatformServiceImpl.java index 6e0014c0e..474db55fe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingDropdownReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingDropdownReadPlatformServiceImpl.java @@ -21,25 +21,21 @@ package org.apache.fineract.accounting.common; import java.util.HashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.accounting.glaccount.domain.GLAccountType; import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage; import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService; import org.apache.fineract.accounting.journalentry.domain.JournalEntryType; import org.apache.fineract.infrastructure.core.data.EnumOptionData; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class AccountingDropdownReadPlatformServiceImpl implements AccountingDropdownReadPlatformService { private final GLAccountReadPlatformService accountReadPlatformService; - @Autowired - public AccountingDropdownReadPlatformServiceImpl(final GLAccountReadPlatformService accountReadPlatformService) { - this.accountReadPlatformService = accountReadPlatformService; - } - @Override public List retrieveGLAccountTypeOptions() { return AccountingEnumerations.gLAccountType(GLAccountType.values()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java index d5d66adc2..6d30a10c8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java @@ -39,6 +39,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData; import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountReadPlatformService; import org.apache.fineract.commands.domain.CommandWrapper; @@ -49,7 +50,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -59,27 +59,15 @@ import org.springframework.stereotype.Component; @Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n" + "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n" + "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity") +@RequiredArgsConstructor public class FinancialActivityAccountsApiResource { + private final PlatformSecurityContext context; private final FinancialActivityAccountReadPlatformService financialActivityAccountReadPlatformService; private final DefaultToApiJsonSerializer apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper; - private final PlatformSecurityContext context; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; - @Autowired - public FinancialActivityAccountsApiResource(final PlatformSecurityContext context, - final FinancialActivityAccountReadPlatformService officeToGLAccountMappingReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, - final ApiRequestParameterHelper apiRequestParameterHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) { - this.context = context; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = toApiJsonSerializer; - this.financialActivityAccountReadPlatformService = officeToGLAccountMappingReadPlatformService; - } - @GET @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityAccountData.java index 82257dee4..a32f76c4e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityAccountData.java @@ -20,14 +20,21 @@ package org.apache.fineract.accounting.financialactivityaccount.data; import java.util.List; import java.util.Map; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; import org.apache.fineract.accounting.glaccount.data.GLAccountData; +@RequiredArgsConstructor +@Getter public class FinancialActivityAccountData { private final Long id; private final FinancialActivityData financialActivityData; private final GLAccountData glAccountData; + @Setter private Map> glAccountOptions; + @Setter private List financialActivityOptions; public FinancialActivityAccountData() { @@ -37,50 +44,4 @@ public class FinancialActivityAccountData { this.glAccountOptions = null; this.financialActivityOptions = null; } - - public FinancialActivityAccountData(final Long id, final FinancialActivityData financialActivityData, - final GLAccountData glAccountData) { - this.id = id; - this.glAccountData = glAccountData; - this.financialActivityData = financialActivityData; - } - - public FinancialActivityAccountData(Map> glAccountOptions, - List financialActivityOptions) { - this.id = null; - this.glAccountData = null; - this.financialActivityData = null; - this.glAccountOptions = glAccountOptions; - this.financialActivityOptions = financialActivityOptions; - - } - - public List getFinancialActivityOptions() { - return financialActivityOptions; - } - - public void setFinancialActivityOptions(List financialActivityOptions) { - this.financialActivityOptions = financialActivityOptions; - } - - public Map> getAccountingMappingOptions() { - return this.glAccountOptions; - } - - public void setAccountingMappingOptions(Map> accountingMappingOptions) { - this.glAccountOptions = accountingMappingOptions; - } - - public GLAccountData getGlAccountData() { - return glAccountData; - } - - public FinancialActivityData getFinancialActivityData() { - return financialActivityData; - } - - public Long getId() { - return id; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java index b044a406e..9311d8f92 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java @@ -18,31 +18,15 @@ */ package org.apache.fineract.accounting.financialactivityaccount.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.domain.GLAccountType; +@RequiredArgsConstructor +@Getter public class FinancialActivityData { private final Integer id; private final String name; private final GLAccountType mappedGLAccountType; - - public Integer getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public GLAccountType getMappedGLAccountType() { - return this.mappedGLAccountType; - } - - public FinancialActivityData(Integer id, String name, GLAccountType mappedGLAccountType) { - - this.id = id; - this.name = name; - this.mappedGLAccountType = mappedGLAccountType; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/CreateFinancialActivityAccountHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/CreateFinancialActivityAccountHandler.java index b8c0403a0..4e6bccc25 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/CreateFinancialActivityAccountHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/CreateFinancialActivityAccountHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.financialactivityaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "CREATE") +@RequiredArgsConstructor public class CreateFinancialActivityAccountHandler implements NewCommandSourceHandler { private final FinancialActivityAccountWritePlatformService writePlatformService; - @Autowired - public CreateFinancialActivityAccountHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/DeleteFinancialActivityAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/DeleteFinancialActivityAccountCommandHandler.java index e6c29b74a..e9a19eb9f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/DeleteFinancialActivityAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/DeleteFinancialActivityAccountCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.financialactivityaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "DELETE") +@RequiredArgsConstructor public class DeleteFinancialActivityAccountCommandHandler implements NewCommandSourceHandler { private final FinancialActivityAccountWritePlatformService writePlatformService; - @Autowired - public DeleteFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/UpdateFinancialActivityAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/UpdateFinancialActivityAccountCommandHandler.java index 3da189c83..fe5c54a12 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/UpdateFinancialActivityAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/handler/UpdateFinancialActivityAccountCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.financialactivityaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "UPDATE") +@RequiredArgsConstructor public class UpdateFinancialActivityAccountCommandHandler implements NewCommandSourceHandler { private final FinancialActivityAccountWritePlatformService writePlatformService; - @Autowired - public UpdateFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java index b17f7d824..8e8735683 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams; @@ -33,10 +34,10 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; import org.apache.fineract.infrastructure.core.exception.InvalidJsonException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public final class FinancialActivityAccountDataValidator { /** @@ -44,15 +45,10 @@ public final class FinancialActivityAccountDataValidator { */ private final Set supportedParameters = FinancialActivityAccountsJsonInputParams.getAllValues(); - private final FromJsonHelper fromApiJsonHelper; - private final String paramNameForFinancialActivity = FinancialActivityAccountsJsonInputParams.FINANCIAL_ACTIVITY_ID.getValue(); private final String paramNameForGLAccount = FinancialActivityAccountsJsonInputParams.GL_ACCOUNT_ID.getValue(); - @Autowired - public FinancialActivityAccountDataValidator(final FromJsonHelper fromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonHelper; - } + private final FromJsonHelper fromApiJsonHelper; public void validateForCreate(final String json) { validateJSONAndCheckForUnsupportedParams(json); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java index e8893f795..2de2cfd11 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountReadPlatformServiceImpl.java @@ -22,6 +22,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService; import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData; @@ -29,26 +30,18 @@ import org.apache.fineract.accounting.financialactivityaccount.data.FinancialAct import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountNotFoundException; import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.infrastructure.core.domain.JdbcSupport; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class FinancialActivityAccountReadPlatformServiceImpl implements FinancialActivityAccountReadPlatformService { private final JdbcTemplate jdbcTemplate; - private final FinancialActivityAccountMapper financialActivityAccountMapper; private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService; - - @Autowired - public FinancialActivityAccountReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, - final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) { - financialActivityAccountMapper = new FinancialActivityAccountMapper(); - this.jdbcTemplate = jdbcTemplate; - this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService; - } + private final FinancialActivityAccountMapper financialActivityAccountMapper = new FinancialActivityAccountMapper(); @Override public List retrieveAll() { @@ -73,7 +66,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia @Override public FinancialActivityAccountData addTemplateDetails(FinancialActivityAccountData financialActivityAccountData) { final Map> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions(); - financialActivityAccountData.setAccountingMappingOptions(accountOptions); + financialActivityAccountData.setGlAccountOptions(accountOptions); financialActivityAccountData.setFinancialActivityOptions(FinancialActivity.getAllFinancialActivities()); return financialActivityAccountData; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java index 4ac2d3a85..7857d20ab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java @@ -21,6 +21,8 @@ package org.apache.fineract.accounting.financialactivityaccount.service; import java.util.HashMap; import java.util.Map; import javax.persistence.PersistenceException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams; @@ -35,31 +37,19 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder; import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.NonTransientDataAccessException; import org.springframework.orm.jpa.JpaSystemException; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor +@Slf4j public class FinancialActivityAccountWritePlatformServiceImpl implements FinancialActivityAccountWritePlatformService { private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository; private final FinancialActivityAccountDataValidator fromApiJsonDeserializer; private final GLAccountRepositoryWrapper glAccountRepositoryWrapper; - private static final Logger LOG = LoggerFactory.getLogger(FinancialActivityAccountWritePlatformServiceImpl.class); - - @Autowired - public FinancialActivityAccountWritePlatformServiceImpl( - final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository, - final FinancialActivityAccountDataValidator fromApiJsonDeserializer, - final GLAccountRepositoryWrapper glAccountRepositoryWrapper) { - this.financialActivityAccountRepository = financialActivityAccountRepository; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.glAccountRepositoryWrapper = glAccountRepositoryWrapper; - } @Override public CommandProcessingResult createFinancialActivityAccountMapping(JsonCommand command) { @@ -158,7 +148,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi throw new DuplicateFinancialActivityAccountFoundException(financialActivityId); } - LOG.error("Error occured.", dve); + log.error("Error occured.", dve); throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue", "Unknown data integrity issue with resource GL Account: " + realCause.getMessage()); } @@ -170,7 +160,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi throw new DuplicateFinancialActivityAccountFoundException(financialActivityId); } - LOG.error("Error occured.", dve); + log.error("Error occured.", dve); throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue", "Unknown data integrity issue with resource GL Account: " + realCause.getMessage()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java index b7a4fba69..4ae0ddf3d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java @@ -46,6 +46,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants; import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService; import org.apache.fineract.accounting.glaccount.data.GLAccountData; @@ -69,7 +70,6 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -78,6 +78,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") @Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n" + "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts") +@RequiredArgsConstructor public class GLAccountsApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode", "disabled", @@ -88,34 +89,16 @@ public class GLAccountsApiResource { private final String resourceNameForPermission = "GLACCOUNT"; + private final PlatformSecurityContext context; private final GLAccountReadPlatformService glAccountReadPlatformService; - private final AccountingDropdownReadPlatformService dropdownReadPlatformService; private final DefaultToApiJsonSerializer apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper; - private final PlatformSecurityContext context; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final AccountingDropdownReadPlatformService dropdownReadPlatformService; private final CodeValueReadPlatformService codeValueReadPlatformService; private final BulkImportWorkbookService bulkImportWorkbookService; private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; - @Autowired - public GLAccountsApiResource(final PlatformSecurityContext context, final GLAccountReadPlatformService glAccountReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final AccountingDropdownReadPlatformService dropdownReadPlatformService, - final CodeValueReadPlatformService codeValueReadPlatformService, final BulkImportWorkbookService bulkImportWorkbookService, - final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { - this.context = context; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = toApiJsonSerializer; - this.glAccountReadPlatformService = glAccountReadPlatformService; - this.dropdownReadPlatformService = dropdownReadPlatformService; - this.codeValueReadPlatformService = codeValueReadPlatformService; - this.bulkImportWorkbookService = bulkImportWorkbookService; - this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService; - } - @GET @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/command/GLAccountCommand.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/command/GLAccountCommand.java index d17e9250a..d63bb4767 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/command/GLAccountCommand.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/command/GLAccountCommand.java @@ -20,6 +20,8 @@ package org.apache.fineract.accounting.glaccount.command; import java.util.ArrayList; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams; import org.apache.fineract.accounting.glaccount.domain.GLAccountType; import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage; @@ -30,34 +32,21 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati /** * Immutable command for adding a general Ledger Account */ +@RequiredArgsConstructor +@Getter public class GLAccountCommand { - @SuppressWarnings("unused") private final Long id; private final String name; private final Long parentId; private final String glCode; private final Boolean disabled; private final Boolean manualEntriesAllowed; - private final Integer usage; private final Integer type; + private final Integer usage; private final String description; private final Long tagId; - public GLAccountCommand(final Long id, final String name, final Long parentId, final String glCode, final Boolean disabled, - final Boolean manualEntriesAllowed, final Integer type, final Integer usage, final String description, final Long tagId) { - this.id = id; - this.name = name; - this.parentId = parentId; - this.glCode = glCode; - this.disabled = disabled; - this.manualEntriesAllowed = manualEntriesAllowed; - this.type = type; - this.usage = usage; - this.description = description; - this.tagId = tagId; - } - public void validateForCreate() { final List dataValidationErrors = new ArrayList<>(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountDataForLookup.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountDataForLookup.java index 5fc0d961a..300c2dc67 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountDataForLookup.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountDataForLookup.java @@ -18,22 +18,14 @@ */ package org.apache.fineract.accounting.glaccount.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter public class GLAccountDataForLookup { private final Long id; - @SuppressWarnings("unused") private final String name; - @SuppressWarnings("unused") private final String glCode; - - public GLAccountDataForLookup(final Long id, final String name, final String glCode) { - this.id = id; - this.name = name; - this.glCode = glCode; - } - - public Long getId() { - return this.id; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/CreateGLAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/CreateGLAccountCommandHandler.java index 8231a5f04..0f0c71901 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/CreateGLAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/CreateGLAccountCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.glaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLACCOUNT", action = "CREATE") +@RequiredArgsConstructor public class CreateGLAccountCommandHandler implements NewCommandSourceHandler { private final GLAccountWritePlatformService writePlatformService; - @Autowired - public CreateGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/DeleteGLAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/DeleteGLAccountCommandHandler.java index 37ddee545..368165e37 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/DeleteGLAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/DeleteGLAccountCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.glaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLACCOUNT", action = "DELETE") +@RequiredArgsConstructor public class DeleteGLAccountCommandHandler implements NewCommandSourceHandler { private final GLAccountWritePlatformService writePlatformService; - @Autowired - public DeleteGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/UpdateGLAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/UpdateGLAccountCommandHandler.java index 21e2d74f5..33a0cd967 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/UpdateGLAccountCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/handler/UpdateGLAccountCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.glaccount.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "GLACCOUNT", action = "UPDATE") +@RequiredArgsConstructor public class UpdateGLAccountCommandHandler implements NewCommandSourceHandler { private final GLAccountWritePlatformService writePlatformService; - @Autowired - public UpdateGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java index d960cb29e..d4b5a1f1c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java @@ -23,6 +23,7 @@ import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams; import org.apache.fineract.accounting.glaccount.command.GLAccountCommand; @@ -31,22 +32,17 @@ import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJson import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s. */ @Component +@RequiredArgsConstructor public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer { private final FromJsonHelper fromApiJsonHelper; - @Autowired - public GLAccountCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper; - } - @Override public GLAccountCommand commandFromApiJson(final String json) { if (StringUtils.isBlank(json)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java index 5966455ed..edab097c2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java @@ -22,6 +22,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Arrays; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.common.AccountingEnumerations; import org.apache.fineract.accounting.glaccount.data.GLAccountData; @@ -34,22 +35,18 @@ import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationP import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.domain.JdbcSupport; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformService { - private final JdbcTemplate jdbcTemplate; private static final String nameDecoratedBaseOnHierarchy = "concat(substring('........................................', 1, ((LENGTH(hierarchy) - LENGTH(REPLACE(hierarchy, '.', '')) - 1) * 4)), name)"; - @Autowired - public GLAccountReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } + private final JdbcTemplate jdbcTemplate; private static final class GLAccountMapper implements RowMapper { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java index 423914935..2b81f6637 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java @@ -20,6 +20,7 @@ package org.apache.fineract.accounting.glaccount.service; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants; import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams; import org.apache.fineract.accounting.glaccount.command.GLAccountCommand; @@ -46,7 +47,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.NonTransientDataAccessException; @@ -56,6 +56,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service +@RequiredArgsConstructor public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccountWritePlatformService { private static final Logger LOG = LoggerFactory.getLogger(GLAccountWritePlatformServiceJpaRepositoryImpl.class); @@ -66,17 +67,6 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount private final CodeValueRepositoryWrapper codeValueRepositoryWrapper; private final JdbcTemplate jdbcTemplate; - @Autowired - public GLAccountWritePlatformServiceJpaRepositoryImpl(final GLAccountRepository glAccountRepository, - final JournalEntryRepository glJournalEntryRepository, final GLAccountCommandFromApiJsonDeserializer fromApiJsonDeserializer, - final CodeValueRepositoryWrapper codeValueRepositoryWrapper, final JdbcTemplate jdbcTemplate) { - this.glAccountRepository = glAccountRepository; - this.glJournalEntryRepository = glJournalEntryRepository; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.codeValueRepositoryWrapper = codeValueRepositoryWrapper; - this.jdbcTemplate = jdbcTemplate; - } - @Transactional @Override public CommandProcessingResult createGLAccount(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java index 636c95af0..3991e84f3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java @@ -43,6 +43,7 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand; import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData; @@ -67,7 +68,6 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import org.glassfish.jersey.media.multipart.FormDataParam; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -76,6 +76,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") @Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n" + "\n" + "A journal entry directly changes the account balances on the general ledger") +@RequiredArgsConstructor public class JournalEntriesApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -85,30 +86,14 @@ public class JournalEntriesApiResource { private final String resourceNameForPermission = "JOURNALENTRY"; + private final PlatformSecurityContext context; private final JournalEntryReadPlatformService journalEntryReadPlatformService; private final DefaultToApiJsonSerializer apiJsonSerializerService; private final ApiRequestParameterHelper apiRequestParameterHelper; - private final PlatformSecurityContext context; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final BulkImportWorkbookService bulkImportWorkbookService; private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService; - @Autowired - public JournalEntriesApiResource(final PlatformSecurityContext context, - final JournalEntryReadPlatformService journalEntryReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final BulkImportWorkbookService bulkImportWorkbookService, - final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) { - this.context = context; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = toApiJsonSerializer; - this.journalEntryReadPlatformService = journalEntryReadPlatformService; - this.bulkImportWorkbookService = bulkImportWorkbookService; - this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService; - } - @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/JournalEntryCommand.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/JournalEntryCommand.java index 9cc556c9f..63ee97075 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/JournalEntryCommand.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/JournalEntryCommand.java @@ -22,6 +22,8 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams; import org.apache.fineract.infrastructure.core.data.ApiParameterError; import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; @@ -30,52 +32,27 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati /** * Immutable command for adding an accounting closure */ +@RequiredArgsConstructor +@Getter public class JournalEntryCommand { private final Long officeId; - private final LocalDate transactionDate; private final String currencyCode; + private final LocalDate transactionDate; private final String comments; private final String referenceNumber; private final Long accountingRuleId; private final BigDecimal amount; private final Long paymentTypeId; - @SuppressWarnings("unused") private final String accountNumber; - @SuppressWarnings("unused") private final String checkNumber; - @SuppressWarnings("unused") private final String receiptNumber; - @SuppressWarnings("unused") private final String bankNumber; - @SuppressWarnings("unused") private final String routingCode; private final SingleDebitOrCreditEntryCommand[] credits; private final SingleDebitOrCreditEntryCommand[] debits; - public JournalEntryCommand(final Long officeId, final String currencyCode, final LocalDate transactionDate, final String comments, - final SingleDebitOrCreditEntryCommand[] credits, final SingleDebitOrCreditEntryCommand[] debits, final String referenceNumber, - final Long accountingRuleId, final BigDecimal amount, final Long paymentTypeId, final String accountNumber, - final String checkNumber, final String receiptNumber, final String bankNumber, final String routingCode) { - this.officeId = officeId; - this.currencyCode = currencyCode; - this.transactionDate = transactionDate; - this.comments = comments; - this.credits = credits; - this.debits = debits; - this.referenceNumber = referenceNumber; - this.accountingRuleId = accountingRuleId; - this.amount = amount; - this.paymentTypeId = paymentTypeId; - this.accountNumber = accountNumber; - this.checkNumber = checkNumber; - this.receiptNumber = receiptNumber; - this.bankNumber = bankNumber; - this.routingCode = routingCode; - - } - public void validateForCreate() { final List dataValidationErrors = new ArrayList<>(); @@ -141,33 +118,4 @@ public class JournalEntryCommand { baseDataValidator.reset().parameter(paramSuffix + "[" + arrayPos + "].amount").value(credit.getAmount()).notNull() .zeroOrPositiveAmount(); } - - public Long getOfficeId() { - return this.officeId; - } - - public LocalDate getTransactionDate() { - return this.transactionDate; - } - - public String getComments() { - return this.comments; - } - - public SingleDebitOrCreditEntryCommand[] getCredits() { - return this.credits; - } - - public SingleDebitOrCreditEntryCommand[] getDebits() { - return this.debits; - } - - public String getReferenceNumber() { - return this.referenceNumber; - } - - public Long getAccountingRuleId() { - return this.accountingRuleId; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/SingleDebitOrCreditEntryCommand.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/SingleDebitOrCreditEntryCommand.java index 4ff4393ff..d003f9313 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/SingleDebitOrCreditEntryCommand.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/command/SingleDebitOrCreditEntryCommand.java @@ -20,10 +20,14 @@ package org.apache.fineract.accounting.journalentry.command; import java.math.BigDecimal; import java.util.Set; +import lombok.Getter; +import lombok.RequiredArgsConstructor; /** * Immutable command for adding a "Credit" entry to the Journal */ +@Getter +@RequiredArgsConstructor public class SingleDebitOrCreditEntryCommand { private final Long glAccountId; @@ -32,14 +36,6 @@ public class SingleDebitOrCreditEntryCommand { private final Set parametersPassedInRequest; - public SingleDebitOrCreditEntryCommand(final Set parametersPassedInRequest, final Long glAccountId, final BigDecimal amount, - final String comments) { - this.parametersPassedInRequest = parametersPassedInRequest; - this.glAccountId = glAccountId; - this.amount = amount; - this.comments = comments; - } - public boolean isGlAccountIdChanged() { return this.parametersPassedInRequest.contains("glAccountId"); } @@ -51,21 +47,4 @@ public class SingleDebitOrCreditEntryCommand { public boolean isCommentsChanged() { return this.parametersPassedInRequest.contains("comments"); } - - public Long getGlAccountId() { - return this.glAccountId; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public String getComments() { - return this.comments; - } - - public Set getParametersPassedInRequest() { - return this.parametersPassedInRequest; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ChargePaymentDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ChargePaymentDTO.java index 91542869d..124da74b2 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ChargePaymentDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ChargePaymentDTO.java @@ -19,30 +19,14 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor +@Getter public class ChargePaymentDTO { private final Long chargeId; private final BigDecimal amount; private final Long loanChargeId; - - public ChargePaymentDTO(final Long chargeId, final Long loanChargeId, final BigDecimal amount) { - this.chargeId = chargeId; - this.amount = amount; - this.loanChargeId = loanChargeId; - - } - - public Long getChargeId() { - return this.chargeId; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public Long getLoanChargeId() { - return this.loanChargeId; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientChargePaymentDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientChargePaymentDTO.java index b3638594c..c1fbb493b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientChargePaymentDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientChargePaymentDTO.java @@ -19,7 +19,11 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor +@Getter public class ClientChargePaymentDTO { private final Long chargeId; @@ -27,34 +31,4 @@ public class ClientChargePaymentDTO { private final Long clientChargeId; private final boolean isPenalty; private final Long incomeAccountId; - - public ClientChargePaymentDTO(Long chargeId, BigDecimal amount, Long clientChargeId, boolean isPenalty, Long incomeAccountId) { - - this.chargeId = chargeId; - this.amount = amount; - this.clientChargeId = clientChargeId; - this.isPenalty = isPenalty; - this.incomeAccountId = incomeAccountId; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public Long getClientChargeId() { - return this.clientChargeId; - } - - public boolean isPenalty() { - return this.isPenalty; - } - - public Long getChargeId() { - return chargeId; - } - - public Long getIncomeAccountId() { - return this.incomeAccountId; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientTransactionDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientTransactionDTO.java index cff96790b..263d142a4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientTransactionDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/ClientTransactionDTO.java @@ -21,92 +21,35 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.portfolio.client.domain.ClientTransactionType; +@RequiredArgsConstructor +@Getter public class ClientTransactionDTO { - private final Long officeId; private final Long clientId; - private String currencyCode; + private final Long officeId; + private final Long paymentTypeId; private final Long transactionId; private final Date transactionDate; - private final Long paymentTypeId; private final EnumOptionData transactionType; + private final String currencyCode; private final BigDecimal amount; - private final Boolean accountingEnabled; - /*** Boolean values determines if the transaction is reversed ***/ private final boolean reversed; + private final boolean accountingEnabled; + /** Breakdowns of fees this Transaction pays **/ private final List chargePayments; - public ClientTransactionDTO(final Long clientId, final Long officeId, final Long paymentTypeId, final Long transactionId, - final Date transactionDate, final EnumOptionData transactionType, final String currencyCode, final BigDecimal amount, - final boolean reversed, final boolean accountingEnabled, final List clientChargePayments) { - this.clientId = clientId; - this.paymentTypeId = paymentTypeId; - this.transactionId = transactionId; - this.transactionDate = transactionDate; - this.amount = amount; - this.reversed = reversed; - this.transactionType = transactionType; - this.chargePayments = clientChargePayments; - this.officeId = officeId; - this.accountingEnabled = accountingEnabled; - this.currencyCode = currencyCode; - } - - public Long getOfficeId() { - return this.officeId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public boolean isReversed() { - return this.reversed; - } - - public Long getPaymentTypeId() { - return this.paymentTypeId; - } - - public EnumOptionData getTransactionType() { - return transactionType; - } - public boolean isChargePayment() { - return ClientTransactionType.PAY_CHARGE.getValue().equals(Integer.valueOf(this.transactionType.getId().intValue())); + return ClientTransactionType.PAY_CHARGE.getValue().equals(this.transactionType.getId().intValue()); } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public List getChargePayments() { - return this.chargePayments; - } - - public Long getTransactionId() { - return this.transactionId; - } - - public Boolean getAccountingEnabled() { - return this.accountingEnabled; - } - - public Long getClientId() { - return this.clientId; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/CreditDebit.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/CreditDebit.java index 7bc18bc64..0cac02234 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/CreditDebit.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/CreditDebit.java @@ -19,14 +19,13 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor +@Getter public class CreditDebit { private final Long glAccountId; private final BigDecimal amount; - - public CreditDebit(Long glAccountId, BigDecimal amount) { - this.glAccountId = glAccountId; - this.amount = amount; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryAssociationParametersData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryAssociationParametersData.java index 522be40bf..970401a6f 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryAssociationParametersData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/JournalEntryAssociationParametersData.java @@ -18,6 +18,11 @@ */ package org.apache.fineract.accounting.journalentry.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter public class JournalEntryAssociationParametersData { private final boolean transactionDetailsRequired; @@ -27,17 +32,4 @@ public class JournalEntryAssociationParametersData { this.transactionDetailsRequired = false; this.runningBalanceRequired = false; } - - public JournalEntryAssociationParametersData(final boolean transactionDetailsRequired, final boolean runningBalanceRequired) { - this.transactionDetailsRequired = transactionDetailsRequired; - this.runningBalanceRequired = runningBalanceRequired; - } - - public boolean isTransactionDetailsRequired() { - return this.transactionDetailsRequired; - } - - public boolean isRunningBalanceRequired() { - return this.runningBalanceRequired; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanDTO.java index 152ffc474..6bfc6ac48 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanDTO.java @@ -19,86 +19,26 @@ package org.apache.fineract.accounting.journalentry.data; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@AllArgsConstructor +@Getter public class LoanDTO { + @Setter private Long loanId; + @Setter private Long loanProductId; + @Setter private Long officeId; - + @Setter private String currencyCode; + @Setter private boolean cashBasedAccountingEnabled; - final boolean upfrontAccrualBasedAccountingEnabled; - final boolean periodicAccrualBasedAccountingEnabled; + private final boolean upfrontAccrualBasedAccountingEnabled; + private final boolean periodicAccrualBasedAccountingEnabled; + @Setter private List newLoanTransactions; - - public LoanDTO(final Long loanId, final Long loanProductId, final Long officeId, final String currencyCode, - final boolean cashBasedAccountingEnabled, final boolean upfrontAccrualBasedAccountingEnabled, - final boolean periodicAccrualBasedAccountingEnabled, final List newLoanTransactions) { - this.loanId = loanId; - this.loanProductId = loanProductId; - this.officeId = officeId; - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - this.newLoanTransactions = newLoanTransactions; - this.currencyCode = currencyCode; - this.upfrontAccrualBasedAccountingEnabled = upfrontAccrualBasedAccountingEnabled; - this.periodicAccrualBasedAccountingEnabled = periodicAccrualBasedAccountingEnabled; - } - - public Long getLoanId() { - return this.loanId; - } - - public void setLoanId(final Long loanId) { - this.loanId = loanId; - } - - public Long getLoanProductId() { - return this.loanProductId; - } - - public void setLoanProductId(final Long loanProductId) { - this.loanProductId = loanProductId; - } - - public Long getOfficeId() { - return this.officeId; - } - - public void setOfficeId(final Long officeId) { - this.officeId = officeId; - } - - public boolean isCashBasedAccountingEnabled() { - return this.cashBasedAccountingEnabled; - } - - public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) { - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - } - - public boolean isUpfrontAccrualBasedAccountingEnabled() { - return this.upfrontAccrualBasedAccountingEnabled; - } - - public boolean isPeriodicAccrualBasedAccountingEnabled() { - return this.periodicAccrualBasedAccountingEnabled; - } - - public List getNewLoanTransactions() { - return this.newLoanTransactions; - } - - public void setNewLoanTransactions(final List newLoanTransactions) { - this.newLoanTransactions = newLoanTransactions; - } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public void setCurrencyCode(final String currencyCode) { - this.currencyCode = currencyCode; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanTransactionDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanTransactionDTO.java index e61ffaded..4d07de2df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanTransactionDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/LoanTransactionDTO.java @@ -21,15 +21,19 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionEnumData; +@RequiredArgsConstructor +@Getter public class LoanTransactionDTO { private final Long officeId; - + private final Long paymentTypeId; private final String transactionId; private final Date transactionDate; - private final Long paymentTypeId; private final LoanTransactionEnumData transactionType; private final BigDecimal amount; @@ -50,94 +54,6 @@ public class LoanTransactionDTO { private final boolean isAccountTransfer; + @Setter private boolean isLoanToLoanTransfer; - - public LoanTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate, - final LoanTransactionEnumData transactionType, final BigDecimal amount, final BigDecimal principal, final BigDecimal interest, - final BigDecimal fees, final BigDecimal penalties, final BigDecimal overPayment, final boolean reversed, - final List feePayments, final List penaltyPayments, boolean isAccountTransfer) { - this.paymentTypeId = paymentTypeId; - this.transactionId = transactionId; - this.transactionDate = transactionDate; - this.amount = amount; - this.principal = principal; - this.interest = interest; - this.fees = fees; - this.penalties = penalties; - this.reversed = reversed; - this.transactionType = transactionType; - this.feePayments = feePayments; - this.penaltyPayments = penaltyPayments; - this.overPayment = overPayment; - this.officeId = officeId; - this.isAccountTransfer = isAccountTransfer; - } - - public Long getOfficeId() { - return this.officeId; - } - - public String getTransactionId() { - return this.transactionId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public LoanTransactionEnumData getTransactionType() { - return this.transactionType; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public BigDecimal getPrincipal() { - return this.principal; - } - - public BigDecimal getInterest() { - return this.interest; - } - - public BigDecimal getFees() { - return this.fees; - } - - public BigDecimal getPenalties() { - return this.penalties; - } - - public BigDecimal getOverPayment() { - return this.overPayment; - } - - public boolean isReversed() { - return this.reversed; - } - - public Long getPaymentTypeId() { - return this.paymentTypeId; - } - - public List getPenaltyPayments() { - return this.penaltyPayments; - } - - public List getFeePayments() { - return this.feePayments; - } - - public boolean isAccountTransfer() { - return this.isAccountTransfer; - } - - public void setIsLoanToLoanTransfer(boolean isLoanToLoanTransfer) { - this.isLoanToLoanTransfer = isLoanToLoanTransfer; - } - - public boolean isLoanToLoanTransfer() { - return this.isLoanToLoanTransfer; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/OfficeOpeningBalancesData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/OfficeOpeningBalancesData.java index 7ea43a87b..8e5c59d6c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/OfficeOpeningBalancesData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/OfficeOpeningBalancesData.java @@ -20,44 +20,24 @@ package org.apache.fineract.accounting.journalentry.data; import java.time.LocalDate; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.data.GLAccountData; +@RequiredArgsConstructor +@Getter public final class OfficeOpeningBalancesData { - @SuppressWarnings("unused") private final Long officeId; - @SuppressWarnings("unused") private final String officeName; - @SuppressWarnings("unused") private final LocalDate transactionDate; - @SuppressWarnings("unused") private final GLAccountData contraAccount; - @SuppressWarnings("unused") private final List assetAccountOpeningBalances; - @SuppressWarnings("unused") private final List liabityAccountOpeningBalances; - @SuppressWarnings("unused") private final List incomeAccountOpeningBalances; - @SuppressWarnings("unused") private final List equityAccountOpeningBalances; - @SuppressWarnings("unused") private final List expenseAccountOpeningBalances; - private OfficeOpeningBalancesData(final Long officeId, final String officeName, final LocalDate transactionDate, - final GLAccountData contraAccount, final List assetAccountOpeningBalances, - final List liabityAccountOpeningBalances, final List incomeAccountOpeningBalances, - final List equityAccountOpeningBalances, final List expenseAccountOpeningBalances) { - this.officeId = officeId; - this.officeName = officeName; - this.transactionDate = transactionDate; - this.contraAccount = contraAccount; - this.assetAccountOpeningBalances = assetAccountOpeningBalances; - this.liabityAccountOpeningBalances = liabityAccountOpeningBalances; - this.incomeAccountOpeningBalances = incomeAccountOpeningBalances; - this.equityAccountOpeningBalances = equityAccountOpeningBalances; - this.expenseAccountOpeningBalances = expenseAccountOpeningBalances; - } - public static OfficeOpeningBalancesData createNew(final Long officeId, final String officeName, final LocalDate transactionDate, final GLAccountData contraAccount, final List assetAccountOpeningBalances, final List liabityAccountOpeningBalances, final List incomeAccountOpeningBalances, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsDTO.java index 77c0153ae..66028d83d 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsDTO.java @@ -19,7 +19,13 @@ package org.apache.fineract.accounting.journalentry.data; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@AllArgsConstructor +@Getter +@Setter public class SavingsDTO { private Long savingsId; @@ -29,73 +35,4 @@ public class SavingsDTO { private boolean cashBasedAccountingEnabled; private boolean accrualBasedAccountingEnabled; private List newSavingsTransactions; - - public SavingsDTO(final Long savingsId, final Long savingsProductId, final Long officeId, final String currencyCode, - final boolean cashBasedAccountingEnabled, final boolean accrualBasedAccountingEnabled, - final List newSavingsTransactions) { - this.savingsId = savingsId; - this.savingsProductId = savingsProductId; - this.officeId = officeId; - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled; - this.newSavingsTransactions = newSavingsTransactions; - this.currencyCode = currencyCode; - } - - public Long getSavingsId() { - return this.savingsId; - } - - public void setSavingsId(final Long savingsId) { - this.savingsId = savingsId; - } - - public Long getSavingsProductId() { - return this.savingsProductId; - } - - public void setSavingsProductId(final Long savingsProductId) { - this.savingsProductId = savingsProductId; - } - - public Long getOfficeId() { - return this.officeId; - } - - public void setOfficeId(final Long officeId) { - this.officeId = officeId; - } - - public boolean isCashBasedAccountingEnabled() { - return this.cashBasedAccountingEnabled; - } - - public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) { - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - } - - public boolean isAccrualBasedAccountingEnabled() { - return this.accrualBasedAccountingEnabled; - } - - public void setAccrualBasedAccountingEnabled(final boolean accrualBasedAccountingEnabled) { - this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled; - } - - public List getNewSavingsTransactions() { - return this.newSavingsTransactions; - } - - public void setNewSavingsTransactions(final List newSavingsTransactions) { - this.newSavingsTransactions = newSavingsTransactions; - } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public void setCurrencyCode(final String currencyCode) { - this.currencyCode = currencyCode; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsTransactionDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsTransactionDTO.java index d0405ee11..95042852d 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsTransactionDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SavingsTransactionDTO.java @@ -21,97 +21,33 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData; +@RequiredArgsConstructor +@Getter public class SavingsTransactionDTO { private final Long officeId; + private final Long paymentTypeId; private final String transactionId; private final Date transactionDate; - private final Long paymentTypeId; private final SavingsAccountTransactionEnumData transactionType; private final BigDecimal amount; - private final BigDecimal overdraftAmount; /*** Boolean values determines if the transaction is reversed ***/ private final boolean reversed; /** Breakdowns of fees and penalties this Transaction pays **/ - private final List penaltyPayments; private final List feePayments; - private final List taxPayments; - + private final List penaltyPayments; + private final BigDecimal overdraftAmount; private final boolean isAccountTransfer; - - public SavingsTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate, - final SavingsAccountTransactionEnumData transactionType, final BigDecimal amount, final boolean reversed, - final List feePayments, final List penaltyPayments, final BigDecimal overdraftAmount, - boolean isAccountTransfer, final List taxPayments) { - this.paymentTypeId = paymentTypeId; - this.transactionId = transactionId; - this.transactionDate = transactionDate; - this.amount = amount; - this.reversed = reversed; - this.transactionType = transactionType; - this.feePayments = feePayments; - this.penaltyPayments = penaltyPayments; - this.officeId = officeId; - this.overdraftAmount = overdraftAmount; - this.isAccountTransfer = isAccountTransfer; - this.taxPayments = taxPayments; - } - - public Long getOfficeId() { - return this.officeId; - } - - public String getTransactionId() { - return this.transactionId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public Long getPaymentTypeId() { - return this.paymentTypeId; - } - - public SavingsAccountTransactionEnumData getTransactionType() { - return this.transactionType; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public boolean isReversed() { - return this.reversed; - } - - public List getPenaltyPayments() { - return this.penaltyPayments; - } - - public List getFeePayments() { - return this.feePayments; - } - - public BigDecimal getOverdraftAmount() { - return this.overdraftAmount; - } + private final List taxPayments; public boolean isOverdraftTransaction() { return this.overdraftAmount != null && this.overdraftAmount.doubleValue() > 0; } - - public boolean isAccountTransfer() { - return this.isAccountTransfer; - } - - public List getTaxPayments() { - return this.taxPayments; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesDTO.java index 28cbb7f7f..4c513e78a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesDTO.java @@ -19,7 +19,13 @@ package org.apache.fineract.accounting.journalentry.data; import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +@AllArgsConstructor +@Getter +@Setter public class SharesDTO { private Long shareAccountId; @@ -29,73 +35,4 @@ public class SharesDTO { private boolean cashBasedAccountingEnabled; private boolean accrualBasedAccountingEnabled; private List newTransactions; - - public SharesDTO(final Long shareAccountId, final Long shareProductId, final Long officeId, final String currencyCode, - final boolean cashBasedAccountingEnabled, final boolean accrualBasedAccountingEnabled, - final List newTransactions) { - this.shareAccountId = shareAccountId; - this.shareProductId = shareProductId; - this.officeId = officeId; - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled; - this.newTransactions = newTransactions; - this.currencyCode = currencyCode; - } - - public Long getOfficeId() { - return this.officeId; - } - - public void setOfficeId(final Long officeId) { - this.officeId = officeId; - } - - public boolean isCashBasedAccountingEnabled() { - return this.cashBasedAccountingEnabled; - } - - public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) { - this.cashBasedAccountingEnabled = cashBasedAccountingEnabled; - } - - public boolean isAccrualBasedAccountingEnabled() { - return this.accrualBasedAccountingEnabled; - } - - public void setAccrualBasedAccountingEnabled(final boolean accrualBasedAccountingEnabled) { - this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled; - } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public void setCurrencyCode(final String currencyCode) { - this.currencyCode = currencyCode; - } - - public Long getShareAccountId() { - return this.shareAccountId; - } - - public void setShareAccountId(Long shareAccountId) { - this.shareAccountId = shareAccountId; - } - - public Long getShareProductId() { - return this.shareProductId; - } - - public void setShareProductId(Long shareProductId) { - this.shareProductId = shareProductId; - } - - public List getNewTransactions() { - return this.newTransactions; - } - - public void setNewTransactions(List newTransactions) { - this.newTransactions = newTransactions; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesTransactionDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesTransactionDTO.java index 0b5402785..06aac0311 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesTransactionDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/SharesTransactionDTO.java @@ -21,14 +21,18 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionEnumData; +@RequiredArgsConstructor +@Getter public class SharesTransactionDTO { private final Long officeId; + private final Long paymentTypeId; private final String transactionId; private final Date transactionDate; - private final Long paymentTypeId; private final ShareAccountTransactionEnumData transactionType; private final ShareAccountTransactionEnumData transactionStatus; @@ -39,55 +43,4 @@ public class SharesTransactionDTO { /** Breakdowns of fees and penalties this Transaction pays **/ private final List feePayments; - - public SharesTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate, - final ShareAccountTransactionEnumData transactionType, ShareAccountTransactionEnumData transactionStatus, - final BigDecimal amount, final BigDecimal chargeAmount, final List feePayments) { - this.paymentTypeId = paymentTypeId; - this.transactionId = transactionId; - this.transactionDate = transactionDate; - this.amount = amount; - this.chargeAmount = chargeAmount; - this.transactionType = transactionType; - this.transactionStatus = transactionStatus; - this.feePayments = feePayments; - this.officeId = officeId; - } - - public Long getOfficeId() { - return this.officeId; - } - - public String getTransactionId() { - return this.transactionId; - } - - public Date getTransactionDate() { - return this.transactionDate; - } - - public Long getPaymentTypeId() { - return this.paymentTypeId; - } - - public ShareAccountTransactionEnumData getTransactionType() { - return this.transactionType; - } - - public BigDecimal getAmount() { - return this.amount; - } - - public List getFeePayments() { - return this.feePayments; - } - - public ShareAccountTransactionEnumData getTransactionStatus() { - return this.transactionStatus; - } - - public BigDecimal getChargeAmount() { - return this.chargeAmount; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TaxPaymentDTO.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TaxPaymentDTO.java index e9e1d34b9..36270147f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TaxPaymentDTO.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TaxPaymentDTO.java @@ -19,29 +19,14 @@ package org.apache.fineract.accounting.journalentry.data; import java.math.BigDecimal; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor +@Getter public class TaxPaymentDTO { - private final Long creditAccountId; private final Long debitAccountId; + private final Long creditAccountId; private final BigDecimal amount; - - public TaxPaymentDTO(final Long debitAccountId, final Long creditAccountId, final BigDecimal amount) { - this.debitAccountId = debitAccountId; - this.creditAccountId = creditAccountId; - this.amount = amount; - } - - public Long getCreditAccountId() { - return this.creditAccountId; - } - - public Long getDebitAccountId() { - return this.debitAccountId; - } - - public BigDecimal getAmount() { - return this.amount; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionDetailData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionDetailData.java index bff47530f..834b683f7 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionDetailData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionDetailData.java @@ -18,21 +18,18 @@ */ package org.apache.fineract.accounting.journalentry.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.portfolio.note.data.NoteData; import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData; +@RequiredArgsConstructor +@Getter public class TransactionDetailData { - @SuppressWarnings("unused") private final Long transactionId; - - @SuppressWarnings("unused") private final PaymentDetailData paymentDetails; - - @SuppressWarnings("unused") private final NoteData noteData; - - @SuppressWarnings("unused") private final TransactionTypeEnumData transactionType; public TransactionDetailData(final Long transactionId, final PaymentDetailData paymentDetails, final NoteData noteData) { @@ -40,14 +37,5 @@ public class TransactionDetailData { this.paymentDetails = paymentDetails; this.noteData = noteData; this.transactionType = null; - - } - - public TransactionDetailData(final Long transactionId, final PaymentDetailData paymentDetails, final NoteData noteData, - final TransactionTypeEnumData transactionType) { - this.transactionId = transactionId; - this.paymentDetails = paymentDetails; - this.noteData = noteData; - this.transactionType = transactionType; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionTypeEnumData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionTypeEnumData.java index f2ddffaf7..e6463c3e1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionTypeEnumData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/data/TransactionTypeEnumData.java @@ -18,24 +18,17 @@ */ package org.apache.fineract.accounting.journalentry.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + /** * Immutable data object represent loan and Savings status enumerations. */ -@SuppressWarnings("unused") +@RequiredArgsConstructor +@Getter public class TransactionTypeEnumData { private final Long id; private final String code; private final String value; - - public TransactionTypeEnumData(final Long id, final String code, final String value) { - this.id = id; - this.code = code; - this.value = value; - } - - public Long id() { - return this.id; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/CreateJournalEntryCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/CreateJournalEntryCommandHandler.java index a5fd88e4e..edcfabda4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/CreateJournalEntryCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/CreateJournalEntryCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.journalentry.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "JOURNALENTRY", action = "CREATE") +@RequiredArgsConstructor public class CreateJournalEntryCommandHandler implements NewCommandSourceHandler { private final JournalEntryWritePlatformService writePlatformService; - @Autowired - public CreateJournalEntryCommandHandler(final JournalEntryWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/DefineOpeningBalanceCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/DefineOpeningBalanceCommandHandler.java index 24899b082..f423658a7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/DefineOpeningBalanceCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/DefineOpeningBalanceCommandHandler.java @@ -18,25 +18,21 @@ */ package org.apache.fineract.accounting.journalentry.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service @CommandType(entity = "JOURNALENTRY", action = "DEFINEOPENINGBALANCE") +@RequiredArgsConstructor public class DefineOpeningBalanceCommandHandler implements NewCommandSourceHandler { private final JournalEntryWritePlatformService writePlatformService; - @Autowired - public DefineOpeningBalanceCommandHandler(final JournalEntryWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Override public CommandProcessingResult processCommand(JsonCommand command) { return this.writePlatformService.defineOpeningBalance(command); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/ReverseJournalEntryCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/ReverseJournalEntryCommandHandler.java index b74821c8c..41a950fb8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/ReverseJournalEntryCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/ReverseJournalEntryCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.journalentry.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "JOURNALENTRY", action = "REVERSE") +@RequiredArgsConstructor public class ReverseJournalEntryCommandHandler implements NewCommandSourceHandler { private final JournalEntryWritePlatformService writePlatformService; - @Autowired - public ReverseJournalEntryCommandHandler(final JournalEntryWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/UpdateRunningBalanceCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/UpdateRunningBalanceCommandHandler.java index a3c203ed6..00fbd8b65 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/UpdateRunningBalanceCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/handler/UpdateRunningBalanceCommandHandler.java @@ -18,25 +18,21 @@ */ package org.apache.fineract.accounting.journalentry.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.service.JournalEntryRunningBalanceUpdateService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service @CommandType(entity = "JOURNALENTRY", action = "UPDATERUNNINGBALANCE") +@RequiredArgsConstructor public class UpdateRunningBalanceCommandHandler implements NewCommandSourceHandler { private final JournalEntryRunningBalanceUpdateService journalEntryRunningBalanceUpdateService; - @Autowired - public UpdateRunningBalanceCommandHandler(final JournalEntryRunningBalanceUpdateService journalEntryRunningBalanceUpdateService) { - this.journalEntryRunningBalanceUpdateService = journalEntryRunningBalanceUpdateService; - } - @Override public CommandProcessingResult processCommand(JsonCommand command) { return journalEntryRunningBalanceUpdateService.updateOfficeRunningBalance(command); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java index d9ced0ef8..7a6483180 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java @@ -29,6 +29,7 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams; import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand; @@ -37,22 +38,17 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException; import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer; import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Implementation of {@link FromApiJsonDeserializer} for {@link JournalEntryCommand}'s. */ @Component +@RequiredArgsConstructor public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer { private final FromJsonHelper fromApiJsonHelper; - @Autowired - public JournalEntryCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper; - } - @Override public JournalEntryCommand commandFromApiJson(final String json) { if (StringUtils.isBlank(json)) { @@ -102,8 +98,8 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr debits = populateCreditsOrDebitsArray(topLevelJsonElement, locale, debits, JournalEntryJsonInputParams.DEBITS.getValue()); } } - return new JournalEntryCommand(officeId, currencyCode, transactionDate, comments, credits, debits, referenceNumber, - accountingRuleId, amount, paymentTypeId, accountNumber, checkNumber, receiptNumber, bankNumber, routingCode); + return new JournalEntryCommand(officeId, currencyCode, transactionDate, comments, referenceNumber, accountingRuleId, amount, + paymentTypeId, accountNumber, checkNumber, receiptNumber, bankNumber, routingCode, credits, debits); } /** @@ -124,7 +120,7 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr final String comments = this.fromApiJsonHelper.extractStringNamed("comments", creditElement); final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed("amount", creditElement, locale); - debitOrCredits[i] = new SingleDebitOrCreditEntryCommand(parametersPassedInForCreditsCommand, glAccountId, amount, comments); + debitOrCredits[i] = new SingleDebitOrCreditEntryCommand(glAccountId, amount, comments, parametersPassedInForCreditsCommand); } return debitOrCredits; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForLoanFactory.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForLoanFactory.java index 6246be868..fe09b4777 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForLoanFactory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForLoanFactory.java @@ -18,21 +18,17 @@ */ package org.apache.fineract.accounting.journalentry.service; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.data.LoanDTO; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class AccountingProcessorForLoanFactory { private final ApplicationContext applicationContext; - @Autowired - public AccountingProcessorForLoanFactory(final ApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - public AccountingProcessorForLoan determineProcessor(final LoanDTO loanDTO) { AccountingProcessorForLoan accountingProcessorForLoan = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSavingsFactory.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSavingsFactory.java index 35e7e219d..e5c9fb4b5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSavingsFactory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSavingsFactory.java @@ -18,21 +18,17 @@ */ package org.apache.fineract.accounting.journalentry.service; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.data.SavingsDTO; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class AccountingProcessorForSavingsFactory { private final ApplicationContext applicationContext; - @Autowired - public AccountingProcessorForSavingsFactory(final ApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - /*** * Looks like overkill for now, but wanted to keep the savings side of accounting identical to that of Loans (would * we need an Accrual based accounting in the future?) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSharesFactory.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSharesFactory.java index a59fd4097..ef7240b0f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSharesFactory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorForSharesFactory.java @@ -18,21 +18,17 @@ */ package org.apache.fineract.accounting.journalentry.service; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.journalentry.data.SharesDTO; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class AccountingProcessorForSharesFactory { private final ApplicationContext applicationContext; - @Autowired - public AccountingProcessorForSharesFactory(final ApplicationContext applicationContext) { - this.applicationContext = applicationContext; - } - public AccountingProcessorForShares determineProcessor(final SharesDTO sharesDTO) { AccountingProcessorForShares accountingProcessorForShares = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorHelper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorHelper.java index 2e59977d5..9a742a85e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccountingProcessorHelper.java @@ -26,6 +26,7 @@ import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.closure.domain.GLClosureRepository; @@ -75,14 +76,11 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumD import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction; import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository; import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionEnumData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class AccountingProcessorHelper { public static final String LOAN_TRANSACTION_IDENTIFIER = "L"; @@ -90,6 +88,7 @@ public class AccountingProcessorHelper { public static final String CLIENT_TRANSACTION_IDENTIFIER = "C"; public static final String PROVISIONING_TRANSACTION_IDENTIFIER = "P"; public static final String SHARE_TRANSACTION_IDENTIFIER = "SH"; + private final JournalEntryRepository glJournalEntryRepository; private final ProductToGLAccountMappingRepository accountMappingRepository; private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository; @@ -101,32 +100,6 @@ public class AccountingProcessorHelper { private final SavingsAccountTransactionRepository savingsAccountTransactionRepository; private final AccountTransfersReadPlatformService accountTransfersReadPlatformService; private final ChargeRepositoryWrapper chargeRepositoryWrapper; - private final JdbcTemplate jdbcTemplate; - private static final Logger LOG = LoggerFactory.getLogger(AccountingProcessorHelper.class); - - @Autowired - public AccountingProcessorHelper(final JournalEntryRepository glJournalEntryRepository, - final ProductToGLAccountMappingRepository accountMappingRepository, final GLClosureRepository closureRepository, - final OfficeRepositoryWrapper officeRepositoryWrapper, final LoanTransactionRepository loanTransactionRepository, - final SavingsAccountTransactionRepository savingsAccountTransactionRepository, - final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository, - final AccountTransfersReadPlatformService accountTransfersReadPlatformService, - final GLAccountRepositoryWrapper accountRepositoryWrapper, - final ClientTransactionRepositoryWrapper clientTransactionRepositoryWrapper, - final ChargeRepositoryWrapper chargeRepositoryWrapper, final JdbcTemplate jdbcTemplate) { - this.glJournalEntryRepository = glJournalEntryRepository; - this.accountMappingRepository = accountMappingRepository; - this.closureRepository = closureRepository; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.loanTransactionRepository = loanTransactionRepository; - this.savingsAccountTransactionRepository = savingsAccountTransactionRepository; - this.financialActivityAccountRepository = financialActivityAccountRepository; - this.accountTransfersReadPlatformService = accountTransfersReadPlatformService; - this.accountRepositoryWrapper = accountRepositoryWrapper; - this.clientTransactionRepository = clientTransactionRepositoryWrapper; - this.chargeRepositoryWrapper = chargeRepositoryWrapper; - this.jdbcTemplate = jdbcTemplate; - } public LoanDTO populateLoanDtoFromMap(final Map accountingBridgeData, final boolean cashBasedAccountingEnabled, final boolean upfrontAccrualBasedAccountingEnabled, final boolean periodicAccrualBasedAccountingEnabled) { @@ -165,7 +138,7 @@ public class AccountingProcessorHelper { final Long loanChargeId = (Long) loanChargePaid.get("loanChargeId"); final boolean isPenalty = (Boolean) loanChargePaid.get("isPenalty"); final BigDecimal chargeAmountPaid = (BigDecimal) loanChargePaid.get("amount"); - final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid); + final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId); if (isPenalty) { penaltyPaymentDetails.add(chargePaymentDTO); } else { @@ -180,12 +153,12 @@ public class AccountingProcessorHelper { } final LoanTransactionDTO transaction = new LoanTransactionDTO(transactionOfficeId, paymentTypeId, transactionId, transactionDate, transactionType, amount, principal, interest, fees, penalties, overPayments, reversed, - feePaymentDetails, penaltyPaymentDetails, isAccountTransfer); + penaltyPaymentDetails, feePaymentDetails, isAccountTransfer); Boolean isLoanToLoanTransfer = (Boolean) accountingBridgeData.get("isLoanToLoanTransfer"); if (isLoanToLoanTransfer != null && isLoanToLoanTransfer) { - transaction.setIsLoanToLoanTransfer(true); + transaction.setLoanToLoanTransfer(true); } else { - transaction.setIsLoanToLoanTransfer(false); + transaction.setLoanToLoanTransfer(false); } newLoanTransactions.add(transaction); @@ -228,7 +201,7 @@ public class AccountingProcessorHelper { final Long loanChargeId = (Long) loanChargePaid.get("savingsChargeId"); final boolean isPenalty = (Boolean) loanChargePaid.get("isPenalty"); final BigDecimal chargeAmountPaid = (BigDecimal) loanChargePaid.get("amount"); - final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid); + final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId); if (isPenalty) { penaltyPayments.add(chargePaymentDTO); } else { @@ -295,7 +268,7 @@ public class AccountingProcessorHelper { final Long chargeId = (Long) chargePaid.get("chargeId"); final Long loanChargeId = (Long) chargePaid.get("sharesChargeId"); final BigDecimal chargeAmountPaid = (BigDecimal) chargePaid.get("amount"); - final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid); + final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId); feePayments.add(chargePaymentDTO); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java index 72ce62cad..b49baec14 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/AccrualBasedAccountingProcessorForLoan.java @@ -24,6 +24,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan; @@ -33,19 +34,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO; import org.apache.fineract.accounting.journalentry.data.LoanDTO; import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO; import org.apache.fineract.organisation.office.domain.Office; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class AccrualBasedAccountingProcessorForLoan implements AccountingProcessorForLoan { private final AccountingProcessorHelper helper; - @Autowired - public AccrualBasedAccountingProcessorForLoan(final AccountingProcessorHelper accountingProcessorHelper) { - this.helper = accountingProcessorHelper; - } - @Override public void createJournalEntriesForLoan(final LoanDTO loanDTO) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(loanDTO.getOfficeId()); @@ -439,9 +435,10 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess List chargePaymentDTOs = new ArrayList<>(); for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) { - chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(), + chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)) - : chargePaymentDTO.getAmount())); + : chargePaymentDTO.getAmount(), + chargePaymentDTO.getLoanChargeId())); } this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount, @@ -453,9 +450,10 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess List chargePaymentDTOs = new ArrayList<>(); for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) { - chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(), + chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)) - : chargePaymentDTO.getAmount())); + : chargePaymentDTO.getAmount(), + chargePaymentDTO.getLoanChargeId())); } this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForClientTransactions.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForClientTransactions.java index e21759224..b588faad4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForClientTransactions.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForClientTransactions.java @@ -20,25 +20,21 @@ package org.apache.fineract.accounting.journalentry.service; import java.math.BigDecimal; import java.util.Date; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.journalentry.data.ClientTransactionDTO; import org.apache.fineract.organisation.office.domain.Office; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class CashBasedAccountingProcessorForClientTransactions implements AccountingProcessorForClientTransactions { - AccountingProcessorHelper helper; - - @Autowired - public CashBasedAccountingProcessorForClientTransactions(final AccountingProcessorHelper accountingProcessorHelper) { - this.helper = accountingProcessorHelper; - } + private final AccountingProcessorHelper helper; @Override public void createJournalEntriesForClientTransaction(ClientTransactionDTO clientTransactionDTO) { - if (clientTransactionDTO.getAccountingEnabled()) { + if (clientTransactionDTO.isAccountingEnabled()) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(clientTransactionDTO.getOfficeId()); final Date transactionDate = clientTransactionDTO.getTransactionDate(); final Office office = this.helper.getOfficeById(clientTransactionDTO.getOfficeId()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java index bd7d0a31d..f0441fc2d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForLoan.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; @@ -29,19 +30,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO; import org.apache.fineract.accounting.journalentry.data.LoanDTO; import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO; import org.apache.fineract.organisation.office.domain.Office; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class CashBasedAccountingProcessorForLoan implements AccountingProcessorForLoan { private final AccountingProcessorHelper helper; - @Autowired - public CashBasedAccountingProcessorForLoan(final AccountingProcessorHelper accountingProcessorHelper) { - this.helper = accountingProcessorHelper; - } - @Override public void createJournalEntriesForLoan(final LoanDTO loanDTO) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(loanDTO.getOfficeId()); @@ -348,9 +344,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF List chargePaymentDTOs = new ArrayList<>(); for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) { - chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(), + chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)) - : chargePaymentDTO.getAmount())); + : chargePaymentDTO.getAmount(), + chargePaymentDTO.getLoanChargeId())); } this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount, @@ -362,9 +359,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF List chargePaymentDTOs = new ArrayList<>(); for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) { - chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(), + chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)) - : chargePaymentDTO.getAmount())); + : chargePaymentDTO.getAmount(), + chargePaymentDTO.getLoanChargeId())); } this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java index 746ffe6e6..67b409def 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForSavings.java @@ -21,6 +21,7 @@ package org.apache.fineract.accounting.journalentry.service; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings; import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity; @@ -28,19 +29,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO; import org.apache.fineract.accounting.journalentry.data.SavingsDTO; import org.apache.fineract.accounting.journalentry.data.SavingsTransactionDTO; import org.apache.fineract.organisation.office.domain.Office; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class CashBasedAccountingProcessorForSavings implements AccountingProcessorForSavings { private final AccountingProcessorHelper helper; - @Autowired - public CashBasedAccountingProcessorForSavings(final AccountingProcessorHelper accountingProcessorHelper) { - this.helper = accountingProcessorHelper; - } - @Override public void createJournalEntriesForSavings(final SavingsDTO savingsDTO) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(savingsDTO.getOfficeId()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForShares.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForShares.java index ec0de1f3b..dea3e9989 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForShares.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/CashBasedAccountingProcessorForShares.java @@ -21,25 +21,21 @@ package org.apache.fineract.accounting.journalentry.service; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares; import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO; import org.apache.fineract.accounting.journalentry.data.SharesDTO; import org.apache.fineract.accounting.journalentry.data.SharesTransactionDTO; import org.apache.fineract.organisation.office.domain.Office; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class CashBasedAccountingProcessorForShares implements AccountingProcessorForShares { private final AccountingProcessorHelper helper; - @Autowired - public CashBasedAccountingProcessorForShares(final AccountingProcessorHelper helper) { - this.helper = helper; - } - @Override public void createJournalEntriesForShares(SharesDTO sharesDTO) { final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(sharesDTO.getOfficeId()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java index 2850ed9e1..21f5b414a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.common.AccountingEnumerations; import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount; @@ -61,7 +62,6 @@ import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData; import org.apache.fineract.portfolio.savings.service.SavingsEnumerations; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @@ -69,6 +69,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @Service +@RequiredArgsConstructor public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService { private final JdbcTemplate jdbcTemplate; @@ -80,21 +81,6 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat private final PaginationHelper paginationHelper; private final DatabaseSpecificSQLGenerator sqlGenerator; - @Autowired - public JournalEntryReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, - final GLAccountReadPlatformService glAccountReadPlatformService, final ColumnValidator columnValidator, - final OfficeReadPlatformService officeReadPlatformService, - final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper, - DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper paginationHelper) { - this.jdbcTemplate = jdbcTemplate; - this.glAccountReadPlatformService = glAccountReadPlatformService; - this.officeReadPlatformService = officeReadPlatformService; - this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper; - this.columnValidator = columnValidator; - this.paginationHelper = paginationHelper; - this.sqlGenerator = sqlGenerator; - } - private static final class GLJournalEntryMapper implements RowMapper { private final JournalEntryAssociationParametersData associationParametersData; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java index 63a606a4e..69229d801 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java @@ -26,6 +26,8 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.fineract.accounting.common.AccountingEnumerations; import org.apache.fineract.accounting.glaccount.domain.GLAccountType; import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams; @@ -42,19 +44,16 @@ import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecific import org.apache.fineract.infrastructure.jobs.annotation.CronTarget; import org.apache.fineract.infrastructure.jobs.service.JobName; import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor +@Slf4j public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntryRunningBalanceUpdateService { - private static final Logger LOG = LoggerFactory.getLogger(JournalEntryRunningBalanceUpdateServiceImpl.class); - private final JdbcTemplate jdbcTemplate; private final OfficeRepositoryWrapper officeRepositoryWrapper; @@ -66,17 +65,6 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry private final GLJournalEntryMapper entryMapper = new GLJournalEntryMapper(); - @Autowired - public JournalEntryRunningBalanceUpdateServiceImpl(final JdbcTemplate jdbcTemplate, - final OfficeRepositoryWrapper officeRepositoryWrapper, final JournalEntryDataValidator dataValidator, - final FromJsonHelper fromApiJsonHelper, DatabaseSpecificSQLGenerator sqlGenerator) { - this.jdbcTemplate = jdbcTemplate; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.dataValidator = dataValidator; - this.fromApiJsonHelper = fromApiJsonHelper; - this.sqlGenerator = sqlGenerator; - } - @Override @CronTarget(jobName = JobName.ACCOUNTING_RUNNING_BALANCE_UPDATE) public void updateRunningBalance() { @@ -86,7 +74,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class); updateOrganizationRunningBalance(entityDate); } catch (EmptyResultDataAccessException e) { - LOG.debug("No results found for updation of running balance "); + log.debug("No results found for updation of running balance "); } } @@ -107,7 +95,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId); updateRunningBalance(officeId, entityDate); } catch (EmptyResultDataAccessException e) { - LOG.debug("No results found for updation of office running balance with office id: {}", officeId); + log.debug("No results found for updation of office running balance with office id: {}", officeId); } commandProcessingResultBuilder.withOfficeId(officeId); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java index f9be74ad6..34f627e5e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java @@ -30,6 +30,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.closure.domain.GLClosure; import org.apache.fineract.accounting.closure.domain.GLClosureRepository; @@ -78,9 +80,6 @@ import org.apache.fineract.portfolio.client.domain.ClientTransaction; import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail; import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.apache.fineract.useradministration.domain.AppUser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.NonTransientDataAccessException; import org.springframework.orm.jpa.JpaSystemException; @@ -89,10 +88,10 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @Service +@RequiredArgsConstructor +@Slf4j public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements JournalEntryWritePlatformService { - private static final Logger LOG = LoggerFactory.getLogger(JournalEntryWritePlatformServiceJpaRepositoryImpl.class); - private final GLClosureRepository glClosureRepository; private final GLAccountRepository glAccountRepository; private final JournalEntryRepository glJournalEntryRepository; @@ -110,37 +109,6 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper; private final CashBasedAccountingProcessorForClientTransactions accountingProcessorForClientTransactions; - @Autowired - public JournalEntryWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository, - final JournalEntryRepository glJournalEntryRepository, final OfficeRepositoryWrapper officeRepositoryWrapper, - final GLAccountRepository glAccountRepository, final JournalEntryCommandFromApiJsonDeserializer fromApiJsonDeserializer, - final AccountingProcessorHelper accountingProcessorHelper, final AccountingRuleRepository accountingRuleRepository, - final AccountingProcessorForLoanFactory accountingProcessorForLoanFactory, - final AccountingProcessorForSavingsFactory accountingProcessorForSavingsFactory, - final AccountingProcessorForSharesFactory accountingProcessorForSharesFactory, - final GLAccountReadPlatformService glAccountReadPlatformService, - final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository, final PlatformSecurityContext context, - final PaymentDetailWritePlatformService paymentDetailWritePlatformService, - final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper, - final CashBasedAccountingProcessorForClientTransactions accountingProcessorForClientTransactions) { - this.glClosureRepository = glClosureRepository; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.glJournalEntryRepository = glJournalEntryRepository; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.glAccountRepository = glAccountRepository; - this.accountingProcessorForLoanFactory = accountingProcessorForLoanFactory; - this.accountingProcessorForSavingsFactory = accountingProcessorForSavingsFactory; - this.accountingProcessorForSharesFactory = accountingProcessorForSharesFactory; - this.helper = accountingProcessorHelper; - this.accountingRuleRepository = accountingRuleRepository; - this.glAccountReadPlatformService = glAccountReadPlatformService; - this.organisationCurrencyRepository = organisationCurrencyRepository; - this.context = context; - this.paymentDetailWritePlatformService = paymentDetailWritePlatformService; - this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper; - this.accountingProcessorForClientTransactions = accountingProcessorForClientTransactions; - } - @Transactional @Override public CommandProcessingResult createJournalEntry(final JsonCommand command) { @@ -662,7 +630,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa private PlatformDataIntegrityException handleJournalEntryDataIntegrityIssues(final Throwable realCause, final NonTransientDataAccessException dve) { - LOG.error("Error occured.", dve); + log.error("Error occured.", dve); return new PlatformDataIntegrityException("error.msg.glJournalEntry.unknown.data.integrity.issue", "Unknown data integrity issue with resource Journal Entry: " + realCause.getMessage()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java index f0717e831..b0dcc452d 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java @@ -19,19 +19,15 @@ package org.apache.fineract.accounting.producttoaccountmapping.data; import java.io.Serializable; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.portfolio.charge.data.ChargeData; +@RequiredArgsConstructor +@Getter public class ChargeToGLAccountMapper implements Serializable { - @SuppressWarnings("unused") private final ChargeData charge; - @SuppressWarnings("unused") private final GLAccountData incomeAccount; - - public ChargeToGLAccountMapper(final ChargeData charge, final GLAccountData incomeAccount) { - this.charge = charge; - this.incomeAccount = incomeAccount; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java index 7021caa6b..e0e80d4d9 100755 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java @@ -19,19 +19,15 @@ package org.apache.fineract.accounting.producttoaccountmapping.data; import java.io.Serializable; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; +@RequiredArgsConstructor +@Getter public class PaymentTypeToGLAccountMapper implements Serializable { - @SuppressWarnings("unused") private final PaymentTypeData paymentType; - @SuppressWarnings("unused") private final GLAccountData fundSourceAccount; - - public PaymentTypeToGLAccountMapper(final PaymentTypeData paymentType, final GLAccountData fundSourceAccount) { - this.paymentType = paymentType; - this.fundSourceAccount = fundSourceAccount; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java index e53fb6059..037f7f966 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java @@ -26,6 +26,7 @@ import com.google.gson.JsonElement; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams; import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams; @@ -41,7 +42,6 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; import org.apache.fineract.portfolio.savings.DepositAccountType; import org.apache.fineract.portfolio.shareproducts.constants.ShareProductApiConstants; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** @@ -65,15 +65,11 @@ import org.springframework.stereotype.Component; * */ @Component +@RequiredArgsConstructor public final class ProductToGLAccountMappingFromApiJsonDeserializer { private final FromJsonHelper fromApiJsonHelper; - @Autowired - public ProductToGLAccountMappingFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonHelper; - } - public void validateForLoanProductCreate(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java index 24cfcf33a..2a1859abe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java @@ -34,13 +34,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper { - @Autowired public LoanProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository, final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper, final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java index 73267804e..102bfa4c7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java @@ -27,6 +27,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams; import org.apache.fineract.accounting.glaccount.domain.GLAccount; @@ -44,33 +45,19 @@ import org.apache.fineract.portfolio.charge.domain.Charge; import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.domain.PaymentType; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class ProductToGLAccountMappingHelper { protected final GLAccountRepository accountRepository; - protected final GLAccountRepositoryWrapper accountRepositoryWrapper; protected final ProductToGLAccountMappingRepository accountMappingRepository; protected final FromJsonHelper fromApiJsonHelper; private final ChargeRepositoryWrapper chargeRepositoryWrapper; + protected final GLAccountRepositoryWrapper accountRepositoryWrapper; private final PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper; - @Autowired - public ProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository, - final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper, - final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper, - PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper) { - this.accountRepository = glAccountRepository; - this.accountMappingRepository = glAccountMappingRepository; - this.fromApiJsonHelper = fromApiJsonHelper; - this.chargeRepositoryWrapper = chargeRepositoryWrapper; - this.accountRepositoryWrapper = accountRepositoryWrapper; - this.paymentTypeRepositoryWrapper = paymentTypeRepositoryWrapper; - - } - public void saveProductToAccountMapping(final JsonElement element, final String paramName, final Long productId, final int placeHolderTypeId, final GLAccountType expectedAccountType, final PortfolioProductType portfolioProductType) { final Long accountId = this.fromApiJsonHelper.extractLongNamed(paramName, element); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java index 990ef4d9a..3ee10559b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings; @@ -39,21 +40,16 @@ import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioPr import org.apache.fineract.infrastructure.core.domain.JdbcSupport; import org.apache.fineract.portfolio.charge.data.ChargeData; import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class ProductToGLAccountMappingReadPlatformServiceImpl implements ProductToGLAccountMappingReadPlatformService { private final JdbcTemplate jdbcTemplate; - @Autowired - public ProductToGLAccountMappingReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - } - private static final class ProductToGLAccountMappingMapper implements RowMapper> { public String schema() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java index 66b04327f..9b83d02af 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java @@ -25,6 +25,7 @@ import com.google.gson.JsonElement; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan; import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings; @@ -37,11 +38,11 @@ import org.apache.fineract.accounting.producttoaccountmapping.serialization.Prod import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.savings.DepositAccountType; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service +@RequiredArgsConstructor public class ProductToGLAccountMappingWritePlatformServiceImpl implements ProductToGLAccountMappingWritePlatformService { private final FromJsonHelper fromApiJsonHelper; @@ -50,19 +51,6 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc private final SavingsProductToGLAccountMappingHelper savingsProductToGLAccountMappingHelper; private final ShareProductToGLAccountMappingHelper shareProductToGLAccountMappingHelper; - @Autowired - public ProductToGLAccountMappingWritePlatformServiceImpl(final FromJsonHelper fromApiJsonHelper, - final ProductToGLAccountMappingFromApiJsonDeserializer deserializer, - final LoanProductToGLAccountMappingHelper loanProductToGLAccountMappingHelper, - final SavingsProductToGLAccountMappingHelper savingsProductToGLAccountMappingHelper, - final ShareProductToGLAccountMappingHelper shareProductToGLAccountMappingHelper) { - this.fromApiJsonHelper = fromApiJsonHelper; - this.deserializer = deserializer; - this.loanProductToGLAccountMappingHelper = loanProductToGLAccountMappingHelper; - this.savingsProductToGLAccountMappingHelper = savingsProductToGLAccountMappingHelper; - this.shareProductToGLAccountMappingHelper = shareProductToGLAccountMappingHelper; - } - @Override @Transactional public void createLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java index 598f9c311..6cccdfe1f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java @@ -33,13 +33,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper { - @Autowired public SavingsProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository, final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper, final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ShareProductToGLAccountMappingHelper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ShareProductToGLAccountMappingHelper.java index 51ca34b3d..add700b73 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ShareProductToGLAccountMappingHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/service/ShareProductToGLAccountMappingHelper.java @@ -33,13 +33,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper; import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper { - @Autowired public ShareProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository, final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper, final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper, diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java index ec0f229f0..82ad05a2b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java @@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants; import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData; import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData; @@ -55,7 +56,6 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer import org.apache.fineract.infrastructure.core.service.Page; import org.apache.fineract.infrastructure.core.service.SearchParameters; import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -65,32 +65,20 @@ import org.springframework.stereotype.Component; @Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n" + "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n" + "Boolean variable whether to add journal entries for generated provisioning entries\n") +@RequiredArgsConstructor public class ProvisioningEntriesApiResource { + private static final Set PROVISIONING_ENTRY_PARAMETERS = new HashSet<>( + Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM)); + private static final Set ALL_PROVISIONING_ENTRIES = new HashSet<>( + Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM)); + private final PlatformSecurityContext platformSecurityContext; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final DefaultToApiJsonSerializer toApiJsonSerializer; private final DefaultToApiJsonSerializer entriesApiJsonSerializer; private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService; private final ApiRequestParameterHelper apiRequestParameterHelper; - private static final Set PROVISIONING_ENTRY_PARAMETERS = new HashSet<>( - Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM)); - private static final Set ALL_PROVISIONING_ENTRIES = new HashSet<>( - Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM)); - - @Autowired - public ProvisioningEntriesApiResource(final PlatformSecurityContext platformSecurityContext, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, - final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService, - final ApiRequestParameterHelper apiRequestParameterHelper, final DefaultToApiJsonSerializer entriesApiJsonSerializer) { - this.platformSecurityContext = platformSecurityContext; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.toApiJsonSerializer = toApiJsonSerializer; - this.provisioningEntriesReadPlatformService = provisioningEntriesReadPlatformService; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.entriesApiJsonSerializer = entriesApiJsonSerializer; - } @POST @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/data/LoanProductProvisioningEntryData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/data/LoanProductProvisioningEntryData.java index cd3f0498a..89a940438 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/data/LoanProductProvisioningEntryData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/data/LoanProductProvisioningEntryData.java @@ -19,45 +19,29 @@ package org.apache.fineract.accounting.provisioning.data; import java.math.BigDecimal; +import lombok.Getter; +@Getter public class LoanProductProvisioningEntryData { private final Long historyId; - private final Long officeId; - private final String officeName; - private final String currencyCode; - private final Long productId; - private final String productName; - private final Long categoryId; - private final String categoryName; - private final Long overdueInDays; - private final BigDecimal percentage; - private final BigDecimal balance; - private final BigDecimal amountreserved; - private final Long liablityAccount; - private final String liabilityAccountCode; - private final String liabilityAccountName; - private final Long expenseAccount; - private final String expenseAccountCode; - private final String expenseAccountName; - private final Long criteriaId; public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String currencyCode, final Long productId, @@ -108,49 +92,4 @@ public class LoanProductProvisioningEntryData { this.expenseAccountName = expenseAccountName; this.criteriaId = criteriaId; } - - public Long getHistoryId() { - return this.historyId; - } - - public Long getOfficeId() { - return this.officeId; - } - - public Long getProductId() { - return this.productId; - } - - public Long getCategoryId() { - return this.categoryId; - } - - public Long getOverdueInDays() { - return this.overdueInDays; - } - - public BigDecimal getOutstandingBalance() { - return balance; - } - - public BigDecimal getPercentage() { - return percentage; - } - - public Long getLiablityAccount() { - return this.liablityAccount; - } - - public Long getExpenseAccount() { - return this.expenseAccount; - } - - public String getCurrencyCode() { - return this.currencyCode; - } - - public Long getCriteriaId() { - return this.criteriaId; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningEntriesRequestCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningEntriesRequestCommandHandler.java index 492680131..75d521dc9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningEntriesRequestCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningEntriesRequestCommandHandler.java @@ -18,27 +18,22 @@ */ package org.apache.fineract.accounting.provisioning.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "PROVISIONENTRIES", action = "CREATE") +@RequiredArgsConstructor public class CreateProvisioningEntriesRequestCommandHandler implements NewCommandSourceHandler { private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService; - @Autowired - public CreateProvisioningEntriesRequestCommandHandler( - final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) { - this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(JsonCommand jsonCommand) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningJournalEntriesRequestCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningJournalEntriesRequestCommandHandler.java index a42e25e98..96c5922ec 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningJournalEntriesRequestCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/CreateProvisioningJournalEntriesRequestCommandHandler.java @@ -18,27 +18,22 @@ */ package org.apache.fineract.accounting.provisioning.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "PROVISIONJOURNALENTRIES", action = "CREATE") +@RequiredArgsConstructor public class CreateProvisioningJournalEntriesRequestCommandHandler implements NewCommandSourceHandler { private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService; - @Autowired - public CreateProvisioningJournalEntriesRequestCommandHandler( - final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) { - this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(JsonCommand jsonCommand) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/ReCreateProvisioningEntryRequestCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/ReCreateProvisioningEntryRequestCommandHandler.java index 24b23ce79..d1c251370 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/ReCreateProvisioningEntryRequestCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/handler/ReCreateProvisioningEntryRequestCommandHandler.java @@ -18,27 +18,22 @@ */ package org.apache.fineract.accounting.provisioning.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "PROVISIONENTRIES", action = "RECREATE") +@RequiredArgsConstructor public class ReCreateProvisioningEntryRequestCommandHandler implements NewCommandSourceHandler { private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService; - @Autowired - public ReCreateProvisioningEntryRequestCommandHandler( - final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) { - this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(JsonCommand jsonCommand) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java index 206664d3e..e2bb3b01f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants; import org.apache.fineract.infrastructure.core.data.ApiParameterError; @@ -37,20 +38,15 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.organisation.provisioning.exception.ProvisioningCriteriaCannotBeCreatedException; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component +@RequiredArgsConstructor public class ProvisioningEntriesDefinitionJsonDeserializer implements ProvisioningEntriesApiConstants { - private final FromJsonHelper fromApiJsonHelper; private static final Set supportedParameters = new HashSet<>( Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM)); - - @Autowired - public ProvisioningEntriesDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonHelper; - } + private final FromJsonHelper fromApiJsonHelper; public void validateForCreate(final String json) { if (StringUtils.isBlank(json)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesReadPlatformServiceImpl.java index 1b145f21c..d60b14b1a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesReadPlatformServiceImpl.java @@ -26,39 +26,30 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData; import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData; import org.apache.fineract.infrastructure.core.service.Page; import org.apache.fineract.infrastructure.core.service.PaginationHelper; import org.apache.fineract.infrastructure.core.service.SearchParameters; import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor +@Slf4j public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningEntriesReadPlatformService { - private static final Logger LOG = LoggerFactory.getLogger(ProvisioningEntriesReadPlatformServiceImpl.class); private final JdbcTemplate jdbcTemplate; private final PaginationHelper loanProductProvisioningEntryDataPaginationHelper; private final PaginationHelper provisioningEntryDataPaginationHelper; private final DatabaseSpecificSQLGenerator sqlGenerator; - @Autowired - public ProvisioningEntriesReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, DatabaseSpecificSQLGenerator sqlGenerator, - PaginationHelper paginationHelper) { - this.jdbcTemplate = jdbcTemplate; - this.loanProductProvisioningEntryDataPaginationHelper = paginationHelper; - this.provisioningEntryDataPaginationHelper = paginationHelper; - this.sqlGenerator = sqlGenerator; - } - @Override public Collection retrieveLoanProductsProvisioningData(Date date) { String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(date); @@ -250,7 +241,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE try { data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { date }); } catch (EmptyResultDataAccessException e) { - LOG.error("Problem occurred in retrieveProvisioningEntryData function", e); + log.error("Problem occurred in retrieveProvisioningEntryData function", e); } return data; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java index 94e4bc657..06d6b3e00 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java @@ -26,6 +26,8 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.fineract.accounting.glaccount.domain.GLAccount; import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository; import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService; @@ -60,17 +62,15 @@ import org.apache.fineract.organisation.provisioning.service.ProvisioningCriteri import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository; import org.apache.fineract.useradministration.domain.AppUser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.orm.jpa.JpaSystemException; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor +@Slf4j public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements ProvisioningEntriesWritePlatformService { - private static final Logger LOG = LoggerFactory.getLogger(ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.class); private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService; private final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService; private final LoanProductRepository loanProductRepository; @@ -83,28 +83,6 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements private final ProvisioningEntriesDefinitionJsonDeserializer fromApiJsonDeserializer; private final FromJsonHelper fromApiJsonHelper; - @Autowired - public ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl( - final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService, - final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService, - final LoanProductRepository loanProductRepository, final GLAccountRepository glAccountRepository, - final OfficeRepositoryWrapper officeRepositoryWrapper, final ProvisioningCategoryRepository provisioningCategoryRepository, - final PlatformSecurityContext platformSecurityContext, final ProvisioningEntryRepository provisioningEntryRepository, - final JournalEntryWritePlatformService journalEntryWritePlatformService, - final ProvisioningEntriesDefinitionJsonDeserializer fromApiJsonDeserializer, final FromJsonHelper fromApiJsonHelper) { - this.provisioningEntriesReadPlatformService = provisioningEntriesReadPlatformService; - this.provisioningCriteriaReadPlatformService = provisioningCriteriaReadPlatformService; - this.loanProductRepository = loanProductRepository; - this.glAccountRepository = glAccountRepository; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.provisioningCategoryRepository = provisioningCategoryRepository; - this.platformSecurityContext = platformSecurityContext; - this.provisioningEntryRepository = provisioningEntryRepository; - this.journalEntryWritePlatformService = journalEntryWritePlatformService; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.fromApiJsonHelper = fromApiJsonHelper; - } - @Override public CommandProcessingResult createProvisioningJournalEntries(Long provisioningEntryId, JsonCommand command) { ProvisioningEntry requestedEntry = this.provisioningEntryRepository.findById(provisioningEntryId) @@ -169,9 +147,9 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements } createProvsioningEntry(currentDate, addJournalEntries); } catch (ProvisioningEntryAlreadyCreatedException peace) { - LOG.error("Provisioning Entry already created", peace); + log.error("Provisioning Entry already created", peace); } catch (final JpaSystemException | DataIntegrityViolationException dve) { - LOG.error("Problem occurred in generateLoanLossProvisioningAmount function", dve); + log.error("Problem occurred in generateLoanLossProvisioningAmount function", dve); } } @@ -238,7 +216,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements GLAccount liabilityAccount = glAccountRepository.findById(data.getLiablityAccount()).get(); GLAccount expenseAccount = glAccountRepository.findById(data.getExpenseAccount()).get(); MonetaryCurrency currency = loanProduct.getPrincipalAmount().getCurrency(); - Money money = Money.of(currency, data.getOutstandingBalance()); + Money money = Money.of(currency, data.getBalance()); Money amountToReserve = money.percentageOf(data.getPercentage(), MoneyHelper.getRoundingMode()); Long criteraId = data.getCriteriaId(); LoanProductProvisioningEntry entry = new LoanProductProvisioningEntry(loanProduct, office, data.getCurrencyCode(), diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java index 027dde635..50e31296b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java @@ -46,6 +46,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingConstants; import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService; @@ -66,7 +67,6 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.office.service.OfficeReadPlatformService; import org.apache.fineract.useradministration.domain.AppUser; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -80,6 +80,7 @@ import org.springframework.stereotype.Component; + "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n" + "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n" + "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule") +@RequiredArgsConstructor public class AccountingRuleApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>( @@ -98,23 +99,6 @@ public class AccountingRuleApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final CodeValueReadPlatformService codeValueReadPlatformService; - @Autowired - public AccountingRuleApiResource(final PlatformSecurityContext context, - final AccountingRuleReadPlatformService accountingRuleReadPlatformService, - final DefaultToApiJsonSerializer toApiJsonSerializer, - final ApiRequestParameterHelper apiRequestParameterHelper, final GLAccountReadPlatformService accountReadPlatformService, - final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, - final OfficeReadPlatformService officeReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService) { - this.context = context; - this.apiRequestParameterHelper = apiRequestParameterHelper; - this.commandsSourceWritePlatformService = commandsSourceWritePlatformService; - this.apiJsonSerializerService = toApiJsonSerializer; - this.accountingRuleReadPlatformService = accountingRuleReadPlatformService; - this.officeReadPlatformService = officeReadPlatformService; - this.accountReadPlatformService = accountReadPlatformService; - this.codeValueReadPlatformService = codeValueReadPlatformService; - } - @GET @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/data/AccountingTagRuleData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/data/AccountingTagRuleData.java index 930beda41..1f80b609d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/data/AccountingTagRuleData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/data/AccountingTagRuleData.java @@ -18,25 +18,16 @@ */ package org.apache.fineract.accounting.rule.data; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.core.data.EnumOptionData; +@RequiredArgsConstructor +@Getter public class AccountingTagRuleData { - @SuppressWarnings("unused") private final Long id; private final CodeValueData tag; - @SuppressWarnings("unused") private final EnumOptionData transactionType; - - public AccountingTagRuleData(final Long id, final CodeValueData tag, final EnumOptionData transactionType) { - this.id = id; - this.tag = tag; - this.transactionType = transactionType; - } - - public CodeValueData getTag() { - return this.tag; - } - } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/CreateAccountingRuleCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/CreateAccountingRuleCommandHandler.java index f90ca890d..8a8dc9ddc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/CreateAccountingRuleCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/CreateAccountingRuleCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.rule.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "ACCOUNTINGRULE", action = "CREATE") +@RequiredArgsConstructor public class CreateAccountingRuleCommandHandler implements NewCommandSourceHandler { private final AccountingRuleWritePlatformService writePlatformService; - @Autowired - public CreateAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/DeleteAccountingRuleCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/DeleteAccountingRuleCommandHandler.java index ec61507c5..c53743261 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/DeleteAccountingRuleCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/DeleteAccountingRuleCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.rule.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "ACCOUNTINGRULE", action = "DELETE") +@RequiredArgsConstructor public class DeleteAccountingRuleCommandHandler implements NewCommandSourceHandler { private final AccountingRuleWritePlatformService writePlatformService; - @Autowired - public DeleteAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/UpdateAccountingRuleCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/UpdateAccountingRuleCommandHandler.java index 82ab71f6f..9c8118083 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/UpdateAccountingRuleCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/handler/UpdateAccountingRuleCommandHandler.java @@ -18,26 +18,22 @@ */ package org.apache.fineract.accounting.rule.handler; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService; import org.apache.fineract.commands.annotation.CommandType; import org.apache.fineract.commands.handler.NewCommandSourceHandler; import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @CommandType(entity = "ACCOUNTINGRULE", action = "UPDATE") +@RequiredArgsConstructor public class UpdateAccountingRuleCommandHandler implements NewCommandSourceHandler { private final AccountingRuleWritePlatformService writePlatformService; - @Autowired - public UpdateAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) { - this.writePlatformService = writePlatformService; - } - @Transactional @Override public CommandProcessingResult processCommand(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java index 129593e20..20b1983e6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.rule.api.AccountingRuleJsonInputParams; import org.apache.fineract.infrastructure.core.data.ApiParameterError; @@ -32,11 +33,11 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; import org.apache.fineract.infrastructure.core.exception.InvalidJsonException; import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; @Component +@RequiredArgsConstructor public class AccountingRuleCommandFromApiJsonDeserializer { /** @@ -46,11 +47,6 @@ public class AccountingRuleCommandFromApiJsonDeserializer { private final FromJsonHelper fromApiJsonHelper; - @Autowired - public AccountingRuleCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) { - this.fromApiJsonHelper = fromApiJsonHelper; - } - public void validateForCreate(final String json) { if (StringUtils.isBlank(json)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java index 2a3d66039..0b982c4d7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import lombok.RequiredArgsConstructor; import org.apache.fineract.accounting.common.AccountingEnumerations; import org.apache.fineract.accounting.glaccount.data.GLAccountDataForLookup; import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService; @@ -35,7 +36,6 @@ import org.apache.fineract.accounting.rule.exception.AccountingRuleNotFoundExcep import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.domain.JdbcSupport; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -44,18 +44,12 @@ import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Service; @Service +@RequiredArgsConstructor public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleReadPlatformService { private final JdbcTemplate jdbcTemplate; private final GLAccountReadPlatformService glAccountReadPlatformService; - @Autowired - public AccountingRuleReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, - final GLAccountReadPlatformService glAccountReadPlatformService) { - this.jdbcTemplate = jdbcTemplate; - this.glAccountReadPlatformService = glAccountReadPlatformService; - } - private static final class AccountingRuleDataExtractor implements ResultSetExtractor> { private final String schemaSql; diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java index 932af7cf5..e1c7e9392 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java @@ -25,6 +25,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams; import org.apache.fineract.accounting.glaccount.domain.GLAccount; @@ -47,9 +49,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException; import org.apache.fineract.organisation.office.domain.Office; import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.NonTransientDataAccessException; import org.springframework.orm.jpa.JpaSystemException; @@ -57,10 +56,10 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service +@RequiredArgsConstructor +@Slf4j public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements AccountingRuleWritePlatformService { - private static final Logger LOG = LoggerFactory.getLogger(AccountingRuleWritePlatformServiceJpaRepositoryImpl.class); - private final AccountingRuleRepositoryWrapper accountingRuleRepositoryWrapper; private final AccountingRuleRepository accountingRuleRepository; private final GLAccountRepositoryWrapper accountRepositoryWrapper; @@ -68,19 +67,6 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco private final AccountingRuleCommandFromApiJsonDeserializer fromApiJsonDeserializer; private final CodeValueRepository codeValueRepository; - @Autowired - public AccountingRuleWritePlatformServiceJpaRepositoryImpl(final AccountingRuleRepositoryWrapper accountingRuleRepositoryWrapper, - final GLAccountRepositoryWrapper accountRepositoryWrapper, final OfficeRepositoryWrapper officeRepositoryWrapper, - final AccountingRuleRepository ruleRepository, final AccountingRuleCommandFromApiJsonDeserializer fromApiJsonDeserializer, - final CodeValueRepository codeValueRepository) { - this.accountRepositoryWrapper = accountRepositoryWrapper; - this.officeRepositoryWrapper = officeRepositoryWrapper; - this.accountingRuleRepository = ruleRepository; - this.accountingRuleRepositoryWrapper = accountingRuleRepositoryWrapper; - this.fromApiJsonDeserializer = fromApiJsonDeserializer; - this.codeValueRepository = codeValueRepository; - } - /** * @param command * @param dve @@ -93,7 +79,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco throw new AccountingRuleDuplicateException(); } - LOG.error("Error occured.", dve); + log.error("Error occured.", dve); throw new PlatformDataIntegrityException("error.msg.accounting.rule.unknown.data.integrity.issue", "Unknown data integrity issue with resource Accounting Rule: " + realCause.getMessage()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/data/AdHocData.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/data/AdHocData.java index 6707dc0b5..88b1b3bcd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/data/AdHocData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/data/AdHocData.java @@ -22,6 +22,8 @@ import java.time.ZonedDateTime; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.fineract.adhocquery.domain.ReportRunFrequency; import org.apache.fineract.infrastructure.core.data.EnumOptionData; @@ -29,133 +31,32 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData; * Immutable data object represent note or case information AdHocData * */ +@Getter +@RequiredArgsConstructor public class AdHocData { - @SuppressWarnings("unused") private final Long id; - @SuppressWarnings("unused") private final String name; - @SuppressWarnings("unused") private final String query; - @SuppressWarnings("unused") private final String tableName; - @SuppressWarnings("unused") private final String tableFields; - @SuppressWarnings("unused") private final String email; - @SuppressWarnings("unused") private final boolean isActive; - @SuppressWarnings("unused") private final ZonedDateTime createdOn; - @SuppressWarnings("unused") private final Long createdById; - @SuppressWarnings("unused") private final Long updatedById; - @SuppressWarnings("unused") private final ZonedDateTime updatedOn; - @SuppressWarnings("unused") private final String createdBy; - private final List reportRunFrequencies; - private final Long reportRunFrequency; - private final Long reportRunEvery; - private final ZonedDateTime lastRun; - public AdHocData(final Long id, final String name, final String query, final String tableName, final String tableFields, - final boolean isActive, final ZonedDateTime createdOn, final Long createdById, final Long updatedById, - final ZonedDateTime updatedOn, final String createdBy, final String email, final List reportRunFrequencies, - final Long reportRunFrequency, final Long reportRunEvery, final ZonedDateTime lastRun) { - this.id = id; - this.name = name; - this.query = query; - this.tableName = tableName; - this.tableFields = tableFields; - this.isActive = isActive; - this.createdOn = createdOn; - this.createdById = createdById; - this.updatedById = updatedById; - this.updatedOn = updatedOn; - this.createdBy = createdBy; - this.email = email; - this.reportRunFrequencies = reportRunFrequencies; - this.reportRunFrequency = reportRunFrequency; - this.reportRunEvery = reportRunEvery; - this.lastRun = lastRun; - } - public static AdHocData template() { List reportRunFrequencies = Arrays.stream(ReportRunFrequency.values()) .map(rrf -> new EnumOptionData(rrf.getValue(), rrf.getCode(), rrf.getCode())).collect(Collectors.toList()); - AdHocData adHocData = new AdHocData(null, null, null, null, null, false, null, null, null, null, null, null, reportRunFrequencies, - null, null, null); - return adHocData; - } - - public Long getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public String getQuery() { - return this.query; - } - - public String getTableName() { - return this.tableName; - } - - public String getTableFields() { - return this.tableFields; - } - - public String getEmail() { - return this.email; - } - - public boolean isActive() { - return this.isActive; - } - - public ZonedDateTime getCreatedOn() { - return this.createdOn; - } - - public Long getCreatedById() { - return this.createdById; - } - - public Long getUpdatedById() { - return this.updatedById; - } - - public ZonedDateTime getUpdatedOn() { - return this.updatedOn; - } - - public String getCreatedBy() { - return this.createdBy; - } - - public List getReportRunFrequencies() { - return this.reportRunFrequencies; - } - - public Long getReportRunFrequency() { - return this.reportRunFrequency; - } - - public Long getReportRunEvery() { - return this.reportRunEvery; - } - - public ZonedDateTime getLastRun() { - return this.lastRun; + return new AdHocData(null, null, null, null, null, null, false, null, null, null, null, null, reportRunFrequencies, null, null, + null); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java index f4f175d98..6626c948a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocReadPlatformServiceImpl.java @@ -100,8 +100,8 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService { final Long reportRunEvery = JdbcSupport.getLong(rs, "report_run_every"); final ZonedDateTime lastRun = JdbcSupport.getDateTime(rs, "last_run"); - return new AdHocData(id, name, query, tableName, tableFields, isActive, createdDate, createdById, updatedById, updatedOn, - createdByUsername, email, AdHocData.template().getReportRunFrequencies(), reportRunFrequency, reportRunEvery, lastRun); + return new AdHocData(id, name, query, tableName, tableFields, email, isActive, createdDate, createdById, updatedById, updatedOn, + createdByUsername, AdHocData.template().getReportRunFrequencies(), reportRunFrequency, reportRunEvery, lastRun); } public String schema() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchRequest.java b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchRequest.java index c172cd64a..ab0334f22 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchRequest.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchRequest.java @@ -19,6 +19,9 @@ package org.apache.fineract.batch.domain; import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; /** * Provides an object for separate HTTP requests in the Batch Request for Batch API. A requestId is also included as @@ -30,6 +33,9 @@ import java.util.Set; * @see org.apache.fineract.batch.api.BatchApiResource * @see Header */ +@NoArgsConstructor +@AllArgsConstructor +@Data public class BatchRequest { private Long requestId; @@ -38,150 +44,4 @@ public class BatchRequest { private Set
headers; private Long reference; private String body; - - /** - * Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers, reference and body of the incoming - * request. - * - * @param requestId - * of HTTP request. - * @param relativeUrl - * of HTTP request. - * @param method - * of HTTP request. - * @param headers - * of HTTP request. - * @param reference - * of HTTP request. - * @param body - * of HTTP request. - * - * @see Header - */ - public BatchRequest(Long requestId, String relativeUrl, String method, Set
headers, Long reference, String body) { - - this.requestId = requestId; - this.relativeUrl = relativeUrl; - this.method = method; - this.headers = headers; - this.reference = reference; - this.body = body; - } - - /** - * Constructs a default constructor of 'BatchRequest' - */ - public BatchRequest() { - - } - - /** - * Returns the value of 'requestId' of an object of this class. - * - * @return requestId of the HTTP request. - */ - public Long getRequestId() { - return this.requestId; - } - - /** - * Sets the value of 'requestId' of an object of this class. - * - * @param requestId - */ - public void setRequestId(Long requestId) { - this.requestId = requestId; - } - - /** - * Returns the value of 'relativeUrl' of an object of this class. - * - * @return relativeUrl of the HTTP request. - */ - public String getRelativeUrl() { - return this.relativeUrl; - } - - /** - * Sets the value of 'relativeUrl' of an object of this class. - * - * @param relativeUrl - */ - public void setRelativeUrl(String relativeUrl) { - this.relativeUrl = relativeUrl; - } - - /** - * Returns the value of 'method' of an object of this class. - * - * @return method of the HTTP request. - */ - public String getMethod() { - return this.method; - } - - /** - * Sets the value of 'method' of the object of this class. - * - * @param method - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * Returns the values of 'headers' of {@link Header} type of an object of this class. - * - * @return headers of the HTTP request. - * @see Header - */ - public Set
getHeaders() { - return this.headers; - } - - /** - * Sets the values of 'headers' of {@link Header} type of an object of this class. - * - * @param headers - * @see Header - */ - public void setHeaders(Set
headers) { - this.headers = headers; - } - - /** - * Returns the value of 'reference' of an object of this class - * - * @return reference of the HTTP request - */ - public Long getReference() { - return this.reference; - } - - /** - * Sets the value of 'reference' of an object of this class. - * - * @param reference - */ - public void setReference(Long reference) { - this.reference = reference; - } - - /** - * Returns the value of 'body' of an object of this class. - * - * @return body of the HTTP request. - */ - public String getBody() { - return this.body; - } - - /** - * Sets the value of 'body' of an object of this class. - * - * @param body - */ - public void setBody(String body) { - this.body = body; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchResponse.java b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchResponse.java index 73cbb8bf7..c63410ec1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchResponse.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/BatchResponse.java @@ -19,6 +19,9 @@ package org.apache.fineract.batch.domain; import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; /** * Provides an object for separate HTTP responses in the Batch Response for Batch API. It contains all the information @@ -31,108 +34,13 @@ import java.util.Set; * @see org.apache.fineract.batch.service.BatchApiService * @see Header */ +@NoArgsConstructor +@AllArgsConstructor +@Data public class BatchResponse { private Long requestId; private Integer statusCode; private Set
headers; private String body; - - /** - * Constructs a 'BatchResponse' with requestId, statusCode, headers and body of the HTTP requests. - * - * @param requestId - * @param statusCode - * @param headers - * @param body - * @see Header - */ - public BatchResponse(Long requestId, Integer statusCode, Set
headers, String body) { - this.requestId = requestId; - this.statusCode = statusCode; - this.headers = headers; - this.body = body; - } - - /** - * Constructs a default constructor of 'BatchResponse' - */ - public BatchResponse() { - - } - - /** - * Returns the 'requestId' of an object of this class. - * - * @return requestId of the HTTP request. - */ - public Long getRequestId() { - return this.requestId; - } - - /** - * Sets the value of 'requestId' of an object of this class. - * - * @param requestId - */ - public void setRequestId(Long requestId) { - this.requestId = requestId; - } - - /** - * Returns the 'statusCode' of an object of this class. - * - * @return statusCode of the HTTP request. - */ - public Integer getStatusCode() { - return this.statusCode; - } - - /** - * Sets the value of 'statusCode' of an object of this class. - * - * @param statusCode - */ - public void setStatusCode(Integer statusCode) { - this.statusCode = statusCode; - } - - /** - * Returns the 'headers' of {@link Header} type of an object of this class. - * - * @return headers of the HTTP request. - * @see Header - */ - public Set
getHeaders() { - return this.headers; - } - - /** - * Sets the value of 'headers' of {@link Header} type of an object of this class. - * - * @param headers - * of {@link Header} Type - * @see Header - */ - public void setHeaders(Set
headers) { - this.headers = headers; - } - - /** - * Returns the 'body' of an object of this class. - * - * @return body of the HTTP request. - */ - public String getBody() { - return this.body; - } - - /** - * Sets the value of 'body' of an object of this class. - * - * @param body - */ - public void setBody(String body) { - this.body = body; - } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/Header.java b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/Header.java index 48b61c6ba..336100cab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/domain/Header.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/domain/Header.java @@ -18,6 +18,10 @@ */ package org.apache.fineract.batch.domain; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + /** * Provides an object to handle HTTP headers as name and value pairs for Batch API. It is used in {@link BatchRequest} * and {@link BatchResponse} to store the information regarding the headers in incoming and outgoing JSON Strings. @@ -27,65 +31,11 @@ package org.apache.fineract.batch.domain; * @see BatchRequest * @see BatchResponse */ +@NoArgsConstructor +@AllArgsConstructor +@Data public class Header { private String name; private String value; - - /** - * Constructs a 'Header' with the name and value of HTTP headers. - * - * @param name - * of the HTTP header. - * @param value - * of the HTTP header. - */ - public Header(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * Constructs a default constructor of 'Header' - */ - public Header() { - - } - - /** - * Returns the 'name' data field of the object of this class. - * - * @return name data field of this class - */ - public String getName() { - return this.name; - } - - /** - * Sets 'name' data field of this class. - * - * @param name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Returns the 'value' data field of the object of this class. - * - * @return value data field of this class - */ - public String getValue() { - return this.value; - } - - /** - * Sets 'value' data field of this class. - * - * @param value - */ - public void setValue(String value) { - this.value = value; - } - } diff --git a/lombok.config b/lombok.config new file mode 100644 index 000000000..aa692161e --- /dev/null +++ b/lombok.config @@ -0,0 +1,21 @@ +# +# 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. +# +config.stopBubbling = true + +lombok.addLombokGeneratedAnnotation = true \ No newline at end of file