Fineract-614

Changes to comply with Checkstyle rules
This commit is contained in:
Angel Cajas
2020-03-13 17:15:25 +01:00
committed by Michael Vorburger ⛑️
parent 8df44af628
commit b9b265b915
10 changed files with 125 additions and 125 deletions
@@ -25,8 +25,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.google.gson.JsonArray;
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
import org.apache.fineract.infrastructure.codes.domain.CodeValueRepositoryWrapper;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
@@ -73,7 +71,6 @@ import org.apache.fineract.portfolio.loanaccount.exception.MultiDisbursementData
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanApplicationTerms;
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleModel;
import org.apache.fineract.portfolio.loanaccount.loanschedule.service.LoanScheduleAssembler;
import org.apache.fineract.portfolio.loanproduct.LoanProductConstants;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
@@ -20,9 +20,18 @@
package org.apache.fineract.portfolio.rate.api;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -34,15 +43,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.rate.data.RateData;
import org.apache.fineract.portfolio.rate.service.RateReadService;
import org.apache.fineract.portfolio.rate.service.RateWriteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
/**
* Bowpi GT Created by Jose on 19/07/2017.
*/
@@ -19,10 +19,9 @@
package org.apache.fineract.portfolio.rate.data;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import java.io.Serializable;
import java.math.BigDecimal;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
/**
* Bowpi GT Created by Jose on 19/07/2017.
@@ -19,22 +19,20 @@
package org.apache.fineract.portfolio.rate.domain;
import java.util.ArrayList;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang.StringUtils;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
import org.apache.fineract.portfolio.charge.exception.ChargeParameterUpdateNotSupportedException;
import org.apache.fineract.useradministration.domain.AppUser;
import org.apache.fineract.portfolio.rate.domain.RateAppliesTo;
import javax.persistence.*;
import java.math.BigDecimal;
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
/**
* Bowpi GT Created by Jose on 19/07/2017.
@@ -133,7 +131,8 @@ public class Rate extends AbstractAuditableCustom<AppUser, Long> {
'}';
}
public static Rate from(String name, BigDecimal percentage, RateAppliesTo productApply, Boolean active) {
public static Rate from(String name, BigDecimal percentage, RateAppliesTo productApply,
Boolean active) {
return new Rate(name, percentage, productApply, active);
}
@@ -143,7 +142,8 @@ public class Rate extends AbstractAuditableCustom<AppUser, Long> {
final BigDecimal percentage = command.bigDecimalValueOfParameterNamed("percentage");
final RateAppliesTo productApply = RateAppliesTo.fromInt(command.integerValueOfParameterNamed("productApply"));
final RateAppliesTo productApply = RateAppliesTo
.fromInt(command.integerValueOfParameterNamed("productApply"));
final boolean active = command.booleanPrimitiveValueOfParameterNamed("active");
@@ -198,7 +198,8 @@ public class Rate extends AbstractAuditableCustom<AppUser, Long> {
return approveUserId;
}
public void assembleFrom(String name, BigDecimal percentage, Integer productApply, boolean active){
public void assembleFrom(String name, BigDecimal percentage, Integer productApply,
boolean active) {
this.name = name;
this.percentage = percentage;
this.productApply = productApply;
@@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.fineract.portfolio.rate.domain;
package org.apache.fineract.portfolio.rate.domain;
public enum RateAppliesTo {
@@ -60,7 +60,8 @@ public enum RateAppliesTo {
public boolean isLoanRate() {
return this.value.equals(RateAppliesTo.LOAN.getValue());
}
public static Object[] validValues() {
return new Object[] { RateAppliesTo.LOAN.getValue() };
return new Object[]{RateAppliesTo.LOAN.getValue()};
}
}
@@ -18,19 +18,18 @@
*/
package org.apache.fineract.portfolio.rate.domain;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* Bowpi GT
* Rate repository to save on m_rate table (custom change for Credi Chapin)
* Created by Jose on 19/07/2017.
* Bowpi GT Rate repository to save on m_rate table (custom change for Credi Chapin) Created by Jose
* on 19/07/2017.
*/
public interface RateRepository extends JpaRepository<Rate, Long>, JpaSpecificationExecutor<Rate> {
Rate findByName(String name);
List<Rate> findAllByActiveAndProductApply(boolean active, String productApply);
}
@@ -32,10 +32,12 @@ public class RateEnumerations {
EnumOptionData optionData = null;
switch (type) {
case LOAN:
optionData = new EnumOptionData(RateAppliesTo.LOAN.getValue().longValue(), RateAppliesTo.LOAN.getCode(), "Loan");
optionData = new EnumOptionData(RateAppliesTo.LOAN.getValue().longValue(),
RateAppliesTo.LOAN.getCode(), "Loan");
break;
default:
optionData = new EnumOptionData(RateAppliesTo.INVALID.getValue().longValue(), RateAppliesTo.INVALID.getCode(),
optionData = new EnumOptionData(RateAppliesTo.INVALID.getValue().longValue(),
RateAppliesTo.INVALID.getCode(),
"Invalid");
break;
}
@@ -43,5 +45,4 @@ public class RateEnumerations {
}
}
@@ -18,10 +18,9 @@
*/
package org.apache.fineract.portfolio.rate.service;
import org.apache.fineract.portfolio.rate.data.RateData;
import java.util.Collection;
import java.util.List;
import org.apache.fineract.portfolio.rate.data.RateData;
/**
* Bowpi GT
@@ -19,25 +19,23 @@
package org.apache.fineract.portfolio.rate.service;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.charge.service.ChargeEnumerations;
import org.apache.fineract.portfolio.rate.domain.RateAppliesTo;
import org.apache.fineract.portfolio.rate.exception.RateNotFoundException;
import org.apache.fineract.portfolio.rate.domain.Rate;
import org.apache.fineract.portfolio.rate.data.RateData;
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;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.rate.data.RateData;
import org.apache.fineract.portfolio.rate.domain.Rate;
import org.apache.fineract.portfolio.rate.domain.RateAppliesTo;
import org.apache.fineract.portfolio.rate.exception.RateNotFoundException;
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;
/**
* Bowpi GT Created by Jose on 19/07/2017.
@@ -95,7 +93,7 @@ public class RateReadServiceImpl implements RateReadService {
this.context.authenticatedUser();
final RateMapper rm = new RateMapper();
final String sql = "select " + rm.rateSchema() + " where r.active = ? and product_apply=?";
return this.jdbcTemplate.query(sql, rm, new Object[]{true, RateAppliesTo.LOAN.getValue() });
return this.jdbcTemplate.query(sql, rm, new Object[]{true, RateAppliesTo.LOAN.getValue()});
}
@Override
@@ -146,7 +144,8 @@ public class RateReadServiceImpl implements RateReadService {
final Long id = rateResponse.getId();
final String name = rateResponse.getName();
final BigDecimal percentage = rateResponse.getPercentage();
final EnumOptionData productApply = RateEnumerations.rateAppliesTo(rateResponse.getProductApply());;
final EnumOptionData productApply = RateEnumerations
.rateAppliesTo(rateResponse.getProductApply());
final boolean active = rateResponse.isActive();
return RateData.instance(id, name, percentage, productApply, active);
}