Added and Enforced Membername Checkstyle(2)

This commit is contained in:
Manthan Surkar
2020-08-20 07:29:09 +03:00
committed by Petri Tuomola
parent bfcd74aeb3
commit 774fcd9265
61 changed files with 224 additions and 215 deletions
@@ -184,6 +184,11 @@
<message key="ws.notPreceded" <message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module> </module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParenPad" /> <module name="ParenPad" />
<module name="ModifierOrder"/> <module name="ModifierOrder"/>
<module name="LocalVariableName"> <module name="LocalVariableName">
@@ -231,11 +236,7 @@
<module name="RedundantModifier"/> <module name="RedundantModifier"/>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
@@ -36,10 +36,10 @@ import org.springframework.stereotype.Component;
@Component @Component
public class ExternalServicesPropertiesCommandFromApiJsonDeserializer { public class ExternalServicesPropertiesCommandFromApiJsonDeserializer {
private final Set<String> S3SupportedParameters = S3JSONinputParams.getAllValues(); private final Set<String> s3SupportedParameters = S3JSONinputParams.getAllValues();
private final Set<String> SMTPSupportedParameters = SMTPJSONinputParams.getAllValues(); private final Set<String> smtpSupportedParameters = SMTPJSONinputParams.getAllValues();
private final Set<String> SMSSupportedParameters = SMSJSONinputParams.getAllValues(); private final Set<String> smsSupportedParameters = SMSJSONinputParams.getAllValues();
private final Set<String> NotificationSupportedParameters = NotificationJSONinputParams.getAllValues(); private final Set<String> notificationSupportedParameters = NotificationJSONinputParams.getAllValues();
private final FromJsonHelper fromApiJsonHelper; private final FromJsonHelper fromApiJsonHelper;
@Autowired @Autowired
@@ -55,19 +55,19 @@ public class ExternalServicesPropertiesCommandFromApiJsonDeserializer {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType(); final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
switch (externalServiceName) { switch (externalServiceName) {
case "S3": case "S3":
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.S3SupportedParameters); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.s3SupportedParameters);
break; break;
case "SMTP": case "SMTP":
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.SMTPSupportedParameters); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.smtpSupportedParameters);
break; break;
case "SMS": case "SMS":
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.SMSSupportedParameters); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.smsSupportedParameters);
break; break;
case "NOTIFICATION": case "NOTIFICATION":
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.NotificationSupportedParameters); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.notificationSupportedParameters);
break; break;
default: default:
@@ -58,7 +58,7 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class CreditBureauConfigurationAPI { public class CreditBureauConfigurationAPI {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive")); Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
private final String resourceNameForPermissions = "CreditBureau"; private final String resourceNameForPermissions = "CreditBureau";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
@@ -107,7 +107,7 @@ public class CreditBureauConfigurationAPI {
final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau(); final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, creditBureau, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, creditBureau, this.responseDataParameters);
} }
@@ -123,7 +123,7 @@ public class CreditBureauConfigurationAPI {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping,
this.RESPONSE_DATA_PARAMETERS); this.responseDataParameters);
} }
@@ -138,8 +138,7 @@ public class CreditBureauConfigurationAPI {
.retrieveOrgCreditBureau(); .retrieveOrgCreditBureau();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau, return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau, this.responseDataParameters);
this.RESPONSE_DATA_PARAMETERS);
} }
@@ -170,7 +169,7 @@ public class CreditBureauConfigurationAPI {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping,
this.RESPONSE_DATA_PARAMETERS); this.responseDataParameters);
} }
@PUT @PUT
@@ -38,11 +38,11 @@ public final class CreditBureauLoanProductMappingData {
private final long stalePeriod; private final long stalePeriod;
private final boolean is_active; private final boolean isActive;
private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId, final long organisationCreditBureauId, private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId, final long organisationCreditBureauId,
final String alias, final String creditbureauSummary, final String loanProductName, final long loanProductId, final String alias, final String creditbureauSummary, final String loanProductName, final long loanProductId,
final boolean isCreditCheckMandatory, final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) { final boolean isCreditCheckMandatory, final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean isActive) {
this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId; this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId;
this.organisationCreditBureauId = organisationCreditBureauId; this.organisationCreditBureauId = organisationCreditBureauId;
this.alias = alias; this.alias = alias;
@@ -52,16 +52,16 @@ public final class CreditBureauLoanProductMappingData {
this.isCreditCheckMandatory = isCreditCheckMandatory; this.isCreditCheckMandatory = isCreditCheckMandatory;
this.skipCrediCheckInFailure = skipCrediCheckInFailure; this.skipCrediCheckInFailure = skipCrediCheckInFailure;
this.stalePeriod = stalePeriod; this.stalePeriod = stalePeriod;
this.is_active = is_active; this.isActive = isActive;
} }
public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId, public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId,
final long organisationCreditBureauId, final String alias, final String creditbureauSummary, final String loanProductName, final long organisationCreditBureauId, final String alias, final String creditbureauSummary, final String loanProductName,
final long loanProductId, final boolean isCreditCheckMandatory, final boolean skipCrediCheckInFailure, final long stalePeriod, final long loanProductId, final boolean isCreditCheckMandatory, final boolean skipCrediCheckInFailure, final long stalePeriod,
final boolean is_active) { final boolean isActive) {
return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias, return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias,
creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure, stalePeriod, creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure, stalePeriod,
is_active); isActive);
} }
public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) { public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) {
@@ -104,8 +104,8 @@ public final class CreditBureauLoanProductMappingData {
return this.stalePeriod; return this.stalePeriod;
} }
public boolean isIs_active() { public boolean isisActive() {
return this.is_active; return this.isActive;
} }
} }
@@ -34,11 +34,11 @@ public final class OrganisationCreditBureauData {
private final String creditBureauSummary; private final String creditBureauSummary;
private final boolean is_active; private final boolean isActive;
private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias, final long creditBureauId, private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias, final long creditBureauId,
final String creditBureauName, final String creditBureauProduct, final String creditBureauCountry, final String creditBureauName, final String creditBureauProduct, final String creditBureauCountry,
final String creditBureauSummary, final boolean is_active) { final String creditBureauSummary, final boolean isActive) {
this.organisationCreditBureauId = organisationCreditBureauId; this.organisationCreditBureauId = organisationCreditBureauId;
this.alias = alias; this.alias = alias;
this.creditBureauId = creditBureauId; this.creditBureauId = creditBureauId;
@@ -46,14 +46,14 @@ public final class OrganisationCreditBureauData {
this.creditBureauProduct = creditBureauProduct; this.creditBureauProduct = creditBureauProduct;
this.creditBureauCountry = creditBureauCountry; this.creditBureauCountry = creditBureauCountry;
this.creditBureauSummary = creditBureauSummary; this.creditBureauSummary = creditBureauSummary;
this.is_active = is_active; this.isActive = isActive;
} }
public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias, public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias,
final long creditBureauId, final String creditBureauName, final String creditBureauProduct, final String creditBureauCountry, final long creditBureauId, final String creditBureauName, final String creditBureauProduct, final String creditBureauCountry,
final String creditBureauSummary, final boolean is_active) { final String creditBureauSummary, final boolean isActive) {
return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName, creditBureauProduct, return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName, creditBureauProduct,
creditBureauCountry, creditBureauSummary, is_active); creditBureauCountry, creditBureauSummary, isActive);
} }
public long getOrganisationCreditBureauId() { public long getOrganisationCreditBureauId() {
@@ -85,7 +85,7 @@ public final class OrganisationCreditBureauData {
} }
public boolean isActive() { public boolean isActive() {
return this.is_active; return this.isActive;
} }
} }
@@ -28,6 +28,7 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct; import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
@SuppressWarnings({ "MemberName" })
@Entity @Entity
@Table(name = "m_creditbureau_loanproduct_mapping") @Table(name = "m_creditbureau_loanproduct_mapping")
public class CreditBureauLoanProductMapping extends AbstractPersistableCustom { public class CreditBureauLoanProductMapping extends AbstractPersistableCustom {
@@ -37,16 +37,16 @@ public class OrganisationCreditBureau extends AbstractPersistableCustom {
@OneToOne @OneToOne
private CreditBureau creditbureau; private CreditBureau creditbureau;
private boolean is_active; private boolean isActive;
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL) @OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>(); private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>();
public OrganisationCreditBureau(String alias, CreditBureau creditbureau, boolean is_active, public OrganisationCreditBureau(String alias, CreditBureau creditbureau, boolean isActive,
List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) { List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
this.alias = alias; this.alias = alias;
this.creditbureau = creditbureau; this.creditbureau = creditbureau;
this.is_active = is_active; this.isActive = isActive;
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping; this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
} }
@@ -56,9 +56,9 @@ public class OrganisationCreditBureau extends AbstractPersistableCustom {
public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditbureau) { public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditbureau) {
final String alias = command.stringValueOfParameterNamed("alias"); final String alias = command.stringValueOfParameterNamed("alias");
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active"); final boolean isActive = command.booleanPrimitiveValueOfParameterNamed("isActive");
return new OrganisationCreditBureau(alias, creditbureau, is_active, null); return new OrganisationCreditBureau(alias, creditbureau, isActive, null);
} }
public String getAlias() { public String getAlias() {
@@ -78,11 +78,11 @@ public class OrganisationCreditBureau extends AbstractPersistableCustom {
} }
public boolean isActive() { public boolean isActive() {
return this.is_active; return this.isActive;
} }
public void setIsActive(boolean is_active) { public void setIsActive(boolean isActive) {
this.is_active = is_active; this.isActive = isActive;
} }
public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() { public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() {
@@ -26,6 +26,7 @@ import org.apache.fineract.infrastructure.dataqueries.data.ResultsetRowData;
/** /**
* Created by sanyam on 31/7/17. * Created by sanyam on 31/7/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class DatatablesApiResourceSwagger { final class DatatablesApiResourceSwagger {
private DatatablesApiResourceSwagger() { private DatatablesApiResourceSwagger() {
@@ -62,7 +62,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.") @Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.")
public class ReportsApiResource { public class ReportsApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType", "reportSubType", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "reportName", "reportType", "reportSubType",
"reportCategory", "description", "reportSql", "coreReport", "useReport", "reportParameters")); "reportCategory", "description", "reportSql", "coreReport", "useReport", "reportParameters"));
private final String resourceNameForPermissions = "REPORT"; private final String resourceNameForPermissions = "REPORT";
@@ -97,7 +97,7 @@ public class ReportsApiResource {
final Collection<ReportData> result = this.readReportingService.retrieveReportList(); final Collection<ReportData> result = this.readReportingService.retrieveReportList();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, result, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, result, this.responseDataParameters);
} }
@GET @GET
@@ -119,7 +119,7 @@ public class ReportsApiResource {
if (settings.isTemplate()) { if (settings.isTemplate()) {
result.appendedTemplate(this.readReportingService.getAllowedParameters(), this.readReportingService.getAllowedReportTypes()); result.appendedTemplate(this.readReportingService.getAllowedParameters(), this.readReportingService.getAllowedReportTypes());
} }
return this.toApiJsonSerializer.serialize(settings, result, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, result, this.responseDataParameters);
} }
@GET @GET
@@ -138,7 +138,7 @@ public class ReportsApiResource {
result.appendedTemplate(this.readReportingService.getAllowedParameters(), this.readReportingService.getAllowedReportTypes()); result.appendedTemplate(this.readReportingService.getAllowedParameters(), this.readReportingService.getAllowedReportTypes());
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, result, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, result, this.responseDataParameters);
} }
@POST @POST
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
public class DataTableValidator { public class DataTableValidator {
private final FromJsonHelper fromApiJsonHelper; private final FromJsonHelper fromApiJsonHelper;
private final Set<String> REGISTER_PARAMS = new HashSet<>( private final Set<String> registerParams = new HashSet<>(
Arrays.asList(DataTableApiConstant.categoryParamName, DataTableApiConstant.localParamName)); Arrays.asList(DataTableApiConstant.categoryParamName, DataTableApiConstant.localParamName));
@Autowired @Autowired
@@ -50,7 +50,7 @@ public class DataTableValidator {
public void validateDataTableRegistration(final String json) { public void validateDataTableRegistration(final String json) {
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType(); final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REGISTER_PARAMS); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, registerParams);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
@@ -71,10 +71,10 @@ import org.springframework.stereotype.Component;
+ "Groups: URL Pattern as groups") + "Groups: URL Pattern as groups")
public class DocumentManagementApiResource { public class DocumentManagementApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("id", "parentEntityType", "parentEntityId", "name", "fileName", "size", "type", "description")); Arrays.asList("id", "parentEntityType", "parentEntityId", "name", "fileName", "size", "type", "description"));
private final String SystemEntityType = "DOCUMENT"; private final String systemEntityType = "DOCUMENT";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final DocumentReadPlatformService documentReadPlatformService; private final DocumentReadPlatformService documentReadPlatformService;
@@ -104,12 +104,12 @@ public class DocumentManagementApiResource {
@PathParam("entityType") @Parameter(description = "entityType") final String entityType, @PathParam("entityType") @Parameter(description = "entityType") final String entityType,
@PathParam("entityId") @Parameter(description = "entityId") final Long entityId) { @PathParam("entityId") @Parameter(description = "entityId") final Long entityId) {
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); this.context.authenticatedUser().validateHasReadPermission(this.systemEntityType);
final Collection<DocumentData> documentDatas = this.documentReadPlatformService.retrieveAllDocuments(entityType, entityId); final Collection<DocumentData> documentDatas = this.documentReadPlatformService.retrieveAllDocuments(entityType, entityId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, documentDatas, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, documentDatas, this.responseDataParameters);
} }
@POST @POST
@@ -204,12 +204,12 @@ public class DocumentManagementApiResource {
@PathParam("entityId") @Parameter(description = "entityId") final Long entityId, @PathParam("entityId") @Parameter(description = "entityId") final Long entityId,
@PathParam("documentId") @Parameter(description = "documentId") final Long documentId, @Context final UriInfo uriInfo) { @PathParam("documentId") @Parameter(description = "documentId") final Long documentId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); this.context.authenticatedUser().validateHasReadPermission(this.systemEntityType);
final DocumentData documentData = this.documentReadPlatformService.retrieveDocument(entityType, entityId, documentId); final DocumentData documentData = this.documentReadPlatformService.retrieveDocument(entityType, entityId, documentId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, documentData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, documentData, this.responseDataParameters);
} }
@GET @GET
@@ -223,7 +223,7 @@ public class DocumentManagementApiResource {
@PathParam("entityId") @Parameter(description = "entityId") final Long entityId, @PathParam("entityId") @Parameter(description = "entityId") final Long entityId,
@PathParam("documentId") @Parameter(description = "documentId") final Long documentId) { @PathParam("documentId") @Parameter(description = "documentId") final Long documentId) {
this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType); this.context.authenticatedUser().validateHasReadPermission(this.systemEntityType);
final FileData fileData = this.documentReadPlatformService.retrieveFileData(entityType, entityId, documentId); final FileData fileData = this.documentReadPlatformService.retrieveFileData(entityType, entityId, documentId);
final ResponseBuilder response = Response.ok(fileData.file()); final ResponseBuilder response = Response.ok(fileData.file());
@@ -22,7 +22,7 @@ public final class FineractEntityType {
private String type; private String type;
private String description; private String description;
private String table_name; private String tableName;
public static final FineractEntityType OFFICE = new FineractEntityType("office", "Offices", "m_office"); public static final FineractEntityType OFFICE = new FineractEntityType("office", "Offices", "m_office");
public static final FineractEntityType LOAN_PRODUCT = new FineractEntityType("loan_product", "Loan Products", "m_product_loan"); public static final FineractEntityType LOAN_PRODUCT = new FineractEntityType("loan_product", "Loan Products", "m_product_loan");
@@ -31,10 +31,10 @@ public final class FineractEntityType {
public static final FineractEntityType CHARGE = new FineractEntityType("charge", "Fees/Charges", "m_charge"); public static final FineractEntityType CHARGE = new FineractEntityType("charge", "Fees/Charges", "m_charge");
public static final FineractEntityType SHARE_PRODUCT = new FineractEntityType("shares_product", "Shares Products", "m_share_product"); public static final FineractEntityType SHARE_PRODUCT = new FineractEntityType("shares_product", "Shares Products", "m_share_product");
private FineractEntityType(String type, String description, String table_name) { private FineractEntityType(String type, String description, String tableName) {
this.type = type; this.type = type;
this.description = description; this.description = description;
this.table_name = table_name; this.tableName = tableName;
} }
public String getType() { public String getType() {
@@ -46,7 +46,7 @@ public final class FineractEntityType {
} }
public String getTable() { public String getTable() {
return this.table_name; return this.tableName;
} }
public static FineractEntityType get(String type) { public static FineractEntityType get(String type) {
@@ -27,6 +27,7 @@ import org.springframework.util.Assert;
@Repository @Repository
@Profile("twofactor") @Profile("twofactor")
@SuppressWarnings({ "MemberName" })
public class OTPRequestRepository { public class OTPRequestRepository {
private final ConcurrentHashMap<Long, OTPRequest> OTPrequests = new ConcurrentHashMap<>(); private final ConcurrentHashMap<Long, OTPRequest> OTPrequests = new ConcurrentHashMap<>();
@@ -35,7 +35,7 @@ import org.springframework.util.Assert;
public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler {
protected final Logger LOG = LoggerFactory.getLogger(getClass()); protected static final Logger LOG = LoggerFactory.getLogger(CustomAuthenticationFailureHandler.class);
private String defaultFailureUrl; private String defaultFailureUrl;
private boolean forwardToDestination = false; private boolean forwardToDestination = false;
@@ -55,18 +55,18 @@ public class CustomAuthenticationFailureHandler implements AuthenticationFailure
final AuthenticationException exception) throws IOException, ServletException { final AuthenticationException exception) throws IOException, ServletException {
if (this.defaultFailureUrl == null) { if (this.defaultFailureUrl == null) {
this.LOG.debug("No failure URL set, sending 401 Unauthorized error"); LOG.debug("No failure URL set, sending 401 Unauthorized error");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication Failed: " + exception.getMessage()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authentication Failed: " + exception.getMessage());
} else { } else {
saveException(request, exception); saveException(request, exception);
if (this.forwardToDestination) { if (this.forwardToDestination) {
this.LOG.debug("Forwarding to {}", this.defaultFailureUrl); LOG.debug("Forwarding to {}", this.defaultFailureUrl);
request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response); request.getRequestDispatcher(this.defaultFailureUrl).forward(request, response);
} else { } else {
this.LOG.debug("Redirecting to {}", this.defaultFailureUrl); LOG.debug("Redirecting to {}", this.defaultFailureUrl);
final String oauthToken = request.getParameter("oauth_token"); final String oauthToken = request.getParameter("oauth_token");
request.setAttribute("oauth_token", oauthToken); request.setAttribute("oauth_token", oauthToken);
@@ -26,6 +26,7 @@ import org.joda.time.DateTime;
/** /**
* Created by sanyam on 13/8/17. * Created by sanyam on 13/8/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class SurveyApiResourceSwagger { final class SurveyApiResourceSwagger {
private SurveyApiResourceSwagger() { private SurveyApiResourceSwagger() {
@@ -47,7 +47,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Mix Taxonomy", description = "") @Tag(name = "Mix Taxonomy", description = "")
public class MixTaxonomyApiResource { public class MixTaxonomyApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("taxonomyId", "name", "namespace", "dimension", "description")); Arrays.asList("taxonomyId", "name", "namespace", "dimension", "description"));
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
@@ -75,6 +75,6 @@ public class MixTaxonomyApiResource {
final List<MixTaxonomyData> taxonomyDatas = this.readTaxonomyService.retrieveAll(); final List<MixTaxonomyData> taxonomyDatas = this.readTaxonomyService.retrieveAll();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, taxonomyDatas, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, taxonomyDatas, this.responseDataParameters);
} }
} }
@@ -51,7 +51,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Mix Mapping", description = "") @Tag(name = "Mix Mapping", description = "")
public class MixTaxonomyMappingApiResource { public class MixTaxonomyMappingApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("identifier", "config")); private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("identifier", "config"));
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final ToApiJsonSerializer<MixTaxonomyMappingData> toApiJsonSerializer; private final ToApiJsonSerializer<MixTaxonomyMappingData> toApiJsonSerializer;
@@ -80,7 +80,7 @@ public class MixTaxonomyMappingApiResource {
this.context.authenticatedUser(); this.context.authenticatedUser();
final MixTaxonomyMappingData mappingData = this.readTaxonomyMappingService.retrieveTaxonomyMapping(); final MixTaxonomyMappingData mappingData = this.readTaxonomyMappingService.retrieveTaxonomyMapping();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, mappingData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, mappingData, this.responseDataParameters);
} }
@PUT @PUT
@@ -58,7 +58,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.") @Tag(name = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.")
public class CurrenciesApiResource { public class CurrenciesApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions")); private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
private final String resourceNameForPermissions = "CURRENCY"; private final String resourceNameForPermissions = "CURRENCY";
@@ -94,7 +94,7 @@ public class CurrenciesApiResource {
final ApplicationCurrencyConfigurationData configurationData = this.readPlatformService.retrieveCurrencyConfiguration(); final ApplicationCurrencyConfigurationData configurationData = this.readPlatformService.retrieveCurrencyConfiguration();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, configurationData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, configurationData, this.responseDataParameters);
} }
@PUT @PUT
@@ -74,7 +74,7 @@ public class OfficesApiResource {
/** /**
* The set of parameters that are supported in response for {@link OfficeData}. * The set of parameters that are supported in response for {@link OfficeData}.
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "nameDecorated", "externalId", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "name", "nameDecorated", "externalId",
"openingDate", "hierarchy", "parentId", "parentName", "allowedParents")); "openingDate", "hierarchy", "parentId", "parentName", "allowedParents"));
private final String resourceNameForPermissions = "OFFICE"; private final String resourceNameForPermissions = "OFFICE";
@@ -121,7 +121,7 @@ public class OfficesApiResource {
final Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices(onlyManualEntries, searchParameters); final Collection<OfficeData> offices = this.readPlatformService.retrieveAllOffices(onlyManualEntries, searchParameters);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, offices, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, offices, this.responseDataParameters);
} }
@GET @GET
@@ -142,7 +142,7 @@ public class OfficesApiResource {
office = OfficeData.appendedTemplate(office, allowedParents); office = OfficeData.appendedTemplate(office, allowedParents);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, office, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, office, this.responseDataParameters);
} }
@POST @POST
@@ -185,7 +185,7 @@ public class OfficesApiResource {
office = OfficeData.appendedTemplate(office, allowedParents); office = OfficeData.appendedTemplate(office, allowedParents);
} }
return this.toApiJsonSerializer.serialize(settings, office, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, office, this.responseDataParameters);
} }
@PUT @PUT
@@ -75,8 +75,8 @@ public class StaffApiResource {
/** /**
* The set of parameters that are supported in response for {@link StaffData}. * The set of parameters that are supported in response for {@link StaffData}.
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "firstname", "lastname", "displayName", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "firstname", "lastname", "displayName", "officeId",
"officeId", "officeName", "isLoanOfficer", "externalId", "mobileNo", "allowedOffices", "isActive", "joiningDate")); "officeName", "isLoanOfficer", "externalId", "mobileNo", "allowedOffices", "isActive", "joiningDate"));
private final String resourceNameForPermissions = "STAFF"; private final String resourceNameForPermissions = "STAFF";
@@ -134,7 +134,7 @@ public class StaffApiResource {
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, staff, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, staff, this.responseDataParameters);
} }
@POST @POST
@@ -174,7 +174,7 @@ public class StaffApiResource {
final Collection<OfficeData> allowedOffices = this.officeReadPlatformService.retrieveAllOfficesForDropdown(); final Collection<OfficeData> allowedOffices = this.officeReadPlatformService.retrieveAllOfficesForDropdown();
staff = StaffData.templateData(staff, allowedOffices); staff = StaffData.templateData(staff, allowedOffices);
} }
return this.toApiJsonSerializer.serialize(settings, staff, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, staff, this.responseDataParameters);
} }
@PUT @PUT
@@ -58,7 +58,7 @@ import org.springframework.stereotype.Component;
+ "add regular expression for validation") + "add regular expression for validation")
public class EntityFieldConfigurationApiResources { public class EntityFieldConfigurationApiResources {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("clientAddressId", "client_id", "address_id", "address_type_id", "isActive", "fieldConfigurationId", "entity", Arrays.asList("clientAddressId", "client_id", "address_id", "address_type_id", "isActive", "fieldConfigurationId", "entity",
"table", "field", "is_enabled", "is_mandatory", "validation_regex")); "table", "field", "is_enabled", "is_mandatory", "validation_regex"));
private final String resourceNameForPermissions = "Address"; private final String resourceNameForPermissions = "Address";
@@ -97,7 +97,7 @@ public class EntityFieldConfigurationApiResources {
final Collection<FieldConfigurationData> fldconfig = this.readPlatformServicefld.retrieveFieldConfiguration(entityname); final Collection<FieldConfigurationData> fldconfig = this.readPlatformServicefld.retrieveFieldConfiguration(entityname);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializerfld.serialize(settings, fldconfig, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializerfld.serialize(settings, fldconfig, this.responseDataParameters);
} }
@@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* Created by Chirag Gupta on 12/01/17. * Created by Chirag Gupta on 12/01/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class EntityFieldConfigurationApiResourcesSwagger { final class EntityFieldConfigurationApiResourcesSwagger {
private EntityFieldConfigurationApiResourcesSwagger() {} private EntityFieldConfigurationApiResourcesSwagger() {}
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.codes.data.CodeValueData;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class AddressData implements Serializable { public class AddressData implements Serializable {
private final Long client_id; private final Long clientID;
private final String addressType; private final String addressType;
@@ -92,7 +92,7 @@ public class AddressData implements Serializable {
this.stateProvinceId = stateProvinceId; this.stateProvinceId = stateProvinceId;
this.city = city; this.city = city;
this.townVillage = null; this.townVillage = null;
this.client_id = null; this.clientID = null;
this.addressType = null; this.addressType = null;
this.addressId = null; this.addressId = null;
this.countyDistrict = null; this.countyDistrict = null;
@@ -109,7 +109,7 @@ public class AddressData implements Serializable {
this.addressTypeIdOptions = null; this.addressTypeIdOptions = null;
} }
private AddressData(final String addressType, final Long client_id, final Long addressId, final Long addressTypeId, private AddressData(final String addressType, final Long clientID, final Long addressId, final Long addressTypeId,
final Boolean is_active, final String street, final String addressLine1, final String addressLine2, final String addressLine3, final Boolean is_active, final String street, final String addressLine1, final String addressLine2, final String addressLine3,
final String townVillage, final String city, final String countyDistrict, final Long stateProvinceId, final Long countryId, final String townVillage, final String city, final String countyDistrict, final Long stateProvinceId, final Long countryId,
final String stateName, final String countryName, final String postalCode, final BigDecimal latitude, final String stateName, final String countryName, final String postalCode, final BigDecimal latitude,
@@ -117,7 +117,7 @@ public class AddressData implements Serializable {
final Collection<CodeValueData> countryIdOptions, final Collection<CodeValueData> stateProvinceIdOptions, final Collection<CodeValueData> countryIdOptions, final Collection<CodeValueData> stateProvinceIdOptions,
final Collection<CodeValueData> addressTypeIdOptions) { final Collection<CodeValueData> addressTypeIdOptions) {
this.addressType = addressType; this.addressType = addressType;
this.client_id = client_id; this.clientID = clientID;
this.addressId = addressId; this.addressId = addressId;
this.addressTypeId = addressTypeId; this.addressTypeId = addressTypeId;
this.isActive = is_active; this.isActive = is_active;
@@ -144,15 +144,15 @@ public class AddressData implements Serializable {
this.addressTypeIdOptions = addressTypeIdOptions; this.addressTypeIdOptions = addressTypeIdOptions;
} }
public static AddressData instance(final String addressType, final Long client_id, final Long addressId, final Long addressTypeId, public static AddressData instance(final String addressType, final Long clientID, final Long addressId, final Long addressTypeId,
final Boolean is_active, final String street, final String addressLine1, final String addressLine2, final String addressLine3, final Boolean is_active, final String street, final String addressLine1, final String addressLine2, final String addressLine3,
final String townVillage, final String city, final String countyDistrict, final Long stateProvinceId, final Long countryId, final String townVillage, final String city, final String countyDistrict, final Long stateProvinceId, final Long countryId,
final String stateName, final String countryName, final String postalCode, final BigDecimal latitude, final String stateName, final String countryName, final String postalCode, final BigDecimal latitude,
final BigDecimal longitude, final String createdBy, final Date createdOn, final String updatedBy, final Date updatedOn) { final BigDecimal longitude, final String createdBy, final Date createdOn, final String updatedBy, final Date updatedOn) {
return new AddressData(addressType, client_id, addressId, addressTypeId, is_active, street, addressLine1, addressLine2, return new AddressData(addressType, clientID, addressId, addressTypeId, is_active, street, addressLine1, addressLine2, addressLine3,
addressLine3, townVillage, city, countyDistrict, stateProvinceId, countryId, stateName, countryName, postalCode, latitude, townVillage, city, countyDistrict, stateProvinceId, countryId, stateName, countryName, postalCode, latitude, longitude,
longitude, createdBy, createdOn, updatedBy, updatedOn, null, null, null); createdBy, createdOn, updatedBy, updatedOn, null, null, null);
} }
public static AddressData instance1(final Long addressId, final String street, final String addressLine1, final String addressLine2, public static AddressData instance1(final Long addressId, final String street, final String addressLine1, final String addressLine2,
@@ -20,27 +20,27 @@ package org.apache.fineract.portfolio.address.data;
public final class ClientAddressData { public final class ClientAddressData {
private final long clientAddressId; private final long clientAddressID;
private final long client_id; private final long clientID;
private final long address_id; private final long addressID;
private final long address_type_id; private final long addressTypeID;
private final boolean isActive; private final boolean isActive;
private ClientAddressData(final long clientAddressId, final long client_id, final long address_id, final long address_type_id, private ClientAddressData(final long clientAddressID, final long client_id, final long address_id, final long address_type_id,
final boolean isActive) { final boolean isActive) {
this.clientAddressId = clientAddressId; this.clientAddressID = clientAddressID;
this.client_id = client_id; this.clientID = client_id;
this.address_id = address_id; this.addressID = address_id;
this.address_type_id = address_type_id; this.addressTypeID = address_type_id;
this.isActive = isActive; this.isActive = isActive;
} }
public static ClientAddressData instance(final long clientAddressId, final long client_id, final long address_id, public static ClientAddressData instance(final long clientAddressID, final long client_id, final long address_id,
final long address_type_id, final boolean isActive) { final long address_type_id, final boolean isActive) {
return new ClientAddressData(clientAddressId, client_id, address_id, address_type_id, isActive); return new ClientAddressData(clientAddressID, client_id, address_id, address_type_id, isActive);
} }
} }
@@ -28,26 +28,26 @@ public final class FieldConfigurationData {
private final String field; private final String field;
private final boolean is_enabled; private final boolean isEnabled;
private final boolean is_mandatory; private final boolean isMandatory;
private final String validation_regex; private final String validationRegex;
private FieldConfigurationData(final long fieldConfigurationId, final String entity, final String subentity, final String field, private FieldConfigurationData(final long fieldConfigurationId, final String entity, final String subentity, final String field,
final boolean is_enabled, final boolean is_mandatory, final String validation_regex) { final boolean isEnabled, final boolean isMandatory, final String validationRegex) {
this.fieldConfigurationId = fieldConfigurationId; this.fieldConfigurationId = fieldConfigurationId;
this.entity = entity; this.entity = entity;
this.subentity = subentity; this.subentity = subentity;
this.field = field; this.field = field;
this.is_enabled = is_enabled; this.isEnabled = isEnabled;
this.is_mandatory = is_mandatory; this.isMandatory = isMandatory;
this.validation_regex = validation_regex; this.validationRegex = validationRegex;
} }
public static FieldConfigurationData instance(final long fieldConfigurationId, final String entity, final String subentity, public static FieldConfigurationData instance(final long fieldConfigurationId, final String entity, final String subentity,
final String field, final boolean is_enabled, final boolean is_mandatory, final String validation_regex) { final String field, final boolean isEnabled, final boolean isMandatory, final String validationRegex) {
return new FieldConfigurationData(fieldConfigurationId, entity, subentity, field, is_enabled, is_mandatory, validation_regex); return new FieldConfigurationData(fieldConfigurationId, entity, subentity, field, isEnabled, isMandatory, validationRegex);
} }
public long getFieldConfigurationId() { public long getFieldConfigurationId() {
@@ -66,16 +66,16 @@ public final class FieldConfigurationData {
return this.field; return this.field;
} }
public boolean isIs_enabled() { public boolean isisEnabled() {
return this.is_enabled; return this.isEnabled;
} }
public boolean isIs_mandatory() { public boolean isIs_mandatory() {
return this.is_mandatory; return this.isMandatory;
} }
public String getValidation_regex() { public String getValidation_regex() {
return this.validation_regex; return this.validationRegex;
} }
} }
@@ -32,7 +32,7 @@ public class FieldConfiguration extends AbstractPersistableCustom {
private String field; private String field;
private boolean is_enabled; private boolean isEnabled;
public FieldConfiguration() { public FieldConfiguration() {
@@ -42,7 +42,7 @@ public class FieldConfiguration extends AbstractPersistableCustom {
this.entity = entity; this.entity = entity;
this.table = table; this.table = table;
this.field = field; this.field = field;
this.is_enabled = is_enabled; this.isEnabled = is_enabled;
} }
@@ -84,9 +84,9 @@ public class AddressCommandFromApiJsonDeserializer {
for (final FieldConfigurationData data : configurationData) { for (final FieldConfigurationData data : configurationData) {
madatoryFieldsMap.put(data.getField(), data.isIs_mandatory()); madatoryFieldsMap.put(data.getField(), data.isIs_mandatory());
enabledFieldsMap.put(data.getField(), data.isIs_enabled()); enabledFieldsMap.put(data.getField(), data.isisEnabled());
regexFieldsMap.put(data.getField(), data.getValidation_regex()); regexFieldsMap.put(data.getField(), data.getValidation_regex());
if (data.isIs_enabled()) { if (data.isisEnabled()) {
enabledFieldList.add(data.getField()); enabledFieldList.add(data.getField());
} }
} }
@@ -67,7 +67,7 @@ public class CalendarsApiResource {
/** /**
* The set of parameters that are supported in response for {@link Calendar} * The set of parameters that are supported in response for {@link Calendar}
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "entityId", "entityType", "title", "description", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "entityId", "entityType", "title", "description",
"location", "startDate", "endDate", "duration", "type", "repeating", "recurrence", "frequency", "interval", "repeatsOnDay", "location", "startDate", "endDate", "duration", "type", "repeating", "recurrence", "frequency", "interval", "repeatsOnDay",
"remindBy", "firstReminder", "secondReminder", "humanReadable", "createdDate", "lastUpdatedDate", "createdByUserId", "remindBy", "firstReminder", "secondReminder", "humanReadable", "createdDate", "lastUpdatedDate", "createdByUserId",
"createdByUsername", "lastUpdatedByUserId", "lastUpdatedByUsername", "recurringDates", "nextTenRecurringDates", "createdByUsername", "lastUpdatedByUserId", "lastUpdatedByUsername", "recurringDates", "nextTenRecurringDates",
@@ -117,7 +117,7 @@ public class CalendarsApiResource {
if (settings.isTemplate()) { if (settings.isTemplate()) {
calendarData = handleTemplate(calendarData); calendarData = handleTemplate(calendarData);
} }
return this.toApiJsonSerializer.serialize(settings, calendarData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, calendarData, this.responseDataParameters);
} }
/** /**
@@ -155,7 +155,7 @@ public class CalendarsApiResource {
calendarsData = this.readPlatformService.updateWithRecurringDates(calendarsData); calendarsData = this.readPlatformService.updateWithRecurringDates(calendarsData);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, calendarsData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, calendarsData, this.responseDataParameters);
} }
@GET @GET
@@ -170,7 +170,7 @@ public class CalendarsApiResource {
calendarData = handleTemplate(calendarData); calendarData = handleTemplate(calendarData);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, calendarData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, calendarData, this.responseDataParameters);
} }
@POST @POST
@@ -64,7 +64,7 @@ import org.springframework.stereotype.Component;
+ "At present we support defining charges for use with Client accounts and both loan and saving products.") + "At present we support defining charges for use with Client accounts and both loan and saving products.")
public class ChargesApiResource { public class ChargesApiResource {
private final Set<String> CHARGES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty", "active", private final Set<String> chargesDataParameters = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty", "active",
"chargeAppliesTo", "chargeTimeType", "chargeCalculationType", "chargeCalculationTypeOptions", "chargeAppliesToOptions", "chargeAppliesTo", "chargeTimeType", "chargeCalculationType", "chargeCalculationTypeOptions", "chargeAppliesToOptions",
"chargeTimeTypeOptions", "currencyOptions", "loanChargeCalculationTypeOptions", "loanChargeTimeTypeOptions", "chargeTimeTypeOptions", "currencyOptions", "loanChargeCalculationTypeOptions", "loanChargeTimeTypeOptions",
"savingsChargeCalculationTypeOptions", "savingsChargeTimeTypeOptions", "incomeAccount", "clientChargeCalculationTypeOptions", "savingsChargeCalculationTypeOptions", "savingsChargeTimeTypeOptions", "incomeAccount", "clientChargeCalculationTypeOptions",
@@ -103,7 +103,7 @@ public class ChargesApiResource {
final Collection<ChargeData> charges = this.readPlatformService.retrieveAllCharges(); final Collection<ChargeData> charges = this.readPlatformService.retrieveAllCharges();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, charges, this.CHARGES_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, charges, this.chargesDataParameters);
} }
@GET @GET
@@ -127,7 +127,7 @@ public class ChargesApiResource {
charge = ChargeData.withTemplate(charge, templateData); charge = ChargeData.withTemplate(charge, templateData);
} }
return this.toApiJsonSerializer.serialize(settings, charge, this.CHARGES_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, charge, this.chargesDataParameters);
} }
@GET @GET
@@ -145,7 +145,7 @@ public class ChargesApiResource {
final ChargeData charge = this.readPlatformService.retrieveNewChargeDetails(); final ChargeData charge = this.readPlatformService.retrieveNewChargeDetails();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, charge, this.CHARGES_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, charge, this.chargesDataParameters);
} }
@POST @POST
@@ -65,14 +65,14 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
private final ChargeRepository chargeRepository; private final ChargeRepository chargeRepository;
private final LoanProductRepository loanProductRepository; private final LoanProductRepository loanProductRepository;
private final FineractEntityAccessUtil fineractEntityAccessUtil; private final FineractEntityAccessUtil fineractEntityAccessUtil;
private final GLAccountRepositoryWrapper gLAccountRepository; private final GLAccountRepositoryWrapper glAccountRepository;
private final TaxGroupRepositoryWrapper taxGroupRepository; private final TaxGroupRepositoryWrapper taxGroupRepository;
@Autowired @Autowired
public ChargeWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, public ChargeWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
final ChargeDefinitionCommandFromApiJsonDeserializer fromApiJsonDeserializer, final ChargeRepository chargeRepository, final ChargeDefinitionCommandFromApiJsonDeserializer fromApiJsonDeserializer, final ChargeRepository chargeRepository,
final LoanProductRepository loanProductRepository, final RoutingDataSource dataSource, final LoanProductRepository loanProductRepository, final RoutingDataSource dataSource,
final FineractEntityAccessUtil fineractEntityAccessUtil, final GLAccountRepositoryWrapper gLAccountRepository, final FineractEntityAccessUtil fineractEntityAccessUtil, final GLAccountRepositoryWrapper glAccountRepository,
final TaxGroupRepositoryWrapper taxGroupRepository) { final TaxGroupRepositoryWrapper taxGroupRepository) {
this.context = context; this.context = context;
this.fromApiJsonDeserializer = fromApiJsonDeserializer; this.fromApiJsonDeserializer = fromApiJsonDeserializer;
@@ -81,7 +81,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
this.chargeRepository = chargeRepository; this.chargeRepository = chargeRepository;
this.loanProductRepository = loanProductRepository; this.loanProductRepository = loanProductRepository;
this.fineractEntityAccessUtil = fineractEntityAccessUtil; this.fineractEntityAccessUtil = fineractEntityAccessUtil;
this.gLAccountRepository = gLAccountRepository; this.glAccountRepository = glAccountRepository;
this.taxGroupRepository = taxGroupRepository; this.taxGroupRepository = taxGroupRepository;
} }
@@ -98,7 +98,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
GLAccount glAccount = null; GLAccount glAccount = null;
if (glAccountId != null) { if (glAccountId != null) {
glAccount = this.gLAccountRepository.findOneWithNotFoundDetection(glAccountId); glAccount = this.glAccountRepository.findOneWithNotFoundDetection(glAccountId);
} }
final Long taxGroupId = command.longValueOfParameterNamed(ChargesApiConstants.taxGroupIdParamName); final Long taxGroupId = command.longValueOfParameterNamed(ChargesApiConstants.taxGroupIdParamName);
@@ -171,7 +171,7 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP
final Long newValue = command.longValueOfParameterNamed(ChargesApiConstants.glAccountIdParamName); final Long newValue = command.longValueOfParameterNamed(ChargesApiConstants.glAccountIdParamName);
GLAccount newIncomeAccount = null; GLAccount newIncomeAccount = null;
if (newValue != null) { if (newValue != null) {
newIncomeAccount = this.gLAccountRepository.findOneWithNotFoundDetection(newValue); newIncomeAccount = this.glAccountRepository.findOneWithNotFoundDetection(newValue);
} }
chargeForUpdate.setAccount(newIncomeAccount); chargeForUpdate.setAccount(newIncomeAccount);
} }
@@ -62,7 +62,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.") @Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.")
public class ClientAddressApiResources { public class ClientAddressApiResources {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("addressId", "street", "addressLine1", "addressLine2", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("addressId", "street", "addressLine1", "addressLine2",
"addressLine3", "townVillage", "city", "countyDistrict", "stateProvinceId", "countryId", "postalCode", "latitude", "longitude", "addressLine3", "townVillage", "city", "countyDistrict", "stateProvinceId", "countryId", "postalCode", "latitude", "longitude",
"createdBy", "createdOn", "updatedBy", "updatedOn", "clientAddressId", "client_id", "address_id", "address_type_id", "isActive", "createdBy", "createdOn", "updatedBy", "updatedOn", "clientAddressId", "client_id", "address_id", "address_type_id", "isActive",
"fieldConfigurationId", "entity", "table", "field", "is_enabled", "is_mandatory", "validation_regex")); "fieldConfigurationId", "entity", "table", "field", "is_enabled", "is_mandatory", "validation_regex"));
@@ -94,7 +94,7 @@ public class ClientAddressApiResources {
final AddressData template = this.readPlatformService.retrieveTemplate(); final AddressData template = this.readPlatformService.retrieveTemplate();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, template, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, template, this.responseDataParameters);
} }
@@ -144,7 +144,7 @@ public class ClientAddressApiResources {
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, address, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, address, this.responseDataParameters);
} }
@@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
/** /**
* Created by Chirag Gupta on 01/12/18. * Created by Chirag Gupta on 01/12/18.
*/ */
@SuppressWarnings({ "MemberName" })
final class ClientAddressApiResourcesSwagger { final class ClientAddressApiResourcesSwagger {
private ClientAddressApiResourcesSwagger() {} private ClientAddressApiResourcesSwagger() {}
@@ -53,8 +53,8 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class ClientFamilyMembersApiResources { public class ClientFamilyMembersApiResources {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "clientId", "firstName", "middleName", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "clientId", "firstName", "middleName", "lastName",
"lastName", "qualification", "relationship", "maritalStatus", "gender", "dateOfBirth", "profession", "clientFamilyMemberId")); "qualification", "relationship", "maritalStatus", "gender", "dateOfBirth", "profession", "clientFamilyMemberId"));
private final String resourceNameForPermissions = "FamilyMembers"; private final String resourceNameForPermissions = "FamilyMembers";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final ClientFamilyMembersReadPlatformService readPlatformService; private final ClientFamilyMembersReadPlatformService readPlatformService;
@@ -87,7 +87,7 @@ public class ClientFamilyMembersApiResources {
final ClientFamilyMembersData familyMembers = this.readPlatformService.getClientFamilyMember(familyMemberId); final ClientFamilyMembersData familyMembers = this.readPlatformService.getClientFamilyMember(familyMemberId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, familyMembers, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, familyMembers, this.responseDataParameters);
} }
@@ -101,7 +101,7 @@ public class ClientFamilyMembersApiResources {
final Collection<ClientFamilyMembersData> familyMembers = this.readPlatformService.getClientFamilyMembers(clientId); final Collection<ClientFamilyMembersData> familyMembers = this.readPlatformService.getClientFamilyMembers(clientId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, familyMembers, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, familyMembers, this.responseDataParameters);
} }
@@ -116,7 +116,7 @@ public class ClientFamilyMembersApiResources {
final ClientFamilyMembersData options = this.readPlatformService.retrieveTemplate(); final ClientFamilyMembersData options = this.readPlatformService.retrieveTemplate();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, options, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, options, this.responseDataParameters);
} }
@@ -24,6 +24,7 @@ import java.util.List;
/** /**
* Created by Chirag Gupta on 12/17/17. * Created by Chirag Gupta on 12/17/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class CollectionSheetApiResourceSwagger { final class CollectionSheetApiResourceSwagger {
private CollectionSheetApiResourceSwagger() {} private CollectionSheetApiResourceSwagger() {}
@@ -64,7 +64,7 @@ public class FundsApiResource {
/** /**
* The set of parameters that are supported in response for {@link CodeData} * The set of parameters that are supported in response for {@link CodeData}
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "externalId")); private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "name", "externalId"));
private final String resourceNameForPermissions = "FUND"; private final String resourceNameForPermissions = "FUND";
@@ -98,7 +98,7 @@ public class FundsApiResource {
final Collection<FundData> funds = this.readPlatformService.retrieveAllFunds(); final Collection<FundData> funds = this.readPlatformService.retrieveAllFunds();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, funds, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, funds, this.responseDataParameters);
} }
@POST @POST
@@ -132,7 +132,7 @@ public class FundsApiResource {
final FundData fund = this.readPlatformService.retrieveFund(fundId); final FundData fund = this.readPlatformService.retrieveFund(fundId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, fund, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, fund, this.responseDataParameters);
} }
@PUT @PUT
@@ -56,7 +56,7 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class BulkLoansApiResource { public class BulkLoansApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("officeId", "fromLoanOfficerId", "assignmentDate", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("officeId", "fromLoanOfficerId", "assignmentDate",
"officeOptions", "loanOfficerOptions", "accountSummaryCollection")); "officeOptions", "loanOfficerOptions", "accountSummaryCollection"));
private final String resourceNameForPermissions = "LOAN"; private final String resourceNameForPermissions = "LOAN";
@@ -110,7 +110,7 @@ public class BulkLoansApiResource {
new LocalDate(), offices, loanOfficers, staffAccountSummaryCollectionData); new LocalDate(), offices, loanOfficers, staffAccountSummaryCollectionData);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, loanReassignmentData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanReassignmentData, this.responseDataParameters);
} }
@POST @POST
@@ -71,7 +71,7 @@ import org.springframework.stereotype.Component;
+ "Loan Charges are instances of Charges and represent either fees and penalties for loan products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Loan) are described here") + "Loan Charges are instances of Charges and represent either fees and penalties for loan products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Loan) are described here")
public class LoanChargesApiResource { public class LoanChargesApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("id", "chargeId", "name", "penalty", "chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage", Arrays.asList("id", "chargeId", "name", "penalty", "chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage",
"amountPercentageAppliedTo", "currency", "amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage", "amountPercentageAppliedTo", "currency", "amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage",
"amount", "amountPaid", "chargeOptions", "installmentChargeData")); "amount", "amountPaid", "chargeOptions", "installmentChargeData"));
@@ -117,7 +117,7 @@ public class LoanChargesApiResource {
final Collection<LoanChargeData> loanCharges = this.loanChargeReadPlatformService.retrieveLoanCharges(loanId); final Collection<LoanChargeData> loanCharges = this.loanChargeReadPlatformService.retrieveLoanCharges(loanId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, loanCharges, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanCharges, this.responseDataParameters);
} }
@GET @GET
@@ -138,7 +138,7 @@ public class LoanChargesApiResource {
final LoanChargeData loanChargeTemplate = LoanChargeData.template(chargeOptions); final LoanChargeData loanChargeTemplate = LoanChargeData.template(chargeOptions);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, loanChargeTemplate, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanChargeTemplate, this.responseDataParameters);
} }
@GET @GET
@@ -162,7 +162,7 @@ public class LoanChargesApiResource {
final LoanChargeData loanChargeData = new LoanChargeData(loanCharge, installmentChargeData); final LoanChargeData loanChargeData = new LoanChargeData(loanCharge, installmentChargeData);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, loanChargeData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanChargeData, this.responseDataParameters);
} }
@POST @POST
@@ -49,7 +49,7 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class LoanDisbursementDetailApiResource { public class LoanDisbursementDetailApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("id", "expectedDisbursementDate", "actualDisbursementDate", "principal", "approvedPrincipal")); Arrays.asList("id", "expectedDisbursementDate", "actualDisbursementDate", "principal", "approvedPrincipal"));
private final String resourceNameForPermissions = "LOAN"; private final String resourceNameForPermissions = "LOAN";
@@ -112,7 +112,7 @@ public class LoanDisbursementDetailApiResource {
final DisbursementData disbursementData = this.loanReadPlatformService.retrieveLoanDisbursementDetail(loanId, disbursementId); final DisbursementData disbursementData = this.loanReadPlatformService.retrieveLoanDisbursementDetail(loanId, disbursementId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, disbursementData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, disbursementData, this.responseDataParameters);
} }
} }
@@ -68,7 +68,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.") @Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.")
public class LoanTransactionsApiResource { public class LoanTransactionsApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("id", "type", "date", "currency", "amount", "externalId")); Arrays.asList("id", "type", "date", "currency", "amount", "externalId"));
private final String resourceNameForPermissions = "LOAN"; private final String resourceNameForPermissions = "LOAN";
@@ -160,7 +160,7 @@ public class LoanTransactionsApiResource {
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, transactionData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, transactionData, this.responseDataParameters);
} }
@GET @GET
@@ -185,7 +185,7 @@ public class LoanTransactionsApiResource {
transactionData = LoanTransactionData.templateOnTop(transactionData, paymentTypeOptions); transactionData = LoanTransactionData.templateOnTop(transactionData, paymentTypeOptions);
} }
return this.toApiJsonSerializer.serialize(settings, transactionData, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, transactionData, this.responseDataParameters);
} }
@POST @POST
@@ -198,7 +198,7 @@ import org.springframework.util.CollectionUtils;
+ "Specifies compounding frequency start date for interest recalculation. This date must be equal to disbursement date") + "Specifies compounding frequency start date for interest recalculation. This date must be equal to disbursement date")
public class LoansApiResource { public class LoansApiResource {
private final Set<String> LOAN_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "accountNo", "status", "externalId", "clientId", private final Set<String> loanDataParameters = new HashSet<>(Arrays.asList("id", "accountNo", "status", "externalId", "clientId",
"group", "loanProductId", "loanProductName", "loanProductDescription", "isLoanProductLinkedToFloatingRate", "fundId", "group", "loanProductId", "loanProductName", "loanProductDescription", "isLoanProductLinkedToFloatingRate", "fundId",
"fundName", "loanPurposeId", "loanPurposeName", "loanOfficerId", "loanOfficerName", "currency", "principal", "totalOverpaid", "fundName", "loanPurposeId", "loanPurposeName", "loanOfficerId", "loanOfficerName", "currency", "principal", "totalOverpaid",
"inArrearsTolerance", "termFrequency", "termPeriodFrequencyType", "numberOfRepayments", "repaymentEvery", "inArrearsTolerance", "termFrequency", "termPeriodFrequencyType", "numberOfRepayments", "repaymentEvery",
@@ -217,8 +217,8 @@ public class LoansApiResource {
LoanApiConstants.loanIdToClose, LoanApiConstants.topupAmount, LoanApiConstants.clientActiveLoanOptions, LoanApiConstants.loanIdToClose, LoanApiConstants.topupAmount, LoanApiConstants.clientActiveLoanOptions,
LoanApiConstants.datatables, LoanProductConstants.RATES_PARAM_NAME)); LoanApiConstants.datatables, LoanProductConstants.RATES_PARAM_NAME));
private final Set<String> LOAN_APPROVAL_DATA_PARAMETERS = new HashSet<>(Arrays.asList("approvalDate", "approvalAmount")); private final Set<String> loanApprovalDataParameters = new HashSet<>(Arrays.asList("approvalDate", "approvalAmount"));
final Set<String> GLIM_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("glimId", "groupId", "clientId", "parentLoanAccountNo", final Set<String> glimAccountsDataParameters = new HashSet<>(Arrays.asList("glimId", "groupId", "clientId", "parentLoanAccountNo",
"parentPrincipalAmount", "childLoanAccountNo", "childPrincipalAmount", "clientName")); "parentPrincipalAmount", "childLoanAccountNo", "childPrincipalAmount", "clientName"));
private final String resourceNameForPermissions = "LOAN"; private final String resourceNameForPermissions = "LOAN";
@@ -338,7 +338,7 @@ public class LoansApiResource {
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.loanApprovalDataToApiJsonSerializer.serialize(settings, loanApprovalTemplate, this.LOAN_APPROVAL_DATA_PARAMETERS); return this.loanApprovalDataToApiJsonSerializer.serialize(settings, loanApprovalTemplate, this.loanApprovalDataParameters);
} }
@@ -457,7 +457,7 @@ public class LoansApiResource {
newLoanAccount.setDatatables(datatableTemplates); newLoanAccount.setDatatables(datatableTemplates);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, newLoanAccount, this.LOAN_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, newLoanAccount, this.loanDataParameters);
} }
private Collection<PortfolioAccountData> getaccountLinkingOptions(final LoanAccountData newLoanAccount, final Long clientId, private Collection<PortfolioAccountData> getaccountLinkingOptions(final LoanAccountData newLoanAccount, final Long clientId,
@@ -734,7 +734,7 @@ public class LoansApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters(), final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters(),
mandatoryResponseParameters); mandatoryResponseParameters);
String toReturn = this.toApiJsonSerializer.serialize(settings, loanAccount, this.LOAN_DATA_PARAMETERS); String toReturn = this.toApiJsonSerializer.serialize(settings, loanAccount, this.loanDataParameters);
return toReturn; return toReturn;
} }
@@ -764,7 +764,7 @@ public class LoansApiResource {
final Page<LoanAccountData> loanBasicDetails = this.loanReadPlatformService.retrieveAll(searchParameters); final Page<LoanAccountData> loanBasicDetails = this.loanReadPlatformService.retrieveAll(searchParameters);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, loanBasicDetails, this.LOAN_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanBasicDetails, this.loanDataParameters);
} }
@POST @POST
@@ -930,7 +930,7 @@ public class LoansApiResource {
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
Collection<GlimRepaymentTemplate> glimRepaymentTemplate = this.glimAccountInfoReadPlatformService.findglimRepaymentTemplate(glimId); Collection<GlimRepaymentTemplate> glimRepaymentTemplate = this.glimAccountInfoReadPlatformService.findglimRepaymentTemplate(glimId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.glimTemplateToApiJsonSerializer.serialize(settings, glimRepaymentTemplate, this.GLIM_ACCOUNTS_DATA_PARAMETERS); return this.glimTemplateToApiJsonSerializer.serialize(settings, glimRepaymentTemplate, this.glimAccountsDataParameters);
} }
@POST @POST
@@ -90,7 +90,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.") @Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.")
public class LoanProductsApiResource { public class LoanProductsApiResource {
private final Set<String> LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "shortName", "description", "fundId", private final Set<String> loanProductDataParameters = new HashSet<>(Arrays.asList("id", "name", "shortName", "description", "fundId",
"fundName", "includeInBorrowerCycle", "currency", "principal", "minPrincipal", "maxPrincipal", "numberOfRepayments", "fundName", "includeInBorrowerCycle", "currency", "principal", "minPrincipal", "maxPrincipal", "numberOfRepayments",
"minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType", "graceOnPrincipalPayment", "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType", "graceOnPrincipalPayment",
"recurringMoratoriumOnPrincipalPeriods", "graceOnInterestPayment", "graceOnInterestCharged", "interestRatePerPeriod", "recurringMoratoriumOnPrincipalPeriods", "graceOnInterestPayment", "graceOnInterestCharged", "interestRatePerPeriod",
@@ -106,7 +106,7 @@ public class LoanProductsApiResource {
LoanProductConstants.CAN_USE_FOR_TOPUP, LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM, LoanProductConstants.CAN_USE_FOR_TOPUP, LoanProductConstants.IS_EQUAL_AMORTIZATION_PARAM,
LoanProductConstants.RATES_PARAM_NAME)); LoanProductConstants.RATES_PARAM_NAME));
private final Set<String> PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>( private final Set<String> productMixDataParameters = new HashSet<>(
Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions")); Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions"));
private final String resourceNameForPermissions = "LOANPRODUCT"; private final String resourceNameForPermissions = "LOANPRODUCT";
@@ -210,13 +210,13 @@ public class LoanProductsApiResource {
if (associationParameters.contains("productMixes")) { if (associationParameters.contains("productMixes")) {
this.context.authenticatedUser().validateHasReadPermission("PRODUCTMIX"); this.context.authenticatedUser().validateHasReadPermission("PRODUCTMIX");
final Collection<ProductMixData> productMixes = this.productMixReadPlatformService.retrieveAllProductMixes(); final Collection<ProductMixData> productMixes = this.productMixReadPlatformService.retrieveAllProductMixes();
return this.productMixDataApiJsonSerializer.serialize(settings, productMixes, this.PRODUCT_MIX_DATA_PARAMETERS); return this.productMixDataApiJsonSerializer.serialize(settings, productMixes, this.productMixDataParameters);
} }
} }
final Collection<LoanProductData> products = this.loanProductReadPlatformService.retrieveAllLoanProducts(); final Collection<LoanProductData> products = this.loanProductReadPlatformService.retrieveAllLoanProducts();
return this.toApiJsonSerializer.serialize(settings, products, this.LOAN_PRODUCT_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, products, this.loanProductDataParameters);
} }
@GET @GET
@@ -238,13 +238,13 @@ public class LoanProductsApiResource {
final Collection<LoanProductData> productOptions = this.loanProductReadPlatformService.retrieveAvailableLoanProductsForMix(); final Collection<LoanProductData> productOptions = this.loanProductReadPlatformService.retrieveAvailableLoanProductsForMix();
final ProductMixData productMixData = ProductMixData.template(productOptions); final ProductMixData productMixData = ProductMixData.template(productOptions);
return this.productMixDataApiJsonSerializer.serialize(settings, productMixData, this.PRODUCT_MIX_DATA_PARAMETERS); return this.productMixDataApiJsonSerializer.serialize(settings, productMixData, this.productMixDataParameters);
} }
LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveNewLoanProductDetails(); LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveNewLoanProductDetails();
loanProduct = handleTemplate(loanProduct); loanProduct = handleTemplate(loanProduct);
return this.toApiJsonSerializer.serialize(settings, loanProduct, this.LOAN_PRODUCT_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanProduct, this.loanProductDataParameters);
} }
@GET @GET
@@ -285,7 +285,7 @@ public class LoanProductsApiResource {
if (settings.isTemplate()) { if (settings.isTemplate()) {
loanProduct = handleTemplate(loanProduct); loanProduct = handleTemplate(loanProduct);
} }
return this.toApiJsonSerializer.serialize(settings, loanProduct, this.LOAN_PRODUCT_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, loanProduct, this.loanProductDataParameters);
} }
@PUT @PUT
@@ -56,7 +56,7 @@ public class ProductMixApiResource {
private final String resourceNameForPermissions = "PRODUCTMIX"; private final String resourceNameForPermissions = "PRODUCTMIX";
private final Set<String> PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>( private final Set<String> productMixDataParameters = new HashSet<>(
Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions")); Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions"));
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
@@ -95,7 +95,7 @@ public class ProductMixApiResource {
final Collection<LoanProductData> productOptions = this.loanProductReadPlatformService.retrieveAvailableLoanProductsForMix(); final Collection<LoanProductData> productOptions = this.loanProductReadPlatformService.retrieveAvailableLoanProductsForMix();
productMixData = ProductMixData.withTemplateOptions(productMixData, productOptions); productMixData = ProductMixData.withTemplateOptions(productMixData, productOptions);
} }
return this.toApiJsonSerializer.serialize(settings, productMixData, this.PRODUCT_MIX_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, productMixData, this.productMixDataParameters);
} }
@POST @POST
@@ -67,7 +67,7 @@ import org.springframework.stereotype.Component;
@Tag(name = "Notes", description = "Notes API allows to enter notes for supported resources.") @Tag(name = "Notes", description = "Notes API allows to enter notes for supported resources.")
public class NotesApiResource { public class NotesApiResource {
private final Set<String> NOTE_DATA_PARAMETERS = new HashSet<>( private final Set<String> noteDataParemeters = new HashSet<>(
Arrays.asList("id", "clientId", "groupId", "loanId", "loanTransactionId", "depositAccountId", "savingAccountId", "noteType", Arrays.asList("id", "clientId", "groupId", "loanId", "loanTransactionId", "depositAccountId", "savingAccountId", "noteType",
"note", "createdById", "createdByUsername", "createdOn", "updatedById", "updatedByUsername", "updatedOn")); "note", "createdById", "createdByUsername", "createdOn", "updatedById", "updatedByUsername", "updatedOn"));
@@ -113,7 +113,7 @@ public class NotesApiResource {
final Collection<NoteData> notes = this.readPlatformService.retrieveNotesByResource(resourceId, noteTypeId); final Collection<NoteData> notes = this.readPlatformService.retrieveNotesByResource(resourceId, noteTypeId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, notes, this.NOTE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, notes, this.noteDataParemeters);
} }
@GET @GET
@@ -143,7 +143,7 @@ public class NotesApiResource {
final NoteData note = this.readPlatformService.retrieveNote(noteId, resourceId, noteTypeId); final NoteData note = this.readPlatformService.retrieveNote(noteId, resourceId, noteTypeId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, note, this.NOTE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, note, this.noteDataParemeters);
} }
@POST @POST
@@ -56,7 +56,7 @@ import org.springframework.stereotype.Component;
@Scope("singleton") @Scope("singleton")
public class RateApiResource { public class RateApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "percentage", "productApply", "active")); private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "name", "percentage", "productApply", "active"));
private final String resourceNameForPermissions = "RATE"; private final String resourceNameForPermissions = "RATE";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final RateReadService readPlatformService; private final RateReadService readPlatformService;
@@ -87,7 +87,7 @@ public class RateApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, rate, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, rate, this.responseDataParameters);
} }
@POST @POST
@@ -113,7 +113,7 @@ public class RateApiResource {
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, rates, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, rates, this.responseDataParameters);
} }
@PUT @PUT
@@ -127,6 +127,7 @@ import org.springframework.util.CollectionUtils;
@Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "deposit_type_enum", discriminatorType = DiscriminatorType.INTEGER) @DiscriminatorColumn(name = "deposit_type_enum", discriminatorType = DiscriminatorType.INTEGER)
@DiscriminatorValue("100") @DiscriminatorValue("100")
@SuppressWarnings({ "MemberName" })
public class SavingsAccount extends AbstractPersistableCustom { public class SavingsAccount extends AbstractPersistableCustom {
private static final Logger LOG = LoggerFactory.getLogger(SavingsAccount.class); private static final Logger LOG = LoggerFactory.getLogger(SavingsAccount.class);
@@ -57,7 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements FixedDepositProductWritePlatformService { public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements FixedDepositProductWritePlatformService {
private final Logger LOG; private static final Logger LOG = LoggerFactory.getLogger(FixedDepositProductWritePlatformServiceJpaRepositoryImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final FixedDepositProductRepository fixedDepositProductRepository; private final FixedDepositProductRepository fixedDepositProductRepository;
private final DepositProductDataValidator fromApiJsonDataValidator; private final DepositProductDataValidator fromApiJsonDataValidator;
@@ -75,7 +75,7 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
this.fixedDepositProductRepository = fixedDepositProductRepository; this.fixedDepositProductRepository = fixedDepositProductRepository;
this.fromApiJsonDataValidator = fromApiJsonDataValidator; this.fromApiJsonDataValidator = fromApiJsonDataValidator;
this.depositProductAssembler = depositProductAssembler; this.depositProductAssembler = depositProductAssembler;
this.LOG = LoggerFactory.getLogger(FixedDepositProductWritePlatformServiceJpaRepositoryImpl.class);
this.accountMappingWritePlatformService = accountMappingWritePlatformService; this.accountMappingWritePlatformService = accountMappingWritePlatformService;
this.chartAssembler = chartAssembler; this.chartAssembler = chartAssembler;
} }
@@ -206,6 +206,6 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.LOG.error("Error occured.", dae); LOG.error("Error occured.", dae);
} }
} }
@@ -57,7 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implements RecurringDepositProductWritePlatformService { public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implements RecurringDepositProductWritePlatformService {
private final Logger LOG; private static final Logger LOG = LoggerFactory.getLogger(RecurringDepositProductWritePlatformServiceJpaRepositoryImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final RecurringDepositProductRepository recurringDepositProductRepository; private final RecurringDepositProductRepository recurringDepositProductRepository;
private final DepositProductDataValidator fromApiJsonDataValidator; private final DepositProductDataValidator fromApiJsonDataValidator;
@@ -75,7 +75,7 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
this.recurringDepositProductRepository = recurringDepositProductRepository; this.recurringDepositProductRepository = recurringDepositProductRepository;
this.fromApiJsonDataValidator = fromApiJsonDataValidator; this.fromApiJsonDataValidator = fromApiJsonDataValidator;
this.depositProductAssembler = depositProductAssembler; this.depositProductAssembler = depositProductAssembler;
this.LOG = LoggerFactory.getLogger(RecurringDepositProductWritePlatformServiceJpaRepositoryImpl.class);
this.accountMappingWritePlatformService = accountMappingWritePlatformService; this.accountMappingWritePlatformService = accountMappingWritePlatformService;
this.chartAssembler = chartAssembler; this.chartAssembler = chartAssembler;
} }
@@ -206,6 +206,6 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.LOG.error("Error occured.", dae); LOG.error("Error occured.", dae);
} }
} }
@@ -58,7 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements SavingsProductWritePlatformService { public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements SavingsProductWritePlatformService {
private final Logger LOG; private static final Logger LOG = LoggerFactory.getLogger(SavingsProductWritePlatformServiceJpaRepositoryImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final SavingsProductRepository savingProductRepository; private final SavingsProductRepository savingProductRepository;
private final SavingsProductDataValidator fromApiJsonDataValidator; private final SavingsProductDataValidator fromApiJsonDataValidator;
@@ -76,7 +76,6 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
this.savingProductRepository = savingProductRepository; this.savingProductRepository = savingProductRepository;
this.fromApiJsonDataValidator = fromApiJsonDataValidator; this.fromApiJsonDataValidator = fromApiJsonDataValidator;
this.savingsProductAssembler = savingsProductAssembler; this.savingsProductAssembler = savingsProductAssembler;
this.LOG = LoggerFactory.getLogger(SavingsProductWritePlatformServiceJpaRepositoryImpl.class);
this.accountMappingWritePlatformService = accountMappingWritePlatformService; this.accountMappingWritePlatformService = accountMappingWritePlatformService;
this.fineractEntityAccessUtil = fineractEntityAccessUtil; this.fineractEntityAccessUtil = fineractEntityAccessUtil;
} }
@@ -104,7 +103,7 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dae) {
this.LOG.error("Error occured.", dae); LOG.error("Error occured.", dae);
} }
@Transactional @Transactional
@@ -52,7 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class SelfBeneficiariesTPTWritePlatformServiceImpl implements SelfBeneficiariesTPTWritePlatformService { public class SelfBeneficiariesTPTWritePlatformServiceImpl implements SelfBeneficiariesTPTWritePlatformService {
private final Logger LOG; private static final Logger LOG = LoggerFactory.getLogger(SelfBeneficiariesTPTWritePlatformServiceImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final SelfBeneficiariesTPTRepository repository; private final SelfBeneficiariesTPTRepository repository;
private final SelfBeneficiariesTPTDataValidator validator; private final SelfBeneficiariesTPTDataValidator validator;
@@ -68,7 +68,7 @@ public class SelfBeneficiariesTPTWritePlatformServiceImpl implements SelfBenefic
this.validator = validator; this.validator = validator;
this.loanRepositoryWrapper = loanRepositoryWrapper; this.loanRepositoryWrapper = loanRepositoryWrapper;
this.savingRepositoryWrapper = savingRepositoryWrapper; this.savingRepositoryWrapper = savingRepositoryWrapper;
this.LOG = LoggerFactory.getLogger(SelfBeneficiariesTPTWritePlatformServiceImpl.class);
} }
@Transactional @Transactional
@@ -178,7 +178,7 @@ public class SelfBeneficiariesTPTWritePlatformServiceImpl implements SelfBenefic
"Beneficiary with name `" + name + "` already exists", NAME_PARAM_NAME, name); "Beneficiary with name `" + name + "` already exists", NAME_PARAM_NAME, name);
} }
this.LOG.error("Error occured.", dae); LOG.error("Error occured.", dae);
throw new PlatformDataIntegrityException("error.msg.beneficiary.unknown.data.integrity.issue", throw new PlatformDataIntegrityException("error.msg.beneficiary.unknown.data.integrity.issue",
"Unknown data integrity issue with resource."); "Unknown data integrity issue with resource.");
} }
@@ -25,6 +25,7 @@ import java.util.Set;
/** /**
* Created by Chirag Gupta on 12/19/17. * Created by Chirag Gupta on 12/19/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class SelfLoansApiResourceSwagger { final class SelfLoansApiResourceSwagger {
private SelfLoansApiResourceSwagger() {} private SelfLoansApiResourceSwagger() {}
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AccountEntityServiceForLoanImpl implements AccountEntityService { public class AccountEntityServiceForLoanImpl implements AccountEntityService {
private final String KEY = EntityAccountType.LOAN.name(); private final String key = EntityAccountType.LOAN.name();
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final AppuserLoansMapperReadService appuserLoansMapperReadService; private final AppuserLoansMapperReadService appuserLoansMapperReadService;
@@ -48,7 +48,7 @@ public class AccountEntityServiceForLoanImpl implements AccountEntityService {
@Override @Override
public String getKey() { public String getKey() {
return KEY; return key;
} }
@Override @Override
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AccountEntityServiceForSavingsImpl implements AccountEntityService { public class AccountEntityServiceForSavingsImpl implements AccountEntityService {
private final String KEY = EntityAccountType.SAVINGS.name(); private final String key = EntityAccountType.SAVINGS.name();
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final AppuserSavingsMapperReadService appuserSavingsMapperReadService; private final AppuserSavingsMapperReadService appuserSavingsMapperReadService;
@@ -49,7 +49,7 @@ public class AccountEntityServiceForSavingsImpl implements AccountEntityService
@Override @Override
public String getKey() { public String getKey() {
return KEY; return key;
} }
@Override @Override
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AccountEntityServiceForShareAccountsImpl implements AccountEntityService { public class AccountEntityServiceForShareAccountsImpl implements AccountEntityService {
private final String KEY = EntityAccountType.SHARES.name(); private final String key = EntityAccountType.SHARES.name();
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService; private final AppUserShareAccountsMapperReadPlatformService appUserShareAccountsMapperReadPlatformService;
@@ -47,7 +47,7 @@ public class AccountEntityServiceForShareAccountsImpl implements AccountEntitySe
@Override @Override
public String getKey() { public String getKey() {
return KEY; return key;
} }
@Override @Override
@@ -25,7 +25,7 @@ import java.util.Set;
/** /**
* Created by Kang Breder on 05/08/19. * Created by Kang Breder on 05/08/19.
*/ */
@SuppressWarnings({ "MemberName" })
final class SelfShareAccountsApiResourceSwagger { final class SelfShareAccountsApiResourceSwagger {
private SelfShareAccountsApiResourceSwagger() { private SelfShareAccountsApiResourceSwagger() {
@@ -81,9 +81,9 @@ import org.springframework.stereotype.Component;
+ "UGDs can be assigned to an entity like client or loan and be of a type like Document or SMS. The entity and type of a UGD is only there for the convenience of user agents (UIs), in order to know where to show UGDs for the user (i.e. which tab). The Template Engine back-end runner does not actually need this metadata.") + "UGDs can be assigned to an entity like client or loan and be of a type like Document or SMS. The entity and type of a UGD is only there for the convenience of user agents (UIs), in order to know where to show UGDs for the user (i.e. which tab). The Template Engine back-end runner does not actually need this metadata.")
public class TemplatesApiResource { public class TemplatesApiResource {
private final Set<String> RESPONSE_TEMPLATES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id")); private final Set<String> responseTemplatesDataParameters = new HashSet<>(Arrays.asList("id"));
private final Set<String> RESPONSE_TEMPLATE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "entities", "types", "template")); private final Set<String> responseTemplateDataParameters = new HashSet<>(Arrays.asList("id", "entities", "types", "template"));
private final String RESOURCE_NAME_FOR_PERMISSION = "template"; private final String resourceNameForPermission = "template";
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final DefaultToApiJsonSerializer<Template> toApiJsonSerializer; private final DefaultToApiJsonSerializer<Template> toApiJsonSerializer;
@@ -120,7 +120,7 @@ public class TemplatesApiResource {
@DefaultValue("-1") @QueryParam("entityId") @Parameter(description = "entityId") final int entityId, @DefaultValue("-1") @QueryParam("entityId") @Parameter(description = "entityId") final int entityId,
@Context final UriInfo uriInfo) { @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
// FIXME - we dont use the ORM when doing fetches - we write SQL and // FIXME - we dont use the ORM when doing fetches - we write SQL and
// fetch through JDBC returning data to be serialized to JSON // fetch through JDBC returning data to be serialized to JSON
@@ -133,7 +133,7 @@ public class TemplatesApiResource {
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, templates, this.RESPONSE_TEMPLATES_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, templates, this.responseTemplatesDataParameters);
} }
@GET @GET
@@ -145,12 +145,12 @@ public class TemplatesApiResource {
@ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.GetTemplatesTemplateResponse.class))) }) @ApiResponse(responseCode = "200", description = "", content = @Content(schema = @Schema(implementation = TemplatesApiResourcesSwagger.GetTemplatesTemplateResponse.class))) })
public String template(@Context final UriInfo uriInfo) { public String template(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
final TemplateData templateData = TemplateData.template(); final TemplateData templateData = TemplateData.template();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.templateDataApiJsonSerializer.serialize(settings, templateData, this.RESPONSE_TEMPLATES_DATA_PARAMETERS); return this.templateDataApiJsonSerializer.serialize(settings, templateData, this.responseTemplatesDataParameters);
} }
@POST @POST
@@ -175,24 +175,24 @@ public class TemplatesApiResource {
public String retrieveOne(@PathParam("templateId") @Parameter(description = "templateId") final Long templateId, public String retrieveOne(@PathParam("templateId") @Parameter(description = "templateId") final Long templateId,
@Context final UriInfo uriInfo) { @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
final Template template = this.templateService.findOneById(templateId); final Template template = this.templateService.findOneById(templateId);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, template, this.RESPONSE_TEMPLATES_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, template, this.responseTemplatesDataParameters);
} }
@GET @GET
@Path("{templateId}/template") @Path("{templateId}/template")
public String getTemplateByTemplate(@PathParam("templateId") final Long templateId, @Context final UriInfo uriInfo) { public String getTemplateByTemplate(@PathParam("templateId") final Long templateId, @Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(this.RESOURCE_NAME_FOR_PERMISSION); this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
final TemplateData template = TemplateData.template(this.templateService.findOneById(templateId)); final TemplateData template = TemplateData.template(this.templateService.findOneById(templateId));
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.templateDataApiJsonSerializer.serialize(settings, template, this.RESPONSE_TEMPLATE_DATA_PARAMETERS); return this.templateDataApiJsonSerializer.serialize(settings, template, this.responseTemplateDataParameters);
} }
@PUT @PUT
@@ -61,7 +61,7 @@ import org.springframework.stereotype.Component;
+ "Permissions are not updated, except in the case of enabling or disabling non-read transactions for Maker Checker functionality") + "Permissions are not updated, except in the case of enabling or disabling non-read transactions for Maker Checker functionality")
public class PermissionsApiResource { public class PermissionsApiResource {
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("grouping", "code", "entityName", "actionName", "selected", "isMakerChecker")); Arrays.asList("grouping", "code", "entityName", "actionName", "selected", "isMakerChecker"));
private final String resourceNameForPermissions = "PERMISSION"; private final String resourceNameForPermissions = "PERMISSION";
@@ -107,7 +107,7 @@ public class PermissionsApiResource {
permissions = this.permissionReadPlatformService.retrieveAllPermissions(); permissions = this.permissionReadPlatformService.retrieveAllPermissions();
} }
return this.toApiJsonSerializer.serialize(settings, permissions, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, permissions, this.responseDataParameters);
} }
@PUT @PUT
@@ -71,13 +71,13 @@ public class RolesApiResource {
/** /**
* The set of parameters that are supported in response for {@link RoleData} * The set of parameters that are supported in response for {@link RoleData}
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> responseDataParameters = new HashSet<>(
Arrays.asList("id", "name", "description", "availablePermissions", "selectedPermissions")); Arrays.asList("id", "name", "description", "availablePermissions", "selectedPermissions"));
/** /**
* The set of parameters that are supported in response for {@link RoleData} * The set of parameters that are supported in response for {@link RoleData}
*/ */
private final Set<String> PERMISSIONS_RESPONSE_DATA_PARAMETERS = new HashSet<>( private final Set<String> permissionsResponseParameters = new HashSet<>(
Arrays.asList("id", "name", "description", "permissionUsageData")); Arrays.asList("id", "name", "description", "permissionUsageData"));
private final String resourceNameForPermissions = "ROLE"; private final String resourceNameForPermissions = "ROLE";
@@ -119,7 +119,7 @@ public class RolesApiResource {
final Collection<RoleData> roles = this.roleReadPlatformService.retrieveAll(); final Collection<RoleData> roles = this.roleReadPlatformService.retrieveAll();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, roles, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, roles, this.responseDataParameters);
} }
@POST @POST
@@ -156,7 +156,7 @@ public class RolesApiResource {
final RoleData role = this.roleReadPlatformService.retrieveOne(roleId); final RoleData role = this.roleReadPlatformService.retrieveOne(roleId);
return this.toApiJsonSerializer.serialize(settings, role, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, role, this.responseDataParameters);
} }
/** /**
@@ -233,7 +233,7 @@ public class RolesApiResource {
final RoleData role = this.roleReadPlatformService.retrieveOne(roleId); final RoleData role = this.roleReadPlatformService.retrieveOne(roleId);
final Collection<PermissionData> permissionUsageData = this.permissionReadPlatformService.retrieveAllRolePermissions(roleId); final Collection<PermissionData> permissionUsageData = this.permissionReadPlatformService.retrieveAllRolePermissions(roleId);
final RolePermissionsData permissionsData = role.toRolePermissionData(permissionUsageData); final RolePermissionsData permissionsData = role.toRolePermissionData(permissionUsageData);
return this.permissionsToApiJsonSerializer.serialize(settings, permissionsData, this.PERMISSIONS_RESPONSE_DATA_PARAMETERS); return this.permissionsToApiJsonSerializer.serialize(settings, permissionsData, this.permissionsResponseParameters);
} }
@PUT @PUT
@@ -24,6 +24,7 @@ import java.util.Collection;
/** /**
* Created by sanyam on 23/8/17. * Created by sanyam on 23/8/17.
*/ */
@SuppressWarnings({ "MemberName" })
final class RolesApiResourceSwagger { final class RolesApiResourceSwagger {
private RolesApiResourceSwagger() { private RolesApiResourceSwagger() {
@@ -76,8 +76,8 @@ public class UsersApiResource {
/** /**
* The set of parameters that are supported in response for {@link AppUserData}. * The set of parameters that are supported in response for {@link AppUserData}.
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName", "username", private final Set<String> responseDataParameters = new HashSet<>(Arrays.asList("id", "officeId", "officeName", "username", "firstname",
"firstname", "lastname", "email", "allowedOffices", "availableRoles", "selectedRoles", "staff")); "lastname", "email", "allowedOffices", "availableRoles", "selectedRoles", "staff"));
private final String resourceNameForPermissions = "USER"; private final String resourceNameForPermissions = "USER";
@@ -121,7 +121,7 @@ public class UsersApiResource {
final Collection<AppUserData> users = this.readPlatformService.retrieveAllUsers(); final Collection<AppUserData> users = this.readPlatformService.retrieveAllUsers();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, users, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, users, this.responseDataParameters);
} }
@GET @GET
@@ -144,7 +144,7 @@ public class UsersApiResource {
user = AppUserData.template(user, offices); user = AppUserData.template(user, offices);
} }
return this.toApiJsonSerializer.serialize(settings, user, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, user, this.responseDataParameters);
} }
@GET @GET
@@ -162,7 +162,7 @@ public class UsersApiResource {
final AppUserData user = this.readPlatformService.retrieveNewUserDetails(); final AppUserData user = this.readPlatformService.retrieveNewUserDetails();
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
return this.toApiJsonSerializer.serialize(settings, user, this.RESPONSE_DATA_PARAMETERS); return this.toApiJsonSerializer.serialize(settings, user, this.responseDataParameters);
} }
@POST @POST
@@ -122,7 +122,7 @@ final class UsersApiResourceSwagger {
@Schema(example = "1") @Schema(example = "1")
public Long staffId; public Long staffId;
@Schema(example = "[2,3]") @Schema(example = "[2,3]")
public String Roles; public String roles;
@Schema(example = "true") @Schema(example = "true")
public Boolean sendPasswordToEmail; public Boolean sendPasswordToEmail;
@Schema(example = "true") @Schema(example = "true")
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
class MultiExceptionTest { class MultiExceptionTest {
Logger LOG = LoggerFactory.getLogger(MultiExceptionTest.class); private static Logger LOG = LoggerFactory.getLogger(MultiExceptionTest.class);
@Test() @Test()
void testEmpty() throws MultiException { void testEmpty() throws MultiException {