From dedd3be1dc1110366692db841c042a72300e8c67 Mon Sep 17 00:00:00 2001 From: thesmallstar Date: Mon, 15 Jun 2020 03:59:29 +0530 Subject: [PATCH] FINERACT-821 Added and Enforced LeftCurly Checkstyle --- config/fineractdev-formatter.xml | 2 +- .../config/checkstyle/checkstyle.xml | 2 +- .../integrationtests/common/CenterDomain.java | 12 +- .../common/CurrenciesHelper.java | 4 +- .../common/CurrencyDomain.java | 8 +- .../integrationtests/common/OfficeDomain.java | 8 +- .../common/SchedulerJobHelper.java | 12 +- .../integrationtests/common/Utils.java | 8 +- .../FixedDepositAccountHelper.java | 4 +- .../common/funds/FundsHelper.java | 16 +- .../common/organisation/CampaignsHelper.java | 4 +- .../AccrualAccountingDataValidator.java | 8 +- .../exception/GLClosureInvalidException.java | 4 +- ...ClosureCommandFromApiJsonDeserializer.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...ncialActivityAccountRepositoryWrapper.java | 4 +- ...FinancialActivityAccountDataValidator.java | 4 +- .../glaccount/data/GLAccountData.java | 4 +- .../glaccount/domain/TrialBalance.java | 4 +- .../domain/TrialBalanceRepositoryWrapper.java | 4 +- ...AccountCommandFromApiJsonDeserializer.java | 4 +- .../GLAccountReadPlatformServiceImpl.java | 12 +- ...WritePlatformServiceJpaRepositoryImpl.java | 12 +- ...alEntryCommandFromApiJsonDeserializer.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- ...AccountMappingFromApiJsonDeserializer.java | 12 +- .../domain/LoanProductProvisioningEntry.java | 4 +- ...ningEntriesDefinitionJsonDeserializer.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../AccountingRuleInvalidException.java | 4 +- ...ingRuleCommandFromApiJsonDeserializer.java | 12 +- ...AccountingRuleReadPlatformServiceImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../service/AdHocDataValidator.java | 12 +- .../batch/command/CommandContext.java | 32 ++- .../commands/domain/CommandSource.java | 4 +- .../provider/CommandHandlerProvider.java | 4 +- ...CommandSourceWritePlatformServiceImpl.java | 4 +- .../AccountNumberFormatDataValidator.java | 8 +- .../bulkimport/api/BulkImportApiResource.java | 4 +- .../bulkimport/data/ImportFormatType.java | 4 +- .../importhandler/ImportHandlerUtils.java | 24 +- .../center/CenterImportHandler.java | 12 +- .../FixedDepositImportHandler.java | 4 +- .../group/GroupImportHandler.java | 12 +- .../importhandler/loan/LoanImportHandler.java | 8 +- .../RecurringDepositImportHandler.java | 4 +- .../savings/SavingsImportHandler.java | 4 +- .../LoanComparatorByStatusActive.java | 12 +- .../command/UpdateCacheCommandHandler.java | 8 +- .../email/data/EmailBusinessRulesData.java | 8 +- .../email/data/EmailCampaignValidator.java | 28 +- .../data/EmailConfigurationValidator.java | 16 +- .../email/data/EmailDataValidator.java | 24 +- .../campaigns/email/domain/EmailCampaign.java | 12 +- ...mpaignWritePlatformCommandHandlerImpl.java | 8 +- .../sms/data/SmsBusinessRulesData.java | 12 +- .../campaigns/sms/domain/SmsCampaign.java | 12 +- .../serialization/SmsCampaignValidator.java | 28 +- ...msCampaignWritePlatformServiceJpaImpl.java | 12 +- .../infrastructure/codes/domain/Code.java | 4 +- .../domain/CodeValueRepositoryWrapper.java | 8 +- .../CodeCommandFromApiJsonDeserializer.java | 8 +- ...deValueCommandFromApiJsonDeserializer.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../GlobalConfigurationDataValidator.java | 8 +- .../domain/ConfigurationDomainServiceJpa.java | 32 ++- .../domain/ExternalServicePropertiesPK.java | 12 +- ...alServicesPropertiesRepositoryWrapper.java | 4 +- .../domain/GlobalConfigurationProperty.java | 4 +- .../GlobalConfigurationRepositoryWrapper.java | 4 +- ...pertiesCommandFromApiJsonDeserializer.java | 4 +- ...urationCommandFromApiJsonDeserializer.java | 4 +- .../infrastructure/core/api/DateAdapter.java | 4 +- .../infrastructure/core/api/JsonCommand.java | 8 +- .../core/data/DataValidatorBuilder.java | 156 ++++++++--- .../core/data/EnumOptionData.java | 8 +- .../PaginationParametersDataValidator.java | 4 +- .../core/exception/MultiException.java | 4 +- ...tatableCommandFromApiJsonDeserializer.java | 8 +- .../core/serialization/FromJsonHelper.java | 16 +- .../core/serialization/JsonParserHelper.java | 8 +- .../core/service/SearchParameters.java | 4 +- .../service/TenantDatabaseUpgradeService.java | 4 +- ...tBureauCommandFromApiJsonDeserializer.java | 8 +- ...ProductCommandFromApiJsonDeserializer.java | 8 +- .../api/RunreportsApiResource.java | 4 +- .../dataqueries/data/DataTableValidator.java | 4 +- .../dataqueries/data/DatatableData.java | 4 +- .../EntityDataTableChecksTemplateData.java | 8 +- .../dataqueries/data/EntityTables.java | 4 +- .../dataqueries/domain/Report.java | 12 +- .../ReportCommandFromApiJsonDeserializer.java | 4 +- .../EntityDatatableChecksDataValidator.java | 8 +- ...tatableChecksWritePlatformServiceImpl.java | 16 +- .../service/GenericDataServiceImpl.java | 4 +- .../service/ReadReportingServiceImpl.java | 16 +- .../ReadWriteNonCoreDataServiceImpl.java | 88 ++++-- .../ReportWritePlatformServiceImpl.java | 8 +- .../api/ImagesApiResource.java | 8 +- .../ContentRepositoryFactory.java | 8 +- .../FileSystemContentRepository.java | 4 +- .../documentmanagement/data/FileData.java | 4 +- .../documentmanagement/data/ImageData.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../service/ImageReadPlatformServiceImpl.java | 4 +- .../data/FineractEntityDataValidator.java | 8 +- ...neractEntityRelationRepositoryWrapper.java | 4 +- .../FineractEntityAccessReadServiceImpl.java | 4 +- .../infrastructure/gcm/domain/Sender.java | 48 +++- .../infrastructure/hooks/domain/Hook.java | 8 +- .../hooks/processor/TwilioHookProcessor.java | 4 +- .../HookCommandFromApiJsonDeserializer.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../jobs/data/JobDetailDataValidator.java | 8 +- .../jobs/domain/JobParameter.java | 4 +- .../jobs/service/JobRegisterServiceImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../jobs/service/SchedulerJobListener.java | 4 +- .../SchedulerJobRunnerReadServiceImpl.java | 4 +- .../ReportMailingJobRepositoryWrapper.java | 4 +- .../reportmailingjob/helper/IPv4Helper.java | 16 +- .../validation/ReportMailingJobValidator.java | 24 +- ...InvalidateTFAccessTokenCommandHandler.java | 8 +- .../data/TwoFactorConfigurationValidator.java | 8 +- .../domain/TwoFactorConfiguration.java | 8 +- ...InsecureTwoFactorAuthenticationFilter.java | 4 +- .../TenantAwareBasicAuthenticationFilter.java | 4 +- .../filter/TwoFactorAuthenticationFilter.java | 4 +- .../BasicAuthTenantDetailsServiceJdbc.java | 4 +- .../service/JdbcTenantDetailsService.java | 4 +- ...SpringSecurityPlatformSecurityContext.java | 24 +- ...antAwareJpaPlatformUserDetailsService.java | 4 +- .../TwoFactorConfigurationServiceImpl.java | 28 +- .../service/TwoFactorServiceImpl.java | 36 ++- .../security/service/TwoFactorUtils.java | 4 +- .../security/utils/ColumnValidator.java | 8 +- .../security/utils/SQLBuilder.java | 16 +- .../security/utils/SQLInjectionValidator.java | 36 ++- .../vote/SelfServiceUserAccessVote.java | 4 +- .../sms/data/SmsDataValidator.java | 12 +- .../survey/data/LikelihoodDataValidator.java | 8 +- .../interoperation/data/ExtensionData.java | 4 +- .../interoperation/data/GeoCodeData.java | 4 +- .../data/InteropAccountData.java | 28 +- .../data/InteropIdentifierRequestData.java | 4 +- .../data/InteropQuoteRequestData.java | 4 +- .../data/InteropRequestData.java | 4 +- .../data/InteropTransactionData.java | 4 +- .../data/InteropTransactionRequestData.java | 4 +- .../data/InteropTransactionTypeData.java | 4 +- .../data/InteropTransactionsData.java | 4 +- .../data/InteropTransferRequestData.java | 4 +- .../interoperation/data/MoneyData.java | 4 +- .../domain/InteropIdentifier.java | 20 +- .../serialization/InteropDataValidator.java | 4 +- .../service/InteropServiceImpl.java | 28 +- .../interoperation/util/MathUtil.java | 8 +- .../apache/fineract/mix/data/ContextData.java | 36 ++- .../mix/service/XBRLResultServiceImpl.java | 12 +- .../holiday/api/HolidaysApiResource.java | 4 +- .../holiday/data/HolidayDataValidator.java | 8 +- .../organisation/holiday/domain/Holiday.java | 16 +- .../monetary/data/CurrencyData.java | 8 +- .../ApplicationCurrencyRepositoryWrapper.java | 8 +- .../organisation/monetary/domain/Money.java | 56 +++- ...urrencyCommandFromApiJsonDeserializer.java | 4 +- .../organisation/office/domain/Office.java | 12 +- ...OrganisationCurrencyRepositoryWrapper.java | 4 +- .../OfficeCommandFromApiJsonDeserializer.java | 8 +- ...sactionCommandFromApiJsonDeserializer.java | 4 +- .../data/ProvisioningCategoryData.java | 8 +- .../data/ProvisioningCriteriaData.java | 4 +- .../ProvisioningCriteriaDefinitionData.java | 4 +- .../domain/ProvisioningCategory.java | 12 +- ...ingCategoryDefinitionJsonDeserializer.java | 16 +- ...ingCriteriaDefinitionJsonDeserializer.java | 8 +- .../ProvisioningCriteriaAssembler.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../staff/domain/StaffRepositoryWrapper.java | 8 +- .../StaffCommandFromApiJsonDeserializer.java | 8 +- .../service/StaffReadPlatformServiceImpl.java | 4 +- .../data/CashierTransactionDataValidator.java | 4 +- .../TellerCommandFromApiJsonDeserializer.java | 16 +- ...llerManagementReadPlatformServiceImpl.java | 4 +- .../workingdays/data/WorkingDayValidator.java | 8 +- .../domain/WorkingDaysRepositoryWrapper.java | 4 +- .../workingdays/service/WorkingDaysUtil.java | 4 +- .../api/StandingInstructionApiResource.java | 4 +- .../data/AccountTransfersDataValidator.java | 8 +- .../account/data/PortfolioAccountData.java | 12 +- .../StandingInstructionDataValidator.java | 12 +- .../AccountTransferStandingInstruction.java | 8 +- ...ngInstructionWritePlatformServiceImpl.java | 4 +- ...AddressCommandFromApiJsonDeserializer.java | 4 +- .../AddressWritePlatformServiceImpl.java | 4 +- .../calendar/api/CalendarsApiResource.java | 4 +- .../portfolio/calendar/data/CalendarData.java | 20 +- .../portfolio/calendar/domain/Calendar.java | 32 ++- .../domain/CalendarFrequencyType.java | 4 +- .../calendar/domain/CalendarHistory.java | 12 +- .../calendar/domain/CalendarWeekDaysType.java | 4 +- ...alendarCommandFromApiJsonDeserializer.java | 12 +- .../CalendarReadPlatformServiceImpl.java | 12 +- .../calendar/service/CalendarUtils.java | 80 ++++-- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../portfolio/charge/data/ChargeData.java | 8 +- .../portfolio/charge/domain/Charge.java | 20 +- .../domain/ChargeRepositoryWrapper.java | 8 +- .../LoanChargeCannotBeWaivedException.java | 4 +- ...initionCommandFromApiJsonDeserializer.java | 12 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../data/ClientChargeDataValidator.java | 16 +- .../portfolio/client/data/ClientData.java | 16 +- .../client/data/ClientDataValidator.java | 60 +++-- .../portfolio/client/domain/Client.java | 12 +- .../client/domain/ClientNonPerson.java | 4 +- .../ClientNonPersonRepositoryWrapper.java | 4 +- .../domain/ClientRepositoryWrapper.java | 8 +- .../ClientTransactionRepositoryWrapper.java | 4 +- ...yMemberCommandFromApiJsonDeserializer.java | 12 +- ...ntifierCommandFromApiJsonDeserializer.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 28 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- ...lateralCommandFromApiJsonDeserializer.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...llectionSheetTransactionDataValidator.java | 12 +- .../data/IndividualClientData.java | 4 +- .../collectionsheet/data/JLGClientData.java | 4 +- .../collectionsheet/data/JLGGroupData.java | 4 +- ...sbursalCommandFromApiJsonDeserializer.java | 4 +- ...paymentCommandFromApiJsonDeserializer.java | 8 +- ...enerateCommandFromApiJsonDeserializer.java | 8 +- ...ollectionSheetReadPlatformServiceImpl.java | 12 +- .../floatingrates/data/FloatingRateData.java | 16 +- .../data/FloatingRatePeriodData.java | 16 +- .../floatingrates/domain/FloatingRate.java | 4 +- .../FundCommandFromApiJsonDeserializer.java | 8 +- .../portfolio/group/data/CenterData.java | 8 +- .../group/data/GroupGeneralData.java | 8 +- .../portfolio/group/data/GroupRoleData.java | 8 +- .../group/data/GroupTimelineData.java | 8 +- .../portfolio/group/domain/Group.java | 36 ++- .../group/domain/GroupRepositoryWrapper.java | 8 +- .../GroupRolesDataValidator.java | 12 +- .../GroupingTypesDataValidator.java | 64 +++-- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 16 +- .../data/InterestIncentiveDataValidator.java | 12 +- .../data/InterestRateChartDataValidator.java | 12 +- .../InterestRateChartSlabDataValidator.java | 12 +- .../domain/InterestRateChart.java | 8 +- .../domain/InterestRateChartFields.java | 8 +- .../domain/InterestRateChartSlab.java | 8 +- .../domain/InterestRateChartSlabFields.java | 20 +- .../service/InterestIncentiveAssembler.java | 4 +- .../service/InterestRateChartAssembler.java | 4 +- ...erestRateChartReadPlatformServiceImpl.java | 12 +- .../InterestRateChartSlabAssembler.java | 8 +- ...tRateChartSlabReadPlatformServiceImpl.java | 12 +- .../api/LoanChargesApiResource.java | 4 +- .../api/LoanTransactionsApiResource.java | 4 +- .../loanaccount/api/LoansApiResource.java | 8 +- .../loanaccount/data/DisbursementData.java | 8 +- .../loanaccount/data/LoanAccountData.java | 8 +- .../data/LoanTransactionEnumData.java | 4 +- .../portfolio/loanaccount/domain/Loan.java | 48 +++- .../domain/LoanAccountDomainServiceJpa.java | 8 +- .../loanaccount/domain/LoanCharge.java | 12 +- .../domain/LoanDisbursementDetails.java | 4 +- .../domain/LoanInstallmentCharge.java | 8 +- .../domain/LoanSummaryWrapper.java | 4 +- .../domain/LoanTransactionType.java | 4 +- .../guarantor/domain/Guarantor.java | 4 +- ...arantorCommandFromApiJsonDeserializer.java | 4 +- .../service/GuarantorDomainServiceImpl.java | 4 +- ...ritePlatformServiceJpaRepositoryIImpl.java | 8 +- .../domain/AbstractLoanScheduleGenerator.java | 12 +- .../service/LoanScheduleAssembler.java | 4 +- ...cheduleCalculationPlatformServiceImpl.java | 8 +- ...cheduleHistoryReadPlatformServiceImpl.java | 4 +- .../LoanRescheduleRequestDataValidator.java | 24 +- .../domain/LoanRescheduleRequest.java | 4 +- ...nReschedulePreviewPlatformServiceImpl.java | 4 +- ...ateLoanScheduleQueryFromApiJsonHelper.java | 4 +- ...anApplicationCommandFromApiJsonHelper.java | 36 ++- ...ApplicationTransitionApiJsonValidator.java | 12 +- .../LoanEventApiJsonValidator.java | 52 +++- ...nUpdateCommandFromApiJsonDeserializer.java | 4 +- ...iableLoanScheduleFromApiJsonValidator.java | 8 +- .../LoanAccrualPlatformServiceImpl.java | 12 +- .../LoanAccrualWritePlatformServiceImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 35 ++- .../loanaccount/service/LoanAssembler.java | 16 +- .../service/LoanReadPlatformServiceImpl.java | 8 +- .../service/LoanSchedularServiceImpl.java | 20 +- .../loanaccount/service/LoanUtilService.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 48 +++- .../service/RecalculateInterestPoster.java | 4 +- .../loanproduct/data/LoanProductData.java | 52 +++- .../domain/AmortizationMethod.java | 4 +- .../loanproduct/domain/LoanProduct.java | 8 +- .../LoanProductBorrowerCycleVariations.java | 4 +- .../LoanProductConfigurableAttributes.java | 8 +- .../domain/LoanProductRelatedDetail.java | 4 +- .../domain/RecalculationFrequencyType.java | 4 +- .../ProductMixDataValidator.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../LoanProductDataValidator.java | 8 +- .../loanproduct/service/LoanEnumerations.java | 20 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../meeting/api/MeetingsApiResource.java | 4 +- .../meeting/attendance/AttendanceType.java | 4 +- .../meeting/data/MeetingDataValidator.java | 16 +- .../portfolio/note/api/NotesApiResource.java | 20 +- .../NoteCommandFromApiJsonDeserializer.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 24 +- .../paymentdetail/data/PaymentDetailData.java | 8 +- .../domain/PaymentDetailAssembler.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../paymenttype/data/PaymentTypeData.java | 8 +- .../data/PaymentTypeDataValidator.java | 8 +- .../rate/domain/RateRepositoryWrapper.java | 4 +- ...initionCommandFromApiJsonDeserializer.java | 12 +- .../savings/DepositAccountOnClosureType.java | 4 +- .../DepositAccountOnHoldTransactionType.java | 4 +- .../portfolio/savings/DepositAccountType.java | 4 +- .../SavingsAccountTransactionType.java | 4 +- .../savings/data/DepositAccountData.java | 20 +- .../data/DepositAccountDataValidator.java | 20 +- ...epositAccountTransactionDataValidator.java | 20 +- .../data/DepositProductDataValidator.java | 20 +- .../savings/data/FixedDepositAccountData.java | 12 +- .../data/RecurringDepositAccountData.java | 12 +- .../SavingsAccountChargeDataValidator.java | 16 +- .../savings/data/SavingsAccountData.java | 20 +- .../data/SavingsAccountDataValidator.java | 20 +- ...avingsAccountTransactionDataValidator.java | 16 +- .../savings/data/SavingsProductData.java | 4 +- .../data/SavingsProductDataValidator.java | 12 +- .../domain/DepositAccountAssembler.java | 20 +- .../DepositAccountInterestRateChart.java | 4 +- .../DepositAccountTermAndPreClosure.java | 4 +- .../domain/DepositProductAssembler.java | 4 +- .../savings/domain/DepositTermDetail.java | 12 +- .../savings/domain/FixedDepositAccount.java | 56 +++- .../savings/domain/FixedDepositProduct.java | 8 +- .../domain/RecurringDepositAccount.java | 80 ++++-- .../domain/RecurringDepositProduct.java | 4 +- .../savings/domain/SavingsAccount.java | 252 +++++++++++++----- .../domain/SavingsAccountAssembler.java | 24 +- .../savings/domain/SavingsAccountCharge.java | 12 +- .../domain/SavingsAccountChargeAssembler.java | 4 +- ...SavingsAccountChargeRepositoryWrapper.java | 4 +- .../SavingsAccountRepositoryWrapper.java | 4 +- .../domain/SavingsAccountTransaction.java | 4 +- .../savings/domain/SavingsProduct.java | 8 +- .../PostInterestAsOnDateException.java | 4 +- ...erestRateChartReadPlatformServiceImpl.java | 16 +- ...DepositAccountReadPlatformServiceImpl.java | 24 +- ...WritePlatformServiceJpaRepositoryImpl.java | 48 +++- ...WritePlatformServiceJpaRepositoryImpl.java | 20 +- ...DepositProductReadPlatformServiceImpl.java | 12 +- ...ApplicationTransitionApiJsonValidator.java | 24 +- ...WritePlatformServiceJpaRepositoryImpl.java | 60 +++-- ...WritePlatformServiceJpaRepositoryImpl.java | 24 +- .../savings/service/SavingsEnumerations.java | 4 +- .../service/SavingsSchedularServiceImpl.java | 4 +- .../search/data/AdHocQueryDataValidator.java | 8 +- .../api/SelfAccountTransferApiResource.java | 4 +- .../account/data/SelfAccountTemplateData.java | 16 +- .../SelfAccountTransferDataValidator.java | 8 +- .../SelfBeneficiariesTPTDataValidator.java | 12 +- .../client/api/SelfClientsApiResource.java | 4 +- .../client/data/SelfClientDataValidator.java | 8 +- .../AppuserClientMapperReadServiceImpl.java | 4 +- .../loanaccount/api/SelfLoansApiResource.java | 12 +- .../data/SelfLoansDataValidator.java | 16 +- .../self/pockets/api/PocketApiResource.java | 4 +- .../pockets/data/PocketDataValidator.java | 8 +- ...PocketAccountMappingRepositoryWrapper.java | 4 +- .../domain/PocketRepositoryWrapper.java | 4 +- ...ceRegistrationReadPlatformServiceImpl.java | 4 +- ...eRegistrationWritePlatformServiceImpl.java | 16 +- .../savings/api/SelfSavingsApiResource.java | 8 +- .../data/SelfSavingsDataValidator.java | 12 +- .../security/api/SelfUserApiResource.java | 4 +- .../api/SelfShareAccountsApiResource.java | 8 +- .../data/SelfShareAccountsDataValidator.java | 8 +- .../spm/api/SelfScorecardApiResource.java | 4 +- .../domain/ShareAccountCharge.java | 4 +- .../ShareAccountDataSerializer.java | 88 ++++-- .../ShareAccountCommandsServiceImpl.java | 4 +- .../ShareProductDataSerializer.java | 24 +- .../ShareProductCommandsServiceImpl.java | 4 +- .../ShareProductDividendAssembler.java | 4 +- .../tax/domain/TaxComponentHistory.java | 4 +- .../portfolio/tax/domain/TaxGroup.java | 4 +- .../tax/domain/TaxGroupMappings.java | 4 +- .../tax/serialization/TaxValidator.java | 20 +- .../portfolio/tax/service/TaxAssembler.java | 4 +- .../transfer/data/TransfersDataValidator.java | 28 +- ...WritePlatformServiceJpaRepositoryImpl.java | 20 +- .../ScheduledJobRunnerServiceImpl.java | 8 +- .../spm/api/LookupTableApiResource.java | 12 +- .../fineract/spm/domain/SurveyValidator.java | 4 +- .../useradministration/data/AppUserData.java | 12 +- .../PasswordPreferencesDataValidator.java | 4 +- .../useradministration/data/RoleData.java | 4 +- .../useradministration/domain/AppUser.java | 16 +- .../domain/AppUserClientMapping.java | 12 +- .../domain/AppUserRepositoryWrapper.java | 4 +- ...issionsCommandFromApiJsonDeserializer.java | 4 +- .../AppUserReadPlatformServiceImpl.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../service/RoleDataValidator.java | 12 +- ...WritePlatformServiceJpaRepositoryImpl.java | 12 +- .../service/UserDataValidator.java | 12 +- 422 files changed, 3749 insertions(+), 1254 deletions(-) mode change 100755 => 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestIncentiveAssembler.java mode change 100755 => 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/domain/PaymentDetailAssembler.java diff --git a/config/fineractdev-formatter.xml b/config/fineractdev-formatter.xml index b6f9ad282..0a412cb1e 100644 --- a/config/fineractdev-formatter.xml +++ b/config/fineractdev-formatter.xml @@ -174,7 +174,7 @@ - + diff --git a/fineract-provider/config/checkstyle/checkstyle.xml b/fineract-provider/config/checkstyle/checkstyle.xml index b0801e19d..f632ece11 100644 --- a/fineract-provider/config/checkstyle/checkstyle.xml +++ b/fineract-provider/config/checkstyle/checkstyle.xml @@ -65,6 +65,7 @@ + @@ -185,7 +186,6 @@ - diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java index ce385c321..20fc3719f 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CenterDomain.java @@ -256,13 +256,19 @@ public class CenterDomain implements Comparable { @Override public boolean equals(Object obj) { - if (obj == this) { return true; } + if (obj == this) { + return true; + } - if (!(obj instanceof CenterDomain)) { return false; } + if (!(obj instanceof CenterDomain)) { + return false; + } CenterDomain cd = (CenterDomain) obj; - if (this.hashCode() == cd.hashCode()) { return true; } + if (this.hashCode() == cd.hashCode()) { + return true; + } return false; } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrenciesHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrenciesHelper.java index 2b7bd57ab..3d4afdaab 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrenciesHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrenciesHelper.java @@ -58,7 +58,9 @@ public class CurrenciesHelper { final String code) { ArrayList currenciesList = getAllCurrencies(requestSpec, responseSpec); for (CurrencyDomain e : currenciesList) { - if (e.getCode().equals(code)) { return e; } + if (e.getCode().equals(code)) { + return e; + } } return null; } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrencyDomain.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrencyDomain.java index 5c1527fc1..a96e12b44 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrencyDomain.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/CurrencyDomain.java @@ -133,9 +133,13 @@ public class CurrencyDomain implements Comparable { @Override public boolean equals(Object obj) { - if (obj == this) { return true; } + if (obj == this) { + return true; + } - if (!(obj instanceof CurrencyDomain)) { return false; } + if (!(obj instanceof CurrencyDomain)) { + return false; + } CurrencyDomain cd = (CurrencyDomain) obj; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeDomain.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeDomain.java index e5cb54ae2..d936d9945 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeDomain.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/OfficeDomain.java @@ -134,9 +134,13 @@ public class OfficeDomain { @Override public boolean equals(Object obj) { - if (obj == this) { return true; } + if (obj == this) { + return true; + } - if (!(obj instanceof OfficeDomain)) { return false; } + if (!(obj instanceof OfficeDomain)) { + return false; + } OfficeDomain od = (OfficeDomain) obj; diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java index c0ea9e924..a603c4ce8 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/SchedulerJobHelper.java @@ -166,7 +166,9 @@ public class SchedulerJobHelper { // jobRunStartTime >= beforeExecuteTime (or timeout) await().atMost(TIMEOUT).pollInterval(PAUSE).until(jobLastRunHistorySupplier(jobId), lastRunHistory -> { String jobRunStartText = lastRunHistory.get("jobRunStartTime"); - if (jobRunStartText == null) { return false; } + if (jobRunStartText == null) { + return false; + } Instant jobRunStartTime = df.parse(jobRunStartText, Instant::from); return jobRunStartTime.equals(beforeExecuteTime) || jobRunStartTime.isAfter(beforeExecuteTime); }); @@ -176,7 +178,9 @@ public class SchedulerJobHelper { Map finalLastRunHistory = await().atMost(TIMEOUT).pollInterval(PAUSE).until(jobLastRunHistorySupplier(jobId), lastRunHistory -> { String jobRunEndText = lastRunHistory.get("jobRunEndTime"); - if (jobRunEndText == null) { return false; } + if (jobRunEndText == null) { + return false; + } Instant jobRunEndTime = df.parse(jobRunEndText, Instant::from); Instant jobRunStartTime = df.parse(lastRunHistory.get("jobRunStartTime"), Instant::from); return jobRunEndTime.equals(jobRunStartTime) || jobRunEndTime.isAfter(jobRunStartTime); @@ -201,7 +205,9 @@ public class SchedulerJobHelper { private Callable> jobLastRunHistorySupplier(int jobId) { return () -> { Map job = getSchedulerJobById(jobId); - if (job == null) { return null; } + if (job == null) { + return null; + } return (Map) job.get("lastRunHistory"); }; } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java index 24abceb3e..d20ba5eea 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/Utils.java @@ -135,7 +135,9 @@ public class Utils { public static T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String getURL, final String jsonAttributeToGetBack) { final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString(); - if (jsonAttributeToGetBack == null) { return (T) json; } + if (jsonAttributeToGetBack == null) { + return (T) json; + } return (T) from(json).get(jsonAttributeToGetBack); } @@ -153,7 +155,9 @@ public class Utils { final String postURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) { final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().post(postURL) .andReturn().asString(); - if (jsonAttributeToGetBack == null) { return (T) json; } + if (jsonAttributeToGetBack == null) { + return (T) json; + } return (T) from(json).get(jsonAttributeToGetBack); } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java index 87726e1c7..3e525be31 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java @@ -465,7 +465,9 @@ public class FixedDepositAccountHelper { } private String getDepositAmount() { - if (this.newDepositAmount == null) { return DEPOSIT_AMOUNT; } + if (this.newDepositAmount == null) { + return DEPOSIT_AMOUNT; + } return this.newDepositAmount; } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/funds/FundsHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/funds/FundsHelper.java index a7a345705..9ad0aa004 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/funds/FundsHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/funds/FundsHelper.java @@ -82,19 +82,27 @@ public class FundsHelper { @Override public int hashCode() { - if (this.name != null) { return this.name.hashCode(); } + if (this.name != null) { + return this.name.hashCode(); + } return super.hashCode(); } @Override public boolean equals(Object o) { - if (o == this) { return true; } + if (o == this) { + return true; + } - if (!(o instanceof FundsHelper)) { return false; } + if (!(o instanceof FundsHelper)) { + return false; + } FundsHelper fh = (FundsHelper) o; - if (this.name.equals(fh.name)) { return true; } + if (this.name.equals(fh.name)) { + return true; + } return false; } diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java index 2d50e3bf4..31ab42bf4 100644 --- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java +++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/organisation/CampaignsHelper.java @@ -191,7 +191,9 @@ public class CampaignsHelper { if (reports != null && !reports.isEmpty()) { for (ReportData reportData : reports) { - if (reportName.equals(reportData.getReportName())) { return reportData.getReportId(); } + if (reportName.equals(reportData.getReportName())) { + return reportData.getReportId(); + } } } Assert.notNull(null, "null"); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java index 5b5e8ff29..6d42ebaec 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/serialization/AccrualAccountingDataValidator.java @@ -61,7 +61,9 @@ public final class AccrualAccountingDataValidator { } public void validateLoanPeriodicAccrualData(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, LOAN_PERIODIC_REQUEST_DATA_PARAMETERS); @@ -78,6 +80,8 @@ public final class AccrualAccountingDataValidator { } public void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureInvalidException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureInvalidException.java index 36815731a..bd445aa8e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureInvalidException.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/exception/GLClosureInvalidException.java @@ -43,7 +43,9 @@ public class GLClosureInvalidException extends AbstractPlatformDomainRuleExcepti public String errorCode() { if (name().toString().equalsIgnoreCase("FUTURE_DATE")) { return "error.msg.glclosure.invalid.future.date"; - } else if (name().toString().equalsIgnoreCase("ACCOUNTING_CLOSED")) { return "error.msg.glclosure.invalid.accounting.closed"; } + } else if (name().toString().equalsIgnoreCase("ACCOUNTING_CLOSED")) { + return "error.msg.glclosure.invalid.accounting.closed"; + } return name().toString(); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java index 367948f2f..a59b503b9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/serialization/GLClosureCommandFromApiJsonDeserializer.java @@ -51,7 +51,9 @@ public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromA @Override public GLClosureCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); final Set supportedParameters = GLClosureJsonInputParams.getAllValues(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java index 98db3741e..aa326deff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/service/GLClosureWritePlatformServiceJpaRepositoryImpl.java @@ -75,7 +75,9 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure // ensure closure date is not in the future final Date todaysDate = new Date(); final Date closureDate = command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()); - if (closureDate.after(todaysDate)) { throw new GLClosureInvalidException(GlClosureInvalidReason.FUTURE_DATE, closureDate); } + if (closureDate.after(todaysDate)) { + throw new GLClosureInvalidException(GlClosureInvalidReason.FUTURE_DATE, closureDate); + } // shouldn't be before an existing accounting closure final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(officeId); if (latestGLClosure != null) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/domain/FinancialActivityAccountRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/domain/FinancialActivityAccountRepositoryWrapper.java index fea37b6e3..169182409 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/domain/FinancialActivityAccountRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/domain/FinancialActivityAccountRepositoryWrapper.java @@ -45,7 +45,9 @@ public class FinancialActivityAccountRepositoryWrapper { public FinancialActivityAccount findByFinancialActivityTypeWithNotFoundDetection(final int financialActivityType) { FinancialActivityAccount financialActivityAccount = this.repository.findByFinancialActivityType(financialActivityType); - if (financialActivityAccount == null) { throw new FinancialActivityAccountNotFoundException(financialActivityType); } + if (financialActivityAccount == null) { + throw new FinancialActivityAccountNotFoundException(financialActivityType); + } return financialActivityAccount; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java index 9f6af9280..b17f7d824 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java @@ -106,7 +106,9 @@ public final class FinancialActivityAccountDataValidator { } private void validateJSONAndCheckForUnsupportedParams(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountData.java index bc5081ef8..8d725b208 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/data/GLAccountData.java @@ -237,7 +237,9 @@ public class GLAccountData implements Serializable { } public Integer getTypeId() { - if (this.type != null) { return this.type.getId().intValue(); } + if (this.type != null) { + return this.type.getId().intValue(); + } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalance.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalance.java index 56eca5838..11804ca09 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalance.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalance.java @@ -95,7 +95,9 @@ public class TrialBalance extends AbstractPersistableCustom { @Override public boolean equals(Object obj) { - if (!(obj instanceof TrialBalance)) { return false; } + if (!(obj instanceof TrialBalance)) { + return false; + } TrialBalance other = (TrialBalance) obj; return Objects.equals(other.officeId, officeId) && Objects.equals(other.glAccountId, glAccountId) && Objects.equals(other.amount, amount) && Objects.equals(other.entryDate, entryDate) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalanceRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalanceRepositoryWrapper.java index aa2327a05..28cae3679 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalanceRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/TrialBalanceRepositoryWrapper.java @@ -35,7 +35,9 @@ public class TrialBalanceRepositoryWrapper { public List findNewByOfficeAndAccount(final Long officeId, final Long accountId) { final List trialBalanceList = this.repository.findNewByOfficeAndAccount(officeId, accountId); - if (trialBalanceList == null) { throw new TrialBalanceNotFoundException(officeId, accountId); } + if (trialBalanceList == null) { + throw new TrialBalanceNotFoundException(officeId, accountId); + } return trialBalanceList; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java index f9a281491..284e979cb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/serialization/GLAccountCommandFromApiJsonDeserializer.java @@ -50,7 +50,9 @@ public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromA @Override public GLAccountCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); final Set supportedParameters = GLAccountJsonInputParams.getAllValues(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java index 20a9139da..3512b23a6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountReadPlatformServiceImpl.java @@ -119,7 +119,9 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe } if (usage != null) { - if (!checkValidGLAccountUsage(usage)) { throw new GLAccountInvalidClassificationException(accountClassification); } + if (!checkValidGLAccountUsage(usage)) { + throw new GLAccountInvalidClassificationException(accountClassification); + } } final GLAccountMapper rm = new GLAccountMapper(associationParametersData); @@ -240,14 +242,18 @@ public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformSe private static boolean checkValidGLAccountType(final int type) { for (final GLAccountType accountType : GLAccountType.values()) { - if (accountType.getValue().equals(type)) { return true; } + if (accountType.getValue().equals(type)) { + return true; + } } return false; } private static boolean checkValidGLAccountUsage(final int type) { for (final GLAccountUsage accountUsage : GLAccountUsage.values()) { - if (accountUsage.getValue().equals(type)) { return true; } + if (accountUsage.getValue().equals(type)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java index 5e2a52d78..d0e9726f2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImpl.java @@ -125,7 +125,9 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount validateForAttachedProduct(glAccountId); } final Long parentId = command.longValueOfParameterNamed(GLAccountJsonInputParams.PARENT_ID.getValue()); - if (glAccountId.equals(parentId)) { throw new InvalidParentGLAccountHeadException(glAccountId, parentId); } + if (glAccountId.equals(parentId)) { + throw new InvalidParentGLAccountHeadException(glAccountId, parentId); + } // is the glAccount valid final GLAccount glAccount = this.glAccountRepository.findById(glAccountId) .orElseThrow(() -> new GLAccountNotFoundException(glAccountId)); @@ -178,7 +180,9 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount String sql = "select count(*) from acc_product_mapping acc where acc.gl_account_id = ?"; try { int count = this.jdbcTemplate.queryForObject(sql, Integer.class, glAccountId); - if (count > 0) { throw new GLAccountDisableException(); } + if (count > 0) { + throw new GLAccountDisableException(); + } } catch (EmptyResultDataAccessException e) { LOG.error("Problem encountered in validateForAttachedProduct()", e); } @@ -215,7 +219,9 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount parentGLAccount = this.glAccountRepository.findById(parentAccountId) .orElseThrow(() -> new GLAccountNotFoundException(parentAccountId)); // ensure parent is not a detail account - if (parentGLAccount.isDetailAccount()) { throw new GLAccountInvalidParentException(parentAccountId); } + if (parentGLAccount.isDetailAccount()) { + throw new GLAccountInvalidParentException(parentAccountId); + } } return parentGLAccount; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java index 478473cd9..d98a5df23 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java @@ -56,7 +56,9 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr @Override public JournalEntryCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); final Set supportedParameters = JournalEntryJsonInputParams.getAllValues(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java index 75daa1f43..165e32fb1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java @@ -325,7 +325,9 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa .findUnReversedManualJournalEntriesByTransactionId(command.getTransactionId()); String reversalComment = command.stringValueOfParameterNamed("comments"); - if (journalEntries.size() <= 1) { throw new JournalEntriesNotFoundException(command.getTransactionId()); } + if (journalEntries.size() <= 1) { + throw new JournalEntriesNotFoundException(command.getTransactionId()); + } final String reversalTransactionId = revertJournalEntry(journalEntries, reversalComment); return new CommandProcessingResultBuilder().withTransactionId(reversalTransactionId).build(); } @@ -792,7 +794,9 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa @Override public boolean equals(Object obj) { - if (!(obj instanceof OfficeCurrencyKey)) { return false; } + if (!(obj instanceof OfficeCurrencyKey)) { + return false; + } OfficeCurrencyKey copy = (OfficeCurrencyKey) obj; return Objects.equals(this.office.getId(), copy.office.getId()) && this.currency.equals(copy.currency); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java index c262facba..67f12f294 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java @@ -79,7 +79,9 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer { } public void validateForLoanProductCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct"); @@ -160,7 +162,9 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer { } public void validateForSavingsProductCreate(final String json, DepositAccountType accountType) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) @@ -236,7 +240,9 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer { } public void validateForShareProductCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/domain/LoanProductProvisioningEntry.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/domain/LoanProductProvisioningEntry.java index 21706b917..05fad4c64 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/domain/LoanProductProvisioningEntry.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/domain/LoanProductProvisioningEntry.java @@ -120,7 +120,9 @@ public class LoanProductProvisioningEntry extends AbstractPersistableCustom { @Override public boolean equals(Object obj) { - if (!(obj instanceof LoanProductProvisioningEntry)) { return false; } + if (!(obj instanceof LoanProductProvisioningEntry)) { + return false; + } LoanProductProvisioningEntry other = (LoanProductProvisioningEntry) obj; return Objects.equals(other.entry.getId(), this.entry.getId()) && Objects.equals(other.criteriaId, this.criteriaId) && Objects.equals(other.office.getId(), this.office.getId()) && Objects.equals(other.currencyCode, this.currencyCode) diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java index 19ffdc7a9..e6b4d66c5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/serialization/ProvisioningEntriesDefinitionJsonDeserializer.java @@ -74,6 +74,8 @@ public class ProvisioningEntriesDefinitionJsonDeserializer implements Provisioni Boolean bool = this.fromApiJsonHelper.extractBooleanNamed(JSON_CREATEJOURNALENTRIES_PARAM, element); baseDataValidator.reset().parameter(JSON_CREATEJOURNALENTRIES_PARAM).value(bool).validateForBooleanValue(); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java index be2bfb6cd..851b3cfe5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/service/ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.java @@ -181,7 +181,9 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements try { Collection criteriaCollection = this.provisioningCriteriaReadPlatformService .retrieveAllProvisioningCriterias(); - if (criteriaCollection == null || criteriaCollection.size() == 0) { throw new NoProvisioningCriteriaDefinitionFound(); } + if (criteriaCollection == null || criteriaCollection.size() == 0) { + throw new NoProvisioningCriteriaDefinitionFound(); + } ProvisioningEntry requestedEntry = createProvsioningEntry(createdDate, addJournalEntries); return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(requestedEntry.getId()).build(); } catch (DataIntegrityViolationException dve) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java index 1caa78d2a..801270325 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/exception/AccountingRuleInvalidException.java @@ -43,7 +43,9 @@ public class AccountingRuleInvalidException extends AbstractPlatformDomainRuleEx public String errorCode() { if (name().toString().equalsIgnoreCase("FUTURE_DATE")) { return "error.msg.glclosure.invalid.future.date"; - } else if (name().toString().equalsIgnoreCase("ACCOUNTING_CLOSED")) { return "error.msg.glclosure.invalid.accounting.closed"; } + } else if (name().toString().equalsIgnoreCase("ACCOUNTING_CLOSED")) { + return "error.msg.glclosure.invalid.accounting.closed"; + } return name().toString(); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java index 9adb9b7f1..129593e20 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java @@ -53,7 +53,9 @@ public class AccountingRuleCommandFromApiJsonDeserializer { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -141,7 +143,9 @@ public class AccountingRuleCommandFromApiJsonDeserializer { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateCreditOrDebitTagArray(final String[] creditOrDebitTagArray, final DataValidatorBuilder baseDataValidator, @@ -155,7 +159,9 @@ public class AccountingRuleCommandFromApiJsonDeserializer { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java index 0ceedac8b..2a54cad81 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java @@ -179,7 +179,9 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead final Map extractedData = this.jdbcTemplate.query(sql, resultSetExtractor, new Object[] { accountingRuleId }); final AccountingRuleData accountingRuleData = extractedData.get(accountingRuleId); - if (accountingRuleData == null) { throw new AccountingRuleNotFoundException(accountingRuleId); } + if (accountingRuleData == null) { + throw new AccountingRuleNotFoundException(accountingRuleId); + } return accountingRuleData; } catch (final EmptyResultDataAccessException e) { throw new AccountingRuleNotFoundException(accountingRuleId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java index fac283f9e..69ea6b731 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java @@ -87,7 +87,9 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco final Throwable realCause = dve.getMostSpecificCause(); if (realCause.getMessage().contains("accounting_rule_name_unique")) { throw new AccountingRuleDuplicateException(command.stringValueOfParameterNamed(AccountingRuleJsonInputParams.NAME.getValue())); - } else if (realCause.getMessage().contains("UNIQUE_ACCOUNT_RULE_TAGS")) { throw new AccountingRuleDuplicateException(); } + } else if (realCause.getMessage().contains("UNIQUE_ACCOUNT_RULE_TAGS")) { + throw new AccountingRuleDuplicateException(); + } LOG.error("Error occured.", dve); throw new PlatformDataIntegrityException("error.msg.accounting.rule.unknown.data.integrity.issue", diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocDataValidator.java index 96edbf79f..bdf513e27 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/service/AdHocDataValidator.java @@ -54,7 +54,9 @@ public final class AdHocDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -94,7 +96,9 @@ public final class AdHocDataValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -147,6 +151,8 @@ public final class AdHocDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java index da6635ce8..4f2275ae7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java +++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java @@ -78,7 +78,9 @@ public class CommandContext { * @return boolean */ public boolean matcher(CommandContext other) { - if (this.resource.matches(other.resource) && this.method.equals(other.method)) { return true; } + if (this.resource.matches(other.resource) && this.method.equals(other.method)) { + return true; + } return false; } @@ -93,16 +95,30 @@ public class CommandContext { @Override public boolean equals(Object obj) { - if (this == obj) { return true; } - if (obj == null) { return false; } - if (!(obj instanceof CommandContext)) { return false; } + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof CommandContext)) { + return false; + } CommandContext other = (CommandContext) obj; if (this.method == null) { - if (other.method != null) { return false; } - } else if (!this.method.equals(other.method)) { return false; } + if (other.method != null) { + return false; + } + } else if (!this.method.equals(other.method)) { + return false; + } if (this.resource == null) { - if (other.resource != null) { return false; } - } else if (!this.resource.equals(other.resource)) { return false; } + if (other.resource != null) { + return false; + } + } else if (!this.resource.equals(other.resource)) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java index 553833479..fd990b1f6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandSource.java @@ -203,7 +203,9 @@ public class CommandSource extends AbstractPersistableCustom { } public boolean isMarkedAsAwaitingApproval() { - if (this.processingResult.equals(CommandProcessingResultType.AWAITING_APPROVAL.getValue())) { return true; } + if (this.processingResult.equals(CommandProcessingResultType.AWAITING_APPROVAL.getValue())) { + return true; + } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/provider/CommandHandlerProvider.java b/fineract-provider/src/main/java/org/apache/fineract/commands/provider/CommandHandlerProvider.java index 05740cf4a..1f9404847 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/provider/CommandHandlerProvider.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/provider/CommandHandlerProvider.java @@ -76,7 +76,9 @@ public class CommandHandlerProvider implements ApplicationContextAware { Preconditions.checkArgument(StringUtils.isNoneEmpty(action), "An action must be given!"); final String key = entity + "|" + action; - if (!this.registeredHandlers.containsKey(key)) { throw new UnsupportedCommandException(key); } + if (!this.registeredHandlers.containsKey(key)) { + throw new UnsupportedCommandException(key); + } return (NewCommandSourceHandler) this.applicationContext.getBean(this.registeredHandlers.get(key)); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java index 7b35dc3c3..08e68c70c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/commands/service/PortfolioCommandSourceWritePlatformServiceImpl.java @@ -168,7 +168,9 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio final CommandSource commandSourceInput = this.commandSourceRepository.findById(makerCheckerId) .orElseThrow(() -> new CommandNotFoundException(makerCheckerId)); - if (!commandSourceInput.isMarkedAsAwaitingApproval()) { throw new CommandNotAwaitingApprovalException(makerCheckerId); } + if (!commandSourceInput.isMarkedAsAwaitingApproval()) { + throw new CommandNotAwaitingApprovalException(makerCheckerId); + } this.context.authenticatedUser().validateHasCheckerPermissionTo(commandSourceInput.getPermissionCode()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatDataValidator.java index bd624ba95..d17a6f948 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatDataValidator.java @@ -57,7 +57,9 @@ public class AccountNumberFormatDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACCOUNT_NUMBER_FORMAT_CREATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -137,7 +139,9 @@ public class AccountNumberFormatDataValidator { public void validateForUpdate(final String json, EntityAccountType entityAccountType) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACCOUNT_NUMBER_FORMAT_UPDATE_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java index 8824432f1..94264fbda 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java @@ -81,7 +81,9 @@ public class BulkImportApiResource { } } else { final GlobalEntityType type = GlobalEntityType.fromCode(entityType); - if (type == null) { throw new ImportTypeNotFoundException(entityType); } + if (type == null) { + throw new ImportTypeNotFoundException(entityType); + } importData = this.bulkImportWorkbookService.getImports(type); } final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/data/ImportFormatType.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/data/ImportFormatType.java index 93e83609b..122bbfc4a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/data/ImportFormatType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/data/ImportFormatType.java @@ -37,7 +37,9 @@ public enum ImportFormatType { public static ImportFormatType of(String name) { for (ImportFormatType type : ImportFormatType.values()) { - if (type.name().equalsIgnoreCase(name)) { return type; } + if (type.name().equalsIgnoreCase(name)) { + return type; + } } throw new GeneralPlatformDomainRuleException("error.msg.invalid.file.extension", "Uploaded file extension is not recognized."); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java index bf1d7a730..f3491d333 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/ImportHandlerUtils.java @@ -64,7 +64,9 @@ public class ImportHandlerUtils { public static Long readAsLong(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return null; } + if (c == null || c.getCellType() == CellType.BLANK) { + return null; + } FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); if (c.getCellType() == CellType.FORMULA) { if (eval != null) { @@ -87,7 +89,9 @@ public class ImportHandlerUtils { public static String readAsString(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return null; } + if (c == null || c.getCellType() == CellType.BLANK) { + return null; + } FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); if (c.getCellType() == CellType.FORMULA) { if (eval != null) { @@ -134,7 +138,9 @@ public class ImportHandlerUtils { public static LocalDate readAsDate(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return null; } + if (c == null || c.getCellType() == CellType.BLANK) { + return null; + } LocalDate localDate = new LocalDate(c.getDateCellValue()); return localDate; @@ -142,7 +148,9 @@ public class ImportHandlerUtils { public static Boolean readAsBoolean(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return false; } + if (c == null || c.getCellType() == CellType.BLANK) { + return false; + } FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); if (c.getCellType() == CellType.FORMULA) { if (eval != null) { @@ -169,7 +177,9 @@ public class ImportHandlerUtils { public static Integer readAsInt(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return null; } + if (c == null || c.getCellType() == CellType.BLANK) { + return null; + } FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); if (c.getCellType() == CellType.FORMULA) { if (eval != null) { @@ -191,7 +201,9 @@ public class ImportHandlerUtils { public static Double readAsDouble(int colIndex, Row row) { Cell c = row.getCell(colIndex); - if (c == null || c.getCellType() == CellType.BLANK) { return 0.0; } + if (c == null || c.getCellType() == CellType.BLANK) { + return 0.0; + } FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); if (c.getCellType() == CellType.FORMULA) { if (eval != null) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/center/CenterImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/center/CenterImportHandler.java index 477335932..c44f10019 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/center/CenterImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/center/CenterImportHandler.java @@ -129,7 +129,9 @@ public class CenterImportHandler implements ImportHandler { activationDate = submittedOn; } String centerName = ImportHandlerUtils.readAsString(CenterConstants.CENTER_NAME_COL, row); - if (centerName == null || centerName.equals("")) { throw new IllegalArgumentException("Name is blank"); } + if (centerName == null || centerName.equals("")) { + throw new IllegalArgumentException("Name is blank"); + } List groupMembers = new ArrayList(); for (int cellNo = CenterConstants.GROUP_NAMES_STARTING_COL; cellNo < CenterConstants.GROUP_NAMES_ENDING_COL; cellNo++) { String groupName = ImportHandlerUtils.readAsString(cellNo, row); @@ -150,7 +152,9 @@ public class CenterImportHandler implements ImportHandler { private boolean containsGroupId(List groupMembers, Long groupId) { for (GroupGeneralData group : groupMembers) { - if (group.getId().equals(groupId)) { return true; } + if (group.getId().equals(groupId)) { + return true; + } } return false; } @@ -218,7 +222,9 @@ public class CenterImportHandler implements ImportHandler { if (status == null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) { return 0; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) { return 1; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) { + return 1; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/fixeddeposits/FixedDepositImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/fixeddeposits/FixedDepositImportHandler.java index 048357e53..a78b1232c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/fixeddeposits/FixedDepositImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/fixeddeposits/FixedDepositImportHandler.java @@ -413,7 +413,9 @@ public class FixedDepositImportHandler implements ImportHandler { return 0; } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) { return 1; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { return 2; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { + return 2; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/group/GroupImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/group/GroupImportHandler.java index 142e8c9ed..a97d35aff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/group/GroupImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/group/GroupImportHandler.java @@ -132,7 +132,9 @@ public class GroupImportHandler implements ImportHandler { activationDate = submittedOnDate; } String groupName = ImportHandlerUtils.readAsString(GroupConstants.NAME_COL, row); - if (groupName == null || groupName.equals("")) { throw new IllegalArgumentException("Name is blank"); } + if (groupName == null || groupName.equals("")) { + throw new IllegalArgumentException("Name is blank"); + } List clientMembers = new ArrayList<>(); for (int cellNo = GroupConstants.CLIENT_NAMES_STARTING_COL; cellNo < GroupConstants.CLIENT_NAMES_ENDING_COL; cellNo++) { String clientName = ImportHandlerUtils.readAsString(cellNo, row); @@ -153,7 +155,9 @@ public class GroupImportHandler implements ImportHandler { private boolean containsClientId(List clientMembers, Long clientId) { for (ClientData client : clientMembers) { - if (client.getId().equals(clientId)) { return true; } + if (client.getId().equals(clientId)) { + return true; + } } return false; } @@ -262,7 +266,9 @@ public class GroupImportHandler implements ImportHandler { private int getProgressLevel(String status) { if (status == null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) { return 0; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) { return 1; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) { + return 1; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java index f761bf351..c48ca4bd4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java @@ -132,7 +132,9 @@ public class LoanImportHandler implements ImportHandler { private LoanApprovalData readLoanApproval(Row row, String locale, String dateFormat) { LocalDate approvedDate = ImportHandlerUtils.readAsDate(LoanConstants.APPROVED_DATE_COL, row); - if (approvedDate != null) { return LoanApprovalData.importInstance(approvedDate, row.getRowNum(), locale, dateFormat); } + if (approvedDate != null) { + return LoanApprovalData.importInstance(approvedDate, row.getRowNum(), locale, dateFormat); + } return null; } @@ -503,7 +505,9 @@ public class LoanImportHandler implements ImportHandler { return 1; } else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_FAILED)) { return 2; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED)) { return 3; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED)) { + return 3; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/recurringdeposit/RecurringDepositImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/recurringdeposit/RecurringDepositImportHandler.java index 459843744..0be97aa45 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/recurringdeposit/RecurringDepositImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/recurringdeposit/RecurringDepositImportHandler.java @@ -392,7 +392,9 @@ public class RecurringDepositImportHandler implements ImportHandler { return 0; } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) { return 1; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { return 2; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { + return 2; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java index ccd9ea6ed..4b8fa5af8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/savings/SavingsImportHandler.java @@ -387,7 +387,9 @@ public class SavingsImportHandler implements ImportHandler { return 0; } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) { return 1; - } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { return 2; } + } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) { + return 2; + } return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java index ce3177316..e046b015e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/comparator/LoanComparatorByStatusActive.java @@ -34,11 +34,17 @@ public class LoanComparatorByStatusActive implements Comparator boolean isData2StatusActive = o2.getStatusStringValue().equals("Active"); // if both status active, these have the same rank - if (isData1StatusActive && isData2StatusActive) { return 0; } + if (isData1StatusActive && isData2StatusActive) { + return 0; + } - if (isData1StatusActive) { return -1; } + if (isData1StatusActive) { + return -1; + } - if (isData2StatusActive) { return 1; } + if (isData2StatusActive) { + return 1; + } // if no status active, these have the same rank return 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/command/UpdateCacheCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/command/UpdateCacheCommandHandler.java index a2f6f06e1..26858cd7f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/command/UpdateCacheCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/command/UpdateCacheCommandHandler.java @@ -61,7 +61,9 @@ public class UpdateCacheCommandHandler implements NewCommandSourceHandler { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); command.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS); @@ -74,7 +76,9 @@ public class UpdateCacheCommandHandler implements NewCommandSourceHandler { baseDataValidator.reset().parameter(CacheApiConstants.cacheTypeParameter).value(Integer.valueOf(cacheTypeEnum)).notNull() .isOneOfTheseValues(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } final CacheType cacheType = CacheType.fromInt(cacheTypeEnum); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailBusinessRulesData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailBusinessRulesData.java index fd480b081..1223b910e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailBusinessRulesData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailBusinessRulesData.java @@ -77,8 +77,12 @@ public class EmailBusinessRulesData { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || !(o instanceof EmailBusinessRulesData)) { return false; } + if (this == o) { + return true; + } + if (o == null || !(o instanceof EmailBusinessRulesData)) { + return false; + } EmailBusinessRulesData that = (EmailBusinessRulesData) o; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailCampaignValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailCampaignValidator.java index df79954be..986a4078a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailCampaignValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailCampaignValidator.java @@ -86,7 +86,9 @@ public class EmailCampaignValidator { } public void validateCreate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.supportedParams); @@ -137,7 +139,9 @@ public class EmailCampaignValidator { } public void validateForUpdate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.supportedParamsForUpdate); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -177,7 +181,9 @@ public class EmailCampaignValidator { } public void validatePreviewMessage(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.PREVIEW_REQUEST_DATA_PARAMETERS); @@ -198,7 +204,9 @@ public class EmailCampaignValidator { } public void validateClosedDate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.CLOSE_REQUEST_DATA_PARAMETERS); @@ -216,7 +224,9 @@ public class EmailCampaignValidator { } public void validateActivation(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.ACTIVATION_REQUEST_DATA_PARAMETERS); @@ -235,7 +245,9 @@ public class EmailCampaignValidator { } public void validateClosure(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailCampaignValidator.CLOSE_REQUEST_DATA_PARAMETERS); @@ -253,6 +265,8 @@ public class EmailCampaignValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailConfigurationValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailConfigurationValidator.java index a84241f7b..1ce855472 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailConfigurationValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailConfigurationValidator.java @@ -57,7 +57,9 @@ public class EmailConfigurationValidator { public void validateUpdateConfiguration(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, EmailConfigurationValidator.supportedParams); @@ -85,20 +87,26 @@ public class EmailConfigurationValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public boolean isValidEmail(String email) { // this is the easiest check if (email == null) { return false; - } else if (email.endsWith(".")) { return false; } + } else if (email.endsWith(".")) { + return false; + } // Check the whole email address structure Matcher emailMatcher = EMAIL_PATTERN.matcher(email); // check if the Matcher matches the email pattern - if (!emailMatcher.matches()) { return false; } + if (!emailMatcher.matches()) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailDataValidator.java index 7bc970db1..e5ff3016b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/data/EmailDataValidator.java @@ -69,7 +69,9 @@ public final class EmailDataValidator { final String jsonString = jsonCommand.json(); final JsonElement jsonElement = jsonCommand.parsedJson(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, ScheduledEmailConstants.CREATE_REQUEST_PARAMETERS); @@ -150,7 +152,9 @@ public final class EmailDataValidator { final String jsonString = jsonCommand.json(); final JsonElement jsonElement = jsonCommand.parsedJson(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, ScheduledEmailConstants.UPDATE_REQUEST_PARAMETERS); @@ -245,16 +249,22 @@ public final class EmailDataValidator { **/ public boolean isValidEmail(String email) { // this is the easiest check - if (email == null) { return false; } + if (email == null) { + return false; + } // this is another easy check - if (email.endsWith(".")) { return false; } + if (email.endsWith(".")) { + return false; + } // Check the whole email address structure Matcher emailMatcher = EMAIL_PATTERN.matcher(email); // check if the Matcher matches the email pattern - if (!emailMatcher.matches()) { return false; } + if (!emailMatcher.matches()) { + return false; + } return true; } @@ -309,6 +319,8 @@ public final class EmailDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/domain/EmailCampaign.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/domain/EmailCampaign.java index 88f0d291c..4e51bca57 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/domain/EmailCampaign.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/domain/EmailCampaign.java @@ -365,19 +365,25 @@ public class EmailCampaign extends AbstractPersistableCustom { private void validate() { final List dataValidationErrors = new ArrayList(); validateActivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateReactivate() { final List dataValidationErrors = new ArrayList(); validateReactivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateClosureDate() { final List dataValidationErrors = new ArrayList(); validateClosureDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateActivationDate(final List dataValidationErrors) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java index d3bdc437c..6f69c4f3c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignWritePlatformCommandHandlerImpl.java @@ -186,7 +186,9 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai final EmailCampaign emailCampaign = this.emailCampaignRepository.findById(resourceId) .orElseThrow(() -> new EmailCampaignNotFound(resourceId)); - if (emailCampaign.isActive()) { throw new EmailCampaignMustBeClosedToEditException(emailCampaign.getId()); } + if (emailCampaign.isActive()) { + throw new EmailCampaignMustBeClosedToEditException(emailCampaign.getId()); + } final Map changes = emailCampaign.update(command); if (changes.containsKey(EmailCampaignValidator.businessRuleId)) { @@ -218,7 +220,9 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai final EmailCampaign emailCampaign = this.emailCampaignRepository.findById(resourceId) .orElseThrow(() -> new EmailCampaignNotFound(resourceId)); - if (emailCampaign.isActive()) { throw new EmailCampaignMustBeClosedToBeDeletedException(emailCampaign.getId()); } + if (emailCampaign.isActive()) { + throw new EmailCampaignMustBeClosedToBeDeletedException(emailCampaign.getId()); + } /* * Do not delete but set a boolean is_visible to zero diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/data/SmsBusinessRulesData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/data/SmsBusinessRulesData.java index 1af8b39dc..6b621bf94 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/data/SmsBusinessRulesData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/data/SmsBusinessRulesData.java @@ -75,12 +75,18 @@ public class SmsBusinessRulesData { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || !(o instanceof SmsBusinessRulesData)) { return false; } + if (this == o) { + return true; + } + if (o == null || !(o instanceof SmsBusinessRulesData)) { + return false; + } SmsBusinessRulesData that = (SmsBusinessRulesData) o; - if (reportId != null ? !reportId.equals(that.reportId) : that.reportId != null) { return false; } + if (reportId != null ? !reportId.equals(that.reportId) : that.reportId != null) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/domain/SmsCampaign.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/domain/SmsCampaign.java index 5039b42b1..83d454791 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/domain/SmsCampaign.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/domain/SmsCampaign.java @@ -375,19 +375,25 @@ public class SmsCampaign extends AbstractPersistableCustom { private void validate() { final List dataValidationErrors = new ArrayList<>(); validateActivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateReactivate() { final List dataValidationErrors = new ArrayList<>(); validateReactivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateClosureDate() { final List dataValidationErrors = new ArrayList<>(); validateClosureDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateActivationDate(final List dataValidationErrors) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/serialization/SmsCampaignValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/serialization/SmsCampaignValidator.java index 175aa3107..a8b443297 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/serialization/SmsCampaignValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/serialization/SmsCampaignValidator.java @@ -98,7 +98,9 @@ public class SmsCampaignValidator { } public void validateCreate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.supportedParams); @@ -171,7 +173,9 @@ public class SmsCampaignValidator { } public void validateForUpdate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.supportedParamsForUpdate); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -231,7 +235,9 @@ public class SmsCampaignValidator { } public void validatePreviewMessage(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.PREVIEW_REQUEST_DATA_PARAMETERS); @@ -257,7 +263,9 @@ public class SmsCampaignValidator { } public void validateClosedDate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.CLOSE_REQUEST_DATA_PARAMETERS); @@ -275,7 +283,9 @@ public class SmsCampaignValidator { } public void validateActivation(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.ACTIVATION_REQUEST_DATA_PARAMETERS); @@ -294,7 +304,9 @@ public class SmsCampaignValidator { } public void validateClosure(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsCampaignValidator.CLOSE_REQUEST_DATA_PARAMETERS); @@ -312,7 +324,9 @@ public class SmsCampaignValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public boolean isValidNotificationOrSms(Client client, SmsCampaign smsCampaign, Object mobileNo) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignWritePlatformServiceJpaImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignWritePlatformServiceJpaImpl.java index f85de108e..4326fbe54 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignWritePlatformServiceJpaImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignWritePlatformServiceJpaImpl.java @@ -165,7 +165,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP final SmsCampaign smsCampaign = this.smsCampaignRepository.findById(resourceId) .orElseThrow(() -> new SmsCampaignNotFound(resourceId)); - if (smsCampaign.isActive()) { throw new SmsCampaignMustBeClosedToEditException(smsCampaign.getId()); } + if (smsCampaign.isActive()) { + throw new SmsCampaignMustBeClosedToEditException(smsCampaign.getId()); + } final Map changes = smsCampaign.update(command); if (changes.containsKey(SmsCampaignValidator.runReportId)) { @@ -196,7 +198,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP final SmsCampaign smsCampaign = this.smsCampaignRepository.findById(resourceId) .orElseThrow(() -> new SmsCampaignNotFound(resourceId)); - if (smsCampaign.isActive()) { throw new SmsCampaignMustBeClosedToBeDeletedException(smsCampaign.getId()); } + if (smsCampaign.isActive()) { + throw new SmsCampaignMustBeClosedToBeDeletedException(smsCampaign.getId()); + } /* * Do not delete but set a boolean is_visible to zero @@ -250,7 +254,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP @Override public void insertDirectCampaignIntoSmsOutboundTable(final Loan loan, final SmsCampaign smsCampaign) { try { - if (loan.hasInvalidLoanType()) { throw new InvalidLoanTypeException("Loan Type cannot be 0 for the Triggered Sms Campaign"); } + if (loan.hasInvalidLoanType()) { + throw new InvalidLoanTypeException("Loan Type cannot be 0 for the Triggered Sms Campaign"); + } Set clientSet = new HashSet<>(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/Code.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/Code.java index 624a22cd7..5dd785aa4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/Code.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/Code.java @@ -74,7 +74,9 @@ public class Code extends AbstractPersistableCustom { public Map update(final JsonCommand command) { - if (this.systemDefined) { throw new SystemDefinedCodeCannotBeChangedException(); } + if (this.systemDefined) { + throw new SystemDefinedCodeCannotBeChangedException(); + } final Map actualChanges = new LinkedHashMap<>(1); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/CodeValueRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/CodeValueRepositoryWrapper.java index d7aed0341..47c285445 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/CodeValueRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/domain/CodeValueRepositoryWrapper.java @@ -51,13 +51,17 @@ public class CodeValueRepositoryWrapper { public CodeValue findOneByCodeNameAndIdWithNotFoundDetection(final String codeName, final Long id) { final CodeValue codeValue = this.repository.findByCodeNameAndId(codeName, id); - if (codeValue == null) { throw new CodeValueNotFoundException(codeName, id); } + if (codeValue == null) { + throw new CodeValueNotFoundException(codeName, id); + } return codeValue; } public CodeValue findOneByCodeNameAndLabelWithNotFoundDetection(final String codeName, final String label) { final CodeValue codeValue = this.repository.findByCodeNameAndLabel(codeName, label); - if (codeValue == null) { throw new CodeValueNotFoundException(codeName, label); } + if (codeValue == null) { + throw new CodeValueNotFoundException(codeName, label); + } return codeValue; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java index 8bc840d45..1dc914c26 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java @@ -54,7 +54,9 @@ public final class CodeCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -71,7 +73,9 @@ public final class CodeCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java index 331802ee4..404193c9f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java @@ -53,7 +53,9 @@ public final class CodeValueCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -86,7 +88,9 @@ public final class CodeValueCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java index 9b12cd505..2f7c8952a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/service/CodeWritePlatformServiceJpaRepositoryImpl.java @@ -120,7 +120,9 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf this.context.authenticatedUser(); final Code code = retrieveCodeBy(codeId); - if (code.isSystemDefined()) { throw new SystemDefinedCodeCannotBeChangedException(); } + if (code.isSystemDefined()) { + throw new SystemDefinedCodeCannotBeChangedException(); + } try { this.codeRepository.delete(code); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationDataValidator.java index 9eb87234c..65ce3265b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/data/GlobalConfigurationDataValidator.java @@ -54,7 +54,9 @@ public class GlobalConfigurationDataValidator { public void validateForUpdate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS); @@ -79,7 +81,9 @@ public class GlobalConfigurationDataValidator { baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull(); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java index 123946654..61c14e18e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java @@ -52,10 +52,14 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService @Override public boolean isMakerCheckerEnabledForTask(final String taskPermissionCode) { - if (StringUtils.isBlank(taskPermissionCode)) { throw new PermissionNotFoundException(taskPermissionCode); } + if (StringUtils.isBlank(taskPermissionCode)) { + throw new PermissionNotFoundException(taskPermissionCode); + } final Permission thisTask = this.permissionRepository.findOneByCode(taskPermissionCode); - if (thisTask == null) { throw new PermissionNotFoundException(taskPermissionCode); } + if (thisTask == null) { + throw new PermissionNotFoundException(taskPermissionCode); + } final String makerCheckerConfigurationProperty = "maker-checker"; final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(makerCheckerConfigurationProperty); @@ -168,7 +172,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService public Integer retrieveFinancialYearBeginningMonth() { final String propertyName = "financial-year-beginning-month"; final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); - if (property.isEnabled()) { return property.getValue().intValue(); } + if (property.isEnabled()) { + return property.getValue().intValue(); + } return 1; } @@ -176,7 +182,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService public Integer retrieveMinAllowedClientsInGroup() { final String propertyName = "min-clients-in-group"; final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); - if (property.isEnabled()) { return property.getValue().intValue(); } + if (property.isEnabled()) { + return property.getValue().intValue(); + } return null; } @@ -184,7 +192,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService public Integer retrieveMaxAllowedClientsInGroup() { final String propertyName = "max-clients-in-group"; final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); - if (property.isEnabled()) { return property.getValue().intValue(); } + if (property.isEnabled()) { + return property.getValue().intValue(); + } return null; } @@ -202,7 +212,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); if (property.isEnabled()) { int value = property.getValue().intValue(); - if (value < 0 || value > 6) { return defaultValue; } + if (value < 0 || value > 6) { + return defaultValue; + } return value; } return defaultValue; @@ -304,7 +316,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); int defaultValue = 6; int value = property.getValue().intValue(); - if (value < 1) { return defaultValue; } + if (value < 1) { + return defaultValue; + } return value; } @@ -314,7 +328,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); int defaultValue = 300; int value = property.getValue().intValue(); - if (value < 1) { return defaultValue; } + if (value < 1) { + return defaultValue; + } return value; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicePropertiesPK.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicePropertiesPK.java index b7d4f53f3..104547756 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicePropertiesPK.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicePropertiesPK.java @@ -52,9 +52,15 @@ public class ExternalServicePropertiesPK implements Serializable { @Override public boolean equals(Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof ExternalServicePropertiesPK)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof ExternalServicePropertiesPK)) { + return false; + } final ExternalServicePropertiesPK rhs = (ExternalServicePropertiesPK) obj; return new EqualsBuilder() // .append(this.externalServiceId, rhs.externalServiceId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicesPropertiesRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicesPropertiesRepositoryWrapper.java index 565636e31..8442e34e4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicesPropertiesRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ExternalServicesPropertiesRepositoryWrapper.java @@ -34,7 +34,9 @@ public class ExternalServicesPropertiesRepositoryWrapper { public ExternalServicesProperties findOneByIdAndName(Long id, String name, String externalServiceName) { final ExternalServicesProperties externalServicesProperties = this.repository.findOneByExternalServicePropertiesPK(name, id); - if (externalServicesProperties == null) { throw new ExternalServiceConfigurationNotFoundException(externalServiceName, name); } + if (externalServicesProperties == null) { + throw new ExternalServiceConfigurationNotFoundException(externalServiceName, name); + } return externalServicesProperties; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java index aef7121b2..e6a3a2e37 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationProperty.java @@ -87,7 +87,9 @@ public class GlobalConfigurationProperty extends AbstractPersistableCustom { final Map actualChanges = new LinkedHashMap<>(7); - if (this.isTrapDoor == true) { throw new GlobalConfigurationPropertyCannotBeModfied(this.getId()); } + if (this.isTrapDoor == true) { + throw new GlobalConfigurationPropertyCannotBeModfied(this.getId()); + } final String enabledParamName = "enabled"; if (command.isChangeInBooleanParameterNamed(enabledParamName, this.enabled)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationRepositoryWrapper.java index b874ea54c..5b2b280ab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/GlobalConfigurationRepositoryWrapper.java @@ -40,7 +40,9 @@ public class GlobalConfigurationRepositoryWrapper { public GlobalConfigurationProperty findOneByNameWithNotFoundDetection(final String propertyName) { final GlobalConfigurationProperty property = this.repository.findOneByName(propertyName); - if (property == null) { throw new GlobalConfigurationPropertyNotFoundException(propertyName); } + if (property == null) { + throw new GlobalConfigurationPropertyNotFoundException(propertyName); + } return property; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/ExternalServicesPropertiesCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/ExternalServicesPropertiesCommandFromApiJsonDeserializer.java index 0b38f2c89..4c2884f5d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/ExternalServicesPropertiesCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/ExternalServicesPropertiesCommandFromApiJsonDeserializer.java @@ -48,7 +48,9 @@ public class ExternalServicesPropertiesCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json, final String externalServiceName) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); switch (externalServiceName) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java index f8b1725fe..94970f6c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java @@ -55,7 +55,9 @@ public final class GlobalConfigurationCommandFromApiJsonDeserializer @Override public UpdateGlobalConfigurationCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java index 937ff081f..17178344a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java @@ -39,7 +39,9 @@ public class DateAdapter implements JsonSerializer { @Override @SuppressWarnings("unused") public JsonElement serialize(Date src, Type typeOfSrc, JsonSerializationContext context) { - if (src == null) { return null; } + if (src == null) { + return null; + } return new JsonPrimitive(formatter.format(src.toInstant())); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java index e61a23960..94df4deab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JsonCommand.java @@ -191,7 +191,9 @@ public final class JsonCommand { } public JsonElement jsonElement(final String paramName) { - if (this.parsedCommand.getAsJsonObject().has(paramName)) { return this.parsedCommand.getAsJsonObject().get(paramName); } + if (this.parsedCommand.getAsJsonObject().has(paramName)) { + return this.parsedCommand.getAsJsonObject().get(paramName); + } return null; } @@ -412,7 +414,9 @@ public final class JsonCommand { public Date dateValueOfParameterNamed(final String parameterName) { final LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed(parameterName, this.parsedCommand); - if (localDate == null) { return null; } + if (localDate == null) { + return null; + } return localDate.toDateTimeAtStartOfDay().toDate(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java index ac430b5e5..4c743a892 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java @@ -90,7 +90,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder andNotBlank(final String linkedParameterName, final String linkedValue) { - if (this.value == null && linkedValue == null && this.ignoreNullValue) { return this; } + if (this.value == null && linkedValue == null && this.ignoreNullValue) { + return this; + } if (StringUtils.isBlank(linkedValue)) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -122,7 +124,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder equalToParameter(final String linkedParameterName, final Object linkedValue) { - if (this.value == null && linkedValue == null && this.ignoreNullValue) { return this; } + if (this.value == null && linkedValue == null && this.ignoreNullValue) { + return this; + } if (this.value != null && !this.value.equals(linkedValue)) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -137,7 +141,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder notSameAsParameter(final String linkedParameterName, final Object linkedValue) { - if (this.value == null && linkedValue == null && this.ignoreNullValue) { return this; } + if (this.value == null && linkedValue == null && this.ignoreNullValue) { + return this; + } if (this.value != null && this.value.equals(linkedValue)) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -210,7 +216,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder notBlank() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value == null || StringUtils.isBlank(this.value.toString())) { String realParameterName = this.parameter; @@ -233,7 +241,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder notExceedingLengthOf(final Integer maxLength) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && this.value.toString().trim().length() > maxLength) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -248,7 +258,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder inMinMaxRange(final Integer min, final Integer max) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer number = Integer.valueOf(this.value.toString()); @@ -266,7 +278,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder isOneOfTheseValues(final Object... values) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final List valuesList = Arrays.asList(values); final String valuesListStr = StringUtils.join(valuesList, ", "); @@ -287,7 +301,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder isOneOfTheseStringValues(final Object... values) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final List valuesList = Arrays.asList(values); final String valuesListStr = StringUtils.join(valuesList, ", "); @@ -308,7 +324,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder isOneOfTheseStringValues(final List valuesList) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final String valuesListStr = StringUtils.join(valuesList, ", "); @@ -328,7 +346,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder isNotOneOfTheseValues(final Object... values) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final List valuesList = Arrays.asList(values); @@ -350,7 +370,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder positiveAmount() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final BigDecimal number = BigDecimal.valueOf(Double.valueOf(this.value.toString())); @@ -371,7 +393,9 @@ public class DataValidatorBuilder { * should be used with .notNull() before it */ public DataValidatorBuilder zeroOrPositiveAmount() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final BigDecimal number = BigDecimal.valueOf(Double.valueOf(this.value.toString())); @@ -392,7 +416,9 @@ public class DataValidatorBuilder { * should be used with .notNull() before it */ public DataValidatorBuilder integerZeroOrGreater() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer number = Integer.valueOf(this.value.toString()); @@ -413,7 +439,9 @@ public class DataValidatorBuilder { * should be used with .notNull() before it */ public DataValidatorBuilder integerGreaterThanZero() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer number = Integer.valueOf(this.value.toString()); @@ -431,7 +459,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder integerGreaterThanNumber(Integer number) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer intValue = Integer.valueOf(this.value.toString()); @@ -449,7 +479,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder integerEqualToOrGreaterThanNumber(Integer number) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer intValue = Integer.valueOf(this.value.toString()); @@ -467,7 +499,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder integerSameAsNumber(Integer number) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer intValue = Integer.valueOf(this.value.toString()); @@ -485,7 +519,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder integerInMultiplesOfNumber(Integer number) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Integer intValue = Integer.valueOf(this.value.toString()); @@ -506,7 +542,9 @@ public class DataValidatorBuilder { * should be used with .notNull() before it */ public DataValidatorBuilder longGreaterThanZero() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Long number = Long.valueOf(this.value.toString()); @@ -527,7 +565,9 @@ public class DataValidatorBuilder { * should be used with .notNull() before it */ public DataValidatorBuilder longZeroOrGreater() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Long number = Long.valueOf(this.value.toString()); @@ -545,7 +585,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder longGreaterThanNumber(Long number) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Long longValue = Long.valueOf(this.value.toString()); @@ -563,7 +605,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder longGreaterThanNumber(String paramName, Long number, int index) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null) { final Long longValue = Long.valueOf(this.value.toString()); @@ -581,7 +625,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder arrayNotEmpty() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final Object[] array = (Object[]) this.value; if (ObjectUtils.isEmpty(array)) { @@ -597,7 +643,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder jsonArrayNotEmpty() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final JsonArray array = (JsonArray) this.value; if (this.value != null && !array.iterator().hasNext()) { @@ -653,9 +701,13 @@ public class DataValidatorBuilder { } public DataValidatorBuilder mustBeBlankWhenParameterProvided(final String parameterName, final Object parameterValue) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } - if (this.value == null && parameterValue != null) { return this; } + if (this.value == null && parameterValue != null) { + return this; + } if (this.value != null && StringUtils.isBlank(this.value.toString()) && parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) { @@ -673,9 +725,13 @@ public class DataValidatorBuilder { } public DataValidatorBuilder mustBeBlankWhenParameterProvidedIs(final String parameterName, final Object parameterValue) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } - if (this.value == null && parameterValue != null) { return this; } + if (this.value == null && parameterValue != null) { + return this; + } if (this.value != null && StringUtils.isBlank(this.value.toString()) && parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) { @@ -694,7 +750,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder cantBeBlankWhenParameterProvidedIs(final String parameterName, final Object parameterValue) { - if (this.value != null && StringUtils.isNotBlank(this.value.toString())) { return this; } + if (this.value != null && StringUtils.isNotBlank(this.value.toString())) { + return this; + } final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") .append(this.parameter).append(".must.be.provided.when.").append(parameterName).append(".is.").append(parameterValue); @@ -811,7 +869,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder notLessThanMin(final Integer min) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && min != null) { final Integer number = Integer.valueOf(this.value.toString()); @@ -829,7 +889,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder notGreaterThanMax(final Integer max) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && max != null) { final Integer number = Integer.valueOf(this.value.toString()); @@ -847,7 +909,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder matchesRegularExpression(final String expression) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && !this.value.toString().matches(expression)) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -865,7 +929,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder matchesRegularExpression(final String expression, final String Message) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && !this.value.toString().matches(expression)) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".") @@ -882,7 +948,9 @@ public class DataValidatorBuilder { } private DataValidatorBuilder validateStringFor(final String validInputs) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } final String[] inputs = validInputs.split(VALID_INPUT_SEPERATOR); boolean validationErr = true; for (final String input : inputs) { @@ -908,7 +976,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder validatePhoneNumber() { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } boolean validationErr = true; /* * supports numbers, parentheses(), hyphens and may contain + sign in @@ -947,7 +1017,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder validateDateAfter(final LocalDate date) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && date != null) { final LocalDate dateVal = (LocalDate) this.value; @@ -965,7 +1037,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder validateDateBefore(final LocalDate date) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && date != null) { final LocalDate dateVal = (LocalDate) this.value; @@ -983,7 +1057,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder validateDateBeforeOrEqual(final LocalDate date) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && date != null) { final LocalDate dateVal = (LocalDate) this.value; @@ -1001,7 +1077,9 @@ public class DataValidatorBuilder { } public DataValidatorBuilder validateDateForEqual(final LocalDate date) { - if (this.value == null && this.ignoreNullValue) { return this; } + if (this.value == null && this.ignoreNullValue) { + return this; + } if (this.value != null && date != null) { final LocalDate dateVal = (LocalDate) this.value; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java index 8303af4fd..f6b6a1b9b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java @@ -52,8 +52,12 @@ public class EnumOptionData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof EnumOptionData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof EnumOptionData)) { + return false; + } EnumOptionData that = (EnumOptionData) o; return id.equals(that.id) && code.equals(that.code) && value.equals(that.value); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/PaginationParametersDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/PaginationParametersDataValidator.java index 9adc1e474..339ba1bb8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/PaginationParametersDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/PaginationParametersDataValidator.java @@ -55,6 +55,8 @@ public class PaginationParametersDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/MultiException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/MultiException.java index 4bb2f2d49..869e0f9a3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/MultiException.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/exception/MultiException.java @@ -54,7 +54,9 @@ public class MultiException extends Exception { public MultiException(List problems) { super("MultiException with " + problems.size() + " contained causes (details available)"); - if (problems.isEmpty()) { throw new IllegalArgumentException("List of Throwables must not be empty"); } + if (problems.isEmpty()) { + throw new IllegalArgumentException("List of Throwables must not be empty"); + } this.throwables = new ArrayList<>(problems); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java index 8c53a3319..0a9bad838 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java @@ -103,7 +103,9 @@ public class DatatableCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParametersForCreate); @@ -147,7 +149,9 @@ public class DatatableCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } // Because all parameters are optional, a check to see if at least one // parameter // has been specified is necessary in order to avoid JSON requests with diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java index 669851203..da50c25df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/FromJsonHelper.java @@ -80,7 +80,9 @@ public class FromJsonHelper { } public void checkForUnsupportedParameters(final Type typeOfMap, final String json, final Collection supportedParams) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Map requestMap = this.gsonConverter.fromJson(json, typeOfMap); @@ -91,11 +93,15 @@ public class FromJsonHelper { } } - if (!unsupportedParameterList.isEmpty()) { throw new UnsupportedParameterException(unsupportedParameterList); } + if (!unsupportedParameterList.isEmpty()) { + throw new UnsupportedParameterException(unsupportedParameterList); + } } public void checkForUnsupportedParameters(final JsonObject object, final Collection supportedParams) { - if (object == null) { throw new InvalidParameterException(); } + if (object == null) { + throw new InvalidParameterException(); + } final Set> entries = object.entrySet(); final List unsupportedParameterList = new ArrayList<>(); @@ -106,7 +112,9 @@ public class FromJsonHelper { } } - if (!unsupportedParameterList.isEmpty()) { throw new UnsupportedParameterException(unsupportedParameterList); } + if (!unsupportedParameterList.isEmpty()) { + throw new UnsupportedParameterException(unsupportedParameterList); + } } /** diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java index e328a5746..7286244c6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/JsonParserHelper.java @@ -48,7 +48,9 @@ import org.springframework.format.number.NumberStyleFormatter; public class JsonParserHelper { public boolean parameterExists(final String parameterName, final JsonElement element) { - if (element == null) { return false; } + if (element == null) { + return false; + } return element.getAsJsonObject().has(parameterName); } @@ -544,7 +546,9 @@ public class JsonParserHelper { final double parsedNumberDouble = parsedNumber.doubleValue(); final int parsedNumberInteger = parsedNumber.intValue(); - if (source.contains(Character.toString(symbols.getDecimalSeparator()))) { throw new ParseException(source, 0); } + if (source.contains(Character.toString(symbols.getDecimalSeparator()))) { + throw new ParseException(source, 0); + } if (!Double.valueOf(parsedNumberDouble).equals(Double.valueOf(Integer.valueOf(parsedNumberInteger)))) { throw new ParseException(source, 0); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java index 72b36a1a5..dcbe2031c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/SearchParameters.java @@ -443,7 +443,9 @@ public final class SearchParameters { } public Boolean isOrphansOnly() { - if (this.orphansOnly != null) { return this.orphansOnly; } + if (this.orphansOnly != null) { + return this.orphansOnly; + } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java index 35cb09621..9a2183f09 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/TenantDatabaseUpgradeService.java @@ -121,7 +121,9 @@ public class TenantDatabaseUpgradeService { private String getEnvVar(String name, String defaultValue) { String value = System.getenv(name); - if (value == null) { return defaultValue; } + if (value == null) { + return defaultValue; + } return value; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java index e048dfef9..da55faf71 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauCommandFromApiJsonDeserializer.java @@ -49,7 +49,9 @@ public class CreditBureauCommandFromApiJsonDeserializer { } public void validateForCreate(final String json, final Long creditBureauId) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -74,7 +76,9 @@ public class CreditBureauCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java index 42118eaf2..94032f143 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/serialization/CreditBureauLoanProductCommandFromApiJsonDeserializer.java @@ -50,7 +50,9 @@ public class CreditBureauLoanProductCommandFromApiJsonDeserializer { } public void validateForCreate(final String json, final Long cb_id) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -110,7 +112,9 @@ public class CreditBureauLoanProductCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java index 7f83819ec..d82042a6c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java @@ -124,7 +124,9 @@ public class RunreportsApiResource { parameterTypeValue = "report"; String reportType = this.readExtraDataAndReportingService.getReportType(reportName, isSelfServiceUserReport); ReportingProcessService reportingProcessService = this.reportingProcessServiceProvider.findReportingProcessService(reportType); - if (reportingProcessService != null) { return reportingProcessService.processRequest(reportName, queryParams); } + if (reportingProcessService != null) { + return reportingProcessService.processRequest(reportName, queryParams); + } } else { parameterTypeValue = "parameter"; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DataTableValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DataTableValidator.java index 94166118a..6e17a0a59 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DataTableValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DataTableValidator.java @@ -64,7 +64,9 @@ public class DataTableValidator { baseDataValidator.reset().parameter(DataTableApiConstant.categoryParamName).value(category).isOneOfTheseValues(objectArray); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DatatableData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DatatableData.java index d4d7a7bc7..a716f4351 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DatatableData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/DatatableData.java @@ -50,7 +50,9 @@ public class DatatableData implements Serializable { for (ResultsetColumnHeaderData c : this.columnHeaderData) { - if (c.getColumnName().equals(columnName)) { return true; } + if (c.getColumnName().equals(columnName)) { + return true; + } } return false; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityDataTableChecksTemplateData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityDataTableChecksTemplateData.java index 4262f363f..34c95c274 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityDataTableChecksTemplateData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityDataTableChecksTemplateData.java @@ -56,9 +56,13 @@ public class EntityDataTableChecksTemplateData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } + if (this == o) { + return true; + } - if (!(o instanceof EntityDataTableChecksTemplateData)) { return false; } + if (!(o instanceof EntityDataTableChecksTemplateData)) { + return false; + } EntityDataTableChecksTemplateData that = (EntityDataTableChecksTemplateData) o; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityTables.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityTables.java index 815607e41..a9da7c73f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityTables.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/EntityTables.java @@ -70,7 +70,9 @@ public enum EntityTables { } public static ImmutableList getStatus(String name) { - if (lookup.get(name) != null) { return lookup.get(name).getCodes(); } + if (lookup.get(name) != null) { + return lookup.get(name).getCodes(); + } return ImmutableList.of(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/domain/Report.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/domain/Report.java index 589944efc..8dbd633ec 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/domain/Report.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/domain/Report.java @@ -251,7 +251,9 @@ public final class Report extends AbstractPersistableCustom { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public String getReportName() { @@ -259,7 +261,9 @@ public final class Report extends AbstractPersistableCustom { } public boolean update(final Set newReportParameterUsages) { - if (newReportParameterUsages == null) { return false; } + if (newReportParameterUsages == null) { + return false; + } boolean updated = false; @@ -273,7 +277,9 @@ public final class Report extends AbstractPersistableCustom { private boolean changeInReportParameters(final Set newReportParameterUsages) { - if (!this.reportParameterUsages.equals(newReportParameterUsages)) { return true; } + if (!this.reportParameterUsages.equals(newReportParameterUsages)) { + return true; + } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java index 09a88114c..4017903cc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java @@ -47,7 +47,9 @@ public final class ReportCommandFromApiJsonDeserializer { } public void validate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksDataValidator.java index 22e00df6b..1151342cb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksDataValidator.java @@ -54,7 +54,9 @@ public final class EntityDatatableChecksDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -89,6 +91,8 @@ public final class EntityDatatableChecksDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksWritePlatformServiceImpl.java index be3da00ed..fef4d496a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/EntityDatatableChecksWritePlatformServiceImpl.java @@ -99,7 +99,9 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData String datatableName = command.stringValueOfParameterNamed("datatableName"); DatatableData datatableData = this.readWriteNonCoreDataService.retrieveDatatable(datatableName); - if (datatableData == null) { throw new DatatableNotFoundException(datatableName); } + if (datatableData == null) { + throw new DatatableNotFoundException(datatableName); + } final String entity = command.stringValueOfParameterNamed("entity"); final String foreignKeyColumnName = EntityTables.getForeignKeyColumnNameOnDatatable(entity); @@ -107,7 +109,9 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData LOG.info("{} has column {} ? {}", new Object[] { datatableData.getRegisteredTableName(), foreignKeyColumnName, columnExist }); - if (!columnExist) { throw new EntityDatatableCheckNotSupportedException(datatableData.getRegisteredTableName(), entity); } + if (!columnExist) { + throw new EntityDatatableCheckNotSupportedException(datatableData.getRegisteredTableName(), entity); + } final Long productId = command.longValueOfParameterNamed("productId"); final Long status = command.longValueOfParameterNamed("status"); @@ -171,7 +175,9 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData reqDatatables.add(datatableName); } } - if (reqDatatables.size() > 0) { throw new DatatableEntryRequiredException(reqDatatables.toString()); } + if (reqDatatables.size() > 0) { + throw new DatatableEntryRequiredException(reqDatatables.toString()); + } } } @@ -197,7 +203,9 @@ public class EntityDatatableChecksWritePlatformServiceImpl implements EntityData reqDatatables.add(datatableName); } } - if (reqDatatables.size() > 0) { throw new DatatableEntryRequiredException(reqDatatables.toString()); } + if (reqDatatables.size() > 0) { + throw new DatatableEntryRequiredException(reqDatatables.toString()); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java index a2efa6720..c33d39495 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/GenericDataServiceImpl.java @@ -303,7 +303,9 @@ public class GenericDataServiceImpl implements GenericDataService { + "'order by ORDINAL_POSITION"; final SqlRowSet columnDefinitions = this.jdbcTemplate.queryForRowSet(sql); - if (columnDefinitions.next()) { return columnDefinitions; } + if (columnDefinitions.next()) { + return columnDefinitions; + } throw new DatatableNotFoundException(datatable); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadReportingServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadReportingServiceImpl.java index 70dc6a13b..7b6d3f596 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadReportingServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadReportingServiceImpl.java @@ -226,7 +226,9 @@ public class ReadReportingServiceImpl implements ReadReportingService { // the return statement contains the exact sql required final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(inputSqlWrapped); - if (rs.next() && rs.getString("the_sql") != null) { return rs.getString("the_sql"); } + if (rs.next() && rs.getString("the_sql") != null) { + return rs.getString("the_sql"); + } throw new ReportNotFoundException(name); } @@ -242,7 +244,9 @@ public class ReadReportingServiceImpl implements ReadReportingService { final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sqlWrapped, new Object[] { isSelfServiceUserReport }); - if (rs.next()) { return rs.getString("report_type"); } + if (rs.next()) { + return rs.getString("report_type"); + } throw new ReportNotFoundException(reportName); } @@ -337,7 +341,9 @@ public class ReadReportingServiceImpl implements ReadReportingService { final Collection rpJoins = this.jdbcTemplate.query(sql, rm, new Object[] {}); final Collection reportList = new ArrayList<>(); - if (rpJoins == null || rpJoins.size() == 0) { return reportList; } + if (rpJoins == null || rpJoins.size() == 0) { + return reportList; + } Collection reportParameters = null; @@ -615,6 +621,8 @@ public class ReadReportingServiceImpl implements ReadReportingService { private void validateReportName(final String name) { - if (!StringUtils.isBlank(name) && !name.matches(REPORT_NAME_REGEX_PATTERN)) { throw new SQLInjectionException(); } + if (!StringUtils.isBlank(name) && !name.matches(REPORT_NAME_REGEX_PATTERN)) { + throw new SQLInjectionException(); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index 5baeac032..bb38abf1c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -932,7 +932,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ } } - if (changeColumns == null && addColumns == null && dropColumns == null) { return; } + if (changeColumns == null && addColumns == null && dropColumns == null) { + return; + } if (dropColumns != null) { if (rowCount > 0) { @@ -1058,7 +1060,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ try { this.context.authenticatedUser(); - if (!isRegisteredDataTable(datatableName)) { throw new DatatableNotFoundException(datatableName); } + if (!isRegisteredDataTable(datatableName)) { + throw new DatatableNotFoundException(datatableName); + } validateDatatableName(datatableName); assertDataTableEmpty(datatableName); deregisterDatatable(datatableName); @@ -1123,7 +1127,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final GenericResultsetData grs = retrieveDataTableGenericResultSetForUpdate(appTable, dataTableName, appTableId, datatableId); - if (grs.hasNoEntries()) { throw new DatatableNotFoundException(dataTableName, appTableId); } + if (grs.hasNoEntries()) { + throw new DatatableNotFoundException(dataTableName, appTableId); + } if (grs.hasMoreThanOneEntry()) { throw new PlatformDataIntegrityException("error.msg.attempting.multiple.update", @@ -1179,7 +1185,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final String deleteOneToOneEntrySql = getDeleteEntriesSql(dataTableName, getFKField(appTable), appTableId); final int rowsDeleted = this.jdbcTemplate.update(deleteOneToOneEntrySql); - if (rowsDeleted < 1) { throw new DatatableNotFoundException(dataTableName, appTableId); } + if (rowsDeleted < 1) { + throw new DatatableNotFoundException(dataTableName, appTableId); + } return commandProcessingResult; } @@ -1260,7 +1268,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ LOG.info("data scoped sql: {}", sql); final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - if (!rs.next()) { throw new DatatableNotFoundException(appTable, appTableId); } + if (!rs.next()) { + throw new DatatableNotFoundException(appTable, appTableId); + } final Long officeId = getLongSqlRowSet(rs, "officeId"); final Long groupId = getLongSqlRowSet(rs, "groupId"); @@ -1269,7 +1279,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final Long LoanId = getLongSqlRowSet(rs, "loanId"); final Long entityId = getLongSqlRowSet(rs, "entityId"); - if (rs.next()) { throw new DatatableSystemErrorException("System Error: More than one row returned from data scoping query"); } + if (rs.next()) { + throw new DatatableSystemErrorException("System Error: More than one row returned from data scoping query"); + } return new CommandProcessingResultBuilder() // .withOfficeId(officeId) // @@ -1352,21 +1364,39 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ private void validateAppTable(final String appTable) { - if (appTable.equalsIgnoreCase("m_loan")) { return; } - if (appTable.equalsIgnoreCase("m_savings_account")) { return; } - if (appTable.equalsIgnoreCase("m_client")) { return; } - if (appTable.equalsIgnoreCase("m_group")) { return; } - if (appTable.equalsIgnoreCase("m_center")) { return; } - if (appTable.equalsIgnoreCase("m_office")) { return; } - if (appTable.equalsIgnoreCase("m_product_loan")) { return; } - if (appTable.equalsIgnoreCase("m_savings_product")) { return; } + if (appTable.equalsIgnoreCase("m_loan")) { + return; + } + if (appTable.equalsIgnoreCase("m_savings_account")) { + return; + } + if (appTable.equalsIgnoreCase("m_client")) { + return; + } + if (appTable.equalsIgnoreCase("m_group")) { + return; + } + if (appTable.equalsIgnoreCase("m_center")) { + return; + } + if (appTable.equalsIgnoreCase("m_office")) { + return; + } + if (appTable.equalsIgnoreCase("m_product_loan")) { + return; + } + if (appTable.equalsIgnoreCase("m_savings_product")) { + return; + } throw new PlatformDataIntegrityException("error.msg.invalid.application.table", "Invalid Application Table: " + appTable, "name", appTable); } private String mapToActualAppTable(final String appTable) { - if (appTable.equalsIgnoreCase("m_center")) { return "m_group"; } + if (appTable.equalsIgnoreCase("m_center")) { + return "m_group"; + } return appTable; } @@ -1517,7 +1547,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ // completeness but its okay to take this risk with additional fields // data - if (changedColumns.size() == 0) { return null; } + if (changedColumns.size() == 0) { + return null; + } String pValue = null; String pValueWrite = ""; @@ -1581,7 +1613,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ if (key.equals(grs.getColumnHeaders().get(i).getColumnName())) { columnValue = columnValues.get(i); - if (notTheSame(columnValue, keyValue, colType)) { return true; } + if (notTheSame(columnValue, keyValue, colType)) { + return true; + } return false; } } @@ -1629,7 +1663,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ } } - if (notFound) { throw new PlatformDataIntegrityException("error.msg.column.not.found", "Column: " + key + " Not Found"); } + if (notFound) { + throw new PlatformDataIntegrityException("error.msg.column.not.found", "Column: " + key + " Not Found"); + } } } return affectedColumns; @@ -1765,11 +1801,17 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ } private boolean notTheSame(final String currValue, final String pValue, final String colType) { - if (StringUtils.isEmpty(currValue) && StringUtils.isEmpty(pValue)) { return false; } + if (StringUtils.isEmpty(currValue) && StringUtils.isEmpty(pValue)) { + return false; + } - if (StringUtils.isEmpty(currValue)) { return true; } + if (StringUtils.isEmpty(currValue)) { + return true; + } - if (StringUtils.isEmpty(pValue)) { return true; } + if (StringUtils.isEmpty(pValue)) { + return true; + } if ("DECIMAL".equalsIgnoreCase(colType)) { final BigDecimal currentDecimal = BigDecimal.valueOf(Double.valueOf(currValue)); @@ -1778,7 +1820,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ return currentDecimal.compareTo(newDecimal) != 0; } - if (currValue.equals(pValue)) { return false; } + if (currValue.equals(pValue)) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java index de8c602fa..78b225728 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java @@ -161,7 +161,9 @@ public class ReportWritePlatformServiceImpl implements ReportWritePlatformServic } final Permission permission = this.permissionRepository.findOneByCode("READ" + "_" + report.getReportName()); - if (permission == null) { throw new PermissionNotFoundException("READ" + "_" + report.getReportName()); } + if (permission == null) { + throw new PermissionNotFoundException("READ" + "_" + report.getReportName()); + } this.reportRepository.delete(report); this.permissionRepository.delete(permission); @@ -217,7 +219,9 @@ public class ReportWritePlatformServiceImpl implements ReportWritePlatformServic if (id != null) { // existing report parameter usage reportParameterUsageItem = this.reportParameterUsageRepository.findById(id).orElse(null); - if (reportParameterUsageItem == null) { throw new ReportParameterNotFoundException(id); } + if (reportParameterUsageItem == null) { + throw new ReportParameterNotFoundException(id); + } // check parameter if (jsonObject.has("parameterId")) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java index 27039ba08..f042b16a9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java @@ -220,12 +220,16 @@ public class ImagesApiResource { } private void validateEntityTypeforImage(final String entityName) { - if (!checkValidEntityType(entityName)) { throw new InvalidEntityTypeForImageManagementException(entityName); } + if (!checkValidEntityType(entityName)) { + throw new InvalidEntityTypeForImageManagementException(entityName); + } } private static boolean checkValidEntityType(final String entityType) { for (final EntityTypeForImages entities : EntityTypeForImages.values()) { - if (entities.name().equalsIgnoreCase(entityType)) { return true; } + if (entities.name().equalsIgnoreCase(entityType)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/ContentRepositoryFactory.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/ContentRepositoryFactory.java index c891eb45f..4158fe015 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/ContentRepositoryFactory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/ContentRepositoryFactory.java @@ -42,12 +42,16 @@ public class ContentRepositoryFactory { public ContentRepository getRepository() { final ConfigurationDomainService configurationDomainServiceJpa = this.applicationContext.getBean("configurationDomainServiceJpa", ConfigurationDomainService.class); - if (configurationDomainServiceJpa.isAmazonS3Enabled()) { return createS3DocumentStore(); } + if (configurationDomainServiceJpa.isAmazonS3Enabled()) { + return createS3DocumentStore(); + } return new FileSystemContentRepository(); } public ContentRepository getRepository(final StorageType documentStoreType) { - if (documentStoreType == StorageType.FILE_SYSTEM) { return new FileSystemContentRepository(); } + if (documentStoreType == StorageType.FILE_SYSTEM) { + return new FileSystemContentRepository(); + } return createS3DocumentStore(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/FileSystemContentRepository.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/FileSystemContentRepository.java index 45a509e8c..9790cd0e8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/FileSystemContentRepository.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/contentrepository/FileSystemContentRepository.java @@ -104,7 +104,9 @@ public class FileSystemContentRepository implements ContentRepository { @Override public void deleteFile(final String fileName, final String documentPath) { final boolean fileDeleted = deleteFile(documentPath); - if (!fileDeleted) { throw new ContentManagementException(fileName, null); } + if (!fileDeleted) { + throw new ContentManagementException(fileName, null); + } } private boolean deleteFile(final String documentPath) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/FileData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/FileData.java index b16a4611e..10b0dcef5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/FileData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/FileData.java @@ -58,7 +58,9 @@ public class FileData { public InputStream file() { try { - if (this.inputStream == null) { return new FileInputStream(this.file); } + if (this.inputStream == null) { + return new FileInputStream(this.file); + } return this.inputStream; } catch (final FileNotFoundException e) { LOG.error("Error occured.", e); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/ImageData.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/ImageData.java index 7ac460e5e..27c785ab6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/ImageData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/data/ImageData.java @@ -105,7 +105,9 @@ public class ImageData { } public byte[] getContentOfSize(Integer maxWidth, Integer maxHeight) { - if (maxWidth == null && maxHeight != null) { return getContent(); } + if (maxWidth == null && maxHeight != null) { + return getContent(); + } byte[] out = null; if (this.storageType.equals(StorageType.S3.getValue()) && this.inputStream != null) { try { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/DocumentWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/DocumentWritePlatformServiceJpaRepositoryImpl.java index d7d80077e..001c53b6a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/DocumentWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/DocumentWritePlatformServiceJpaRepositoryImpl.java @@ -168,7 +168,9 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr private static boolean checkValidEntityType(final String entityType) { for (final DocumentManagementEntity entities : DocumentManagementEntity.values()) { - if (entities.name().equalsIgnoreCase(entityType)) { return true; } + if (entities.name().equalsIgnoreCase(entityType)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java index 137dc9801..0da188b72 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/service/ImageReadPlatformServiceImpl.java @@ -107,7 +107,9 @@ public class ImageReadPlatformServiceImpl implements ImageReadPlatformService { // object is becoming null. So further image source is becoming null // For Amazon S3. If file is not present, already // S3ContentRepository would have thrown this exception. - if (!result.available()) { throw new ImageNotFoundException(entityType, entityId); } + if (!result.available()) { + throw new ImageNotFoundException(entityType, entityId); + } return result; } catch (final EmptyResultDataAccessException e) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/data/FineractEntityDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/data/FineractEntityDataValidator.java index e86e55f48..90f0d31ae 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/data/FineractEntityDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/data/FineractEntityDataValidator.java @@ -80,7 +80,9 @@ public class FineractEntityDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS); @@ -173,7 +175,9 @@ public class FineractEntityDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_ENTITY_MAPPING_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/domain/FineractEntityRelationRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/domain/FineractEntityRelationRepositoryWrapper.java index 8cae3849a..b224ec558 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/domain/FineractEntityRelationRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/domain/FineractEntityRelationRepositoryWrapper.java @@ -39,7 +39,9 @@ public class FineractEntityRelationRepositoryWrapper { public FineractEntityRelation findOneByCodeName(final String codeName) { final FineractEntityRelation fineractEntityRelation = this.fineractEntityRelationRepository.findOneByCodeName(codeName); - if (fineractEntityRelation == null) { throw new FineractEntityAccessNotFoundException(codeName); } + if (fineractEntityRelation == null) { + throw new FineractEntityAccessNotFoundException(codeName); + } return fineractEntityRelation; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java index 5b211ca56..f10d692a8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/service/FineractEntityAccessReadServiceImpl.java @@ -81,7 +81,9 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess StringBuilder accessListCSVStrBuf = null; if ((accesslist != null) && (accesslist.size() > 0)) { for (FineractEntityToEntityMappingData accessData : accesslist) { - if (accessData == null) { throw new FineractEntityMappingConfigurationException(); } + if (accessData == null) { + throw new FineractEntityMappingConfigurationException(); + } if (accessListCSVStrBuf == null) { accessListCSVStrBuf = new StringBuilder(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java index b35653009..48918e352 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/domain/Sender.java @@ -124,7 +124,9 @@ public class Sender { * @see java.net.URLConnection#setConnectTimeout(int) */ public final void setConnectTimeout(int connectTimeout) { - if (connectTimeout < 0) { throw new IllegalArgumentException("timeout can not be negative"); } + if (connectTimeout < 0) { + throw new IllegalArgumentException("timeout can not be negative"); + } this.connectTimeout = connectTimeout; } @@ -137,7 +139,9 @@ public class Sender { * @see java.net.URLConnection#setReadTimeout(int) */ public final void setReadTimeout(int readTimeout) { - if (readTimeout < 0) { throw new IllegalArgumentException("timeout can not be negative"); } + if (readTimeout < 0) { + throw new IllegalArgumentException("timeout can not be negative"); + } this.readTimeout = readTimeout; } @@ -186,7 +190,9 @@ public class Sender { } } } while (tryAgain); - if (result == null) { throw new IOException("Could not send message after " + attempt + " attempts"); } + if (result == null) { + throw new IOException("Could not send message after " + attempt + " attempts"); + } return result; } @@ -215,7 +221,9 @@ public class Sender { } int status = (int) responseMap.get("status"); // responseBody - if (responseBody == null) { return null; } + if (responseBody == null) { + return null; + } JsonObject jsonResponse; try { jsonResponse = JsonParser.parseString(responseBody).getAsJsonObject(); @@ -430,7 +438,9 @@ public class Sender { * if there was a JSON parsing error */ public MulticastResult sendNoRetry(Message message, List registrationIds) throws IOException { - if (nonNull(registrationIds).isEmpty()) { throw new IllegalArgumentException("registrationIds cannot be empty"); } + if (nonNull(registrationIds).isEmpty()) { + throw new IllegalArgumentException("registrationIds cannot be empty"); + } Map jsonRequest = new HashMap<>(); messageToMap(message, jsonRequest); jsonRequest.put(JSON_REGISTRATION_IDS, registrationIds); @@ -439,7 +449,9 @@ public class Sender { if (responseMap.get("responseBody") != null) { responseBody = (String) responseMap.get("responseBody"); } - if (responseBody == null) { return null; } + if (responseBody == null) { + return null; + } JsonObject jsonResponse; try { @@ -516,7 +528,9 @@ public class Sender { * Map populated by Message. */ private void messageToMap(Message message, Map mapRequest) { - if (message == null || mapRequest == null) { return; } + if (message == null || mapRequest == null) { + return; + } setJsonField(mapRequest, PARAM_PRIORITY, message.getPriority()); setJsonField(mapRequest, PARAM_CONTENT_AVAILABLE, message.getContentAvailable()); setJsonField(mapRequest, PARAM_TIME_TO_LIVE, message.getTimeToLive()); @@ -580,8 +594,12 @@ public class Sender { private Number getNumber(Map json, String field) { Object value = json.get(field); - if (value == null) { throw new CustomParserException("Missing field: " + field); } - if (!(value instanceof Number)) { throw new CustomParserException("Field " + field + " does not contain a number: " + value); } + if (value == null) { + throw new CustomParserException("Missing field: " + field); + } + if (!(value instanceof Number)) { + throw new CustomParserException("Field " + field + " does not contain a number: " + value); + } return (Number) value; } @@ -622,7 +640,9 @@ public class Sender { * propagated from underlying methods. */ protected HttpURLConnection post(String url, String contentType, String body) throws IOException { - if (url == null || contentType == null || body == null) { throw new IllegalArgumentException("arguments cannot be null"); } + if (url == null || contentType == null || body == null) { + throw new IllegalArgumentException("arguments cannot be null"); + } if (!url.startsWith("https://")) { LOG.warning("URL does not use https: " + url); } @@ -699,7 +719,9 @@ public class Sender { * If the stream is {@literal null}, returns an empty string. */ protected static String getString(InputStream stream) throws IOException { - if (stream == null) { return ""; } + if (stream == null) { + return ""; + } BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)); StringBuilder content = new StringBuilder(); String newLine; @@ -727,7 +749,9 @@ public class Sender { } static T nonNull(T argument) { - if (argument == null) { throw new IllegalArgumentException("argument cannot be null"); } + if (argument == null) { + throw new IllegalArgumentException("argument cannot be null"); + } return argument; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/domain/Hook.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/domain/Hook.java index de8bbe53a..370414c35 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/domain/Hook.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/domain/Hook.java @@ -178,7 +178,9 @@ public class Hook extends AbstractAuditableCustom { } public boolean updateEvents(final Set newHookEvents) { - if (newHookEvents == null) { return false; } + if (newHookEvents == null) { + return false; + } if (this.events == null) { this.events = new HashSet<>(); @@ -189,7 +191,9 @@ public class Hook extends AbstractAuditableCustom { } public boolean updateConfig(final Set newHookConfig) { - if (newHookConfig == null) { return false; } + if (newHookConfig == null) { + return false; + } if (this.config == null) { this.config = new HashSet<>(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java index b371fee78..ac642893e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/processor/TwilioHookProcessor.java @@ -92,7 +92,9 @@ public class TwilioHookProcessor implements HookProcessor { entityName = "sms"; actionName = "send"; json = processUgdTemplate(payload, hook, authToken); - if (json == null) { return; } + if (json == null) { + return; + } } else { json = JsonParser.parseString(payload).getAsJsonObject(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/serialization/HookCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/serialization/HookCommandFromApiJsonDeserializer.java index 62f0a3ea5..b3b11612b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/serialization/HookCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/serialization/HookCommandFromApiJsonDeserializer.java @@ -53,7 +53,9 @@ public class HookCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -75,7 +77,9 @@ public class HookCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/service/HookWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/service/HookWritePlatformServiceJpaRepositoryImpl.java index 6da34f80f..e8869fc18 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/service/HookWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/service/HookWritePlatformServiceJpaRepositoryImpl.java @@ -212,7 +212,9 @@ public class HookWritePlatformServiceJpaRepositoryImpl implements HookWritePlatf private HookTemplate retrieveHookTemplateBy(final String templateName) { final HookTemplate template = this.hookTemplateRepository.findOne(templateName); - if (template == null) { throw new HookTemplateNotFoundException(templateName); } + if (template == null) { + throw new HookTemplateNotFoundException(templateName); + } return template; } @@ -311,7 +313,9 @@ public class HookWritePlatformServiceJpaRepositoryImpl implements HookWritePlatf } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void handleHookDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dve) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/data/JobDetailDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/data/JobDetailDataValidator.java index c0583cd89..90682c069 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/data/JobDetailDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/data/JobDetailDataValidator.java @@ -51,7 +51,9 @@ public class JobDetailDataValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } boolean atLeastOneParameterPassedForUpdate = false; final Type typeOfMap = new TypeToken>() {}.getType(); @@ -92,7 +94,9 @@ public class JobDetailDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/domain/JobParameter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/domain/JobParameter.java index 9788718e5..553cb2131 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/domain/JobParameter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/domain/JobParameter.java @@ -75,7 +75,9 @@ public class JobParameter extends AbstractPersistableCustom { @Override public boolean equals(Object obj) { - if (!(obj instanceof JobParameter)) { return false; } + if (!(obj instanceof JobParameter)) { + return false; + } JobParameter jobParameter = (JobParameter) obj; return Objects.equals(jobParameter.getJobId(), this.getJobId()) && Objects.equals(jobParameter.getParameterName(), this.getParameterName()) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobRegisterServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobRegisterServiceImpl.java index 8325253e3..7d06a9808 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobRegisterServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobRegisterServiceImpl.java @@ -242,7 +242,9 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi @Override public void executeJob(final Long jobId) { final ScheduledJobDetail scheduledJobDetail = this.schedularWritePlatformService.findByJobId(jobId); - if (scheduledJobDetail == null) { throw new JobNotFoundException(String.valueOf(jobId)); } + if (scheduledJobDetail == null) { + throw new JobNotFoundException(String.valueOf(jobId)); + } executeJob(scheduledJobDetail, null); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java index 37574dfcf..0c99d34f7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedularWritePlatformServiceJpaRepositoryImpl.java @@ -116,7 +116,9 @@ public class SchedularWritePlatformServiceJpaRepositoryImpl implements Schedular public CommandProcessingResult updateJobDetail(final Long jobId, final JsonCommand command) { this.dataValidator.validateForUpdate(command.json()); final ScheduledJobDetail scheduledJobDetail = findByJobId(jobId); - if (scheduledJobDetail == null) { throw new JobNotFoundException(String.valueOf(jobId)); } + if (scheduledJobDetail == null) { + throw new JobNotFoundException(String.valueOf(jobId)); + } final Map changes = scheduledJobDetail.update(command); if (!changes.isEmpty()) { this.scheduledJobDetailsRepository.saveAndFlush(scheduledJobDetail); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java index 5b13c55d7..1ef28dfb9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobListener.java @@ -132,7 +132,9 @@ public class SchedulerJobListener implements JobListener { || exception.getCause().toString().contains(SchedulerServiceConstants.JOB_METHOD_INVOCATION_FAILED_EXCEPTION))) { this.stackTraceLevel++; return getCauseFromException(exception.getCause()); - } else if (exception.getCause() != null) { return exception.getCause(); } + } else if (exception.getCause() != null) { + return exception.getCause(); + } return exception; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java index d8b549c0f..15ce35822 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java @@ -73,7 +73,9 @@ public class SchedulerJobRunnerReadServiceImpl implements SchedulerJobRunnerRead @Override public Page retrieveJobHistory(final Long jobId, final SearchParameters searchParameters) { - if (!isJobExist(jobId)) { throw new JobNotFoundException(String.valueOf(jobId)); } + if (!isJobExist(jobId)) { + throw new JobNotFoundException(String.valueOf(jobId)); + } final JobHistoryMapper jobHistoryMapper = new JobHistoryMapper(); final StringBuilder sqlBuilder = new StringBuilder(200); sqlBuilder.append("select SQL_CALC_FOUND_ROWS "); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/domain/ReportMailingJobRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/domain/ReportMailingJobRepositoryWrapper.java index db275f256..068223fe9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/domain/ReportMailingJobRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/domain/ReportMailingJobRepositoryWrapper.java @@ -44,7 +44,9 @@ public class ReportMailingJobRepositoryWrapper { final ReportMailingJob reportMailingJob = this.reportMailingJobRepository.findById(id) .orElseThrow(() -> new ReportMailingJobNotFoundException(id)); - if (reportMailingJob.isDeleted()) { throw new ReportMailingJobNotFoundException(id); } + if (reportMailingJob.isDeleted()) { + throw new ReportMailingJobNotFoundException(id); + } return reportMailingJob; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/helper/IPv4Helper.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/helper/IPv4Helper.java index 6712788da..e852e0f6a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/helper/IPv4Helper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/helper/IPv4Helper.java @@ -43,18 +43,24 @@ public class IPv4Helper { private final static Logger LOG = LoggerFactory.getLogger(IPv4Helper.class); public static long ipAddressToLong(String ipAddress) { - if (ipAddress == null || ipAddress.isEmpty()) { throw new IllegalArgumentException("ip address cannot be null or empty"); } + if (ipAddress == null || ipAddress.isEmpty()) { + throw new IllegalArgumentException("ip address cannot be null or empty"); + } String[] octets = ipAddress.split(java.util.regex.Pattern.quote(".")); - if (octets.length != 4) { throw new IllegalArgumentException("invalid ip address"); } + if (octets.length != 4) { + throw new IllegalArgumentException("invalid ip address"); + } long ip = 0; for (int i = 3; i >= 0; i--) { long octet = Long.parseLong(octets[3 - i]); - if (octet > 255 || octet < 0) { throw new IllegalArgumentException("invalid ip address"); } + if (octet > 255 || octet < 0) { + throw new IllegalArgumentException("invalid ip address"); + } ip |= octet << (i * 8); } @@ -73,7 +79,9 @@ public class IPv4Helper { */ public static String longToIpAddress(long ip) { // if ip is bigger than 255.255.255.255 or smaller than 0.0.0.0 - if (ip > 4294967295L || ip < 0) { throw new IllegalArgumentException("invalid ip"); } + if (ip > 4294967295L || ip < 0) { + throw new IllegalArgumentException("invalid ip"); + } StringBuilder ipAddress = new StringBuilder(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/validation/ReportMailingJobValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/validation/ReportMailingJobValidator.java index eff75d9cc..1ab0a41cf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/validation/ReportMailingJobValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/validation/ReportMailingJobValidator.java @@ -69,7 +69,9 @@ public class ReportMailingJobValidator { final String jsonString = jsonCommand.json(); final JsonElement jsonElement = jsonCommand.parsedJson(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, ReportMailingJobConstants.CREATE_REQUEST_PARAMETERS); @@ -148,7 +150,9 @@ public class ReportMailingJobValidator { final String jsonString = jsonCommand.json(); final JsonElement jsonElement = jsonCommand.parsedJson(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, ReportMailingJobConstants.UPDATE_REQUEST_PARAMETERS); @@ -243,16 +247,22 @@ public class ReportMailingJobValidator { **/ public boolean isValidEmail(String email) { // this is the easiest check - if (email == null) { return false; } + if (email == null) { + return false; + } // this is another easy check - if (email.endsWith(".")) { return false; } + if (email.endsWith(".")) { + return false; + } // Check the whole email address structure Matcher emailMatcher = EMAIL_PATTERN.matcher(email); // check if the Matcher matches the email pattern - if (!emailMatcher.matches()) { return false; } + if (!emailMatcher.matches()) { + return false; + } return true; } @@ -315,6 +325,8 @@ public class ReportMailingJobValidator { * **/ private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/command/InvalidateTFAccessTokenCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/command/InvalidateTFAccessTokenCommandHandler.java index 9e5b63d37..903b5cf1c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/command/InvalidateTFAccessTokenCommandHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/command/InvalidateTFAccessTokenCommandHandler.java @@ -78,7 +78,9 @@ public class InvalidateTFAccessTokenCommandHandler implements NewCommandSourceHa } private void validateJson(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeOfMap, json, new HashSet<>(Collections.singletonList("token"))); @@ -91,6 +93,8 @@ public class InvalidateTFAccessTokenCommandHandler implements NewCommandSourceHa final String token = this.fromJsonHelper.extractStringNamed("token", element); baseDataValidator.reset().parameter("token").value(token).notNull().notBlank(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/data/TwoFactorConfigurationValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/data/TwoFactorConfigurationValidator.java index b1974bfb6..bea4599e5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/data/TwoFactorConfigurationValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/data/TwoFactorConfigurationValidator.java @@ -47,7 +47,9 @@ public class TwoFactorConfigurationValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } boolean atLeastOneParameterPassedForUpdate = false; final Type typeOfMap = new TypeToken>() {}.getType(); @@ -88,7 +90,9 @@ public class TwoFactorConfigurationValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateBooleanParameter(final String name, final JsonElement element, final DataValidatorBuilder baseDataValidator) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/TwoFactorConfiguration.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/TwoFactorConfiguration.java index bd3e2aac4..30d62cf38 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/TwoFactorConfiguration.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/domain/TwoFactorConfiguration.java @@ -58,8 +58,12 @@ public class TwoFactorConfiguration extends AbstractPersistableCustom { } public Object getObjectValue() { - if (TwoFactorConfigurationConstants.NUMBER_PARAMETERS.contains(name)) { return getIntegerValue(); } - if (TwoFactorConfigurationConstants.BOOLEAN_PARAMETERS.contains(name)) { return getBooleanValue(); } + if (TwoFactorConfigurationConstants.NUMBER_PARAMETERS.contains(name)) { + return getIntegerValue(); + } + if (TwoFactorConfigurationConstants.BOOLEAN_PARAMETERS.contains(name)) { + return getBooleanValue(); + } return getStringValue(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/InsecureTwoFactorAuthenticationFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/InsecureTwoFactorAuthenticationFilter.java index b6625c1bf..d54927dc6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/InsecureTwoFactorAuthenticationFilter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/InsecureTwoFactorAuthenticationFilter.java @@ -63,7 +63,9 @@ public class InsecureTwoFactorAuthenticationFilter extends TwoFactorAuthenticati if (authentication != null && authentication.isAuthenticated() && authentication.getPrincipal() instanceof AppUser) { AppUser user = (AppUser) authentication.getPrincipal(); - if (user == null) { return; } + if (user == null) { + return; + } List updatedAuthorities = new ArrayList<>(authentication.getAuthorities()); updatedAuthorities.add(new SimpleGrantedAuthority("TWOFACTOR_AUTHENTICATED")); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java index c6d34c839..dd9058dfd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TenantAwareBasicAuthenticationFilter.java @@ -175,6 +175,8 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil boolean notAllowed = (isSelfServiceRequest && !user.isSelfServiceUser()) || (!isSelfServiceRequest && user.isSelfServiceUser()); - if (notAllowed) { throw new BadCredentialsException("User not authorised to use the requested resource."); } + if (notAllowed) { + throw new BadCredentialsException("User not authorised to use the requested resource."); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TwoFactorAuthenticationFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TwoFactorAuthenticationFilter.java index 7b6ec5e95..bedf16302 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TwoFactorAuthenticationFilter.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/filter/TwoFactorAuthenticationFilter.java @@ -85,7 +85,9 @@ public class TwoFactorAuthenticationFilter extends GenericFilterBean { if (authentication != null && authentication.isAuthenticated()) { AppUser user = (AppUser) authentication.getPrincipal(); - if (user == null) { return; } + if (user == null) { + return; + } if (!user.hasSpecificPermissionTo(TwoFactorConstants.BYPASS_TWO_FACTOR_PERMISSION)) { // User can't bypass two-factor auth, check two-factor access diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/BasicAuthTenantDetailsServiceJdbc.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/BasicAuthTenantDetailsServiceJdbc.java index 720b9198d..0baa31849 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/BasicAuthTenantDetailsServiceJdbc.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/BasicAuthTenantDetailsServiceJdbc.java @@ -123,7 +123,9 @@ public class BasicAuthTenantDetailsServiceJdbc implements BasicAuthTenantDetails private int bindValueInMinMaxRange(final int value, int min, int max) { if (value < min) { return min; - } else if (value > max) { return max; } + } else if (value > max) { + return max; + } return value; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/JdbcTenantDetailsService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/JdbcTenantDetailsService.java index 12544cfad..81c0a02af 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/JdbcTenantDetailsService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/JdbcTenantDetailsService.java @@ -116,7 +116,9 @@ public class JdbcTenantDetailsService implements TenantDetailsService { private int bindValueInMinMaxRange(final int value, int min, int max) { if (value < min) { return min; - } else if (value > max) { return max; } + } else if (value > max) { + return max; + } return value; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java index 2ebc8bbc8..29cdedeb9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java @@ -69,9 +69,13 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo } } - if (currentUser == null) { throw new UnAuthenticatedUserException(); } + if (currentUser == null) { + throw new UnAuthenticatedUserException(); + } - if (this.doesPasswordHasToBeRenewed(currentUser)) { throw new ResetPasswordException(currentUser.getId()); } + if (this.doesPasswordHasToBeRenewed(currentUser)) { + throw new ResetPasswordException(currentUser.getId()); + } return currentUser; } @@ -88,9 +92,13 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo } } - if (currentUser == null) { return null; } + if (currentUser == null) { + return null; + } - if (this.doesPasswordHasToBeRenewed(currentUser)) { throw new ResetPasswordException(currentUser.getId()); } + if (this.doesPasswordHasToBeRenewed(currentUser)) { + throw new ResetPasswordException(currentUser.getId()); + } return currentUser; } @@ -107,7 +115,9 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo } } - if (currentUser == null) { throw new UnAuthenticatedUserException(); } + if (currentUser == null) { + throw new UnAuthenticatedUserException(); + } if (this.shouldCheckForPasswordForceReset(commandWrapper) && this.doesPasswordHasToBeRenewed(currentUser)) { throw new ResetPasswordException(currentUser.getId()); @@ -148,7 +158,9 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo final Date passwordExpirationDate = c.getTime(); - if (DateUtils.getDateOfTenant().after(passwordExpirationDate)) { return true; } + if (DateUtils.getDateOfTenant().after(passwordExpirationDate)) { + return true; + } } return false; diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TenantAwareJpaPlatformUserDetailsService.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TenantAwareJpaPlatformUserDetailsService.java index b3be93464..7bdeac92c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TenantAwareJpaPlatformUserDetailsService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TenantAwareJpaPlatformUserDetailsService.java @@ -48,7 +48,9 @@ public class TenantAwareJpaPlatformUserDetailsService implements PlatformUserDet final PlatformUser appUser = this.platformUserRepository.findByUsernameAndDeletedAndEnabled(username, deleted, enabled); - if (appUser == null) { throw new UsernameNotFoundException(username + ": not found"); } + if (appUser == null) { + throw new UsernameNotFoundException(username + ": not found"); + } return appUser; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorConfigurationServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorConfigurationServiceImpl.java index bdc3ae637..3e88a1ea8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorConfigurationServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorConfigurationServiceImpl.java @@ -132,7 +132,9 @@ public class TwoFactorConfigurationServiceImpl implements TwoFactorConfiguration @Cacheable(value = "tfConfig", key = "T(org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier()+'|smsProvider'") public Integer getSMSProviderId() { Integer value = getIntegerConfig(TwoFactorConfigurationConstants.SMS_PROVIDER_ID, null); - if (value < 1) { return null; } + if (value < 1) { + return null; + } return value; } @@ -190,7 +192,9 @@ public class TwoFactorConfigurationServiceImpl implements TwoFactorConfiguration public Integer getOTPTokenLiveTime() { Integer defaultValue = 300; Integer value = getIntegerConfig(TwoFactorConfigurationConstants.OTP_TOKEN_LIVE_TIME, defaultValue); - if (value < 1) { return defaultValue; } + if (value < 1) { + return defaultValue; + } return value; } @@ -199,7 +203,9 @@ public class TwoFactorConfigurationServiceImpl implements TwoFactorConfiguration public Integer getAccessTokenLiveTime() { Integer defaultValue = 86400; Integer value = getIntegerConfig(TwoFactorConfigurationConstants.ACCESS_TOKEN_LIVE_TIME, defaultValue); - if (value < 1) { return defaultValue; } + if (value < 1) { + return defaultValue; + } return value; } @@ -208,28 +214,36 @@ public class TwoFactorConfigurationServiceImpl implements TwoFactorConfiguration public Integer getAccessTokenExtendedLiveTime() { Integer defaultValue = 604800; Integer value = getIntegerConfig(TwoFactorConfigurationConstants.ACCESS_TOKEN_LIVE_TIME_EXTENDED, defaultValue); - if (value < 1) { return defaultValue; } + if (value < 1) { + return defaultValue; + } return value; } private boolean getBooleanConfig(final String name, final boolean defaultValue) { final TwoFactorConfiguration configuration = configurationRepository.findByName(name); Boolean value = configuration.getBooleanValue(); - if (value == null) { return defaultValue; } + if (value == null) { + return defaultValue; + } return value; } private String getStringConfig(final String name, final String defaultValue) { final TwoFactorConfiguration configuration = configurationRepository.findByName(name); String value = configuration.getStringValue(); - if (value == null) { return defaultValue; } + if (value == null) { + return defaultValue; + } return value; } private Integer getIntegerConfig(final String name, final Integer defaultValue) { final TwoFactorConfiguration configuration = configurationRepository.findByName(name); Integer value = configuration.getIntegerValue(); - if (value == null) { return defaultValue; } + if (value == null) { + return defaultValue; + } return value; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorServiceImpl.java index 360827820..8132d68c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorServiceImpl.java @@ -93,7 +93,9 @@ public class TwoFactorServiceImpl implements TwoFactorService { public OTPRequest createNewOTPToken(final AppUser user, final String deliveryMethodName, final boolean extendedAccessToken) { if (TwoFactorConstants.SMS_DELIVERY_METHOD_NAME.equalsIgnoreCase(deliveryMethodName)) { OTPDeliveryMethod smsDelivery = getSMSDeliveryMethodForUser(user); - if (smsDelivery == null) { throw new OTPDeliveryMethodInvalidException(); } + if (smsDelivery == null) { + throw new OTPDeliveryMethodInvalidException(); + } final OTPRequest request = generateNewToken(smsDelivery, extendedAccessToken); final String smsText = configurationService.getFormattedSmsTextFor(user, request); SmsMessage smsMessage = SmsMessage.pendingSms(null, null, null, user.getStaff(), smsText, user.getStaff().mobileNo(), null, @@ -104,7 +106,9 @@ public class TwoFactorServiceImpl implements TwoFactorService { return request; } else if (TwoFactorConstants.EMAIL_DELIVERY_METHOD_NAME.equalsIgnoreCase(deliveryMethodName)) { OTPDeliveryMethod emailDelivery = getEmailDeliveryMethodForUser(user); - if (emailDelivery == null) { throw new OTPDeliveryMethodInvalidException(); } + if (emailDelivery == null) { + throw new OTPDeliveryMethodInvalidException(); + } final OTPRequest request = generateNewToken(emailDelivery, extendedAccessToken); final String emailSubject = configurationService.getFormattedEmailSubjectFor(user, request); final String emailBody = configurationService.getFormattedEmailBodyFor(user, request); @@ -146,7 +150,9 @@ public class TwoFactorServiceImpl implements TwoFactorService { public void validateTwoFactorAccessToken(AppUser user, String token) { TFAccessToken accessToken = fetchAccessTokenForUser(user, token); - if (accessToken == null || !accessToken.isValid()) { throw new AccessTokenInvalidIException(); } + if (accessToken == null || !accessToken.isValid()) { + throw new AccessTokenInvalidIException(); + } } @Override @@ -157,7 +163,9 @@ public class TwoFactorServiceImpl implements TwoFactorService { final String token = command.stringValueOfParameterNamed("token"); final TFAccessToken accessToken = fetchAccessTokenForUser(user, token); - if (accessToken == null || !accessToken.isValid()) { throw new AccessTokenInvalidIException(); } + if (accessToken == null || !accessToken.isValid()) { + throw new AccessTokenInvalidIException(); + } accessToken.setEnabled(false); tfAccessTokenRepository.save(accessToken); @@ -173,19 +181,29 @@ public class TwoFactorServiceImpl implements TwoFactorService { } private OTPDeliveryMethod getSMSDeliveryMethodForUser(final AppUser user) { - if (!configurationService.isSMSEnabled()) { return null; } + if (!configurationService.isSMSEnabled()) { + return null; + } - if (configurationService.getSMSProviderId() == null) { return null; } + if (configurationService.getSMSProviderId() == null) { + return null; + } - if (user.getStaff() == null) { return null; } + if (user.getStaff() == null) { + return null; + } String mobileNo = user.getStaff().mobileNo(); - if (StringUtils.isBlank(mobileNo)) { return null; } + if (StringUtils.isBlank(mobileNo)) { + return null; + } return new OTPDeliveryMethod(TwoFactorConstants.SMS_DELIVERY_METHOD_NAME, mobileNo); } private OTPDeliveryMethod getEmailDeliveryMethodForUser(final AppUser user) { - if (!configurationService.isEmailEnabled()) { return null; } + if (!configurationService.isEmailEnabled()) { + return null; + } return new OTPDeliveryMethod(TwoFactorConstants.EMAIL_DELIVERY_METHOD_NAME, user.getEmail()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorUtils.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorUtils.java index 681c20797..ee435dbb4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorUtils.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/TwoFactorUtils.java @@ -36,7 +36,9 @@ public class TwoFactorUtils { public boolean isTwoFactorAuthEnabled() { for (final String profile : this.environment.getActiveProfiles()) { - if (TWO_FACTOR_PROFILE_NAME.equals(profile)) { return true; } + if (TWO_FACTOR_PROFILE_NAME.equals(profile)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/ColumnValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/ColumnValidator.java index 5e6df760a..ee3dd4e44 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/ColumnValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/ColumnValidator.java @@ -58,9 +58,13 @@ public class ColumnValidator { Set columns = entry.getValue(); resultSet = dbMetaData.getColumns(null, null, entry.getKey(), null); Set tableColumns = getTableColumns(resultSet); - if (columns.size() > 0 && tableColumns.size() == 0) { throw new SQLInjectionException(); } + if (columns.size() > 0 && tableColumns.size() == 0) { + throw new SQLInjectionException(); + } for (String requestedColumn : columns) { - if (!tableColumns.contains(requestedColumn)) { throw new SQLInjectionException(); } + if (!tableColumns.contains(requestedColumn)) { + throw new SQLInjectionException(); + } } } } catch (SQLException e) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java index 6ee08712b..39bcdad6f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java @@ -62,15 +62,21 @@ public class SQLBuilder { * null value is explicitly permitted. */ public void addCriteria(String criteria, Object argument) { - if (criteria == null || criteria.trim().isEmpty()) { throw new IllegalArgumentException("criteria cannot be null"); } + if (criteria == null || criteria.trim().isEmpty()) { + throw new IllegalArgumentException("criteria cannot be null"); + } String trimmedCriteria = criteria.trim(); - if (trimmedCriteria.isEmpty()) { throw new IllegalArgumentException("criteria cannot be null"); } + if (trimmedCriteria.isEmpty()) { + throw new IllegalArgumentException("criteria cannot be null"); + } if (trimmedCriteria.contains("?")) { throw new IllegalArgumentException( "criteria cannot contain a '?' (that is automatically added at the end): " + trimmedCriteria); } int columnOperatorIndex = trimmedCriteria.indexOf(' '); - if (columnOperatorIndex == -1) { throw new IllegalArgumentException("criteria missing operator: " + trimmedCriteria); } + if (columnOperatorIndex == -1) { + throw new IllegalArgumentException("criteria missing operator: " + trimmedCriteria); + } String columnName = trimmedCriteria.substring(0, columnOperatorIndex).trim().toLowerCase(Locale.ROOT); if (!ATOZ.matcher(columnName).matches()) { throw new IllegalArgumentException("criteria column name must match [a-z]: " + trimmedCriteria); @@ -115,7 +121,9 @@ public class SQLBuilder { * (unless no criteria, then empty) */ public String getSQLTemplate() { - if (sb.length() > 0) { return " WHERE " + sb.toString(); } + if (sb.length() > 0) { + return " WHERE " + sb.toString(); + } return ""; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java index c6d47c744..b88c55999 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLInjectionValidator.java @@ -35,15 +35,21 @@ public class SQLInjectionValidator { public final static void validateSQLInput(final String sqlSearch) { String lowerCaseSQL = sqlSearch.toLowerCase(); for (String ddl : DDL_COMMANDS) { - if (lowerCaseSQL.contains(ddl)) { throw new SQLInjectionException(); } + if (lowerCaseSQL.contains(ddl)) { + throw new SQLInjectionException(); + } } for (String dml : DML_COMMANDS) { - if (lowerCaseSQL.contains(dml)) { throw new SQLInjectionException(); } + if (lowerCaseSQL.contains(dml)) { + throw new SQLInjectionException(); + } } for (String comments : COMMENTS) { - if (lowerCaseSQL.contains(comments)) { throw new SQLInjectionException(); } + if (lowerCaseSQL.contains(comments)) { + throw new SQLInjectionException(); + } } // Removing the space before and after '=' operator @@ -100,21 +106,29 @@ public class SQLInjectionValidator { } } } - if (injectionFound) { throw new SQLInjectionException(); } + if (injectionFound) { + throw new SQLInjectionException(); + } Pattern pattern = Pattern.compile(SQL_PATTERN); Matcher matcher = pattern.matcher(sqlSearch); - if (!matcher.matches()) { throw new SQLInjectionException(); } + if (!matcher.matches()) { + throw new SQLInjectionException(); + } } public final static void validateAdhocQuery(final String sqlSearch) { String lowerCaseSQL = sqlSearch.toLowerCase().trim(); for (String ddl : DDL_COMMANDS) { - if (lowerCaseSQL.startsWith(ddl)) { throw new SQLInjectionException(); } + if (lowerCaseSQL.startsWith(ddl)) { + throw new SQLInjectionException(); + } } for (String comments : COMMENTS) { - if (lowerCaseSQL.contains(comments)) { throw new SQLInjectionException(); } + if (lowerCaseSQL.contains(comments)) { + throw new SQLInjectionException(); + } } // Removing the space before and after '=' operator @@ -171,10 +185,14 @@ public class SQLInjectionValidator { } } } - if (injectionFound) { throw new SQLInjectionException(); } + if (injectionFound) { + throw new SQLInjectionException(); + } Pattern pattern = Pattern.compile(SQL_PATTERN); Matcher matcher = pattern.matcher(sqlSearch); - if (!matcher.matches()) { throw new SQLInjectionException(); } + if (!matcher.matches()) { + throw new SQLInjectionException(); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/vote/SelfServiceUserAccessVote.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/vote/SelfServiceUserAccessVote.java index 708a9bd53..fc63abb1f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/vote/SelfServiceUserAccessVote.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/vote/SelfServiceUserAccessVote.java @@ -51,7 +51,9 @@ public class SelfServiceUserAccessVote implements AccessDecisionVoter>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_REQUEST_DATA_PARAMETERS); @@ -119,7 +121,9 @@ public final class SmsDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_REQUEST_DATA_PARAMETERS); @@ -139,6 +143,8 @@ public final class SmsDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/data/LikelihoodDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/data/LikelihoodDataValidator.java index a5e7855c9..61f3f0dee 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/data/LikelihoodDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/data/LikelihoodDataValidator.java @@ -55,7 +55,9 @@ public class LikelihoodDataValidator { public void validateForUpdate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_LIKELIHOOD_DATA_PARAMETERS); @@ -71,7 +73,9 @@ public class LikelihoodDataValidator { baseDataValidator.reset().parameter(LikelihoodApiConstants.ACTIVE).value(enabledBool).validateForBooleanValue(); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/ExtensionData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/ExtensionData.java index 0dd43c02c..18ed4c0a7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/ExtensionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/ExtensionData.java @@ -54,7 +54,9 @@ public class ExtensionData { } public static ExtensionData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/GeoCodeData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/GeoCodeData.java index 861fd739a..addf8e8dc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/GeoCodeData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/GeoCodeData.java @@ -50,7 +50,9 @@ public class GeoCodeData { } public static GeoCodeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropAccountData.java index c60581f55..fd0737ec4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropAccountData.java @@ -99,7 +99,9 @@ public class InteropAccountData extends CommandProcessingResult { } public static InteropAccountData build(SavingsAccount account) { - if (account == null) { return null; } + if (account == null) { + return null; + } List ids = new ArrayList<>(); for (InteropIdentifier identifier : account.getIdentifiers()) { @@ -117,12 +119,24 @@ public class InteropAccountData extends CommandProcessingResult { private static LocalDate calcStatusUpdateOn(@NotNull SavingsAccount account) { LocalDate date = account.getClosedOnDate(); - if (date != null) { return date; } - if ((date = account.getWithdrawnOnDate()) != null) { return date; } - if ((date = account.getActivationLocalDate()) != null) { return date; } - if ((date = account.getRejectedOnDate()) != null) { return date; } - if ((date = account.getApprovedOnDate()) != null) { return date; } - if ((date = account.getSubmittedOnDate()) != null) { return date; } + if (date != null) { + return date; + } + if ((date = account.getWithdrawnOnDate()) != null) { + return date; + } + if ((date = account.getActivationLocalDate()) != null) { + return date; + } + if ((date = account.getRejectedOnDate()) != null) { + return date; + } + if ((date = account.getApprovedOnDate()) != null) { + return date; + } + if ((date = account.getSubmittedOnDate()) != null) { + return date; + } return null; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropIdentifierRequestData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropIdentifierRequestData.java index aac0ef486..0675e11df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropIdentifierRequestData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropIdentifierRequestData.java @@ -69,7 +69,9 @@ public class InteropIdentifierRequestData { public static InteropIdentifierRequestData validateAndParse(final DataValidatorBuilder dataValidator, @NotNull InteropIdentifierType idType, @NotNull String idValue, String subIdOrType, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropQuoteRequestData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropQuoteRequestData.java index e0bcb1f5f..38236f388 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropQuoteRequestData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropQuoteRequestData.java @@ -104,7 +104,9 @@ public class InteropQuoteRequestData extends InteropRequestData { public static InteropQuoteRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropRequestData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropRequestData.java index 36e3263f8..073287e96 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropRequestData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropRequestData.java @@ -161,7 +161,9 @@ public class InteropRequestData { public static InteropRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } String transactionCode = jsonHelper.extractStringNamed(PARAM_TRANSACTION_CODE, element); DataValidatorBuilder dataValidatorCopy = dataValidator.reset().parameter(PARAM_TRANSACTION_CODE).value(transactionCode).notBlank(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionData.java index e2c5da23b..f5aed5ff1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionData.java @@ -94,7 +94,9 @@ public class InteropTransactionData extends CommandProcessingResult { } public static InteropTransactionData build(SavingsAccountTransaction transaction) { - if (transaction == null) { return null; } + if (transaction == null) { + return null; + } SavingsAccount savingsAccount = transaction.getSavingsAccount(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionRequestData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionRequestData.java index 533b41066..214638b4f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionRequestData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionRequestData.java @@ -64,7 +64,9 @@ public class InteropTransactionRequestData extends InteropRequestData { public static InteropTransactionRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionTypeData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionTypeData.java index 2a99783ad..09139ab5f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionTypeData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionTypeData.java @@ -88,7 +88,9 @@ public class InteropTransactionTypeData { public static InteropTransactionTypeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionsData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionsData.java index dd098421c..69da8902e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionsData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransactionsData.java @@ -36,7 +36,9 @@ public class InteropTransactionsData extends CommandProcessingResult { } public static InteropTransactionsData build(SavingsAccount account, @NotNull Predicate filter) { - if (account == null) { return null; } + if (account == null) { + return null; + } List trans = account.getTransactions().stream().filter(filter).sorted((t1, t2) -> { int i = t2.getDateOf().compareTo(t1.getDateOf()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransferRequestData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransferRequestData.java index 0db38e2a9..d0a7417e4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransferRequestData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/InteropTransferRequestData.java @@ -98,7 +98,9 @@ public class InteropTransferRequestData extends InteropRequestData { public static InteropTransferRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/MoneyData.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/MoneyData.java index 8b896817b..068dfeed6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/MoneyData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/data/MoneyData.java @@ -66,7 +66,9 @@ public class MoneyData { } public static MoneyData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { - if (element == null) { return null; } + if (element == null) { + return null; + } jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/domain/InteropIdentifier.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/domain/InteropIdentifier.java index 463d2098d..eb9ab9cde 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/domain/InteropIdentifier.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/domain/InteropIdentifier.java @@ -150,14 +150,24 @@ public class InteropIdentifier extends AbstractPersistableCustom { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || !(o instanceof InteropIdentifier)) { return false; } + if (this == o) { + return true; + } + if (o == null || !(o instanceof InteropIdentifier)) { + return false; + } InteropIdentifier that = (InteropIdentifier) o; - if (!account.equals(that.account)) { return false; } - if (type != that.type) { return false; } - if (!value.equals(that.value)) { return false; } + if (!account.equals(that.account)) { + return false; + } + if (type != that.type) { + return false; + } + if (!value.equals(that.value)) { + return false; + } return subValueOrType != null ? subValueOrType.equals(that.subValueOrType) : that.subValueOrType == null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/serialization/InteropDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/serialization/InteropDataValidator.java index 34662628f..6ac5ad4ad 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/serialization/InteropDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/serialization/InteropDataValidator.java @@ -94,7 +94,9 @@ public class InteropDataValidator { private JsonObject extractJsonObject(JsonCommand command) { String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final JsonElement element = jsonHelper.parse(json); return element.getAsJsonObject(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java index 20c4d592c..46221b2b6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/service/InteropServiceImpl.java @@ -146,9 +146,13 @@ public class InteropServiceImpl implements InteropService { ZoneId zoneId = ZoneId.of(ThreadLocalContextUtil.getTenant().getTimezoneId()); Predicate transFilter = t -> { SavingsAccountTransactionType transactionType = SavingsAccountTransactionType.fromInt(t.getTypeOf()); - if (debit != transactionType.isDebit() && credit != transactionType.isCredit()) { return false; } + if (debit != transactionType.isDebit() && credit != transactionType.isCredit()) { + return false; + } - if (transactionsFrom == null && transactionsTo == null) { return true; } + if (transactionsFrom == null && transactionsTo == null) { + return true; + } java.time.LocalDateTime transactionDate = t.getTransactionLocalDate().toDateTimeAtStartOfDay().toDate().toInstant() .atZone(zoneId).toLocalDateTime(); @@ -271,7 +275,9 @@ public class InteropServiceImpl implements InteropService { String transferCode = request.getTransferCode(); LocalDateTime transactionDate = DateUtils.getLocalDateTimeOfTenant(); if (MathUtil.isGreaterThanZero(total)) { - if (MathUtil.isLessThan(savingsAccount.getWithdrawableBalance(), total)) { throw new UnsupportedOperationException(); } + if (MathUtil.isLessThan(savingsAccount.getWithdrawableBalance(), total)) { + throw new UnsupportedOperationException(); + } if (findTransaction(savingsAccount, transferCode, SavingsAccountTransactionType.AMOUNT_HOLD) != null) { throw new UnsupportedOperationException("Transfer amount was already put on hold " + transferCode); } @@ -360,7 +366,9 @@ public class InteropServiceImpl implements InteropService { private SavingsAccount validateAndGetSavingAccount(String accountId) { SavingsAccount savingsAccount = savingsAccountRepository.findByExternalId(accountId); - if (savingsAccount == null) { throw new SavingsAccountNotFoundException(accountId); } + if (savingsAccount == null) { + throw new SavingsAccountNotFoundException(accountId); + } return savingsAccount; } @@ -370,7 +378,9 @@ public class InteropServiceImpl implements InteropService { savingsAccount.setHelpers(savingsAccountTransactionSummaryWrapper, savingsHelper); ApplicationCurrency currency = currencyRepository.findOneByCode(request.getAmount().getCurrency()); - if (!savingsAccount.getCurrency().getCode().equals(currency.getCode())) { throw new UnsupportedOperationException(); } + if (!savingsAccount.getCurrency().getCode().equals(currency.getCode())) { + throw new UnsupportedOperationException(); + } SavingsAccountTransactionType transactionType = request.getTransactionRole().getTransactionType(); if (!savingsAccount.isTransactionAllowed(transactionType, request.getExpirationLocalDate())) { @@ -392,13 +402,17 @@ public class InteropServiceImpl implements InteropService { BigDecimal total = transactionType.isDebit() ? amount : MathUtil.negate(amount); MoneyData fspFee = request.getFspFee(); if (fspFee != null) { - if (!savingsAccount.getCurrency().getCode().equals(fspFee.getCurrency())) { throw new UnsupportedOperationException(); } + if (!savingsAccount.getCurrency().getCode().equals(fspFee.getCurrency())) { + throw new UnsupportedOperationException(); + } // TODO: compare with calculated quote fee total = MathUtil.add(total, fspFee.getAmount()); } MoneyData fspCommission = request.getFspCommission(); if (fspCommission != null) { - if (!savingsAccount.getCurrency().getCode().equals(fspCommission.getCurrency())) { throw new UnsupportedOperationException(); } + if (!savingsAccount.getCurrency().getCode().equals(fspCommission.getCurrency())) { + throw new UnsupportedOperationException(); + } // TODO: compare with calculated quote commission total = MathUtil.subtractToZero(total, fspCommission.getAmount()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/MathUtil.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/MathUtil.java index 4573420f2..2f9dac8ab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/MathUtil.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/MathUtil.java @@ -91,8 +91,12 @@ public class MathUtil { * if true then null parameter is omitted, otherwise returns null */ public static Long min(Long first, Long second, boolean notNull) { - if (first == null) { return notNull ? second : null; } - if (second == null) { return notNull ? first : null; } + if (first == null) { + return notNull ? second : null; + } + if (second == null) { + return notNull ? first : null; + } return Math.min(first, second); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java b/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java index 9a2f5fc2b..f1556d92b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/mix/data/ContextData.java @@ -54,19 +54,37 @@ public class ContextData { @Override public boolean equals(final Object obj) { - if (this == obj) { return true; } - if (obj == null) { return false; } - if (!(obj instanceof ContextData)) { return false; } + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ContextData)) { + return false; + } final ContextData other = (ContextData) obj; if (this.dimension == null) { - if (other.dimension != null) { return false; } - } else if (!this.dimension.equals(other.dimension)) { return false; } + if (other.dimension != null) { + return false; + } + } else if (!this.dimension.equals(other.dimension)) { + return false; + } if (this.dimensionType == null) { - if (other.dimensionType != null) { return false; } - } else if (!this.dimensionType.equals(other.dimensionType)) { return false; } + if (other.dimensionType != null) { + return false; + } + } else if (!this.dimensionType.equals(other.dimensionType)) { + return false; + } if (this.periodType == null) { - if (other.periodType != null) { return false; } - } else if (!this.periodType.equals(other.periodType)) { return false; } + if (other.periodType != null) { + return false; + } + } else if (!this.periodType.equals(other.periodType)) { + return false; + } return true; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/service/XBRLResultServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/mix/service/XBRLResultServiceImpl.java index 735087669..9b918ae86 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/mix/service/XBRLResultServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/mix/service/XBRLResultServiceImpl.java @@ -64,20 +64,26 @@ public class XBRLResultServiceImpl implements XBRLResultService { public XBRLData getXBRLResult(final Date startDate, final Date endDate, final String currency) { final HashMap config = retrieveTaxonomyConfig(startDate, endDate); - if (config == null || config.size() == 0) { throw new XBRLMappingInvalidException("Mapping is empty"); } + if (config == null || config.size() == 0) { + throw new XBRLMappingInvalidException("Mapping is empty"); + } return new XBRLData(config, startDate, endDate, currency); } @SuppressWarnings("unchecked") private HashMap retrieveTaxonomyConfig(final Date startDate, final Date endDate) { final MixTaxonomyMappingData taxonomyMapping = this.readTaxonomyMappingService.retrieveTaxonomyMapping(); - if (taxonomyMapping == null) { return null; } + if (taxonomyMapping == null) { + return null; + } final String config = taxonomyMapping.getConfig(); if (config != null) { // HashMap configMap = new HashMap<>(); configMap = new Gson().fromJson(config, configMap.getClass()); - if (configMap == null) { return null; } + if (configMap == null) { + return null; + } // final HashMap resultMap = new HashMap<>(); setupBalanceMap(getAccountSql(startDate, endDate)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java index 086dae801..24165a277 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java @@ -134,7 +134,9 @@ public class HolidaysApiResource { result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "activate" }); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "activate" }); + } return this.toApiJsonSerializer.serialize(result); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java index 4c241caef..d74c5475c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/data/HolidayDataValidator.java @@ -59,7 +59,9 @@ public class HolidayDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS); @@ -114,7 +116,9 @@ public class HolidayDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/domain/Holiday.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/domain/Holiday.java index 5f0cdf486..db048ff62 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/domain/Holiday.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/domain/Holiday.java @@ -195,14 +195,18 @@ public class Holiday extends AbstractPersistableCustom { baseDataValidator.reset().parameter(repaymentsRescheduledToParamName).failWithCode("cannot.edit.holiday.in.active.state"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } return actualChanges; } public boolean update(final Set newOffices) { - if (newOffices == null) { return false; } + if (newOffices == null) { + return false; + } boolean updated = false; if (this.offices != null) { @@ -299,7 +303,9 @@ public class Holiday extends AbstractPersistableCustom { final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status); if (!currentStatus.isPendingActivation()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.pending.for.activation.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = HolidayStatusType.ACTIVE.getValue(); @@ -312,7 +318,9 @@ public class Holiday extends AbstractPersistableCustom { final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status); if (currentStatus.isDeleted()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("already.in.deleted.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = HolidayStatusType.DELETED.getValue(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/data/CurrencyData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/data/CurrencyData.java index be224c96f..a262f3f72 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/data/CurrencyData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/data/CurrencyData.java @@ -92,8 +92,12 @@ public class CurrencyData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof CurrencyData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof CurrencyData)) { + return false; + } CurrencyData that = (CurrencyData) o; return Objects.equals(decimalPlaces, that.decimalPlaces) && Objects.equals(code, that.code) && Objects.equals(name, that.name) && Objects.equals(inMultiplesOf, that.inMultiplesOf) && Objects.equals(displaySymbol, that.displaySymbol) diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepositoryWrapper.java index 1f1228c8a..c355a0342 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/ApplicationCurrencyRepositoryWrapper.java @@ -48,7 +48,9 @@ public class ApplicationCurrencyRepositoryWrapper { public ApplicationCurrency findOneWithNotFoundDetection(final MonetaryCurrency currency) { final ApplicationCurrency defaultApplicationCurrency = this.repository.findOneByCode(currency.getCode()); - if (defaultApplicationCurrency == null) { throw new CurrencyNotFoundException(currency.getCode()); } + if (defaultApplicationCurrency == null) { + throw new CurrencyNotFoundException(currency.getCode()); + } final ApplicationCurrency applicationCurrency = ApplicationCurrency.from(defaultApplicationCurrency, currency.getDigitsAfterDecimal(), currency.getCurrencyInMultiplesOf()); @@ -62,7 +64,9 @@ public class ApplicationCurrencyRepositoryWrapper { */ public ApplicationCurrency findOneWithNotFoundDetection(final String currencyCode) { final ApplicationCurrency applicationCurrency = this.repository.findOneByCode(currencyCode); - if (applicationCurrency == null) { throw new CurrencyNotFoundException(currencyCode); } + if (applicationCurrency == null) { + throw new CurrencyNotFoundException(currencyCode); + } return applicationCurrency; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java index 791a12259..6479a4f64 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/domain/Money.java @@ -40,7 +40,9 @@ public class Money implements Comparable { private BigDecimal amount; public static Money total(final Money... monies) { - if (monies.length == 0) { throw new IllegalArgumentException("Money array must not be empty"); } + if (monies.length == 0) { + throw new IllegalArgumentException("Money array must not be empty"); + } Money total = monies[0]; for (int i = 1; i < monies.length; i++) { total = total.plus(monies[i]); @@ -50,7 +52,9 @@ public class Money implements Comparable { public static Money total(final Iterable monies) { final Iterator it = monies.iterator(); - if (it.hasNext() == false) { throw new IllegalArgumentException("Money iterator must not be empty"); } + if (it.hasNext() == false) { + throw new IllegalArgumentException("Money iterator must not be empty"); + } Money total = it.next(); while (it.hasNext()) { total = total.plus(it.next()); @@ -158,13 +162,17 @@ public class Money implements Comparable { } public Money plus(final BigDecimal amountToAdd) { - if (amountToAdd == null || amountToAdd.compareTo(BigDecimal.ZERO) == 0) { return this; } + if (amountToAdd == null || amountToAdd.compareTo(BigDecimal.ZERO) == 0) { + return this; + } final BigDecimal newAmount = this.amount.add(amountToAdd); return Money.of(monetaryCurrency(), newAmount); } public Money plus(final double amountToAdd) { - if (amountToAdd == 0) { return this; } + if (amountToAdd == 0) { + return this; + } final BigDecimal newAmount = this.amount.add(BigDecimal.valueOf(amountToAdd)); return Money.of(monetaryCurrency(), newAmount); } @@ -175,13 +183,17 @@ public class Money implements Comparable { } public Money minus(final BigDecimal amountToSubtract) { - if (amountToSubtract == null || amountToSubtract.compareTo(BigDecimal.ZERO) == 0) { return this; } + if (amountToSubtract == null || amountToSubtract.compareTo(BigDecimal.ZERO) == 0) { + return this; + } final BigDecimal newAmount = this.amount.subtract(amountToSubtract); return Money.of(monetaryCurrency(), newAmount); } private Money checkCurrencyEqual(final Money money) { - if (isSameCurrency(money) == false) { throw new UnsupportedOperationException("currencies are different."); } + if (isSameCurrency(money) == false) { + throw new UnsupportedOperationException("currencies are different."); + } return money; } @@ -190,43 +202,57 @@ public class Money implements Comparable { } public Money dividedBy(final BigDecimal valueToDivideBy, final RoundingMode roundingMode) { - if (valueToDivideBy.compareTo(BigDecimal.ONE) == 0) { return this; } + if (valueToDivideBy.compareTo(BigDecimal.ONE) == 0) { + return this; + } final BigDecimal newAmount = this.amount.divide(valueToDivideBy, roundingMode); return Money.of(monetaryCurrency(), newAmount); } public Money dividedBy(final double valueToDivideBy, final RoundingMode roundingMode) { - if (valueToDivideBy == 1) { return this; } + if (valueToDivideBy == 1) { + return this; + } final BigDecimal newAmount = this.amount.divide(BigDecimal.valueOf(valueToDivideBy), roundingMode); return Money.of(monetaryCurrency(), newAmount); } public Money dividedBy(final long valueToDivideBy, final RoundingMode roundingMode) { - if (valueToDivideBy == 1) { return this; } + if (valueToDivideBy == 1) { + return this; + } final BigDecimal newAmount = this.amount.divide(BigDecimal.valueOf(valueToDivideBy), roundingMode); return Money.of(monetaryCurrency(), newAmount); } public Money multipliedBy(final BigDecimal valueToMultiplyBy) { - if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) { return this; } + if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) { + return this; + } final BigDecimal newAmount = this.amount.multiply(valueToMultiplyBy); return Money.of(monetaryCurrency(), newAmount); } public Money multipliedBy(final double valueToMultiplyBy) { - if (valueToMultiplyBy == 1) { return this; } + if (valueToMultiplyBy == 1) { + return this; + } final BigDecimal newAmount = this.amount.multiply(BigDecimal.valueOf(valueToMultiplyBy)); return Money.of(monetaryCurrency(), newAmount); } public Money multipliedBy(final long valueToMultiplyBy) { - if (valueToMultiplyBy == 1) { return this; } + if (valueToMultiplyBy == 1) { + return this; + } final BigDecimal newAmount = this.amount.multiply(BigDecimal.valueOf(valueToMultiplyBy)); return Money.of(monetaryCurrency(), newAmount); } public Money multiplyRetainScale(final BigDecimal valueToMultiplyBy, final RoundingMode roundingMode) { - if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) { return this; } + if (valueToMultiplyBy.compareTo(BigDecimal.ONE) == 0) { + return this; + } BigDecimal newAmount = this.amount.multiply(valueToMultiplyBy); newAmount = newAmount.setScale(this.currencyDigitsAfterDecimal, roundingMode); return Money.of(monetaryCurrency(), newAmount); @@ -316,7 +342,9 @@ public class Money implements Comparable { } public Money negated() { - if (isZero()) { return this; } + if (isZero()) { + return this; + } return Money.of(monetaryCurrency(), this.amount.negate()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java index b7accc424..61397c0c7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java @@ -53,7 +53,9 @@ public final class CurrencyCommandFromApiJsonDeserializer { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java index fe4ba6cef..4216da75a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java @@ -118,7 +118,9 @@ public class Office extends AbstractPersistableCustom implements Serializable { final String parentIdParamName = "parentId"; - if (command.parameterExists(parentIdParamName) && this.parent == null) { throw new RootOfficeParentCannotBeUpdated(); } + if (command.parameterExists(parentIdParamName) && this.parent == null) { + throw new RootOfficeParentCannotBeUpdated(); + } if (this.parent != null && command.isChangeInLongParameterNamed(parentIdParamName, this.parent.getId())) { final Long newValue = command.longValueOfParameterNamed(parentIdParamName); @@ -171,9 +173,13 @@ public class Office extends AbstractPersistableCustom implements Serializable { public void update(final Office newParent) { - if (this.parent == null) { throw new RootOfficeParentCannotBeUpdated(); } + if (this.parent == null) { + throw new RootOfficeParentCannotBeUpdated(); + } - if (identifiedBy(newParent.getId())) { throw new CannotUpdateOfficeWithParentOfficeSameAsSelf(getId(), newParent.getId()); } + if (identifiedBy(newParent.getId())) { + throw new CannotUpdateOfficeWithParentOfficeSameAsSelf(getId(), newParent.getId()); + } this.parent = newParent; generateHierarchy(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/OrganisationCurrencyRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/OrganisationCurrencyRepositoryWrapper.java index 1b3200419..10c1f0ff6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/OrganisationCurrencyRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/OrganisationCurrencyRepositoryWrapper.java @@ -46,7 +46,9 @@ public class OrganisationCurrencyRepositoryWrapper { public OrganisationCurrency findOneWithNotFoundDetection(final String currencyCode) { final OrganisationCurrency organisationCurrency = this.repository.findOneByCode(currencyCode); - if (organisationCurrency == null) { throw new OrganizationalCurrencyNotFoundException(currencyCode); } + if (organisationCurrency == null) { + throw new OrganizationalCurrencyNotFoundException(currencyCode); + } return organisationCurrency; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java index 6166b95d2..84e8b8b74 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java @@ -57,7 +57,9 @@ public final class OfficeCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -94,7 +96,9 @@ public final class OfficeCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java index 50124e2cc..ba59e7711 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java @@ -55,7 +55,9 @@ public final class OfficeTransactionCommandFromApiJsonDeserializer { } public void validateOfficeTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/data/ProvisioningCategoryData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/data/ProvisioningCategoryData.java index 7e184d7e5..4c8ca8a00 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/data/ProvisioningCategoryData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/data/ProvisioningCategoryData.java @@ -49,7 +49,9 @@ public class ProvisioningCategoryData implements Comparable>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -62,11 +64,15 @@ public class ProvisioningCategoryDefinitionJsonDeserializer { final String name = this.fromApiJsonHelper.extractStringNamed("categoryname", element); baseDataValidator.reset().parameter("categoryname").value(name).notBlank().notExceedingLengthOf(100); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -79,7 +85,9 @@ public class ProvisioningCategoryDefinitionJsonDeserializer { baseDataValidator.reset().parameter("categoryname").value(categoryName).notBlank().notExceedingLengthOf(100); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java index 568d120e9..3d2c58516 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/serialization/ProvisioningCriteriaDefinitionJsonDeserializer.java @@ -146,7 +146,9 @@ public class ProvisioningCriteriaDefinitionJsonDeserializer implements Provision baseDataValidator.reset().parameter(ProvisioningCriteriaConstants.JSON_PROVISIONING_DEFINITIONS_PARAM).jsonArrayNotEmpty(); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForUpdate(final String json) { @@ -231,7 +233,9 @@ public class ProvisioningCriteriaDefinitionJsonDeserializer implements Provision } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaAssembler.java index 0c83e78b5..e290e8870 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaAssembler.java @@ -85,7 +85,9 @@ public class ProvisioningCriteriaAssembler { for (int i = 0; i < def.size(); i++) { for (int j = i + 1; j < def.size(); j++) { - if (def.get(i).isOverlapping(def.get(j))) { throw new ProvisioningCriteriaOverlappingDefinitionException(); } + if (def.get(i).isOverlapping(def.get(j))) { + throw new ProvisioningCriteriaOverlappingDefinitionException(); + } } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java index cbef5bef2..2f53951ad 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java @@ -110,7 +110,9 @@ public class ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl implement try { this.fromApiJsonDeserializer.validateForUpdate(command.json()); ProvisioningCriteria provisioningCriteria = provisioningCriteriaRepository.findById(criteriaId).orElse(null); - if (provisioningCriteria == null) { throw new ProvisioningCategoryNotFoundException(criteriaId); } + if (provisioningCriteria == null) { + throw new ProvisioningCategoryNotFoundException(criteriaId); + } List products = this.provisioningCriteriaAssembler.parseLoanProducts(command.parsedJson()); final Map changes = provisioningCriteria.update(command, products); if (!changes.isEmpty()) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/StaffRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/StaffRepositoryWrapper.java index 26c1dba02..ae4a6598e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/StaffRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/StaffRepositoryWrapper.java @@ -44,14 +44,18 @@ public class StaffRepositoryWrapper { public Staff findByOfficeWithNotFoundDetection(final Long staffId, final Long officeId) { final Staff staff = this.repository.findByOffice(staffId, officeId); - if (staff == null) { throw new StaffNotFoundException(staffId); } + if (staff == null) { + throw new StaffNotFoundException(staffId); + } return staff; } public Staff findByOfficeHierarchyWithNotFoundDetection(final Long staffId, final String hierarchy) { final Staff staff = this.repository.findById(staffId).orElseThrow(() -> new StaffNotFoundException(staffId)); final String staffhierarchy = staff.office().getHierarchy(); - if (!hierarchy.startsWith(staffhierarchy)) { throw new StaffNotFoundException(staffId); } + if (!hierarchy.startsWith(staffhierarchy)) { + throw new StaffNotFoundException(staffId); + } return staff; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java index 356809aaf..63290f781 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java @@ -60,7 +60,9 @@ public final class StaffCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -121,7 +123,9 @@ public final class StaffCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json, Long staffId) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/service/StaffReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/service/StaffReadPlatformServiceImpl.java index 4f183b05f..d93718e9f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/service/StaffReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/service/StaffReadPlatformServiceImpl.java @@ -219,7 +219,9 @@ public class StaffReadPlatformServiceImpl implements StaffReadPlatformService { sql += " where " + extraCriteria; } sql = sql + " order by s.lastname"; - if (officeId == null) { return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchy }); } + if (officeId == null) { + return this.jdbcTemplate.query(sql, rm, new Object[] { hierarchy }); + } return this.jdbcTemplate.query(sql, rm, new Object[] { officeId, hierarchy }); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java index f1fdf2746..9ce50f2a9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/data/CashierTransactionDataValidator.java @@ -103,7 +103,9 @@ public class CashierTransactionDataValidator { + "') or Time(c.end_time) BETWEEN TIME('" + startTime + "') and TIME('" + endTime + "')) "; } int count = this.jdbcTemplate.queryForObject(sql, Integer.class); - if (count > 0) { throw new CashierAlreadyAlloacated(); } + if (count > 0) { + throw new CashierAlreadyAlloacated(); + } } public void validateOnLoanDisbursal(AppUser user, String currencyCode, BigDecimal transactionAmount) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/serialization/TellerCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/serialization/TellerCommandFromApiJsonDeserializer.java index 38ed7964f..793b06574 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/serialization/TellerCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/serialization/TellerCommandFromApiJsonDeserializer.java @@ -61,7 +61,9 @@ public final class TellerCommandFromApiJsonDeserializer { } public void validateForCreateAndUpdateTeller(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -90,7 +92,9 @@ public final class TellerCommandFromApiJsonDeserializer { baseDataValidator.reset().parameter("status").value(status).notBlank().notExceedingLengthOf(50); if (endDate != null) { - if (endDate.isBefore(startDate)) { throw new InvalidDateInputException(startDate.toString(), endDate.toString()); } + if (endDate.isBefore(startDate)) { + throw new InvalidDateInputException(startDate.toString(), endDate.toString()); + } } throwExceptionIfValidationWarningsExist(dataValidationErrors); } @@ -103,7 +107,9 @@ public final class TellerCommandFromApiJsonDeserializer { } public void validateForAllocateCashier(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -144,7 +150,9 @@ public final class TellerCommandFromApiJsonDeserializer { } public void validateForCashTxnForCashier(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java index 2d37db2d0..0af1db247 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/service/TellerManagementReadPlatformServiceImpl.java @@ -237,7 +237,9 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement sql += " where " + extraCriteria; } sql = sql + " order by t.teller_name"; - if (officeId != null) { return this.jdbcTemplate.query(sql, tm, new Object[] { officeId }); } + if (officeId != null) { + return this.jdbcTemplate.query(sql, tm, new Object[] { officeId }); + } return this.jdbcTemplate.query(sql, tm, new Object[] {}); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java index 36183d7d2..8c3e365c1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java @@ -52,7 +52,9 @@ public class WorkingDayValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS); @@ -83,6 +85,8 @@ public class WorkingDayValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysRepositoryWrapper.java index a29f08df4..bf32f9d25 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysRepositoryWrapper.java @@ -44,7 +44,9 @@ public class WorkingDaysRepositoryWrapper { public WorkingDays findOne() { final List workingDaysList = this.repository.findAll(); - if (workingDaysList == null || workingDaysList.isEmpty()) { throw new WorkingDaysNotFoundException(); } + if (workingDaysList == null || workingDaysList.isEmpty()) { + throw new WorkingDaysNotFoundException(); + } return workingDaysList.get(0); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysUtil.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysUtil.java index 78c6bb58b..a1f3f0dcd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysUtil.java +++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysUtil.java @@ -30,7 +30,9 @@ public class WorkingDaysUtil { final WorkingDays workingDays) { // If date is not a non working day then return date. - if (isWorkingDay(workingDays, date)) { return date; } + if (isWorkingDay(workingDays, date)) { + return date; + } final RepaymentRescheduleType rescheduleType = RepaymentRescheduleType.fromInt(workingDays.getRepaymentReschedulingType()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java index 5d2efb665..64a4ea9b4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java @@ -169,7 +169,9 @@ public class StandingInstructionApiResource { .build(); } - if (commandRequest == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (commandRequest == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); return this.toApiJsonSerializer.serialize(result); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java index 11076bcb4..a7c6dc70e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransfersDataValidator.java @@ -65,7 +65,9 @@ public class AccountTransfersDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS); @@ -96,6 +98,8 @@ public class AccountTransfersDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/PortfolioAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/PortfolioAccountData.java index 0746f46fc..b4d3103b1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/PortfolioAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/PortfolioAccountData.java @@ -87,9 +87,15 @@ public class PortfolioAccountData implements Serializable { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof PortfolioAccountData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof PortfolioAccountData)) { + return false; + } final PortfolioAccountData rhs = (PortfolioAccountData) obj; return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).append(this.productId, rhs.productId) .append(this.productName, rhs.productName).isEquals(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java index 44634aae8..856590049 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/data/StandingInstructionDataValidator.java @@ -88,7 +88,9 @@ public class StandingInstructionDataValidator { public void validateForCreate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_REQUEST_DATA_PARAMETERS); @@ -204,7 +206,9 @@ public class StandingInstructionDataValidator { public void validateForUpdate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_REQUEST_DATA_PARAMETERS); @@ -283,6 +287,8 @@ public class StandingInstructionDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferStandingInstruction.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferStandingInstruction.java index cca712da9..fe40ab29f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferStandingInstruction.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferStandingInstruction.java @@ -151,7 +151,9 @@ public class AccountTransferStandingInstruction extends AbstractPersistableCusto .resource(STANDING_INSTRUCTION_RESOURCE_NAME); validateDependencies(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public Map update(JsonCommand command) { @@ -235,7 +237,9 @@ public class AccountTransferStandingInstruction extends AbstractPersistableCusto this.recurrenceInterval = newValue; } validateDependencies(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } return actualChanges; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java index 331d5cd79..4a2e8b356 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java @@ -246,7 +246,9 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } private boolean transferAmount(final List errors, final AccountTransferDTO accountTransferDTO, final Long instructionId) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/serialization/AddressCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/serialization/AddressCommandFromApiJsonDeserializer.java index ccead5e79..2adbaa74e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/serialization/AddressCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/serialization/AddressCommandFromApiJsonDeserializer.java @@ -61,7 +61,9 @@ public class AddressCommandFromApiJsonDeserializer { } public void validate(final String json, final boolean fromNewClient) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java index ff609630d..a523aaf74 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/service/AddressWritePlatformServiceImpl.java @@ -179,7 +179,9 @@ public class AddressWritePlatformServiceImpl implements AddressWritePlatformServ final ClientAddress clientAddressObj = this.clientAddressRepositoryWrapper.findOneByClientIdAndAddressId(clientId, addressId); - if (clientAddressObj == null) { throw new AddressNotFoundException(clientId); } + if (clientAddressObj == null) { + throw new AddressNotFoundException(clientId); + } final Address addobj = this.addressRepository.getOne(addressId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java index c9fee5a1c..7b46c0cb0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java @@ -180,7 +180,9 @@ public class CalendarsApiResource { final String apiRequestBodyAsJson) { final CalendarEntityType calendarEntityType = CalendarEntityType.getEntityType(entityType); - if (calendarEntityType == null) { throw new CalendarEntityTypeNotSupportedException(entityType); } + if (calendarEntityType == null) { + throw new CalendarEntityTypeNotSupportedException(entityType); + } final CommandWrapper resourceDetails = getResourceDetails(calendarEntityType, entityId); final CommandWrapper commandRequest = new CommandWrapperBuilder().createCalendar(resourceDetails, entityType, entityId) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/data/CalendarData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/data/CalendarData.java index 38dddc5da..33bc74cef 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/data/CalendarData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/data/CalendarData.java @@ -457,21 +457,27 @@ public class CalendarData implements Serializable { public boolean isStartDateBeforeOrEqual(final LocalDate compareDate) { if (this.startDate != null && compareDate != null) { - if (this.startDate.isBefore(compareDate) || this.startDate.equals(compareDate)) { return true; } + if (this.startDate.isBefore(compareDate) || this.startDate.equals(compareDate)) { + return true; + } } return false; } public boolean isEndDateAfterOrEqual(final LocalDate compareDate) { if (this.endDate != null && compareDate != null) { - if (this.endDate.isAfter(compareDate) || this.endDate.isEqual(compareDate)) { return true; } + if (this.endDate.isAfter(compareDate) || this.endDate.isEqual(compareDate)) { + return true; + } } return false; } public boolean isBetweenStartAndEndDate(final LocalDate compareDate) { if (isStartDateBeforeOrEqual(compareDate)) { - if (this.endDate == null || isEndDateAfterOrEqual(compareDate)) { return true; } + if (this.endDate == null || isEndDateAfterOrEqual(compareDate)) { + return true; + } } return false; } @@ -502,8 +508,12 @@ public class CalendarData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof CalendarData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof CalendarData)) { + return false; + } CalendarData that = (CalendarData) o; return Objects.equals(repeating, that.repeating) && Objects.equals(id, that.id) && Objects.equals(calendarInstanceId, that.calendarInstanceId) && Objects.equals(entityId, that.entityId) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/Calendar.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/Calendar.java index c44b483aa..c3721053c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/Calendar.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/Calendar.java @@ -115,7 +115,9 @@ public class Calendar extends AbstractAuditableCustom { if (calendarType.isCollection() && !repeating) { baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue()) .failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.title = StringUtils.defaultIfEmpty(title, null); @@ -350,7 +352,9 @@ public class Calendar extends AbstractAuditableCustom { if (calendarType.isCollection() && !this.repeating) { baseDataValidator.reset().parameter(CalendarSupportedParameters.REPEATING.getValue()) .failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final String newRecurrence = Calendar.constructRecurrence(command, this); @@ -508,39 +512,51 @@ public class Calendar extends AbstractAuditableCustom { } public boolean isStartDateBefore(final LocalDate compareDate) { - if (this.startDate != null && compareDate != null && getStartDateLocalDate().isBefore(compareDate)) { return true; } + if (this.startDate != null && compareDate != null && getStartDateLocalDate().isBefore(compareDate)) { + return true; + } return false; } public boolean isStartDateBeforeOrEqual(final LocalDate compareDate) { if (this.startDate != null && compareDate != null) { - if (getStartDateLocalDate().isBefore(compareDate) || getStartDateLocalDate().equals(compareDate)) { return true; } + if (getStartDateLocalDate().isBefore(compareDate) || getStartDateLocalDate().equals(compareDate)) { + return true; + } } return false; } public boolean isStartDateAfter(final LocalDate compareDate) { - if (this.startDate != null && compareDate != null && getStartDateLocalDate().isAfter(compareDate)) { return true; } + if (this.startDate != null && compareDate != null && getStartDateLocalDate().isAfter(compareDate)) { + return true; + } return false; } public boolean isStartDateAfterOrEqual(final LocalDate compareDate) { if (this.startDate != null && compareDate != null) { - if (getStartDateLocalDate().isAfter(compareDate) || getStartDateLocalDate().isEqual(compareDate)) { return true; } + if (getStartDateLocalDate().isAfter(compareDate) || getStartDateLocalDate().isEqual(compareDate)) { + return true; + } } return false; } public boolean isEndDateAfterOrEqual(final LocalDate compareDate) { if (this.endDate != null && compareDate != null) { - if (getEndDateLocalDate().isAfter(compareDate) || getEndDateLocalDate().isEqual(compareDate)) { return true; } + if (getEndDateLocalDate().isAfter(compareDate) || getEndDateLocalDate().isEqual(compareDate)) { + return true; + } } return false; } public boolean isBetweenStartAndEndDate(final LocalDate compareDate) { if (isStartDateBeforeOrEqual(compareDate)) { - if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { return true; } + if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarFrequencyType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarFrequencyType.java index 060011fd5..10b7f919d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarFrequencyType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarFrequencyType.java @@ -62,7 +62,9 @@ public enum CalendarFrequencyType { public static CalendarFrequencyType fromString(final String frequencyString) { CalendarFrequencyType frequency = CalendarFrequencyType.INVALID; - if (StringUtils.isEmpty(frequencyString)) { return frequency; } + if (StringUtils.isEmpty(frequencyString)) { + return frequency; + } if (frequencyString.equalsIgnoreCase(CalendarFrequencyType.DAILY.toString())) { frequency = CalendarFrequencyType.DAILY; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarHistory.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarHistory.java index 612718ab2..5636520c9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarHistory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarHistory.java @@ -118,21 +118,27 @@ public class CalendarHistory extends AbstractPersistableCustom { public boolean isEndDateAfterOrEqual(final LocalDate compareDate) { if (this.endDate != null && compareDate != null) { - if (getEndDateLocalDate().isAfter(compareDate) || getEndDateLocalDate().isEqual(compareDate)) { return true; } + if (getEndDateLocalDate().isAfter(compareDate) || getEndDateLocalDate().isEqual(compareDate)) { + return true; + } } return false; } public boolean isStartDateBeforeOrEqual(final LocalDate compareDate) { if (this.startDate != null && compareDate != null) { - if (getStartDateLocalDate().isBefore(compareDate) || getStartDateLocalDate().equals(compareDate)) { return true; } + if (getStartDateLocalDate().isBefore(compareDate) || getStartDateLocalDate().equals(compareDate)) { + return true; + } } return false; } public boolean isBetweenStartAndEndDate(final LocalDate compareDate) { if (isStartDateBeforeOrEqual(compareDate)) { - if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { return true; } + if (getEndDateLocalDate() == null || isEndDateAfterOrEqual(compareDate)) { + return true; + } } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarWeekDaysType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarWeekDaysType.java index 2c0fcbff0..d299e5511 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarWeekDaysType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/domain/CalendarWeekDaysType.java @@ -79,7 +79,9 @@ public enum CalendarWeekDaysType { public static CalendarWeekDaysType fromString(final String weekDayString) { CalendarWeekDaysType weekDay = CalendarWeekDaysType.INVALID; - if (StringUtils.isEmpty(weekDayString)) { return weekDay; } + if (StringUtils.isEmpty(weekDayString)) { + return weekDay; + } if (weekDayString.equalsIgnoreCase(CalendarWeekDaysType.MO.toString())) { weekDay = CalendarWeekDaysType.MO; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java index 810c9dd49..79b870425 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java @@ -61,7 +61,9 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD @Override public CalendarCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -93,7 +95,9 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -212,7 +216,9 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java index d80900cfc..5b43571e2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java @@ -162,7 +162,9 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ final List result = this.jdbcTemplate.query(sql, rm, new Object[] { entityId, entityTypeId, CalendarType.COLLECTION.getValue() }); - if (!result.isEmpty() && result.size() > 0) { return result.get(0); } + if (!result.isEmpty() && result.size() > 0) { + return result.get(0); + } return null; } @@ -231,7 +233,9 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ private Collection generateRecurringDate(final CalendarData calendarData, final LocalDate fromDate, final LocalDate tillDate, final int maxCount) { - if (!calendarData.isRepeating()) { return null; } + if (!calendarData.isRepeating()) { + return null; + } final String rrule = calendarData.getRecurrence(); /** * Start date or effective from date of calendar recurrence. @@ -264,7 +268,9 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ try { int calendarInstaneId = this.jdbcTemplate.queryForObject(query, new Object[] { entityId, calendarId, entityTypeId }, Integer.class); - if (calendarInstaneId > 0) { return true; } + if (calendarInstaneId > 0) { + return true; + } return false; } catch (final EmptyResultDataAccessException e) { return false; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarUtils.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarUtils.java index 605b49747..0547d5343 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarUtils.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarUtils.java @@ -64,7 +64,9 @@ public class CalendarUtils { public static LocalDate getNextRecurringDate(final String recurringRule, final LocalDate seedDate, final LocalDate startDate) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return null; } + if (recur == null) { + return null; + } LocalDate nextDate = getNextRecurringDate(recur, seedDate, startDate); nextDate = adjustDate(nextDate, seedDate, getMeetingPeriodFrequencyType(recurringRule)); return nextDate; @@ -157,7 +159,9 @@ public class CalendarUtils { private static Collection getRecurringDates(final Recur recur, final LocalDate seedDate, final LocalDate periodStartDate, final LocalDate periodEndDate, final int maxCount, boolean isSkippMeetingOnFirstDay, final Integer numberOfDays) { - if (recur == null) { return null; } + if (recur == null) { + return null; + } final Date seed = convertToiCal4JCompatibleDate(seedDate); final DateTime periodStart = new DateTime(periodStartDate.toDate()); final DateTime periodEnd = new DateTime(periodEndDate.toDate()); @@ -179,7 +183,9 @@ public class CalendarUtils { recurringDates.add(adjustDate(new LocalDate(date), seedDate, frequencyType)); } - if (isSkippMeetingOnFirstDay) { return skipMeetingOnFirstdayOfMonth(recurringDates, numberOfDays); } + if (isSkippMeetingOnFirstDay) { + return skipMeetingOnFirstdayOfMonth(recurringDates, numberOfDays); + } return recurringDates; } @@ -243,7 +249,9 @@ public class CalendarUtils { "Error in pasring the Recurring Rule value: " + recurringRule, "recurrence", recurringRule); } - if (recur == null) { return humanReadable; } + if (recur == null) { + return humanReadable; + } if (recur.getFrequency().equals(Recur.Frequency.DAILY)) { if (recur.getInterval() == 1) { @@ -343,7 +351,9 @@ public class CalendarUtils { public static boolean isValidRedurringDate(final String recurringRule, final LocalDate seedDate, final LocalDate date) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return false; } + if (recur == null) { + return false; + } final boolean isSkipRepaymentonFirstDayOfMonth = false; final int numberOfDays = 0; return isValidRecurringDate(recur, seedDate, date, isSkipRepaymentonFirstDayOfMonth, numberOfDays); @@ -353,7 +363,9 @@ public class CalendarUtils { boolean isSkipRepaymentonFirstDayOfMonth, final Integer numberOfDays) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return false; } + if (recur == null) { + return false; + } return isValidRecurringDate(recur, seedDate, date, isSkipRepaymentonFirstDayOfMonth, numberOfDays); } @@ -392,7 +404,9 @@ public class CalendarUtils { public static DayNameEnum from(final String name) { for (final DayNameEnum dayName : DayNameEnum.values()) { - if (dayName.toString().equals(name)) { return dayName; } + if (dayName.toString().equals(name)) { + return dayName; + } } return DayNameEnum.MO;// Default it to Monday } @@ -420,7 +434,9 @@ public class CalendarUtils { public static NthDayNameEnum from(final String name) { for (final NthDayNameEnum nthDayName : NthDayNameEnum.values()) { - if (nthDayName.toString().equals(name)) { return nthDayName; } + if (nthDayName.toString().equals(name)) { + return nthDayName; + } } return NthDayNameEnum.INVALID; } @@ -472,7 +488,9 @@ public class CalendarUtils { public static CalendarWeekDaysType getRepeatsOnDay(final String recurringRule) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); final WeekDayList weekDays = recur.getDayList(); - if (weekDays.isEmpty()) { return CalendarWeekDaysType.INVALID; } + if (weekDays.isEmpty()) { + return CalendarWeekDaysType.INVALID; + } // supports only one day WeekDay weekDay = weekDays.get(0); return CalendarWeekDaysType.fromString(weekDay.getDay().name()); @@ -486,8 +504,12 @@ public class CalendarUtils { } else { monthDays = recur.getSetPosList(); } - if (monthDays.isEmpty()) { return NthDayType.INVALID; } - if (!recur.getMonthDayList().isEmpty() && recur.getSetPosList().isEmpty()) { return NthDayType.ONDAY; } + if (monthDays.isEmpty()) { + return NthDayType.INVALID; + } + if (!recur.getMonthDayList().isEmpty() && recur.getSetPosList().isEmpty()) { + return NthDayType.ONDAY; + } Integer monthDay = monthDays.get(0); return NthDayType.fromInt(monthDay); } @@ -496,7 +518,9 @@ public class CalendarUtils { final Integer loanRepaymentInterval, final String frequency, boolean isSkipRepaymentOnFirstDayOfMonth, final Integer numberOfDays) { final Recur recur = CalendarUtils.getICalRecur(calendar.getRecurrence()); - if (recur == null) { return null; } + if (recur == null) { + return null; + } LocalDate startDate = disbursementDate; final LocalDate seedDate = calendar.getStartDateLocalDate(); if (isValidRedurringDate(calendar.getRecurrence(), seedDate, startDate, isSkipRepaymentOnFirstDayOfMonth, numberOfDays) @@ -537,7 +561,9 @@ public class CalendarUtils { final LocalDate oldRepaymentDate, final Integer loanRepaymentInterval, final String frequency, final WorkingDays workingDays, final boolean isSkipRepaymentOnFirstDayOfMonth, final Integer numberOfDays) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return null; } + if (recur == null) { + return null; + } if (isValidRecurringDate(recur, seedDate, oldRepaymentDate, isSkipRepaymentOnFirstDayOfMonth, numberOfDays)) { return oldRepaymentDate; } @@ -552,7 +578,9 @@ public class CalendarUtils { boolean isSkipRepaymentOnFirstDayOfMonth, final Integer numberOfDays) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return null; } + if (recur == null) { + return null; + } LocalDate tmpDate = repaymentDate; if (isValidRecurringDate(recur, seedDate, repaymentDate, isSkipRepaymentOnFirstDayOfMonth, numberOfDays)) { tmpDate = repaymentDate.plusDays(1); @@ -598,7 +626,9 @@ public class CalendarUtils { final Recur oldRecur = getICalRecur(oldRRule); final Recur newRecur = getICalRecur(newRRule); - if (oldRecur == null || oldRecur.getFrequency() == null || newRecur == null || newRecur.getFrequency() == null) { return false; } + if (oldRecur == null || oldRecur.getFrequency() == null || newRecur == null || newRecur.getFrequency() == null) { + return false; + } return oldRecur.getFrequency().equals(newRecur.getFrequency()); } @@ -606,7 +636,9 @@ public class CalendarUtils { final Recur oldRecur = getICalRecur(oldRRule); final Recur newRecur = getICalRecur(newRRule); - if (oldRecur == null || oldRecur.getFrequency() == null || newRecur == null || newRecur.getFrequency() == null) { return false; } + if (oldRecur == null || oldRecur.getFrequency() == null || newRecur == null || newRecur.getFrequency() == null) { + return false; + } return (oldRecur.getInterval() == newRecur.getInterval()); } @@ -664,9 +696,13 @@ public class CalendarUtils { final boolean isSkipMeetingOnFirstDay, final Integer numberOfDays) { LocalDate currentDate = DateUtils.getLocalDateOfTenant(); final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return null; } + if (recur == null) { + return null; + } - if (isValidRecurringDate(recur, seedDate, currentDate, isSkipMeetingOnFirstDay, numberOfDays)) { return currentDate; } + if (isValidRecurringDate(recur, seedDate, currentDate, isSkipMeetingOnFirstDay, numberOfDays)) { + return currentDate; + } if (recur.getFrequency().equals(Recur.Frequency.DAILY)) { currentDate = currentDate.plusDays(recur.getInterval()); @@ -683,7 +719,9 @@ public class CalendarUtils { public static LocalDate getNextScheduleDate(final Calendar calendar, final LocalDate startDate) { final Recur recur = CalendarUtils.getICalRecur(calendar.getRecurrence()); - if (recur == null) { return null; } + if (recur == null) { + return null; + } LocalDate date = startDate; final LocalDate seedDate = calendar.getStartDateLocalDate(); /** @@ -754,7 +792,9 @@ public class CalendarUtils { boolean isSkipRepaymentOnFirstDayOfMonth, final Integer numberOfDays, boolean isCalledFirstTime, boolean applyWorkingDays) { final Recur recur = CalendarUtils.getICalRecur(recurringRule); - if (recur == null) { return null; } + if (recur == null) { + return null; + } LocalDate tmpDate = repaymentDate; final Integer repaymentInterval = getMeetingIntervalFromFrequency(loanRepaymentInterval, frequency, recur); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java index 4d44ba601..d806e5adf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java @@ -149,7 +149,9 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } this.calendarRepository.save(newCalendar); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/data/ChargeData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/data/ChargeData.java index e73dc6b83..2b23364aa 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/data/ChargeData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/data/ChargeData.java @@ -229,7 +229,9 @@ public class ChargeData implements Comparable, Serializable { @Override public boolean equals(final Object obj) { - if (!(obj instanceof ChargeData)) { return false; } + if (!(obj instanceof ChargeData)) { + return false; + } final ChargeData chargeData = (ChargeData) obj; return this.id.equals(chargeData.id); } @@ -241,7 +243,9 @@ public class ChargeData implements Comparable, Serializable { @Override public int compareTo(final ChargeData obj) { - if (obj == null) { return -1; } + if (obj == null) { + return -1; + } return obj.id.compareTo(this.id); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/Charge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/Charge.java index c137a14f8..0045ce487 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/Charge.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/Charge.java @@ -190,7 +190,9 @@ public class Charge extends AbstractPersistableCustom { if (penalty && (chargeTime.isTimeOfDisbursement() || chargeTime.isTrancheDisbursement())) { throw new ChargeDueAtDisbursementCannotBePenaltyException(name); } - if (!penalty && chargeTime.isOverdueInstallment()) { throw new ChargeMustBePenaltyException(name); } + if (!penalty && chargeTime.isOverdueInstallment()) { + throw new ChargeMustBePenaltyException(name); + } // TODO vishwas, this validation seems unnecessary as identical // validation is performed in the write service if (!isAllowedLoanChargeTime()) { @@ -203,7 +205,9 @@ public class Charge extends AbstractPersistableCustom { this.maxCap = maxCap; } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public String getName() { @@ -494,7 +498,9 @@ public class Charge extends AbstractPersistableCustom { } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } return actualChanges; } @@ -606,8 +612,12 @@ public class Charge extends AbstractPersistableCustom { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof Charge)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof Charge)) { + return false; + } Charge other = (Charge) o; return Objects.equals(name, other.name) && Objects.equals(amount, other.amount) && Objects.equals(currencyCode, other.currencyCode) && Objects.equals(chargeAppliesTo, other.chargeAppliesTo) && Objects.equals(chargeTimeType, other.chargeTimeType) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/ChargeRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/ChargeRepositoryWrapper.java index fd61172c3..0fa68dd0b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/ChargeRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/domain/ChargeRepositoryWrapper.java @@ -48,8 +48,12 @@ public class ChargeRepositoryWrapper { public Charge findOneWithNotFoundDetection(final Long id) { final Charge chargeDefinition = this.repository.findById(id).orElseThrow(() -> new ChargeNotFoundException(id)); - if (chargeDefinition.isDeleted()) { throw new ChargeNotFoundException(id); } - if (!chargeDefinition.isActive()) { throw new ChargeIsNotActiveException(id, chargeDefinition.getName()); } + if (chargeDefinition.isDeleted()) { + throw new ChargeNotFoundException(id); + } + if (!chargeDefinition.isActive()) { + throw new ChargeIsNotActiveException(id, chargeDefinition.getName()); + } return chargeDefinition; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/exception/LoanChargeCannotBeWaivedException.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/exception/LoanChargeCannotBeWaivedException.java index 78e70aa9b..2bf917876 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/exception/LoanChargeCannotBeWaivedException.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/exception/LoanChargeCannotBeWaivedException.java @@ -34,7 +34,9 @@ public class LoanChargeCannotBeWaivedException extends AbstractPlatformDomainRul return "This loan charge has already been waived"; } else if (name().toString().equalsIgnoreCase("LOAN_INACTIVE")) { return "This loan charge can be waived as the loan associated with it is currently inactive"; - } else if (name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")) { return "This loan charge can be waived"; } + } else if (name().toString().equalsIgnoreCase("WAIVE_NOT_ALLOWED_FOR_CHARGE")) { + return "This loan charge can be waived"; + } return name().toString(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java index eeaa40508..7ada96bf0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java @@ -64,7 +64,9 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -232,7 +234,9 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -370,6 +374,8 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java index c5f1485a9..d67c01960 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/service/ChargeWritePlatformServiceJpaRepositoryImpl.java @@ -205,7 +205,9 @@ public class ChargeWritePlatformServiceJpaRepositoryImpl implements ChargeWriteP public CommandProcessingResult deleteCharge(final Long chargeId) { final Charge chargeForDelete = this.chargeRepository.findById(chargeId).orElseThrow(() -> new ChargeNotFoundException(chargeId)); - if (chargeForDelete.isDeleted()) { throw new ChargeNotFoundException(chargeId); } + if (chargeForDelete.isDeleted()) { + throw new ChargeNotFoundException(chargeId); + } final Collection loanProducts = this.loanProductRepository.retrieveLoanProductsByChargeId(chargeId); final Boolean isChargeExistWithLoans = isAnyLoansAssociateWithThisCharge(chargeId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java index 17d69968e..7f92a2c7a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientChargeDataValidator.java @@ -47,7 +47,9 @@ public class ClientChargeDataValidator { } public void validateAdd(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -69,7 +71,9 @@ public class ClientChargeDataValidator { } public void validateUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -94,7 +98,9 @@ public class ClientChargeDataValidator { } public void validatePayCharge(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -117,7 +123,9 @@ public class ClientChargeDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientData.java index 5a8e0badd..16dab3f37 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientData.java @@ -570,7 +570,9 @@ final public class ClientData implements Comparable, Serializable { @Override public int compareTo(final ClientData obj) { - if (obj == null) { return -1; } + if (obj == null) { + return -1; + } return new CompareToBuilder() // .append(this.id, obj.id) // .append(this.displayName, obj.displayName) // @@ -581,9 +583,15 @@ final public class ClientData implements Comparable, Serializable { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (obj.getClass() != getClass()) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } final ClientData rhs = (ClientData) obj; return new EqualsBuilder() // .append(this.id, rhs.id) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java index 27a75f696..1e498797e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/data/ClientDataValidator.java @@ -58,7 +58,9 @@ public final class ClientDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -354,7 +356,9 @@ public final class ClientDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -590,7 +594,9 @@ public final class ClientDataValidator { public void validateActivation(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -617,7 +623,9 @@ public final class ClientDataValidator { public void validateForUnassignStaff(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -635,13 +643,17 @@ public final class ClientDataValidator { final Long staffId = this.fromApiJsonHelper.extractLongNamed(staffIdParameterName, element); baseDataValidator.reset().parameter(staffIdParameterName).value(staffId).notNull().longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForAssignStaff(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -659,7 +671,9 @@ public final class ClientDataValidator { final Long staffId = this.fromApiJsonHelper.extractLongNamed(staffIdParameterName, element); baseDataValidator.reset().parameter(staffIdParameterName).value(staffId).notNull().longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @@ -667,7 +681,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -691,7 +707,9 @@ public final class ClientDataValidator { public void validateForSavingsAccount(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -709,7 +727,9 @@ public final class ClientDataValidator { final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParameterName, element); baseDataValidator.reset().parameter(savingsIdParameterName).value(savingsId).notNull().longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @@ -717,7 +737,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_REJECT_DATA_PARAMETERS); @@ -743,7 +765,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiCollectionConstants.CLIENT_WITHDRAW_DATA_PARAMETERS); @@ -769,7 +793,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -793,7 +819,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -817,7 +845,9 @@ public final class ClientDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java index 7b32b74ea..cd218e28a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/Client.java @@ -379,7 +379,9 @@ public final class Client extends AbstractPersistableCustom { validateNameParts(dataValidationErrors); validateActivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @@ -391,7 +393,9 @@ public final class Client extends AbstractPersistableCustom { // vice-cersa validateActivationDate(dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @@ -895,7 +899,9 @@ public final class Client extends AbstractPersistableCustom { public boolean isChildOfGroup(final Long groupId) { if (groupId != null && this.groups != null && !this.groups.isEmpty()) { for (final Group group : this.groups) { - if (group.getId().equals(groupId)) { return true; } + if (group.getId().equals(groupId)) { + return true; + } } } return false; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPerson.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPerson.java index bc746c4d2..e7d16c6af 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPerson.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPerson.java @@ -113,7 +113,9 @@ public class ClientNonPerson extends AbstractPersistableCustom { final List dataValidationErrors = new ArrayList<>(); validateIncorpValidityTillDate(client, dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPersonRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPersonRepositoryWrapper.java index 0ca2e5a87..e2dd277f0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPersonRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientNonPersonRepositoryWrapper.java @@ -52,7 +52,9 @@ public class ClientNonPersonRepositoryWrapper { public ClientNonPerson findOneByClientIdWithNotFoundDetection(final Long clientId) { final ClientNonPerson clientNonPerson = this.repository.findByClientId(clientId); - if (clientNonPerson == null) { throw new ClientNonPersonNotFoundByClientIdException(clientId); } + if (clientNonPerson == null) { + throw new ClientNonPersonNotFoundByClientIdException(clientId); + } return clientNonPerson; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepositoryWrapper.java index 8de708d90..8a8fe914b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientRepositoryWrapper.java @@ -80,14 +80,18 @@ public class ClientRepositoryWrapper { public Client getActiveClientInUserScope(Long clientId) { final Client client = this.findOneWithNotFoundDetection(clientId); - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } this.context.validateAccessRights(client.getOffice().getHierarchy()); return client; } public Client getClientByAccountNumber(String accountNumber) { Client client = this.repository.getClientByAccountNumber(accountNumber); - if (client == null) { throw new ClientNotFoundException(accountNumber); } + if (client == null) { + throw new ClientNotFoundException(accountNumber); + } return client; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientTransactionRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientTransactionRepositoryWrapper.java index ac4c926a8..df5f76db1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientTransactionRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/domain/ClientTransactionRepositoryWrapper.java @@ -39,7 +39,9 @@ public class ClientTransactionRepositoryWrapper { public ClientTransaction findOneWithNotFoundDetection(final Long clientId, final Long transactionId) { final ClientTransaction clientTransaction = this.repository.findById(transactionId) .orElseThrow(() -> new ClientTransactionNotFoundException(clientId, transactionId)); - if (!clientTransaction.getClientId().equals(clientId)) { throw new ClientTransactionNotFoundException(clientId, transactionId); } + if (!clientTransaction.getClientId().equals(clientId)) { + throw new ClientTransactionNotFoundException(clientId, transactionId); + } // enrich Client charge with details of Organizational currency clientTransaction.setCurrency(organisationCurrencyRepository.findOneWithNotFoundDetection(clientTransaction.getCurrencyCode())); return clientTransaction; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientFamilyMemberCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientFamilyMemberCommandFromApiJsonDeserializer.java index a29648025..2e624cc65 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientFamilyMemberCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientFamilyMemberCommandFromApiJsonDeserializer.java @@ -55,7 +55,9 @@ public class ClientFamilyMemberCommandFromApiJsonDeserializer { public void validateForCreate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -77,7 +79,9 @@ public class ClientFamilyMemberCommandFromApiJsonDeserializer { public void validateForCreate(final long clientId, String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -166,7 +170,9 @@ public class ClientFamilyMemberCommandFromApiJsonDeserializer { public void validateForUpdate(final long familyMemberId, String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java index ec4d5d975..3b7f28fc8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java @@ -56,7 +56,9 @@ public final class ClientIdentifierCommandFromApiJsonDeserializer extends Abstra @Override public ClientIdentifierCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java index 466820b89..613a558f7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientChargeWritePlatformServiceJpaRepositoryImpl.java @@ -127,7 +127,9 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements Client baseDataValidator.reset().parameter(ClientApiConstants.dueAsOfDateParamName).value(dueDate.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("dueDate.before.activationDate"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateDueDateOnWorkingDay(clientCharge, fmt); @@ -282,7 +284,9 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements Client if (clientCharge.isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("charge.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (requiresTransactionDateValidation) { @@ -304,17 +308,23 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements Client // validate charge is not already paid or waived if (clientCharge.isWaived()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.already.waived"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } else if (clientCharge.isPaid()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.paid"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (requiresTransactionAmountValidation) { final Money chargePaid = Money.of(clientCharge.getCurrency(), amountPaid); if (!clientCharge.getAmountOutstanding().isGreaterThanOrEqualTo(chargePaid)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.charge.amount.paid.in.access"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } } @@ -408,14 +418,18 @@ public class ClientChargeWritePlatformServiceJpaRepositoryImpl implements Client if (!this.configurationDomainService.allowTransactionsOnHolidayEnabled() && this.holidayRepository.isHoliday(officeId, date)) { baseDataValidator.reset().parameter(jsonPropertyName).value(date.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode(errorMessageFragmentForActivityOnHoliday); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(date)) { baseDataValidator.reset().parameter(jsonPropertyName).value(date.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode(errorMessageFragmentForActivityOnNonWorkingDay); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientIdentifierWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientIdentifierWritePlatformServiceJpaRepositoryImpl.java index 4ea294a56..0e772747b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientIdentifierWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientIdentifierWritePlatformServiceJpaRepositoryImpl.java @@ -130,7 +130,9 @@ public class ClientIdentifierWritePlatformServiceJpaRepositoryImpl implements Cl if (changes.containsKey("documentTypeId")) { documentType = this.codeValueRepository.findOneWithNotFoundDetection(documentTypeId); - if (documentType == null) { throw new CodeValueNotFoundException(documentTypeId); } + if (documentType == null) { + throw new CodeValueNotFoundException(documentTypeId); + } documentTypeId = documentType.getId(); documentTypeLabel = documentType.label(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientTransactionWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientTransactionWritePlatformServiceJpaRepositoryImpl.java index 9c6546d38..1f4320ec5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientTransactionWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientTransactionWritePlatformServiceJpaRepositoryImpl.java @@ -62,7 +62,9 @@ public class ClientTransactionWritePlatformServiceJpaRepositoryImpl implements C final ClientTransaction clientTransaction = this.clientTransactionRepository.findOneWithNotFoundDetection(clientId, transactionId); // validate that transaction can be undone - if (clientTransaction.isReversed()) { throw new ClientTransactionCannotBeUndoneException(clientId, transactionId); } + if (clientTransaction.isReversed()) { + throw new ClientTransactionCannotBeUndoneException(clientId, transactionId); + } // mark transaction as reversed clientTransaction.reverse(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java index 837603f10..7ecd4db2b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java @@ -169,7 +169,9 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP try { final Client client = this.clientRepository.findOneWithNotFoundDetection(clientId); - if (client.isNotPending()) { throw new ClientMustBePendingToBeDeletedException(clientId); } + if (client.isNotPending()) { + throw new ClientMustBePendingToBeDeletedException(clientId); + } final List relatedNotes = this.noteRepository.findByClientId(clientId); this.noteRepository.deleteInBatch(relatedNotes); @@ -642,7 +644,9 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP final Staff presentStaff = clientForUpdate.getStaff(); Long presentStaffId = null; - if (presentStaff == null) { throw new ClientHasNoStaffException(clientId); } + if (presentStaff == null) { + throw new ClientHasNoStaffException(clientId); + } presentStaffId = presentStaff.getId(); final String staffIdParamName = ClientApiConstants.staffIdParamName; if (!command.isChangeInLongParameterNamed(staffIdParamName, presentStaffId)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/serialization/CollateralCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/serialization/CollateralCommandFromApiJsonDeserializer.java index dd33d62bb..b76f4da05 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/serialization/CollateralCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/serialization/CollateralCommandFromApiJsonDeserializer.java @@ -52,7 +52,9 @@ public final class CollateralCommandFromApiJsonDeserializer extends AbstractFrom @Override public CollateralCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); final Set supportedParameters = CollateralJSONinputParams.getAllValues(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/service/CollateralWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/service/CollateralWritePlatformServiceJpaRepositoryImpl.java index 1c82125c5..fa8f08b96 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/service/CollateralWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/service/CollateralWritePlatformServiceJpaRepositoryImpl.java @@ -162,7 +162,9 @@ public class CollateralWritePlatformServiceJpaRepositoryImpl implements Collater public CommandProcessingResult deleteCollateral(final Long loanId, final Long collateralId, final Long commandId) { final Loan loan = this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId, true); final LoanCollateral collateral = this.collateralRepository.findByLoanIdAndId(loanId, collateralId); - if (collateral == null) { throw new CollateralNotFoundException(loanId, collateralId); } + if (collateral == null) { + throw new CollateralNotFoundException(loanId, collateralId); + } /** * Collaterals may be deleted only when the loan associated with them diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java index fac949488..7de1a2074 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java @@ -78,7 +78,9 @@ public class CollectionSheetTransactionDataValidator { public void validateTransaction(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, COLLECTIONSHEET_REQUEST_DATA_PARAMETERS); @@ -116,7 +118,9 @@ public class CollectionSheetTransactionDataValidator { public void validateIndividualCollectionSheet(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INDIVIDUAL_COLLECTIONSHEET_REQUEST_DATA_PARAMETERS); @@ -261,6 +265,8 @@ public class CollectionSheetTransactionDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualClientData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualClientData.java index e219a81df..5eabd1ce9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualClientData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/IndividualClientData.java @@ -98,7 +98,9 @@ public class IndividualClientData { @Override public boolean equals(final Object obj) { - if (!(obj instanceof IndividualClientData)) { return false; } + if (!(obj instanceof IndividualClientData)) { + return false; + } final IndividualClientData clientData = (IndividualClientData) obj; return clientData.clientId.compareTo(this.clientId) == 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGClientData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGClientData.java index 049573c03..733c2aca2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGClientData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGClientData.java @@ -102,7 +102,9 @@ public class JLGClientData { @Override public boolean equals(final Object obj) { - if (!(obj instanceof JLGClientData)) { return false; } + if (!(obj instanceof JLGClientData)) { + return false; + } final JLGClientData clientData = (JLGClientData) obj; return clientData.clientId.compareTo(this.clientId) == 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGGroupData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGGroupData.java index a63e83000..669641eca 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGGroupData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/JLGGroupData.java @@ -88,7 +88,9 @@ public class JLGGroupData { @Override public boolean equals(final Object obj) { - if (!(obj instanceof JLGGroupData)) { return false; } + if (!(obj instanceof JLGGroupData)) { + return false; + } final JLGGroupData groupData = (JLGGroupData) obj; return groupData.groupId.compareTo(this.groupId) == 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer.java index 4ec3804f9..9a18e1afb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer.java @@ -51,7 +51,9 @@ public final class CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer @Override public CollectionSheetBulkDisbursalCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final JsonElement element = this.fromApiJsonHelper.parse(json); final JsonObject topLevelJsonElement = element.getAsJsonObject(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java index 8b26b9ba0..1fa9b6573 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer.java @@ -56,7 +56,9 @@ public final class CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer @Override public CollectionSheetBulkRepaymentCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final JsonElement element = this.fromApiJsonHelper.parse(json); final PaymentDetail paymentDetail = this.paymentDetailAssembler.fetchPaymentDetail(element.getAsJsonObject()); @@ -65,7 +67,9 @@ public final class CollectionSheetBulkRepaymentCommandFromApiJsonDeserializer } public CollectionSheetBulkRepaymentCommand commandFromApiJson(final String json, final PaymentDetail paymentDetail) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java index 031063df5..12bb50f05 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java @@ -65,7 +65,9 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer { public void validateForGenerateCollectionSheet(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -94,7 +96,9 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer { public void validateForGenerateCollectionSheetOfIndividuals(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INDIVIDUAL_COLLECTIONSHEET_SUPPORTED_PARAMS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java index ffc780d7d..f78961981 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java @@ -394,7 +394,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private void mergeGroup(final JLGGroupData groupSavingsData, final List groupsWithLoanData) { final int index = groupsWithLoanData.indexOf(groupSavingsData); - if (index < 0) { return; } + if (index < 0) { + return; + } JLGGroupData groupLoanData = groupsWithLoanData.get(index); List clientsLoanData = (List) groupLoanData.getClients(); @@ -412,7 +414,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private void mergeClient(final JLGClientData clientSavingsData, List clientsLoanData) { final int index = clientsLoanData.indexOf(clientSavingsData); - if (index < 0) { return; } + if (index < 0) { + return; + } JLGClientData clientLoanData = clientsLoanData.get(index); clientLoanData.setSavings(clientSavingsData.getSavings()); @@ -872,7 +876,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe if (clientSavingsData == null || !clientSavingsData.equals(clientData)) { if (clientDatas.contains(clientData)) { final int index = clientDatas.indexOf(clientData); - if (index < 0) { return; } + if (index < 0) { + return; + } clientSavingsData = clientDatas.get(index); clientSavingsData.setLoans(new ArrayList()); } else { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateData.java index fbbcf9f37..9c1b0105d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateData.java @@ -93,7 +93,9 @@ public class FloatingRateData implements Comparable, Serializa @Override public int compareTo(final FloatingRateData obj) { - if (obj == null) { return -1; } + if (obj == null) { + return -1; + } return new CompareToBuilder() // .append(this.id, obj.id) // .append(this.name, obj.name) // @@ -104,9 +106,15 @@ public class FloatingRateData implements Comparable, Serializa @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof FloatingRateData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof FloatingRateData)) { + return false; + } final FloatingRateData rhs = (FloatingRateData) obj; return new EqualsBuilder() // .append(this.id, rhs.id) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRatePeriodData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRatePeriodData.java index 2ddf0db07..0885b2bd6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRatePeriodData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRatePeriodData.java @@ -92,7 +92,9 @@ public class FloatingRatePeriodData implements Comparable getRatePeriods(final AppUser currentUser, final JsonCommand command) { - if (!command.parameterExists("ratePeriods")) { return null; } + if (!command.parameterExists("ratePeriods")) { + return null; + } List ratePeriods = new ArrayList<>(); JsonArray arrayOfParameterNamed = command.arrayOfParameterNamed("ratePeriods"); for (final JsonElement ratePeriod : arrayOfParameterNamed) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java index 8b0fd34f7..a29e90955 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java @@ -52,7 +52,9 @@ public final class FundCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -72,7 +74,9 @@ public final class FundCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/CenterData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/CenterData.java index d06a2ff6b..8353b7ca0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/CenterData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/CenterData.java @@ -268,8 +268,12 @@ public class CenterData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof CenterData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof CenterData)) { + return false; + } CenterData that = (CenterData) o; return Objects.equals(active, that.active) && Objects.equals(id, that.id) && Objects.equals(accountNo, that.accountNo) && Objects.equals(name, that.name) && Objects.equals(externalId, that.externalId) && Objects.equals(officeId, that.officeId) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupGeneralData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupGeneralData.java index 62fdf791d..310677caf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupGeneralData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupGeneralData.java @@ -368,8 +368,12 @@ public class GroupGeneralData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof GroupGeneralData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof GroupGeneralData)) { + return false; + } GroupGeneralData that = (GroupGeneralData) o; return Objects.equals(id, that.id) && Objects.equals(accountNo, that.accountNo) && Objects.equals(name, that.name) && Objects.equals(externalId, that.externalId) && Objects.equals(status, that.status) && Objects.equals(active, that.active) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupRoleData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupRoleData.java index 1acc64476..c81789ecb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupRoleData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupRoleData.java @@ -46,8 +46,12 @@ public class GroupRoleData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof GroupRoleData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof GroupRoleData)) { + return false; + } GroupRoleData that = (GroupRoleData) o; return Objects.equals(id, that.id) && Objects.equals(role, that.role) && Objects.equals(clientId, that.clientId) && Objects.equals(clientName, that.clientName); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupTimelineData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupTimelineData.java index f31cdba56..8aeb3b8ba 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupTimelineData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/data/GroupTimelineData.java @@ -68,8 +68,12 @@ public class GroupTimelineData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof GroupTimelineData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof GroupTimelineData)) { + return false; + } GroupTimelineData that = (GroupTimelineData) o; return Objects.equals(submittedOnDate, that.submittedOnDate) && Objects.equals(submittedByUsername, that.submittedByUsername) && Objects.equals(submittedByFirstname, that.submittedByFirstname) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/Group.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/Group.java index 67ed92993..3ea03578f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/Group.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/Group.java @@ -375,7 +375,9 @@ public final class Group extends AbstractPersistableCustom { public List associateClients(final Set clientMembersSet) { final List differences = new ArrayList<>(); for (final Client client : clientMembersSet) { - if (hasClientAsMember(client)) { throw new ClientExistInGroupException(client.getId(), getId()); } + if (hasClientAsMember(client)) { + throw new ClientExistInGroupException(client.getId(), getId()); + } this.clientMembers.add(client); differences.add(client.getId().toString()); } @@ -504,7 +506,9 @@ public final class Group extends AbstractPersistableCustom { public boolean isChildClient(final Long clientId) { if (clientId != null && this.clientMembers != null && !this.clientMembers.isEmpty()) { for (final Client client : this.clientMembers) { - if (client.getId().equals(clientId)) { return true; } + if (client.getId().equals(clientId)) { + return true; + } } } return false; @@ -542,14 +546,18 @@ public final class Group extends AbstractPersistableCustom { public boolean hasActiveClients() { for (final Client client : this.clientMembers) { - if (!client.isClosed()) { return true; } + if (!client.isClosed()) { + return true; + } } return false; } public boolean hasActiveGroups() { for (final Group group : this.groupMembers) { - if (!group.isClosed()) { return true; } + if (!group.isClosed()) { + return true; + } } return false; } @@ -559,7 +567,9 @@ public final class Group extends AbstractPersistableCustom { } public boolean hasStaff() { - if (this.staff != null) { return true; } + if (this.staff != null) { + return true; + } return false; } @@ -574,7 +584,9 @@ public final class Group extends AbstractPersistableCustom { group.getId()); } - if (hasGroupAsMember(group)) { throw new GroupExistsInCenterException(getId(), group.getId()); } + if (hasGroupAsMember(group)) { + throw new GroupExistsInCenterException(getId(), group.getId()); + } if (group.isChildGroup()) { final String defaultUserMessage = "Group is already associated with a center"; @@ -609,7 +621,9 @@ public final class Group extends AbstractPersistableCustom { public Boolean isGroupsClientCountWithinMinMaxRange(Integer minClients, Integer maxClients) { - if (maxClients == null && minClients == null) { return true; } + if (maxClients == null && minClients == null) { + return true; + } // set minClients or maxClients to 0 if null @@ -623,7 +637,9 @@ public final class Group extends AbstractPersistableCustom { Set activeClientMembers = getActiveClientMembers(); - if (activeClientMembers.size() >= minClients && activeClientMembers.size() <= maxClients) { return true; } + if (activeClientMembers.size() >= minClients && activeClientMembers.size() <= maxClients) { + return true; + } return false; } @@ -701,7 +717,9 @@ public final class Group extends AbstractPersistableCustom { } private void throwExceptionIfErrors(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public Set getClientMembers() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/GroupRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/GroupRepositoryWrapper.java index d24f466b9..4d02ee70d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/GroupRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/domain/GroupRepositoryWrapper.java @@ -47,7 +47,9 @@ public class GroupRepositoryWrapper { public Group findByOfficeWithNotFoundDetection(final Long id, final Office office) { final Group group = findOneWithNotFoundDetection(id); - if (!group.getOffice().getId().equals(office.getId())) { throw new GroupNotFoundException(id); } + if (!group.getOffice().getId().equals(office.getId())) { + throw new GroupNotFoundException(id); + } return group; } @@ -69,7 +71,9 @@ public class GroupRepositoryWrapper { public LocalDate retrieveSubmittedOndate(final Long groupId) { Date submittedOnDate = this.repository.retrieveGroupTypeSubmitteOndDate(groupId); - if (submittedOnDate != null) { return new LocalDate(submittedOnDate); } + if (submittedOnDate != null) { + return new LocalDate(submittedOnDate); + } return null; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java index b2ced2113..5c38b46ce 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupRolesDataValidator.java @@ -51,14 +51,18 @@ public class GroupRolesDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForCreateGroupRole(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS); @@ -82,7 +86,9 @@ public class GroupRolesDataValidator { public void validateForUpdateRole(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_ROLES_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java index 31b440d5c..79737351d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java @@ -88,7 +88,9 @@ public final class GroupingTypesDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS); @@ -153,7 +155,9 @@ public final class GroupingTypesDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS); @@ -221,7 +225,9 @@ public final class GroupingTypesDataValidator { public void validateForCreateGroup(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS); @@ -286,7 +292,9 @@ public final class GroupingTypesDataValidator { public void validateForUpdateCenter(final JsonCommand command, final Long centerId) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CENTER_REQUEST_DATA_PARAMETERS); @@ -334,7 +342,9 @@ public final class GroupingTypesDataValidator { public void validateForUpdateGroup(final JsonCommand command, final Long groupId) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_REQUEST_DATA_PARAMETERS); @@ -387,7 +397,9 @@ public final class GroupingTypesDataValidator { public void validateForActivation(final JsonCommand command, final String resourceName) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACTIVATION_REQUEST_DATA_PARAMETERS); @@ -405,7 +417,9 @@ public final class GroupingTypesDataValidator { } public void validateForUnassignStaff(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -422,11 +436,15 @@ public final class GroupingTypesDataValidator { final Long staffId = this.fromApiJsonHelper.extractLongNamed(staffIdParameterName, element); baseDataValidator.reset().parameter(staffIdParameterName).value(staffId).notNull().integerGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForAssignStaff(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -451,12 +469,16 @@ public final class GroupingTypesDataValidator { baseDataValidator.reset().parameter(inheritStaffForClientAccountsParamName).value(inheritStaffForClientAccounts).ignoreIfNull() .notBlank().isOneOfTheseValues(true, false); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForAssociateClients(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -476,7 +498,9 @@ public final class GroupingTypesDataValidator { public void validateForDisassociateClients(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -497,7 +521,9 @@ public final class GroupingTypesDataValidator { public void validateForGroupClose(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS); @@ -522,7 +548,9 @@ public final class GroupingTypesDataValidator { public void validateForCenterClose(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GROUP_CLOSE_REQUEST_DATA_PARAMETERS); @@ -545,7 +573,9 @@ public final class GroupingTypesDataValidator { } public void validateForAssociateGroups(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -566,7 +596,9 @@ public final class GroupingTypesDataValidator { public void validateForDisassociateGroups(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupRolesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupRolesWritePlatformServiceJpaRepositoryImpl.java index 4265d9928..480eaf750 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupRolesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupRolesWritePlatformServiceJpaRepositoryImpl.java @@ -80,7 +80,9 @@ public class GroupRolesWritePlatformServiceJpaRepositoryImpl implements GroupRol final Client client = this.clientRepository.findOneWithNotFoundDetection(clientId); final Group group = this.groupRepository.findOneWithNotFoundDetection(command.getGroupId()); - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(clientId, command.getGroupId()); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(clientId, command.getGroupId()); + } final GroupRole groupRole = GroupRole.createGroupRole(group, client, role); this.groupRoleRepository.save(groupRole); return new CommandProcessingResultBuilder().withClientId(client.getId()).withGroupId(group.getId()) @@ -138,7 +140,9 @@ public class GroupRolesWritePlatformServiceJpaRepositoryImpl implements GroupRol Client client = null; if (newValue != null) { client = this.clientRepository.findOneWithNotFoundDetection(newValue); - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(newValue, command.getGroupId()); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(newValue, command.getGroupId()); + } } groupRole.updateClient(client); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java index 388449c15..286846bdc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java @@ -355,7 +355,9 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group Integer minClients = configurationDomainService.retrieveMinAllowedClientsInGroup(); Integer maxClients = configurationDomainService.retrieveMaxAllowedClientsInGroup(); boolean isGroupClientCountValid = group.isGroupsClientCountWithinMinMaxRange(minClients, maxClients); - if (!isGroupClientCountValid) { throw new GroupMemberCountNotInPermissibleRangeException(group.getId(), minClients, maxClients); } + if (!isGroupClientCountValid) { + throw new GroupMemberCountNotInPermissibleRangeException(group.getId(), minClients, maxClients); + } entityDatatableChecksWritePlatformService.runTheCheck(group.getId(), EntityTables.GROUP.getName(), StatusEnum.ACTIVATE.getCode().longValue(), EntityTables.GROUP.getForeignKeyColumnNameOnDatatable()); } @@ -364,7 +366,9 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group Integer minClients = configurationDomainService.retrieveMinAllowedClientsInGroup(); Integer maxClients = configurationDomainService.retrieveMaxAllowedClientsInGroup(); boolean isGroupClientCountValid = group.isGroupsClientCountWithinMaxRange(maxClients); - if (!isGroupClientCountValid) { throw new GroupMemberCountNotInPermissibleRangeException(group.getId(), minClients, maxClients); } + if (!isGroupClientCountValid) { + throw new GroupMemberCountNotInPermissibleRangeException(group.getId(), minClients, maxClients); + } } @Transactional @@ -503,7 +507,9 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group final Group groupForUpdate = this.groupRepository.findOneWithNotFoundDetection(grouptId); final Staff presentStaff = groupForUpdate.getStaff(); Long presentStaffId = null; - if (presentStaff == null) { throw new GroupHasNoStaffException(grouptId); } + if (presentStaff == null) { + throw new GroupHasNoStaffException(grouptId); + } presentStaffId = presentStaff.getId(); final String staffIdParamName = "staffId"; if (!command.isChangeInLongParameterNamed(staffIdParamName, presentStaffId)) { @@ -588,7 +594,9 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group final Group groupForDelete = this.groupRepository.findOneWithNotFoundDetection(groupId); - if (groupForDelete.isNotPending()) { throw new GroupMustBePendingToBeDeletedException(groupId); } + if (groupForDelete.isNotPending()) { + throw new GroupMustBePendingToBeDeletedException(groupId); + } final List relatedNotes = this.noteRepository.findByGroupId(groupId); this.noteRepository.deleteInBatch(relatedNotes); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java index f05fcd484..ddeff959b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestIncentiveDataValidator.java @@ -72,7 +72,9 @@ public class InterestIncentiveDataValidator { } public void validateCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS); @@ -115,7 +117,9 @@ public class InterestIncentiveDataValidator { } public void validateUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS); @@ -175,7 +179,9 @@ public class InterestIncentiveDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java index add6ed49b..0d52b5db2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartDataValidator.java @@ -73,7 +73,9 @@ public class InterestRateChartDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) @@ -124,7 +126,9 @@ public class InterestRateChartDataValidator { } public void validateUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) @@ -182,7 +186,9 @@ public class InterestRateChartDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateChartSlabs(JsonElement element, DataValidatorBuilder baseDataValidator, final boolean isPrimaryGroupingByAmount) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java index 81105e3bf..0f8180b49 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java @@ -77,7 +77,9 @@ public class InterestRateChartSlabDataValidator { } public void validateCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS); @@ -164,7 +166,9 @@ public class InterestRateChartSlabDataValidator { } public void validateUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS); @@ -256,7 +260,9 @@ public class InterestRateChartSlabDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateIncentives(JsonElement element, DataValidatorBuilder baseDataValidator, final Locale locale) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java index b1c6d4281..a965e0819 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChart.java @@ -307,7 +307,9 @@ public class InterestRateChart extends AbstractPersistableCustom { final Set chartSlabs = setOfChartSlabs(); for (InterestRateChartSlab interestRateChartSlab : chartSlabs) { - if (interestRateChartSlab.getId().equals(chartSlabId)) { return interestRateChartSlab; } + if (interestRateChartSlab.getId().equals(chartSlabId)) { + return interestRateChartSlab; + } } return null; } @@ -326,7 +328,9 @@ public class InterestRateChart extends AbstractPersistableCustom { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public InterestRateChartFields chartFields() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartFields.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartFields.java index 31820362e..32aed212a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartFields.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartFields.java @@ -128,7 +128,9 @@ public class InterestRateChartFields { public boolean isFromDateAfter(LocalDate compare) { final LocalDate fromDate = getFromDateAsLocalDate(); - if (fromDate != null && compare != null) { return fromDate.isAfter(compare); } + if (fromDate != null && compare != null) { + return fromDate.isAfter(compare); + } return false; } @@ -159,7 +161,9 @@ public class InterestRateChartFields { final LocalDateInterval thisInterval = LocalDateInterval.create(thisFromDate, thisEndDate); final LocalDateInterval thatInterval = LocalDateInterval.create(thatFromDate, thatEndDate); - if (thisInterval.containsPortionOf(thatInterval) || thatInterval.containsPortionOf(thisInterval)) { return true; } + if (thisInterval.containsPortionOf(thatInterval) || thatInterval.containsPortionOf(thisInterval)) { + return true; + } return false;// no overlapping } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlab.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlab.java index d49886779..3a4137b02 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlab.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlab.java @@ -105,7 +105,9 @@ public class InterestRateChartSlab extends AbstractPersistableCustom { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public InterestRateChartSlabFields slabFields() { @@ -128,7 +130,9 @@ public class InterestRateChartSlab extends AbstractPersistableCustom { final Set interestIncentives = setOfInterestIncentives(); for (InterestIncentives interestIncentive : interestIncentives) { - if (interestIncentive.getId().equals(interestIncentiveId)) { return interestIncentive; } + if (interestIncentive.getId().equals(interestIncentiveId)) { + return interestIncentive; + } } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java index 443f9289a..bd1aa9b55 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/domain/InterestRateChartSlabFields.java @@ -199,7 +199,9 @@ public class InterestRateChartSlabFields { if (isPrimaryGroupingByAmount) { if (isAmountSame) { if (hasPeriods) { - if (this.toPeriod == null) { return true; } + if (this.toPeriod == null) { + return true; + } return isNotProperPeriodStart(that.fromPeriod); } } else { @@ -208,7 +210,9 @@ public class InterestRateChartSlabFields { } else { if (isPeriodSame) { if (hasAmounts) { - if (this.amountRangeTo == null) { return true; } + if (this.amountRangeTo == null) { + return true; + } return isNotProperAmountStart(that.amountRangeFrom); } } else { @@ -272,7 +276,9 @@ public class InterestRateChartSlabFields { return true; } else if (this.toPeriod == null) { return true; - } else if (that.toPeriod == null) { return that.fromPeriod <= this.toPeriod; } + } else if (that.toPeriod == null) { + return that.fromPeriod <= this.toPeriod; + } return this.fromPeriod <= that.toPeriod && that.fromPeriod <= this.toPeriod; } @@ -283,7 +289,9 @@ public class InterestRateChartSlabFields { return true; } else if (this.amountRangeTo == null) { return true; - } else if (that.amountRangeTo == null) { return that.amountRangeFrom.compareTo(this.amountRangeTo) <= 0; } + } else if (that.amountRangeTo == null) { + return that.amountRangeFrom.compareTo(this.amountRangeTo) <= 0; + } return this.amountRangeFrom.compareTo(that.amountRangeTo) <= 0 && that.amountRangeFrom.compareTo(this.amountRangeTo) <= 0; } @@ -297,7 +305,9 @@ public class InterestRateChartSlabFields { public boolean isIntegerSame(final Integer obj1, final Integer obj2) { if (obj1 == null || obj2 == null) { - if (Objects.equals(obj1, obj2)) { return true; } + if (Objects.equals(obj1, obj2)) { + return true; + } return false; } return obj1.equals(obj2); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestIncentiveAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestIncentiveAssembler.java old mode 100755 new mode 100644 index 3af59561c..55e2f7a7e --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestIncentiveAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestIncentiveAssembler.java @@ -97,6 +97,8 @@ public class InterestIncentiveAssembler { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartAssembler.java index 16fe6716f..b7836b2ab 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartAssembler.java @@ -75,7 +75,9 @@ public class InterestRateChartAssembler { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public InterestRateChart assembleFrom(final JsonElement element, final String currencyCode, diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java index 10f7d967f..1bc04dbe0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java @@ -124,7 +124,9 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha this.context.authenticatedUser(); final String sql = "select " + this.chartExtractor.schema() + " where irc.id = ? order by ircd.id asc"; Collection chartDatas = this.jdbcTemplate.query(sql, this.chartExtractor, new Object[] { chartId }); - if (chartDatas == null || chartDatas.isEmpty()) { throw new InterestRateChartNotFoundException(chartId); } + if (chartDatas == null || chartDatas.isEmpty()) { + throw new InterestRateChartNotFoundException(chartId); + } return chartDatas.iterator().next(); } @@ -307,7 +309,9 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "ircdId"); // If there are not chart Slabs are associated then in // InterestRateChartExtractor the chart Slabs id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String description = rs.getString("ircdDescription"); final Integer fromPeriod = JdbcSupport.getInteger(rs, "ircdFromPeriod"); @@ -389,7 +393,9 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "iriId"); // If there are not Incentive are associated then in // InterestRateChartExtractor the incentive id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String attributeValue = rs.getString("attributeValue"); String attributeValueDesc = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java index 0fcae7887..153bd6453 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java @@ -119,7 +119,9 @@ public class InterestRateChartSlabAssembler { final InterestRateChart chart = this.interestRateChartRepositoryWrapper.findOneWithNotFoundDetection(chartId); final InterestRateChartSlab interestRateChartSlab = chart.findChartSlab(chartSlabId); - if (interestRateChartSlab == null) { throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId); } + if (interestRateChartSlab == null) { + throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId); + } return interestRateChartSlab; } @@ -144,6 +146,8 @@ public class InterestRateChartSlabAssembler { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java index 9ddc40461..aecc6799e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java @@ -79,7 +79,9 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat final String sql = "select " + this.chartSlabExtractor.schema() + " where irc.id = ? order by ircd.id asc"; Collection chartDatas = this.jdbcTemplate.query(sql, this.chartSlabExtractor, new Object[] { chartSlabId, chartId }); - if (chartDatas == null || chartDatas.isEmpty()) { throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId); } + if (chartDatas == null || chartDatas.isEmpty()) { + throw new InterestRateChartSlabNotFoundException(chartSlabId, chartId); + } return chartDatas.iterator().next(); } @@ -152,7 +154,9 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "ircdId"); // If there are not chart Slabs are associated then in // InterestRateChartExtractor the chart Slabs id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String description = rs.getString("ircdDescription"); final Integer fromPeriod = JdbcSupport.getInteger(rs, "ircdFromPeriod"); @@ -228,7 +232,9 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "iriId"); // If there are not Incentive are associated then in // InterestRateChartExtractor the incentive id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String attributeValue = rs.getString("attributeValue"); String attributeValueDesc = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java index 4a7a86ded..cb7cecd05 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java @@ -238,7 +238,9 @@ public class LoanChargesApiResource { } else { throw new UnrecognizedQueryParamException("command", commandParam); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } return this.toApiJsonSerializer.serialize(result); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java index f910452a9..bf23d9c7c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java @@ -235,7 +235,9 @@ public class LoanTransactionsApiResource { result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } return this.toApiJsonSerializer.serialize(result); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java index 1c81283e6..8da259908 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java @@ -910,7 +910,9 @@ public class LoansApiResource { result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } return this.toApiJsonSerializer.serialize(result); } @@ -980,7 +982,9 @@ public class LoansApiResource { result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } return this.toApiJsonSerializer.serialize(result); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java index 512bb0a2f..32876dadf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java @@ -101,7 +101,9 @@ public class DisbursementData implements Comparable { @Override public int compareTo(final DisbursementData obj) { - if (obj == null) { return -1; } + if (obj == null) { + return -1; + } return obj.expectedDisbursementDate.compareTo(this.expectedDisbursementDate); } @@ -117,7 +119,9 @@ public class DisbursementData implements Comparable { } public BigDecimal getWaivedChargeAmount() { - if (this.waivedChargeAmount == null) { return BigDecimal.ZERO; } + if (this.waivedChargeAmount == null) { + return BigDecimal.ZERO; + } return this.waivedChargeAmount; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java index 3b04618bd..ab4e4d7a0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanAccountData.java @@ -1846,7 +1846,9 @@ public class LoanAccountData { } public Long getInterestRecalculationDetailId() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getId(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getId(); + } return null; } @@ -1859,7 +1861,9 @@ public class LoanAccountData { } public BigDecimal getTotalPaidFeeCharges() { - if (this.summary != null) { return this.summary.getTotalPaidFeeCharges(); } + if (this.summary != null) { + return this.summary.getTotalPaidFeeCharges(); + } return BigDecimal.ZERO; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionEnumData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionEnumData.java index ad981301f..7aee9b1f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionEnumData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionEnumData.java @@ -86,7 +86,9 @@ public class LoanTransactionEnumData { * @return */ public boolean isPaymentOrReceipt() { - if (isDisbursement() || isRepayment() || isRepaymentAtDisbursement() || isRecoveryRepayment()) { return true; } + if (isDisbursement() || isRepayment() || isRepaymentAtDisbursement() || isRecoveryRepayment()) { + return true; + } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java index b151046b5..131cc1bc2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java @@ -832,7 +832,9 @@ public class Loan extends AbstractPersistableCustom { private boolean doesLoanChargePaidByContainLoanCharge(Set loanChargePaidBys, LoanCharge loanCharge) { for (LoanChargePaidBy loanChargePaidBy : loanChargePaidBys) { - if (loanChargePaidBy.getLoanCharge().equals(loanCharge)) { return true; } + if (loanChargePaidBy.getLoanCharge().equals(loanCharge)) { + return true; + } } return false; } @@ -880,7 +882,9 @@ public class Loan extends AbstractPersistableCustom { */ private BigDecimal calculateAmountPercentageAppliedTo(final LoanCharge loanCharge) { BigDecimal amount = BigDecimal.ZERO; - if (loanCharge.isOverdueInstallmentCharge()) { return loanCharge.getAmountPercentageAppliedTo(); } + if (loanCharge.isOverdueInstallmentCharge()) { + return loanCharge.getAmountPercentageAppliedTo(); + } switch (loanCharge.getChargeCalculation()) { case PERCENT_OF_AMOUNT: amount = getDerivedAmountForCharge(loanCharge); @@ -927,7 +931,9 @@ public class Loan extends AbstractPersistableCustom { totalTranchDisbursementCount++; } } - if (totalTranchDisbursementCount < 2) { return true; } + if (totalTranchDisbursementCount < 2) { + return true; + } } return false; } @@ -2648,7 +2654,9 @@ public class Loan extends AbstractPersistableCustom { */ public void regenerateRepaymentSchedule(final ScheduleGeneratorDTO scheduleGeneratorDTO, final AppUser currentUser) { final LoanScheduleModel loanSchedule = regenerateScheduleModel(scheduleGeneratorDTO); - if (loanSchedule == null) { return; } + if (loanSchedule == null) { + return; + } updateLoanSchedule(loanSchedule, currentUser); final Set charges = this.charges(); for (final LoanCharge loanCharge : charges) { @@ -4593,7 +4601,9 @@ public class Loan extends AbstractPersistableCustom { } public Integer getLoanProductLoanCounter() { - if (this.loanProductCounter == null) { return 0; } + if (this.loanProductCounter == null) { + return 0; + } return this.loanProductCounter; } @@ -4987,7 +4997,9 @@ public class Loan extends AbstractPersistableCustom { break; } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @@ -5074,7 +5086,9 @@ public class Loan extends AbstractPersistableCustom { public LoanRepaymentScheduleInstallment fetchRepaymentScheduleInstallment(final Integer installmentNumber) { LoanRepaymentScheduleInstallment installment = null; - if (installmentNumber == null) { return installment; } + if (installmentNumber == null) { + return installment; + } List installments = getRepaymentScheduleInstallments(); for (final LoanRepaymentScheduleInstallment scheduleInstallment : installments) { if (scheduleInstallment.getInstallmentNumber().equals(installmentNumber)) { @@ -5102,7 +5116,9 @@ public class Loan extends AbstractPersistableCustom { } public Long loanInterestRecalculationDetailId() { - if (loanInterestRecalculationDetails() != null) { return this.loanInterestRecalculationDetails.getId(); } + if (loanInterestRecalculationDetails() != null) { + return this.loanInterestRecalculationDetails.getId(); + } return null; } @@ -5179,7 +5195,9 @@ public class Loan extends AbstractPersistableCustom { LocalDate lastTransactionDate = getLastUserTransactionDate(); final LoanScheduleDTO loanSchedule = getRecalculatedSchedule(generatorDTO); - if (loanSchedule == null) { return; } + if (loanSchedule == null) { + return; + } updateLoanSchedule(loanSchedule.getInstallments(), currentUser); this.interestRecalculatedOn = DateUtils.getDateOfTenant(); LocalDate lastRepaymentDate = this.getLastRepaymentPeriodDueDate(true); @@ -5354,7 +5372,9 @@ public class Loan extends AbstractPersistableCustom { private LoanTransaction getTransactionForDate(List transactions, LocalDate effectiveDate) { for (LoanTransaction loanTransaction : transactions) { - if (loanTransaction.getTransactionDate().isEqual(effectiveDate)) { return loanTransaction; } + if (loanTransaction.getTransactionDate().isEqual(effectiveDate)) { + return loanTransaction; + } } return null; } @@ -5407,7 +5427,9 @@ public class Loan extends AbstractPersistableCustom { private LoanScheduleDTO getRecalculatedSchedule(final ScheduleGeneratorDTO generatorDTO) { - if (!this.repaymentScheduleDetail().isInterestRecalculationEnabled() || isNpa) { return null; } + if (!this.repaymentScheduleDetail().isInterestRecalculationEnabled() || isNpa) { + return null; + } final InterestMethod interestMethod = this.loanRepaymentScheduleDetail.getInterestMethod(); final LoanScheduleGenerator loanScheduleGenerator = generatorDTO.getLoanScheduleFactory().create(interestMethod); @@ -6322,7 +6344,9 @@ public class Loan extends AbstractPersistableCustom { } private double calculateInterestForDays(int daysInPeriod, BigDecimal interest, int days) { - if (interest.doubleValue() == 0) { return 0; } + if (interest.doubleValue() == 0) { + return 0; + } return interest.doubleValue() / daysInPeriod * days; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java index ae112b724..1a9734f2a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java @@ -374,11 +374,15 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { private void checkClientOrGroupActive(final Loan loan) { final Client client = loan.client(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = loan.group(); if (group != null) { - if (group.isNotActive()) { throw new GroupNotActiveException(group.getId()); } + if (group.isNotActive()) { + throw new GroupNotActiveException(group.getId()); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java index d1176bcef..ac6c9d30b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanCharge.java @@ -588,12 +588,16 @@ public class LoanCharge extends AbstractPersistableCustom { } private boolean determineIfFullyPaid() { - if (this.amount == null) { return true; } + if (this.amount == null) { + return true; + } return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0; } private BigDecimal calculateOutstanding() { - if (this.amount == null) { return null; } + if (this.amount == null) { + return null; + } BigDecimal amountPaidLocal = BigDecimal.ZERO; if (this.amountPaid != null) { amountPaidLocal = this.amountPaid; @@ -851,7 +855,9 @@ public class LoanCharge extends AbstractPersistableCustom { public LoanInstallmentCharge getInstallmentLoanCharge(final LocalDate periodDueDate) { for (final LoanInstallmentCharge loanChargePerInstallment : this.loanInstallmentCharge) { - if (periodDueDate.isEqual(loanChargePerInstallment.getRepaymentInstallment().getDueDate())) { return loanChargePerInstallment; } + if (periodDueDate.isEqual(loanChargePerInstallment.getRepaymentInstallment().getDueDate())) { + return loanChargePerInstallment; + } } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanDisbursementDetails.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanDisbursementDetails.java index 50190856f..737f5a6f0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanDisbursementDetails.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanDisbursementDetails.java @@ -67,7 +67,9 @@ public class LoanDisbursementDetails extends AbstractPersistableCustom { @Override public boolean equals(final Object obj) { - if (!(obj instanceof LoanDisbursementDetails)) { return false; } + if (!(obj instanceof LoanDisbursementDetails)) { + return false; + } final LoanDisbursementDetails loanDisbursementDetails = (LoanDisbursementDetails) obj; if (loanDisbursementDetails.principal.equals(this.principal) && loanDisbursementDetails.expectedDisbursementDate.equals(this.expectedDisbursementDate)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanInstallmentCharge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanInstallmentCharge.java index 9c4bf3967..5737155e2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanInstallmentCharge.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanInstallmentCharge.java @@ -103,12 +103,16 @@ public class LoanInstallmentCharge extends AbstractPersistableCustom implements } private boolean determineIfFullyPaid() { - if (this.amount == null) { return true; } + if (this.amount == null) { + return true; + } return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0; } private BigDecimal calculateOutstanding() { - if (this.amount == null) { return null; } + if (this.amount == null) { + return null; + } BigDecimal amountPaidLocal = BigDecimal.ZERO; if (this.amountPaid != null) { amountPaidLocal = this.amountPaid; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummaryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummaryWrapper.java index 8ac9bfb89..1b33d1371 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummaryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummaryWrapper.java @@ -234,7 +234,9 @@ public final class LoanSummaryWrapper { public Money calculateTotalChargesRepaidAtDisbursement(Set charges, MonetaryCurrency currency) { Money total = Money.zero(currency); - if (charges == null) { return total; } + if (charges == null) { + return total; + } for (final LoanCharge loanCharge : charges) { if (!loanCharge.isPenaltyCharge() && loanCharge.getAmountPaid(currency).isGreaterThanZero()) { total = total.plus(loanCharge.getAmountPaid(currency)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionType.java index 3f2e29aeb..2ac359037 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionType.java @@ -72,7 +72,9 @@ public enum LoanTransactionType { public static LoanTransactionType fromInt(final Integer transactionType) { - if (transactionType == null) { return LoanTransactionType.INVALID; } + if (transactionType == null) { + return LoanTransactionType.INVALID; + } LoanTransactionType loanTransactionType = null; switch (transactionType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/domain/Guarantor.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/domain/Guarantor.java index 0002548e0..ddd5713dc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/domain/Guarantor.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/domain/Guarantor.java @@ -342,7 +342,9 @@ public class Guarantor extends AbstractPersistableCustom { } public boolean hasGuarantor(Long savingsId) { - if (savingsId == null) { return false; } + if (savingsId == null) { + return false; + } boolean hasGuarantee = false; for (GuarantorFundingDetails guarantorFundingDetails : this.guarantorFundDetails) { if (guarantorFundingDetails.getStatus().isActive() diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/serialization/GuarantorCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/serialization/GuarantorCommandFromApiJsonDeserializer.java index fd644b8c2..4a1ce12f2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/serialization/GuarantorCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/serialization/GuarantorCommandFromApiJsonDeserializer.java @@ -52,7 +52,9 @@ public final class GuarantorCommandFromApiJsonDeserializer extends AbstractFromA @Override public GuarantorCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); final Set supportedParameters = GuarantorJSONinputParams.getAllValues(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java index d284f0fe0..c7957c122 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java @@ -219,7 +219,9 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService { */ @Override public void transaferFundsFromGuarantor(final Loan loan) { - if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) <= 0) { return; } + if (loan.getGuaranteeAmount().compareTo(BigDecimal.ZERO) <= 0) { + return; + } final List existGuarantorList = this.guarantorRepository.findByLoan(loan); final boolean isRegularTransaction = true; final boolean isExceptionForBalanceCheck = true; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java index c1be1fb49..ed727e5d4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorWritePlatformServiceJpaRepositoryIImpl.java @@ -201,7 +201,9 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto final Loan loan = this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId, true); validateLoanStatus(loan); final Guarantor guarantorForUpdate = this.guarantorRepository.findByLoanAndId(loan, guarantorId); - if (guarantorForUpdate == null) { throw new GuarantorNotFoundException(loanId, guarantorId); } + if (guarantorForUpdate == null) { + throw new GuarantorNotFoundException(loanId, guarantorId); + } final Map changesOnly = guarantorForUpdate.update(command); @@ -321,7 +323,9 @@ public class GuarantorWritePlatformServiceJpaRepositoryIImpl implements Guaranto } else if (guarantor.getClientRelationshipType() != null) { errorCode = "guarantor.relation.should.be.empty.for.own"; } - if (errorCode != null) { throw new InvalidGuarantorException(guarantor.getEntityId(), guarantor.getLoanId(), errorCode); } + if (errorCode != null) { + throw new InvalidGuarantorException(guarantor.getEntityId(), guarantor.getLoanId(), errorCode); + } } } else if (guarantor.isExistingEmployee()) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java index 5f304345b..3ddf70bcd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java @@ -398,7 +398,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener private void updateCompoundingDetails(final Collection periods, final LoanScheduleParams params, final LoanApplicationTerms loanApplicationTerms) { final Map> compoundingDetails = params.getCompoundingDateVariations(); - if (compoundingDetails.isEmpty()) { return; } + if (compoundingDetails.isEmpty()) { + return; + } for (LoanScheduleModelPeriod loanScheduleModelPeriod : periods) { if (loanScheduleModelPeriod.isRepaymentPeriod() && loanScheduleModelPeriod.getLoanCompoundingDetails().isEmpty()) { Map periodCompoundingDetails = compoundingDetails.get(loanScheduleModelPeriod.periodFromDate()); @@ -1507,7 +1509,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener // in this case emi amount will be reduced but number of // installments won't change Money principal = getPrincipalToBeScheduled(loanApplicationTerms); - if (!principal.minus(totalCumulativePrincipal).isGreaterThanZero()) { return; } + if (!principal.minus(totalCumulativePrincipal).isGreaterThanZero()) { + return; + } if (loanApplicationTerms.getAmortizationMethod().isEqualPrincipal()) { loanApplicationTerms.updateFixedPrincipalAmount(mc, periodNumber, principal.minus(totalCumulativePrincipal)); } else if (loanApplicationTerms.getActualFixedEmiAmount() == null) { @@ -2582,7 +2586,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener private LocalDate getNextCompoundScheduleDate(LocalDate startDate, LoanApplicationTerms loanApplicationTerms, final HolidayDetailDTO holidayDetailDTO) { LocalDate nextScheduleDate = null; - if (!loanApplicationTerms.getInterestRecalculationCompoundingMethod().isCompoundingEnabled()) { return null; } + if (!loanApplicationTerms.getInterestRecalculationCompoundingMethod().isCompoundingEnabled()) { + return null; + } if (loanApplicationTerms.getCompoundingFrequencyType().isSameAsRepayment()) { nextScheduleDate = this.scheduledDateGenerator.generateNextScheduleDateStartingFromDisburseDate(startDate, loanApplicationTerms, holidayDetailDTO); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java index ccbbe64c9..5a80d925c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java @@ -849,7 +849,9 @@ public class LoanScheduleAssembler { "Loan schedule date not in sync with meeting date"); } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (loan.getExpectedFirstRepaymentOnDate() == null) { loan.setExpectedFirstRepaymentOnDate(loan.fetchRepaymentScheduleInstallment(1).getDueDate().toDate()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java index 0a9bab8de..003b8c72a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java @@ -132,7 +132,9 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC } else { this.loanProductCommandFromApiJsonDeserializer.validateMinMaxConstraints(query.parsedJson(), baseDataValidator, loanProduct); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } return this.loanScheduleAssembler.assembleLoanScheduleFrom(query.parsedJson()); } @@ -155,7 +157,9 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC BigDecimal disbursedAmount = loan.getDisbursedAmount(); BigDecimal principalRepaid = loan.getLoanSummary().getTotalPrincipalRepaid(); BigDecimal principalWrittenOff = loan.getLoanSummary().getTotalPrincipalWrittenOff(); - if (disbursedAmount.subtract(principalWrittenOff).subtract(principalRepaid).compareTo(BigDecimal.ZERO) <= 0) { return; } + if (disbursedAmount.subtract(principalWrittenOff).subtract(principalRepaid).compareTo(BigDecimal.ZERO) <= 0) { + return; + } } MonetaryCurrency currency = loan.getCurrency(); Money totalPrincipal = Money.zero(currency); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleHistoryReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleHistoryReadPlatformServiceImpl.java index 86b349d84..8c6694575 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleHistoryReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleHistoryReadPlatformServiceImpl.java @@ -71,7 +71,9 @@ public class LoanScheduleHistoryReadPlatformServiceImpl implements LoanScheduleH try { this.context.authenticatedUser(); Integer versionNumber = fetchCurrentVersionNumber(loanId); - if (versionNumber == 0) { return null; } + if (versionNumber == 0) { + return null; + } final LoanScheduleArchiveResultSetExtractor fullResultsetExtractor = new LoanScheduleArchiveResultSetExtractor( repaymentScheduleRelatedLoanData, disbursementData); final String sql = "select " + fullResultsetExtractor.schema() diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java index 883a263b5..0e4f05bc3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/data/LoanRescheduleRequestDataValidator.java @@ -82,7 +82,9 @@ public class LoanRescheduleRequestDataValidator { final String jsonString = jsonCommand.json(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, CREATE_REQUEST_DATA_PARAMETERS); @@ -184,7 +186,9 @@ public class LoanRescheduleRequestDataValidator { "Loan rescheduling is not supported for the loan product with interest recalculation enabled"); } validateForOverdueCharges(dataValidatorBuilder, loan, installment); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateForOverdueCharges(DataValidatorBuilder dataValidatorBuilder, final Loan loan, @@ -211,7 +215,9 @@ public class LoanRescheduleRequestDataValidator { public void validateForApproveAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { final String jsonString = jsonCommand.json(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, APPROVE_REQUEST_DATA_PARAMETERS); @@ -266,7 +272,9 @@ public class LoanRescheduleRequestDataValidator { validateForOverdueCharges(dataValidatorBuilder, loan, installment); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } /** @@ -279,7 +287,9 @@ public class LoanRescheduleRequestDataValidator { public void validateForRejectAction(final JsonCommand jsonCommand, LoanRescheduleRequest loanRescheduleRequest) { final String jsonString = jsonCommand.json(); - if (StringUtils.isBlank(jsonString)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonString)) { + throw new InvalidJsonException(); + } final Type typeToken = new TypeToken>() {}.getType(); this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString, REJECT_REQUEST_DATA_PARAMETERS); @@ -308,6 +318,8 @@ public class LoanRescheduleRequestDataValidator { + "Loan reschedule request is not in submitted and pending approval state."); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleRequest.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleRequest.java index e0f6200d9..ffc016ee3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleRequest.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleRequest.java @@ -308,7 +308,9 @@ public class LoanRescheduleRequest extends AbstractPersistableCustom { public LoanTermVariations getDueDateTermVariationIfExists() { if (this.loanRescheduleRequestToTermVariationMappings != null && this.loanRescheduleRequestToTermVariationMappings.size() > 0) { for (LoanRescheduleRequestToTermVariationMapping mapping : this.loanRescheduleRequestToTermVariationMappings) { - if (mapping.getLoanTermVariations().getTermType().isDueDateVariation()) { return mapping.getLoanTermVariations(); } + if (mapping.getLoanTermVariations().getTermType().isDueDateVariation()) { + return mapping.getLoanTermVariations(); + } } } return null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanReschedulePreviewPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanReschedulePreviewPlatformServiceImpl.java index eedacc099..51a425812 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanReschedulePreviewPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanReschedulePreviewPlatformServiceImpl.java @@ -74,7 +74,9 @@ public class LoanReschedulePreviewPlatformServiceImpl implements LoanRescheduleP final LoanRescheduleRequest loanRescheduleRequest = this.loanRescheduleRequestRepository.findOneWithNotFoundDetection(requestId, true); - if (loanRescheduleRequest == null) { throw new LoanRescheduleRequestNotFoundException(requestId); } + if (loanRescheduleRequest == null) { + throw new LoanRescheduleRequestNotFoundException(requestId); + } Loan loan = loanRescheduleRequest.getLoan(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java index 486d7d941..fc58f6a8a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java @@ -78,7 +78,9 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper { } public void validate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java index 480cbe7eb..650600830 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java @@ -101,7 +101,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { } public void validateForCreate(final String json, final boolean isMeetingMandatoryForJLGLoans, final LoanProduct loanProduct) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -453,7 +455,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { unsupportedParameterList.add(LoanApiConstants.emiAmountParameterName); throw new UnsupportedParameterException(unsupportedParameterList); } - if (isEqualAmortization) { throw new EqualAmortizationUnsupportedFeatureException("fixed.emi", "fixed emi"); } + if (isEqualAmortization) { + throw new EqualAmortizationUnsupportedFeatureException("fixed.emi", "fixed emi"); + } final BigDecimal emiAnount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(LoanApiConstants.emiAmountParameterName, element); baseDataValidator.reset().parameter(LoanApiConstants.emiAmountParameterName).value(emiAnount).ignoreIfNull().positiveAmount(); @@ -483,11 +487,15 @@ public final class LoanApplicationCommandFromApiJsonHelper { validateLoanMultiDisbursementdate(element, baseDataValidator, expectedDisbursementDate, principal); validatePartialPeriodSupport(interestCalculationPeriodType, baseDataValidator, element, loanProduct); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForModify(final String json, final LoanProduct loanProduct, final Loan existingLoanApplication) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -897,7 +905,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { unsupportedParameterList.add(LoanApiConstants.emiAmountParameterName); throw new UnsupportedParameterException(unsupportedParameterList); } - if (isEqualAmortization) { throw new EqualAmortizationUnsupportedFeatureException("fixed.emi", "fixed emi"); } + if (isEqualAmortization) { + throw new EqualAmortizationUnsupportedFeatureException("fixed.emi", "fixed emi"); + } final BigDecimal emiAnount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(LoanApiConstants.emiAmountParameterName, element); baseDataValidator.reset().parameter(LoanApiConstants.emiAmountParameterName).value(emiAnount).ignoreIfNull().positiveAmount(); @@ -932,7 +942,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { } public void validateForUndo(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set undoSupportedParameters = new HashSet<>(Arrays.asList("note")); final Type typeOfMap = new TypeToken>() {}.getType(); @@ -948,7 +960,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { baseDataValidator.reset().parameter(note).value(noteText).notExceedingLengthOf(1000); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateMinMaxConstraintValues(final JsonElement element, final LoanProduct loanProduct) { @@ -1137,7 +1151,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { } public void validateLoanCharges(final Set charges, final List dataValidationErrors) { - if (charges == null) { return; } + if (charges == null) { + return; + } final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); for (LoanCharge loanCharge : charges) { String errorcode = null; @@ -1174,7 +1190,9 @@ public final class LoanApplicationCommandFromApiJsonHelper { final List dataValidationErrors = new ArrayList<>(); validateLoanCharges(loan.charges(), dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validatePartialPeriodSupport(final Integer interestCalculationPeriodType, final DataValidatorBuilder baseDataValidator, diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java index 1165d5192..be778be38 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java @@ -58,7 +58,9 @@ public final class LoanApplicationTransitionApiJsonValidator { public void validateApproval(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList(LoanApiConstants.loanIdTobeApproved, LoanApiConstants.approvedLoanAmountParameterName, LoanApiConstants.approvedOnDateParameterName, @@ -94,7 +96,9 @@ public final class LoanApplicationTransitionApiJsonValidator { public void validateRejection(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList(LoanApiConstants.rejectedOnDateParameterName, LoanApiConstants.noteParameterName, LoanApiConstants.localeParameterName, LoanApiConstants.dateFormatParameterName)); @@ -118,7 +122,9 @@ public final class LoanApplicationTransitionApiJsonValidator { public void validateApplicantWithdrawal(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList(LoanApiConstants.withdrawnOnDateParameterName, LoanApiConstants.noteParameterName, LoanApiConstants.localeParameterName, LoanApiConstants.dateFormatParameterName)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java index 226047ebf..b0470eeb7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java @@ -67,7 +67,9 @@ public final class LoanEventApiJsonValidator { public void validateDisbursement(final String json, boolean isAccountTransfer) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } Set disbursementParameters = null; @@ -124,7 +126,9 @@ public final class LoanEventApiJsonValidator { public void validateTransaction(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "transactionAmount", "externalId", "note", "locale", "dateFormat", "paymentTypeId", "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber")); @@ -151,7 +155,9 @@ public final class LoanEventApiJsonValidator { public void validateNewRepaymentTransaction(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set transactionParameters = new HashSet<>( Arrays.asList("transactionDate", "transactionAmount", "externalId", "note", "locale", "dateFormat", "paymentTypeId", @@ -206,7 +212,9 @@ public final class LoanEventApiJsonValidator { } public void validateTransactionWithNoAmount(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>( Arrays.asList("transactionDate", "note", "locale", "dateFormat", "writeoffReasonId")); @@ -228,7 +236,9 @@ public final class LoanEventApiJsonValidator { } public void validateAddLoanCharge(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList("chargeId", "amount", "dueDate", "locale", "dateFormat")); @@ -254,7 +264,9 @@ public final class LoanEventApiJsonValidator { } public void validateUpdateOfLoanCharge(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList("amount", "dueDate", "locale", "dateFormat")); @@ -277,7 +289,9 @@ public final class LoanEventApiJsonValidator { } public void validateUpdateOfLoanOfficer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>( Arrays.asList("assignmentDate", "fromLoanOfficerId", "toLoanOfficerId", "locale", "dateFormat")); @@ -305,7 +319,9 @@ public final class LoanEventApiJsonValidator { } public void validateForBulkLoanReassignment(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set supportedParameters = new HashSet<>( Arrays.asList("assignmentDate", "fromLoanOfficerId", "toLoanOfficerId", "loans", "locale", "dateFormat")); @@ -332,7 +348,9 @@ public final class LoanEventApiJsonValidator { public void validateChargePaymentTransaction(final String json, final boolean isChargeIdIncluded) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } Set transactionParameters = null; if (isChargeIdIncluded) { transactionParameters = new HashSet<>( @@ -363,7 +381,9 @@ public final class LoanEventApiJsonValidator { public void validateInstallmentChargeTransaction(final String json) { - if (StringUtils.isBlank(json)) { return; } + if (StringUtils.isBlank(json)) { + return; + } Set transactionParameters = new HashSet<>(Arrays.asList("dueDate", "locale", "dateFormat", "installmentNumber")); final Type typeOfMap = new TypeToken>() {}.getType(); @@ -382,7 +402,9 @@ public final class LoanEventApiJsonValidator { public void validateUpdateDisbursementDateAndAmount(final String json, LoanDisbursementDetails loanDisbursementDetails) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>( Arrays.asList("locale", "dateFormat", LoanApiConstants.disbursementDataParameterName, @@ -419,7 +441,9 @@ public final class LoanEventApiJsonValidator { public void validateNewRefundTransaction(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "transactionAmount", "externalId", "note", "locale", "dateFormat", "paymentTypeId", "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber")); @@ -446,7 +470,9 @@ public final class LoanEventApiJsonValidator { public void validateLoanForeclosure(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set foreclosureParameters = new HashSet<>(Arrays.asList("transactionDate", "note", "locale", "dateFormat")); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java index 7eea82d98..fb4c616da 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java @@ -52,7 +52,9 @@ public final class LoanUpdateCommandFromApiJsonDeserializer extends AbstractFrom @Override public LoanUpdateCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java index e5a2d2dc0..2fa5f5b91 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/VariableLoanScheduleFromApiJsonValidator.java @@ -65,7 +65,9 @@ public class VariableLoanScheduleFromApiJsonValidator { } public void validateSchedule(final String json, final Loan loan) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.variableSchedulesupportedParameters); @@ -111,7 +113,9 @@ public class VariableLoanScheduleFromApiJsonValidator { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("variable.schedule.not.supported", "Loan schedule modification not allowed"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateLoanTermVariations(final Loan loan, final DataValidatorBuilder baseDataValidator, final String dateFormat, diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualPlatformServiceImpl.java index e78ccb892..bb19ad1d4 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualPlatformServiceImpl.java @@ -73,7 +73,9 @@ public class LoanAccrualPlatformServiceImpl implements LoanAccrualPlatformServic errors.add(e); } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } @Override @@ -115,7 +117,9 @@ public class LoanAccrualPlatformServiceImpl implements LoanAccrualPlatformServic errors.add(e); } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } @Override @@ -132,7 +136,9 @@ public class LoanAccrualPlatformServiceImpl implements LoanAccrualPlatformServic errors.add(e); } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java index f8a3049b4..9103c023e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java @@ -489,7 +489,9 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat public void addIncomeAndAccrualTransactions(Long loanId) throws LoanNotFoundException { if (loanId != null) { Loan loan = this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId, true); - if (loan == null) { throw new LoanNotFoundException(loanId); } + if (loan == null) { + throw new LoanNotFoundException(loanId); + } final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); existingTransactionIds.addAll(loan.findExistingTransactionIds()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java index 4f6582e5a..4fbfb7e0d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java @@ -307,7 +307,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa this.loanProductCommandFromApiJsonDeserializer.validateMinMaxConstraints(command.parsedJson(), baseDataValidator, loanProduct); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } final Loan newLoanApplication = this.loanAssembler.assembleFrom(command, currentUser); @@ -472,8 +474,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa } } - } else // for applications other than GLIM - { + } else { // for applications other than GLIM newLoanApplication.updateAccountNo(this.accountNumberGenerator.generate(newLoanApplication, accountNumberFormat)); this.loanRepositoryWrapper.save(newLoanApplication); } @@ -826,7 +827,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa if (changes.containsKey(clientIdParamName)) { final Long clientId = command.longValueOfParameterNamed(clientIdParamName); final Client client = this.clientRepository.findOneWithNotFoundDetection(clientId); - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } existingLoanApplication.updateClient(client); } @@ -835,7 +838,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa if (changes.containsKey(groupIdParamName)) { final Long groupId = command.longValueOfParameterNamed(groupIdParamName); final Group group = this.groupRepository.findOneWithNotFoundDetection(groupId); - if (group.isNotActive()) { throw new GroupNotActiveException(groupId); } + if (group.isNotActive()) { + throw new GroupNotActiveException(groupId); + } existingLoanApplication.updateGroup(group); } @@ -869,7 +874,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa existingLoanApplication.setInterestRateDifferential(null); existingLoanApplication.setIsFloatingInterestRate(null); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } existingLoanApplication.updateIsInterestRecalculationEnabled(); @@ -1281,7 +1288,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final BigDecimal principal = this.fromJsonHelper.extractBigDecimalWithLocaleNamed("approvedLoanAmount", element); fromApiJsonDeserializer.validateLoanMultiDisbursementdate(element, baseDataValidator, expectedDisbursementDate, principal); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @Transactional @@ -1658,11 +1667,15 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa private void checkClientOrGroupActive(final Loan loan) { final Client client = loan.client(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = loan.group(); if (group != null) { - if (group.isNotActive()) { throw new GroupNotActiveException(group.getId()); } + if (group.isNotActive()) { + throw new GroupNotActiveException(group.getId()); + } } } @@ -1711,7 +1724,9 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa .findOneByCodeName(FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS.toStr()); FineractEntityToEntityMapping officeToLoanProductMappingList = this.repository.findListByProductId(fineractEntityRelation, productId, officeId); - if (officeToLoanProductMappingList == null) { throw new NotOfficeSpecificProductException(productId, officeId); } + if (officeToLoanProductMappingList == null) { + throw new NotOfficeSpecificProductException(productId, officeId); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java index c68b1bfba..8cdb60be3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAssembler.java @@ -243,17 +243,23 @@ public class LoanAssembler { if (clientId != null) { client = this.clientRepository.findOneWithNotFoundDetection(clientId); - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } } if (groupId != null) { group = this.groupRepository.findById(groupId).orElseThrow(() -> new GroupNotFoundException(groupId)); - if (group.isNotActive()) { throw new GroupNotActiveException(groupId); } + if (group.isNotActive()) { + throw new GroupNotActiveException(groupId); + } } if (client != null && group != null) { - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(clientId, groupId); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(clientId, groupId); + } loanApplication = Loan.newIndividualLoanApplicationFromGroup(accountNo, client, group, loanType.getId().intValue(), loanProduct, fund, loanOfficer, loanPurpose, loanTransactionProcessingStrategy, loanProductRelatedDetail, loanCharges, collateral, @@ -331,7 +337,9 @@ public class LoanAssembler { Staff staff = null; if (loanOfficerId != null) { staff = this.staffRepository.findById(loanOfficerId).orElseThrow(() -> new StaffNotFoundException(loanOfficerId)); - if (staff.isNotLoanOfficer()) { throw new StaffRoleException(loanOfficerId, StaffRoleException.StaffRole.LOAN_OFFICER); } + if (staff.isNotLoanOfficer()) { + throw new StaffRoleException(loanOfficerId, StaffRoleException.StaffRole.LOAN_OFFICER); + } } return staff; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index 6046a7348..b5c98d423 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -1468,7 +1468,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { @Override public Collection retrieveAllowedLoanOfficers(final Long selectedOfficeId, final boolean staffInSelectedOfficeOnly) { - if (selectedOfficeId == null) { return null; } + if (selectedOfficeId == null) { + return null; + } Collection allowedLoanOfficers = null; @@ -1498,7 +1500,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { .append(" and ls.recalculated_interest_component <> 1 ") .append(" and mc.charge_time_enum = 9 and ml.loan_status_id = 300 "); - if (backdatePenalties) { return this.jdbcTemplate.query(sqlBuilder.toString(), rm, new Object[] { penaltyWaitPeriod }); } + if (backdatePenalties) { + return this.jdbcTemplate.query(sqlBuilder.toString(), rm, new Object[] { penaltyWaitPeriod }); + } // Only apply for duedate = yesterday (so that we don't apply // penalties on the duedate itself) sqlBuilder.append(" and ls.duedate >= DATE_SUB(CURDATE(),INTERVAL (? + 1) DAY)"); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanSchedularServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanSchedularServiceImpl.java index 0004336d7..795065f27 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanSchedularServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanSchedularServiceImpl.java @@ -115,7 +115,9 @@ public class LoanSchedularServiceImpl implements LoanSchedularService { exceptions.add(e); } } - if (!exceptions.isEmpty()) { throw new JobExecutionException(exceptions); } + if (!exceptions.isEmpty()) { + throw new JobExecutionException(exceptions); + } } } @@ -166,7 +168,9 @@ public class LoanSchedularServiceImpl implements LoanSchedularService { } LOG.info("recalculateInterest: Loans count {}", i); } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } } @@ -181,7 +185,9 @@ public class LoanSchedularServiceImpl implements LoanSchedularService { // gets the Office object final OfficeData office = this.officeReadPlatformService.retrieveOffice(officeIdLong); - if (office == null) { throw new OfficeNotFoundException(officeIdLong); } + if (office == null) { + throw new OfficeNotFoundException(officeIdLong); + } final int threadPoolSize = Integer.parseInt(jobParameters.get("thread-pool-size")); final int batchSize = Integer.parseInt(jobParameters.get("batch-size")); @@ -226,7 +232,9 @@ public class LoanSchedularServiceImpl implements LoanSchedularService { double toGetCeilValue = size / threadPoolSize; batchSize = (int) Math.ceil(toGetCeilValue); - if (batchSize == 0) { return; } + if (batchSize == 0) { + return; + } int toIndex = (batchSize > size - 1) ? size : batchSize; while (toIndex < size && loanIds.get(toIndex - 1).equals(loanIds.get(toIndex))) { @@ -265,7 +273,9 @@ public class LoanSchedularServiceImpl implements LoanSchedularService { // break the lists into sub lists private List safeSubList(List list, int fromIndex, int toIndex) { int size = list.size(); - if (fromIndex >= size || toIndex <= 0 || fromIndex >= toIndex) { return Collections.emptyList(); } + if (fromIndex >= size || toIndex <= 0 || fromIndex >= toIndex) { + return Collections.emptyList(); + } fromIndex = Math.max(0, fromIndex); toIndex = Math.min(size, toIndex); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java index 87c644fd1..654ec2b58 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java @@ -164,7 +164,9 @@ public class LoanUtilService { } } - if (entityId == null || calendar == null) { return isSkipRepaymentOnFirstMonth; } + if (entityId == null || calendar == null) { + return isSkipRepaymentOnFirstMonth; + } isSkipRepaymentOnFirstMonth = this.calendarReadPlatformService.isCalendarAssociatedWithEntity(entityId, calendar.getId(), entityTypeId); return isSkipRepaymentOnFirstMonth; @@ -217,7 +219,9 @@ public class LoanUtilService { public LocalDate getCalculatedRepaymentsStartingFromDate(final LocalDate actualDisbursementDate, final Loan loan, final Calendar calendar) { final CalendarHistoryDataWrapper calendarHistoryDataWrapper = null; - if (calendar == null) { return getCalculatedRepaymentsStartingFromDate(loan); } + if (calendar == null) { + return getCalculatedRepaymentsStartingFromDate(loan); + } return calculateRepaymentStartingFromDate(actualDisbursementDate, loan, calendar, calendarHistoryDataWrapper); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index c64b8c23a..f973aa941 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -644,7 +644,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final SingleDisbursalCommand[] disbursalCommand = bulkDisbursalCommand.getDisburseTransactions(); final Map changes = new LinkedHashMap<>(); - if (disbursalCommand == null) { return changes; } + if (disbursalCommand == null) { + return changes; + } final LocalDate nextPossibleRepaymentDate = null; final Date rescheduledRepaymentDate = null; @@ -908,7 +910,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Map changes = new LinkedHashMap<>(); final boolean isRecoveryRepayment = false; - if (repaymentCommand == null) { return changes; } + if (repaymentCommand == null) { + return changes; + } List transactionIds = new ArrayList<>(); boolean isAccountTransfer = false; HolidayDetailDTO holidayDetailDTO = null; @@ -1484,7 +1488,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Set loanCharges = new HashSet<>(1); loanCharges.add(loanCharge); this.loanApplicationCommandFromApiJsonHelper.validateLoanCharges(loanCharges, dataValidationErrors); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -1875,7 +1881,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } private void transferFeeCharge(final AccountTransferDTO accountTransferDTO, List errors) { @@ -1892,7 +1900,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final LoanCharge loanCharge = this.loanChargeRepository.findById(loanChargeId) .orElseThrow(() -> new LoanChargeNotFoundException(loanChargeId)); - if (loanCharge.hasNotLoanIdentifiedBy(loanId)) { throw new LoanChargeNotFoundException(loanChargeId, loanId); } + if (loanCharge.hasNotLoanIdentifiedBy(loanId)) { + throw new LoanChargeNotFoundException(loanChargeId, loanId); + } return loanCharge; } @@ -2013,7 +2023,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf checkClientOrGroupActive(loan); this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REASSIGN_OFFICER, constructEntityMap(BusinessEntity.LOAN, loan)); - if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); } + if (!loan.hasLoanOfficer(fromLoanOfficer)) { + throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); + } loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment); @@ -2053,7 +2065,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf constructEntityMap(BusinessEntity.LOAN, loan)); checkClientOrGroupActive(loan); - if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); } + if (!loan.hasLoanOfficer(fromLoanOfficer)) { + throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); + } loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment); saveLoanWithDataIntegrityViolationChecks(loan); @@ -2080,7 +2094,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); - if (loan.getLoanOfficer() == null) { throw new LoanOfficerUnassignmentException(loanId); } + if (loan.getLoanOfficer() == null) { + throw new LoanOfficerUnassignmentException(loanId); + } this.businessEventNotifierService.notifyBusinessEventToBeExecuted(BusinessEvents.LOAN_REMOVE_OFFICER, constructEntityMap(BusinessEntity.LOAN, loan)); @@ -2339,7 +2355,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled(); - if (!isHolidayEnabled) { return; } + if (!isHolidayEnabled) { + return; + } final Collection loanStatuses = new ArrayList<>(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), LoanStatus.APPROVED.getValue(), LoanStatus.ACTIVE.getValue())); @@ -2377,11 +2395,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf private void checkClientOrGroupActive(final Loan loan) { final Client client = loan.client(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = loan.group(); if (group != null) { - if (group.isNotActive()) { throw new GroupNotActiveException(group.getId()); } + if (group.isNotActive()) { + throw new GroupNotActiveException(group.getId()); + } } } @@ -2614,7 +2636,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf loanApplicationCommandFromApiJsonHelper.validateLoanMultiDisbursementdate(element, baseDataValidator, expectedDisbursementDate, principal); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateForAddAndDeleteTranche(final Loan loan) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/RecalculateInterestPoster.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/RecalculateInterestPoster.java index 30088dff1..592b87c89 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/RecalculateInterestPoster.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/RecalculateInterestPoster.java @@ -95,7 +95,9 @@ public class RecalculateInterestPoster implements Callable { } LOG.info("Loans count {}", i); } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java index 83e5ff1b7..2291709e9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java @@ -1029,7 +1029,9 @@ public class LoanProductData implements Serializable { @Override public boolean equals(final Object obj) { - if (!(obj instanceof LoanProductData)) { return false; } + if (!(obj instanceof LoanProductData)) { + return false; + } final LoanProductData loanProductData = (LoanProductData) obj; return loanProductData.id.equals(this.id); } @@ -1109,62 +1111,86 @@ public class LoanProductData implements Serializable { } private EnumOptionData getRescheduleStrategyType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRescheduleStrategyType(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRescheduleStrategyType(); + } return null; } private EnumOptionData getInterestRecalculationCompoundingType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getInterestRecalculationCompoundingType(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getInterestRecalculationCompoundingType(); + } return null; } private EnumOptionData getInterestRecalculationCompoundingNthDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyNthDay(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationCompoundingFrequencyNthDay(); + } return null; } private EnumOptionData getInterestRecalculationCompoundingWeekDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyWeekday(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationCompoundingFrequencyWeekday(); + } return null; } private Integer getInterestRecalculationCompoundingOnDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyOnDay(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationCompoundingFrequencyOnDay(); + } return null; } private EnumOptionData getRecalculationRestFrequencyType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationRestFrequencyType(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationRestFrequencyType(); + } return null; } private Integer getRecalculationRestFrequencyInterval() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationRestFrequencyInterval(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationRestFrequencyInterval(); + } return null; } private EnumOptionData getInterestRecalculationRestNthDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationRestFrequencyNthDay(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationRestFrequencyNthDay(); + } return null; } private EnumOptionData getInterestRecalculationRestWeekDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationRestFrequencyWeekday(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationRestFrequencyWeekday(); + } return null; } private Integer getInterestRecalculationRestOnDayType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationRestFrequencyOnDay(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationRestFrequencyOnDay(); + } return null; } private EnumOptionData getRecalculationCompoundingFrequencyType() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyType(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationCompoundingFrequencyType(); + } return null; } private Integer getRecalculationCompoundingFrequencyInterval() { - if (isInterestRecalculationEnabled()) { return this.interestRecalculationData.getRecalculationCompoundingFrequencyInterval(); } + if (isInterestRecalculationEnabled()) { + return this.interestRecalculationData.getRecalculationCompoundingFrequencyInterval(); + } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AmortizationMethod.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AmortizationMethod.java index 30a9f8008..53f3fcdbf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AmortizationMethod.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/AmortizationMethod.java @@ -42,7 +42,9 @@ public enum AmortizationMethod { public static AmortizationMethod fromInt(final Integer selectedMethod) { - if (selectedMethod == null) { return null; } + if (selectedMethod == null) { + return null; + } AmortizationMethod repaymentMethod = null; switch (selectedMethod) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java index b7b925e4f..758eb606f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java @@ -699,7 +699,9 @@ public class LoanProduct extends AbstractPersistableCustom { } public boolean update(final List newProductCharges) { - if (newProductCharges == null) { return false; } + if (newProductCharges == null) { + return false; + } boolean updated = false; if (this.charges != null) { @@ -718,7 +720,9 @@ public class LoanProduct extends AbstractPersistableCustom { } public boolean updateRates(final List newProductRates) { - if (newProductRates == null) { return false; } + if (newProductRates == null) { + return false; + } boolean updated = false; if (this.rates != null) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java index 42b9dc57b..4a04a196e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductBorrowerCycleVariations.java @@ -79,7 +79,9 @@ public class LoanProductBorrowerCycleVariations extends AbstractPersistableCusto @Override public boolean equals(final Object obj) { - if (!(obj instanceof LoanProductBorrowerCycleVariations)) { return false; } + if (!(obj instanceof LoanProductBorrowerCycleVariations)) { + return false; + } final LoanProductBorrowerCycleVariations other = (LoanProductBorrowerCycleVariations) obj; return Objects.equals(loanProduct, other.loanProduct) && Objects.equals(borrowerCycleNumber, other.borrowerCycleNumber) && Objects.equals(paramType, other.paramType) && Objects.equals(valueConditionType, other.valueConditionType) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java index f231c6213..1da592a7b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductConfigurableAttributes.java @@ -211,9 +211,13 @@ public class LoanProductConfigurableAttributes extends AbstractPersistableCustom @Override public boolean equals(Object o) { - if (this == o) { return true; } + if (this == o) { + return true; + } - if (!(o instanceof LoanProductConfigurableAttributes)) { return false; } + if (!(o instanceof LoanProductConfigurableAttributes)) { + return false; + } LoanProductConfigurableAttributes that = (LoanProductConfigurableAttributes) o; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java index 9f334225e..375e6e297 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java @@ -550,7 +550,9 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche .failWithCode("causes.principal.moratorium.for.last.installment"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private Integer defaultToZeroIfNull(final Integer value) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/RecalculationFrequencyType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/RecalculationFrequencyType.java index 6984d0bde..7b8d834bc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/RecalculationFrequencyType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/RecalculationFrequencyType.java @@ -41,7 +41,9 @@ public enum RecalculationFrequencyType { } public static RecalculationFrequencyType fromInt(final Integer ruleTypeValue) { - if (ruleTypeValue == null) { return RecalculationFrequencyType.INVALID; } + if (ruleTypeValue == null) { + return RecalculationFrequencyType.INVALID; + } final RecalculationFrequencyType type = intToEnumMap.get(ruleTypeValue); return type; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java index 45d83ff41..fa689f127 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java @@ -52,7 +52,9 @@ public final class ProductMixDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -86,7 +88,9 @@ public final class ProductMixDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java index 7e7bd125d..a5f5be454 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java @@ -135,7 +135,9 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM final Map changes = new LinkedHashMap<>(); final List existedProductMixes = new ArrayList<>(this.productMixRepository.findByProductId(productId)); - if (CollectionUtils.isEmpty(existedProductMixes)) { throw new ProductMixNotFoundException(productId); } + if (CollectionUtils.isEmpty(existedProductMixes)) { + throw new ProductMixNotFoundException(productId); + } final Set restrictedIds = new HashSet<>(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); // updating with empty array means deleting the existed records. @@ -218,7 +220,9 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM final Map changes = new LinkedHashMap<>(); final List existedProductMixes = this.productMixRepository.findByProductId(productId); - if (CollectionUtils.isEmpty(existedProductMixes)) { throw new ProductMixNotFoundException(productId); } + if (CollectionUtils.isEmpty(existedProductMixes)) { + throw new ProductMixNotFoundException(productId); + } this.productMixRepository.deleteAll(existedProductMixes); changes.put("removedProductsForMix", getProductIdsFromCollection(existedProductMixes)); return new CommandProcessingResultBuilder().with(changes).withProductId(productId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java index 235a853d3..a61e0aa31 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java @@ -123,7 +123,9 @@ public final class LoanProductDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -914,7 +916,9 @@ public final class LoanProductDataValidator { } public void validateForUpdate(final String json, final LoanProduct loanProduct) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanEnumerations.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanEnumerations.java index 4f429cbe4..77f96f9b3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanEnumerations.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanEnumerations.java @@ -75,7 +75,9 @@ public class LoanEnumerations { return AccountEnumerations.loanType(id); } else if (typeName.equals(INTEREST_RECALCULATION_COMPOUNDING_TYPE)) { return interestRecalculationCompoundingType(id); - } else if (typeName.equals(RESCHEDULE_STRATEGY_TYPE)) { return rescheduleStrategyType(id); } + } else if (typeName.equals(RESCHEDULE_STRATEGY_TYPE)) { + return rescheduleStrategyType(id); + } return null; } @@ -148,7 +150,9 @@ public class LoanEnumerations { } public static EnumOptionData repaymentFrequencyNthDayType(final Integer id) { - if (id == null) { return null; } + if (id == null) { + return null; + } return repaymentFrequencyNthDayType(NthDayType.fromInt(id)); } @@ -184,7 +188,9 @@ public class LoanEnumerations { } public static EnumOptionData repaymentFrequencyDayOfWeekType(final Integer id) { - if (id == null) { return null; } + if (id == null) { + return null; + } return repaymentFrequencyDayOfWeekType(DayOfWeekType.fromInt(id)); } @@ -607,7 +613,9 @@ public class LoanEnumerations { } public static EnumOptionData interestRecalculationCompoundingNthDayType(final Integer id) { - if (id == null) { return null; } + if (id == null) { + return null; + } return interestRecalculationCompoundingNthDayType(NthDayType.fromInt(id)); } @@ -642,7 +650,9 @@ public class LoanEnumerations { } public static EnumOptionData interestRecalculationCompoundingDayOfWeekType(final Integer id) { - if (id == null) { return null; } + if (id == null) { + return null; + } return interestRecalculationCompoundingDayOfWeekType(DayOfWeekType.fromInt(id)); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java index 25dccc1ec..2e726ebff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java @@ -373,7 +373,9 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro final LocalDate closeDate = command.localDateValueOfParameterNamed("closeDate"); if (startDate != null && closeDate != null) { - if (closeDate.isBefore(startDate)) { throw new LoanProductDateException(startDate.toString(), closeDate.toString()); } + if (closeDate.isBefore(startDate)) { + throw new LoanProductDateException(startDate.toString(), closeDate.toString()); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java index 20d50bb9d..f108b80fc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java @@ -182,7 +182,9 @@ public class MeetingsApiResource { final String apiRequestBodyAsJson) { final CalendarEntityType calendarEntityType = CalendarEntityType.getEntityType(entityType); - if (calendarEntityType == null) { throw new CalendarEntityTypeNotSupportedException(entityType); } + if (calendarEntityType == null) { + throw new CalendarEntityTypeNotSupportedException(entityType); + } final CommandWrapper resourceDetails = getResourceDetails(calendarEntityType, entityId); final CommandWrapper commandRequest = new CommandWrapperBuilder().createMeeting(resourceDetails, entityType, entityId) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/attendance/AttendanceType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/attendance/AttendanceType.java index 523a4d332..b019b5d4d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/attendance/AttendanceType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/attendance/AttendanceType.java @@ -50,7 +50,9 @@ public enum AttendanceType { public static AttendanceType fromInt(final Integer attendanceTypeId) { - if (attendanceTypeId == null) { return AttendanceType.INVALID; } + if (attendanceTypeId == null) { + return AttendanceType.INVALID; + } AttendanceType attendanceType = AttendanceType.INVALID; switch (attendanceTypeId) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java index 51ebe38c8..91a39b9e2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/data/MeetingDataValidator.java @@ -63,7 +63,9 @@ public class MeetingDataValidator { public void validateForCreate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); @@ -90,7 +92,9 @@ public class MeetingDataValidator { public void validateForUpdate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); @@ -121,7 +125,9 @@ public class MeetingDataValidator { public void validateForUpdateAttendance(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); @@ -136,7 +142,9 @@ public class MeetingDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateAttendanceDetails(final JsonElement element, final DataValidatorBuilder baseDataValidator) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java index 11cdf834d..0ad4f01e9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java @@ -99,7 +99,9 @@ public class NotesApiResource { final NoteType noteType = NoteType.fromApiUrl(resourceType); - if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); } + if (noteType == null) { + throw new NoteResourceNotSupportedException(resourceType); + } this.context.authenticatedUser().validateHasReadPermission(getResourceDetails(noteType, resourceId).entityName()); @@ -127,7 +129,9 @@ public class NotesApiResource { final NoteType noteType = NoteType.fromApiUrl(resourceType); - if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); } + if (noteType == null) { + throw new NoteResourceNotSupportedException(resourceType); + } this.context.authenticatedUser().validateHasReadPermission(getResourceDetails(noteType, resourceId).entityName()); @@ -154,7 +158,9 @@ public class NotesApiResource { final NoteType noteType = NoteType.fromApiUrl(resourceType); - if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); } + if (noteType == null) { + throw new NoteResourceNotSupportedException(resourceType); + } final CommandWrapper resourceDetails = getResourceDetails(noteType, resourceId); final CommandWrapper commandRequest = new CommandWrapperBuilder().createNote(resourceDetails, resourceType, resourceId) @@ -181,7 +187,9 @@ public class NotesApiResource { final NoteType noteType = NoteType.fromApiUrl(resourceType); - if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); } + if (noteType == null) { + throw new NoteResourceNotSupportedException(resourceType); + } final CommandWrapper resourceDetails = getResourceDetails(noteType, resourceId); @@ -206,7 +214,9 @@ public class NotesApiResource { final NoteType noteType = NoteType.fromApiUrl(resourceType); - if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); } + if (noteType == null) { + throw new NoteResourceNotSupportedException(resourceType); + } final CommandWrapper resourceDetails = getResourceDetails(noteType, resourceId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java index b4516324b..e5c1e1ffe 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java @@ -60,7 +60,9 @@ public final class NoteCommandFromApiJsonDeserializer extends AbstractFromApiJso @Override public NoteCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -72,7 +74,9 @@ public final class NoteCommandFromApiJsonDeserializer extends AbstractFromApiJso } public void validateNote(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java index 0002b0734..c679946a1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java @@ -70,7 +70,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf final Long resourceId = command.getClientId(); final Client client = this.clientRepository.findOneWithNotFoundDetection(resourceId); - if (client == null) { throw new ClientNotFoundException(resourceId); } + if (client == null) { + throw new ClientNotFoundException(resourceId); + } final Note newNote = Note.clientNoteFromJson(client, command); this.noteRepository.save(newNote); @@ -234,7 +236,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf final Client client = this.clientRepository.findOneWithNotFoundDetection(resourceId); final Note noteForUpdate = this.noteRepository.findByClientIdAndId(resourceId, noteId); - if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); } + if (noteForUpdate == null) { + throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); + } final Map changes = noteForUpdate.update(command); @@ -262,7 +266,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf final Note noteForUpdate = this.noteRepository.findByGroupIdAndId(resourceId, noteId); - if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); } + if (noteForUpdate == null) { + throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); + } final Map changes = noteForUpdate.update(command); @@ -287,7 +293,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf final Loan loan = this.loanRepository.findOneWithNotFoundDetection(resourceId); final Note noteForUpdate = this.noteRepository.findByLoanIdAndId(resourceId, noteId); - if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); } + if (noteForUpdate == null) { + throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); + } final Map changes = noteForUpdate.update(command); @@ -312,7 +320,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf final Note noteForUpdate = this.noteRepository.findByLoanTransactionIdAndId(resourceId, noteId); - if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); } + if (noteForUpdate == null) { + throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); + } final Map changes = noteForUpdate.update(command); @@ -438,7 +448,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf break; default: } - if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); } + if (noteForUpdate == null) { + throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); + } return noteForUpdate; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/data/PaymentDetailData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/data/PaymentDetailData.java index c7dabef8e..19667e6bf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/data/PaymentDetailData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/data/PaymentDetailData.java @@ -55,8 +55,12 @@ public class PaymentDetailData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof PaymentDetailData)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof PaymentDetailData)) { + return false; + } PaymentDetailData that = (PaymentDetailData) o; return Objects.equals(id, that.id) && Objects.equals(paymentType, that.paymentType) && Objects.equals(accountNumber, that.accountNumber) && Objects.equals(checkNumber, that.checkNumber) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/domain/PaymentDetailAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/domain/PaymentDetailAssembler.java old mode 100755 new mode 100644 index 25cedd5ef..a5966b372 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/domain/PaymentDetailAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/domain/PaymentDetailAssembler.java @@ -40,7 +40,9 @@ public class PaymentDetailAssembler { public PaymentDetail fetchPaymentDetail(final JsonObject json) { final Long paymentTypeId = this.fromApiJsonHelper.extractLongNamed(PaymentDetailConstants.paymentTypeParamName, json); - if (paymentTypeId == null) { return null; } + if (paymentTypeId == null) { + return null; + } final PaymentType paymentType = this.repositoryWrapper.findOneWithNotFoundDetection(paymentTypeId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/service/PaymentDetailWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/service/PaymentDetailWritePlatformServiceJpaRepositoryImpl.java index e66571a33..772e7496e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/service/PaymentDetailWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymentdetail/service/PaymentDetailWritePlatformServiceJpaRepositoryImpl.java @@ -46,7 +46,9 @@ public class PaymentDetailWritePlatformServiceJpaRepositoryImpl implements Payme @Override public PaymentDetail createPaymentDetail(final JsonCommand command, final Map changes) { final Long paymentTypeId = command.longValueOfParameterNamed(PaymentDetailConstants.paymentTypeParamName); - if (paymentTypeId == null) { return null; } + if (paymentTypeId == null) { + return null; + } final PaymentType paymentType = this.paymentTyperepositoryWrapper.findOneWithNotFoundDetection(paymentTypeId); final PaymentDetail paymentDetail = PaymentDetail.generatePaymentDetail(paymentType, command, changes); @@ -64,7 +66,9 @@ public class PaymentDetailWritePlatformServiceJpaRepositoryImpl implements Payme @Transactional public PaymentDetail createAndPersistPaymentDetail(final JsonCommand command, final Map changes) { final PaymentDetail paymentDetail = createPaymentDetail(command, changes); - if (paymentDetail != null) { return persistPaymentDetail(paymentDetail); } + if (paymentDetail != null) { + return persistPaymentDetail(paymentDetail); + } return paymentDetail; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java index 943329d0f..14b18d6b9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeData.java @@ -64,9 +64,13 @@ public class PaymentTypeData implements Serializable { @Override public boolean equals(Object o) { - if (this == o) { return true; } + if (this == o) { + return true; + } - if (!(o instanceof PaymentTypeData)) { return false; } + if (!(o instanceof PaymentTypeData)) { + return false; + } PaymentTypeData that = (PaymentTypeData) o; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java index 7253bec79..b735af4a2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/data/PaymentTypeDataValidator.java @@ -56,7 +56,9 @@ public class PaymentTypeDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS); @@ -102,7 +104,9 @@ public class PaymentTypeDataValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_PAYMENT_TYPE_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/domain/RateRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/domain/RateRepositoryWrapper.java index 21a0091e1..4bed457f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/domain/RateRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/domain/RateRepositoryWrapper.java @@ -52,7 +52,9 @@ public class RateRepositoryWrapper { break; } } - if (!found) { throw new RateNotFoundException(rateId); } + if (!found) { + throw new RateNotFoundException(rateId); + } } rates.addAll(foundRates); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/serialization/RateDefinitionCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/serialization/RateDefinitionCommandFromApiJsonDeserializer.java index f9a0b40a6..86e8d59a2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/serialization/RateDefinitionCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/serialization/RateDefinitionCommandFromApiJsonDeserializer.java @@ -55,7 +55,9 @@ public class RateDefinitionCommandFromApiJsonDeserializer { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); @@ -80,7 +82,9 @@ public class RateDefinitionCommandFromApiJsonDeserializer { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -109,7 +113,9 @@ public class RateDefinitionCommandFromApiJsonDeserializer { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java index 2632ed7ec..76b0e5aa2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java @@ -53,7 +53,9 @@ public enum DepositAccountOnClosureType { public static DepositAccountOnClosureType fromInt(final Integer closureTypeValue) { - if (closureTypeValue == null) { return DepositAccountOnClosureType.INVALID; } + if (closureTypeValue == null) { + return DepositAccountOnClosureType.INVALID; + } DepositAccountOnClosureType accountOnClosureType = DepositAccountOnClosureType.INVALID; switch (closureTypeValue) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java index 9263ca56e..b6b6f1c51 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java @@ -48,7 +48,9 @@ public enum DepositAccountOnHoldTransactionType { public static DepositAccountOnHoldTransactionType fromInt(final Integer transactionType) { - if (transactionType == null) { return DepositAccountOnHoldTransactionType.INVALID; } + if (transactionType == null) { + return DepositAccountOnHoldTransactionType.INVALID; + } DepositAccountOnHoldTransactionType savingsAccountTransactionType = DepositAccountOnHoldTransactionType.INVALID; switch (transactionType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java index 147f687f1..5cc539f8e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java @@ -52,7 +52,9 @@ public enum DepositAccountType { public static DepositAccountType fromInt(final Integer transactionType) { - if (transactionType == null) { return DepositAccountType.INVALID; } + if (transactionType == null) { + return DepositAccountType.INVALID; + } DepositAccountType depositAccountType = DepositAccountType.INVALID; switch (transactionType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java index 0cfbcf350..99956b6d0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java @@ -61,7 +61,9 @@ public enum SavingsAccountTransactionType { public static SavingsAccountTransactionType fromInt(final Integer transactionType) { - if (transactionType == null) { return SavingsAccountTransactionType.INVALID; } + if (transactionType == null) { + return SavingsAccountTransactionType.INVALID; + } SavingsAccountTransactionType savingsAccountTransactionType = SavingsAccountTransactionType.INVALID; switch (transactionType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java index f912b3787..b68679885 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountData.java @@ -294,14 +294,18 @@ public class DepositAccountData { private SavingsAccountChargeData getWithdrawalFee() { for (SavingsAccountChargeData charge : this.charges()) { - if (charge.isWithdrawalFee()) { return charge; } + if (charge.isWithdrawalFee()) { + return charge; + } } return null; } private SavingsAccountChargeData getAnnualFee() { for (SavingsAccountChargeData charge : this.charges()) { - if (charge.isAnnualFee()) { return charge; } + if (charge.isAnnualFee()) { + return charge; + } } return null; } @@ -329,9 +333,15 @@ public class DepositAccountData { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof DepositAccountData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof DepositAccountData)) { + return false; + } final DepositAccountData rhs = (DepositAccountData) obj; return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).isEquals(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountDataValidator.java index c3d02e60a..21e84a6c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountDataValidator.java @@ -107,7 +107,9 @@ public class DepositAccountDataValidator { } public void validateFixedDepositForSubmit(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -128,7 +130,9 @@ public class DepositAccountDataValidator { } public void validateFixedDepositForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -149,7 +153,9 @@ public class DepositAccountDataValidator { } public void validateRecurringDepositForSubmit(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -171,7 +177,9 @@ public class DepositAccountDataValidator { } public void validateRecurringDepositForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -755,7 +763,9 @@ public class DepositAccountDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java index c50ff424c..3139292aa 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountTransactionDataValidator.java @@ -88,7 +88,9 @@ public class DepositAccountTransactionDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS); @@ -122,7 +124,9 @@ public class DepositAccountTransactionDataValidator { public void validateDepositAmountUpdate(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -148,7 +152,9 @@ public class DepositAccountTransactionDataValidator { public void validateActivation(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -168,7 +174,9 @@ public class DepositAccountTransactionDataValidator { public void validatePreMatureAmountCalculation(final String json, final DepositAccountType depositAccountType) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -189,7 +197,9 @@ public class DepositAccountTransactionDataValidator { public void validateClosing(final JsonCommand command, DepositAccountType depositAccountType, final boolean isPreMatureClose) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductDataValidator.java index 519e6a538..e4b68a8ba 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/DepositProductDataValidator.java @@ -102,7 +102,9 @@ public class DepositProductDataValidator { } public void validateForFixedDepositCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, FIXED_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -127,7 +129,9 @@ public class DepositProductDataValidator { } public void validateForFixedDepositUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, FIXED_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -151,7 +155,9 @@ public class DepositProductDataValidator { } public void validateForRecurringDepositCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, RECURRING_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -178,7 +184,9 @@ public class DepositProductDataValidator { } public void validateForRecurringDepositUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, RECURRING_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -602,7 +610,9 @@ public class DepositProductDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private boolean isCashBasedAccounting(final Integer accountingRuleType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java index 76db8df2f..38a737c7e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/FixedDepositAccountData.java @@ -522,9 +522,15 @@ public class FixedDepositAccountData extends DepositAccountData { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof FixedDepositAccountData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof FixedDepositAccountData)) { + return false; + } final FixedDepositAccountData rhs = (FixedDepositAccountData) obj; return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).isEquals(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java index b11dac96e..bc73f6375 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/RecurringDepositAccountData.java @@ -584,9 +584,15 @@ public class RecurringDepositAccountData extends DepositAccountData { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof RecurringDepositAccountData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof RecurringDepositAccountData)) { + return false; + } final RecurringDepositAccountData rhs = (RecurringDepositAccountData) obj; return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).isEquals(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java index 9fc9bdb2e..bd9593c57 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountChargeDataValidator.java @@ -55,7 +55,9 @@ public class SavingsAccountChargeDataValidator { } public void validateAdd(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -86,7 +88,9 @@ public class SavingsAccountChargeDataValidator { } public void validateUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -123,7 +127,9 @@ public class SavingsAccountChargeDataValidator { } public void validatePayCharge(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -145,6 +151,8 @@ public class SavingsAccountChargeDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountData.java index a22a9c144..77c622241 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountData.java @@ -729,14 +729,18 @@ public class SavingsAccountData implements Serializable { private SavingsAccountChargeData getWithdrawalFee() { for (SavingsAccountChargeData charge : this.charges()) { - if (charge.isWithdrawalFee()) { return charge; } + if (charge.isWithdrawalFee()) { + return charge; + } } return null; } private SavingsAccountChargeData getAnnualFee() { for (SavingsAccountChargeData charge : this.charges()) { - if (charge.isAnnualFee()) { return charge; } + if (charge.isAnnualFee()) { + return charge; + } } return null; } @@ -764,9 +768,15 @@ public class SavingsAccountData implements Serializable { @Override public boolean equals(final Object obj) { - if (obj == null) { return false; } - if (obj == this) { return true; } - if (!(obj instanceof SavingsAccountData)) { return false; } + if (obj == null) { + return false; + } + if (obj == this) { + return true; + } + if (!(obj instanceof SavingsAccountData)) { + return false; + } final SavingsAccountData rhs = (SavingsAccountData) obj; return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).isEquals(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java index d67d7153c..1f81359f8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountDataValidator.java @@ -86,7 +86,9 @@ public class SavingsAccountDataValidator { public void validateForSubmit(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -263,7 +265,9 @@ public class SavingsAccountDataValidator { public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -406,7 +410,9 @@ public class SavingsAccountDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateOverdraftParams(final DataValidatorBuilder baseDataValidator, final JsonElement element) { @@ -438,7 +444,9 @@ public class SavingsAccountDataValidator { public void validateForAssignSavingsOfficer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set supportedParameters = new HashSet<>( Arrays.asList("fromSavingsOfficerId", "toSavingsOfficerId", "assignmentDate", "locale", "dateFormat")); @@ -470,7 +478,9 @@ public class SavingsAccountDataValidator { } public void validateForUnAssignSavingsOfficer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set supportedParameters = new HashSet<>(Arrays.asList("unassignedDate", "locale", "dateFormat")); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java index 43dd3111f..98a0c5a4e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDataValidator.java @@ -77,7 +77,9 @@ public class SavingsAccountTransactionDataValidator { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -103,7 +105,9 @@ public class SavingsAccountTransactionDataValidator { public void validateActivation(final JsonCommand command) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -124,7 +128,9 @@ public class SavingsAccountTransactionDataValidator { public void validateClosing(final JsonCommand command, final SavingsAccount account) { final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, @@ -177,7 +183,9 @@ public class SavingsAccountTransactionDataValidator { public SavingsAccountTransaction validateHoldAndAssembleForm(final String json, final SavingsAccount account, final AppUser createdUser) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_HOLD_AMOUNT_REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java index 83ac7c69e..8adc4c9f5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java @@ -423,7 +423,9 @@ public class SavingsProductData implements Serializable { @Override public boolean equals(final Object obj) { - if (!(obj instanceof SavingsProductData)) { return false; } + if (!(obj instanceof SavingsProductData)) { + return false; + } final SavingsProductData productData = (SavingsProductData) obj; return productData.id.compareTo(this.id) == 0; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java index 59fdd8079..46a60b161 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductDataValidator.java @@ -112,7 +112,9 @@ public class SavingsProductDataValidator { public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -359,7 +361,9 @@ public class SavingsProductDataValidator { public void validateForUpdate(final String json, final SavingsProduct product) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS); @@ -559,7 +563,9 @@ public class SavingsProductDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private boolean isCashBasedAccounting(final Integer accountingRuleType) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java index c4624992c..b8f8e292a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java @@ -169,7 +169,9 @@ public class DepositAccountAssembler { .orElseThrow(() -> new RecurringDepositProductNotFoundException(productId)); } - if (product == null) { throw new SavingsProductNotFoundException(productId); } + if (product == null) { + throw new SavingsProductNotFoundException(productId); + } Client client = null; Group group = null; @@ -187,7 +189,9 @@ public class DepositAccountAssembler { // is // true accountType = AccountType.INDIVIDUAL; - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } } final Long groupId = this.fromApiJsonHelper.extractLongNamed(groupIdParamName, element); @@ -197,10 +201,14 @@ public class DepositAccountAssembler { } if (group != null && client != null) { - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(clientId, groupId); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(clientId, groupId); + } accountType = AccountType.JLG; if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(groupId); } + if (group.isCenter()) { + throw new CenterNotActiveException(groupId); + } throw new GroupNotActiveException(groupId); } } @@ -441,7 +449,9 @@ public class DepositAccountAssembler { final PaymentDetail paymentDetail) { AppUser user = getAppUserIfPresent(); final String json = command.json(); - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final JsonElement element = this.fromApiJsonHelper.parse(json); final Collection savingsAccountTransactions = new ArrayList<>(); final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountInterestRateChart.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountInterestRateChart.java index bf60e4947..317b16aa9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountInterestRateChart.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountInterestRateChart.java @@ -96,7 +96,9 @@ public class DepositAccountInterestRateChart extends AbstractPersistableCustom { final Set chartSlabs = setOfChartSlabs(); for (DepositAccountInterestRateChartSlabs interestRateChartSlab : chartSlabs) { - if (interestRateChartSlab.getId().equals(chartSlabId)) { return interestRateChartSlab; } + if (interestRateChartSlab.getId().equals(chartSlabId)) { + return interestRateChartSlab; + } } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountTermAndPreClosure.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountTermAndPreClosure.java index 42995846c..4e972d617 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountTermAndPreClosure.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountTermAndPreClosure.java @@ -249,7 +249,9 @@ public class DepositAccountTermAndPreClosure extends AbstractPersistableCustom { } public boolean isPreClosurePenalApplicable() { - if (this.preClosureDetail != null) { return this.preClosureDetail.preClosurePenalApplicable(); } + if (this.preClosureDetail != null) { + return this.preClosureDetail.preClosurePenalApplicable(); + } return false; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositProductAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositProductAssembler.java index f981ff457..3cef74195 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositProductAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositProductAssembler.java @@ -189,7 +189,9 @@ public class DepositProductAssembler { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public RecurringDepositProduct assembleRecurringDepositProduct(final JsonCommand command) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositTermDetail.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositTermDetail.java index 2e6c43ca3..fd36bf8ee 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositTermDetail.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositTermDetail.java @@ -140,7 +140,9 @@ public class DepositTermDetail { if (this.minDepositTerm != null && this.maxDepositTerm != null) { final Integer minDepositInDays = this.convertToSafeDays(minDepositTerm, SavingsPeriodFrequencyType.fromInt(minDepositTermType)); final Integer maxDepositInDays = this.convertToSafeDays(maxDepositTerm, SavingsPeriodFrequencyType.fromInt(maxDepositTermType)); - if (minDepositInDays.compareTo(maxDepositInDays) > 0) { return true; } + if (minDepositInDays.compareTo(maxDepositInDays) > 0) { + return true; + } } return false; } @@ -190,14 +192,18 @@ public class DepositTermDetail { } private boolean isEqualOrGreaterThanMin(LocalDate depositStartDate, LocalDate depositEndDate) { - if (minDepositTerm() == null) { return true; } + if (minDepositTerm() == null) { + return true; + } final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.minDepositTermType()); final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType); return minDepositTerm() == null || depositPeriod.compareTo(minDepositTerm()) >= 0; } private boolean isEqualOrLessThanMax(LocalDate depositStartDate, LocalDate depositEndDate) { - if (maxDepositTerm() == null) { return true; } + if (maxDepositTerm() == null) { + return true; + } final SavingsPeriodFrequencyType periodFrequencyType = SavingsPeriodFrequencyType.fromInt(this.maxDepositTermType()); final Integer depositPeriod = depositPeriod(depositStartDate, depositEndDate, periodFrequencyType); return maxDepositTerm() == null || depositPeriod.compareTo(maxDepositTerm()) <= 0; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositAccount.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositAccount.java index 5549044f6..6fb2ceff5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositAccount.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositAccount.java @@ -140,7 +140,9 @@ public class FixedDepositAccount extends SavingsAccount { actualChanges.putAll(termAndPreClosureChanges); validateDomainRules(baseDataValidator); super.validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @Override @@ -249,7 +251,9 @@ public class FixedDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.ACTIVE.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.active.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final LocalDate todayDate = DateUtils.getLocalDateOfTenant(); @@ -342,7 +346,9 @@ public class FixedDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.ACTIVE.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.active.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -352,25 +358,33 @@ public class FixedDepositAccount extends SavingsAccount { if (closedDate.isBefore(getActivationLocalDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isAccountLocked(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.lockin.period"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(maturityDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.before.maturity.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(tenantsTodayDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List savingsAccountTransactions = retreiveListOfTransactions(); if (savingsAccountTransactions.size() > 0) { @@ -378,7 +392,9 @@ public class FixedDepositAccount extends SavingsAccount { if (accountTransaction.isAfter(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.last.transaction.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -426,7 +442,9 @@ public class FixedDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.MATURED.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.matured.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -436,17 +454,23 @@ public class FixedDepositAccount extends SavingsAccount { if (closedDate.isBefore(getActivationLocalDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isBefore(maturityDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.account.maturity.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(tenantsTodayDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List savingsAccountTransactions = retreiveListOfTransactions(); @@ -455,7 +479,9 @@ public class FixedDepositAccount extends SavingsAccount { if (accountTransaction.isAfter(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.last.transaction.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -698,7 +724,9 @@ public class FixedDepositAccount extends SavingsAccount { .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); validateDomainRules(baseDataValidator); super.validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateDomainRules(final DataValidatorBuilder baseDataValidator) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositProduct.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositProduct.java index 19964bb43..aa787976b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositProduct.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/FixedDepositProduct.java @@ -219,7 +219,9 @@ public class FixedDepositProduct extends SavingsProduct { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } @Override @@ -227,7 +229,9 @@ public class FixedDepositProduct extends SavingsProduct { final Set charts = setOfCharts(); for (InterestRateChart chart : charts) { - if (chart.getId().equals(chartId)) { return chart; } + if (chart.getId().equals(chartId)) { + return chart; + } } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java index 26c191505..fa879bd6f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java @@ -173,7 +173,9 @@ public class RecurringDepositAccount extends SavingsAccount { recurringDetail.update(command); validateDomainRules(baseDataValidator); super.validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void updateDepositAmount() { @@ -276,7 +278,9 @@ public class RecurringDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.ACTIVE.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.active.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final LocalDate todayDate = DateUtils.getLocalDateOfTenant(); @@ -292,7 +296,9 @@ public class RecurringDepositAccount extends SavingsAccount { final LocalDate startDate = depositStartDate(); LocalDate maturityDate = null; final Integer depositPeriod = this.accountTermAndPreClosure.depositPeriod(); - if (depositPeriod == null) { return maturityDate; } + if (depositPeriod == null) { + return maturityDate; + } switch (this.accountTermAndPreClosure.depositPeriodFrequencyType()) { case DAYS: maturityDate = startDate.plusDays(depositPeriod); @@ -420,7 +426,9 @@ public class RecurringDepositAccount extends SavingsAccount { public LocalDate depositStartDate() { final LocalDate depositStartDate = accountTermAndPreClosure.getExpectedFirstDepositOnDate(); - if (depositStartDate == null) { return accountSubmittedOrActivationDate(); } + if (depositStartDate == null) { + return accountSubmittedOrActivationDate(); + } return depositStartDate; } @@ -434,7 +442,9 @@ public class RecurringDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.ACTIVE.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.active.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -444,31 +454,41 @@ public class RecurringDepositAccount extends SavingsAccount { if (closedDate.isBefore(getActivationLocalDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isAccountLocked(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.lockin.period"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(maturityDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.before.maturity.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(tenantsTodayDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isAccountLocked(calculateMaturityDate())) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("deposit.period.must.be.greater.than.lock.in.period", "Deposit period must be greater than account lock-in period."); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List savingsAccountTransactions = retreiveListOfTransactions(); @@ -477,7 +497,9 @@ public class RecurringDepositAccount extends SavingsAccount { if (accountTransaction.isAfter(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.last.transaction.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -539,7 +561,9 @@ public class RecurringDepositAccount extends SavingsAccount { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.MATURED.hasStateOf(currentStatus) && this.maturityDate() != null) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.matured.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -549,17 +573,23 @@ public class RecurringDepositAccount extends SavingsAccount { if (closedDate.isBefore(getActivationLocalDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (maturityDate() != null && closedDate.isBefore(maturityDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.account.maturity.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(tenantsTodayDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List savingsAccountTransactions = retreiveListOfTransactions(); if (savingsAccountTransactions.size() > 0) { @@ -567,7 +597,9 @@ public class RecurringDepositAccount extends SavingsAccount { if (accountTransaction.isAfter(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.last.transaction.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -787,7 +819,9 @@ public class RecurringDepositAccount extends SavingsAccount { final String dateAsString = formatter.print(this.accountTermAndPreClosure.getExpectedFirstDepositOnDate()); baseDataValidator.reset().parameter(DepositsApiConstants.activatedOnDateParamName).value(dateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.expected.first.deposit.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } return actualChanges; @@ -956,7 +990,9 @@ public class RecurringDepositAccount extends SavingsAccount { .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); validateDomainRules(baseDataValidator); super.validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private void validateDomainRules(final DataValidatorBuilder baseDataValidator) { @@ -1047,7 +1083,9 @@ public class RecurringDepositAccount extends SavingsAccount { baseDataValidator.reset().parameter(DepositsApiConstants.nominalAnnualInterestRateParamName).value(nominalAnnualInterestRate) .failWithCodeNoParameterAddedToErrorCode("interest.chart.or.nominal.interest.rate.required"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } /** * final boolean recurringFrequencyBeforeDepositPeriod = * recurringFrequencyBeforeDepositPeriod(); @@ -1108,7 +1146,9 @@ public class RecurringDepositAccount extends SavingsAccount { private boolean firstDepositDateBeforeAccountSubmittedOrActivationDate() { final LocalDate expectedFirstDepositLocalDate = accountTermAndPreClosure.getExpectedFirstDepositOnDate(); - if (expectedFirstDepositLocalDate == null) { return false; } + if (expectedFirstDepositLocalDate == null) { + return false; + } return expectedFirstDepositLocalDate.isBefore(accountSubmittedOrActivationDate()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositProduct.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositProduct.java index aa0b806e1..ca260923b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositProduct.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositProduct.java @@ -129,7 +129,9 @@ public class RecurringDepositProduct extends FixedDepositProduct { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public DepositProductRecurringDetail depositRecurringDetail() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java index 183a3a0a8..27b2d9b77 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java @@ -1197,7 +1197,9 @@ public class SavingsAccount extends AbstractPersistableCustom { if (!this.allowOverdraft) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("results.in.balance.going.negative"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -1245,7 +1247,9 @@ public class SavingsAccount extends AbstractPersistableCustom { .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.modifyApplicationAction); this.modifyApplication(command, actualChanges, baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void modifyApplication(final JsonCommand command, final Map actualChanges, @@ -1799,7 +1803,9 @@ public class SavingsAccount extends AbstractPersistableCustom { .resource(resourceName + SavingsApiConstants.summitalAction); validateLockinDetails(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (submittedOn.isAfter(todayDateOfTenant)) { baseDataValidator.reset().parameter(SavingsApiConstants.submittedOnDateParamName).value(submittedOn) @@ -1815,7 +1821,9 @@ public class SavingsAccount extends AbstractPersistableCustom { .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.client.activation.date"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } protected LocalDate getSubmittedOnLocalDate() { @@ -1859,7 +1867,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.approvedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = SavingsAccountStatusType.APPROVED.getValue(); @@ -1884,7 +1894,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.approvedOnDateParamName).value(submittalDateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.submittal.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (approvedOn.isAfter(tenantsTodayDate)) { @@ -1892,7 +1904,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.approvedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_APPLICATION_APPROVED, approvedOn); @@ -1924,7 +1938,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.approvedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.approved.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue(); @@ -1955,7 +1971,9 @@ public class SavingsAccount extends AbstractPersistableCustom { } } - if (transactionToUndo == null) { throw new SavingsAccountTransactionNotFoundException(this.getId(), transactionId); } + if (transactionToUndo == null) { + throw new SavingsAccountTransactionNotFoundException(this.getId(), transactionId); + } validateAttemptToUndoTransferRelatedTransactions(transactionToUndo); validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_UNDO_TRANSACTION, transactionToUndo.transactionLocalDate()); @@ -2010,7 +2028,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.rejectedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = SavingsAccountStatusType.REJECTED.getValue(); @@ -2041,7 +2061,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.rejectedOnDateParamName).value(submittalDateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.submittal.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (rejectedOn.isAfter(tenantsTodayDate)) { @@ -2049,7 +2071,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.rejectedOnDateParamName).value(rejectedOn) .failWithCodeNoParameterAddedToErrorCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_APPLICATION_REJECTED, rejectedOn); @@ -2070,7 +2094,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.withdrawnOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.status = SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT.getValue(); @@ -2100,7 +2126,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.withdrawnOnDateParamName).value(submittalDateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.submittal.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (withdrawnOn.isAfter(tenantsTodayDate)) { @@ -2108,7 +2136,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.withdrawnOnDateParamName).value(withdrawnOn) .failWithCodeNoParameterAddedToErrorCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_APPLICATION_WITHDRAWAL_BY_CUSTOMER, withdrawnOn); @@ -2129,7 +2159,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.approved.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -2161,7 +2193,9 @@ public class SavingsAccount extends AbstractPersistableCustom { final String dateAsString = formatter.print(this.client.getActivationLocalDate()); baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName).value(dateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.client.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (this.group != null && this.group.isActivatedAfter(activationDate)) { @@ -2169,7 +2203,9 @@ public class SavingsAccount extends AbstractPersistableCustom { final String dateAsString = formatter.print(this.client.getActivationLocalDate()); baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName).value(dateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.group.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final LocalDate approvalDate = getApprovedOnLocalDate(); @@ -2181,7 +2217,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName).value(dateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.approval.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (activationDate.isAfter(tenantsTodayDate)) { @@ -2189,7 +2227,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName).value(activationDate) .failWithCodeNoParameterAddedToErrorCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_ACTIVATE, activationDate); @@ -2265,7 +2305,9 @@ public class SavingsAccount extends AbstractPersistableCustom { final SavingsAccountStatusType currentStatus = SavingsAccountStatusType.fromInt(this.status); if (!SavingsAccountStatusType.ACTIVE.hasStateOf(currentStatus)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("not.in.active.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Locale locale = command.extractLocale(); @@ -2275,12 +2317,16 @@ public class SavingsAccount extends AbstractPersistableCustom { if (closedDate.isBefore(getActivationLocalDate())) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.activation.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (closedDate.isAfter(tenantsTodayDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("cannot.be.a.future.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List savingsAccountTransactions = retreiveListOfTransactions(); if (savingsAccountTransactions.size() > 0) { @@ -2288,12 +2334,16 @@ public class SavingsAccount extends AbstractPersistableCustom { if (accountTransaction.isAfter(closedDate)) { baseDataValidator.reset().parameter(SavingsApiConstants.closedOnDateParamName).value(closedDate) .failWithCode("must.be.after.last.transaction.date"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } if (getAccountBalance().doubleValue() != 0) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("results.in.balance.not.zero"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } validateActivityNotBeforeClientOrGroupTransferDate(SavingsEvent.SAVINGS_CLOSE_ACCOUNT, closedDate); this.status = SavingsAccountStatusType.CLOSED.getValue(); @@ -2394,7 +2444,9 @@ public class SavingsAccount extends AbstractPersistableCustom { } public boolean update(final Set newSavingsAccountCharges) { - if (newSavingsAccountCharges == null) { return false; } + if (newSavingsAccountCharges == null) { + return false; + } if (this.charges == null) { this.charges = new HashSet<>(); @@ -2405,7 +2457,9 @@ public class SavingsAccount extends AbstractPersistableCustom { } public boolean hasCurrencyCodeOf(final String matchingCurrencyCode) { - if (this.currency == null) { return false; } + if (this.currency == null) { + return false; + } return this.currency.getCode().equalsIgnoreCase(matchingCurrencyCode); } @@ -2416,12 +2470,16 @@ public class SavingsAccount extends AbstractPersistableCustom { if (isClosed()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("delete.transaction.invalid.account.is.closed"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isActive() || isApproved()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("delete.transaction.invalid.account.is.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.charges.remove(charge); @@ -2435,33 +2493,45 @@ public class SavingsAccount extends AbstractPersistableCustom { if (isClosed()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.closed"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final SavingsAccountCharge savingsAccountCharge = getCharge(savingsAccountChargeId); if (savingsAccountCharge.isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("charge.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (savingsAccountCharge.isWithdrawalFee()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.waiver.of.withdrawal.fee.not.supported"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } // validate charge is not already paid or waived if (savingsAccountCharge.isWaived()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.already.waived"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } else if (savingsAccountCharge.isPaid()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.paid"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } // waive charge @@ -2479,13 +2549,17 @@ public class SavingsAccount extends AbstractPersistableCustom { if (isClosed()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.closed"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!hasCurrencyCodeOf(chargeDefinition.getCurrencyCode())) { baseDataValidator.reset() .failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.currency.and.charge.currency.not.same"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final LocalDate chargeDueDate = savingsAccountCharge.getDueLocalDate(); @@ -2545,14 +2619,18 @@ public class SavingsAccount extends AbstractPersistableCustom { private boolean isWithDrawalFeeExists() { for (SavingsAccountCharge charge : this.charges()) { - if (charge.isWithdrawalFee()) { return true; } + if (charge.isWithdrawalFee()) { + return true; + } } return false; } private boolean isAnnualFeeExists() { for (SavingsAccountCharge charge : this.charges()) { - if (charge.isAnnualFee()) { return true; } + if (charge.isAnnualFee()) { + return true; + } } return false; } @@ -2566,17 +2644,23 @@ public class SavingsAccount extends AbstractPersistableCustom { if (isClosed()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.closed"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (savingsAccountCharge.isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("charge.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (getActivationLocalDate() != null && transactionDate.isBefore(getActivationLocalDate())) { @@ -2621,16 +2705,22 @@ public class SavingsAccount extends AbstractPersistableCustom { // validate charge is not already paid or waived if (savingsAccountCharge.isWaived()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.already.waived"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } else if (savingsAccountCharge.isPaid()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.charge.is.paid"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final Money chargePaid = Money.of(currency, amountPaid); if (!savingsAccountCharge.getAmountOutstanding(getCurrency()).isGreaterThanOrEqualTo(chargePaid)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.charge.amount.paid.in.access"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.payCharge(savingsAccountCharge, chargePaid, transactionDate, user); @@ -2681,7 +2771,9 @@ public class SavingsAccount extends AbstractPersistableCustom { } } - if (charge == null) { throw new SavingsAccountChargeNotFoundException(savingsAccountChargeId, getId()); } + if (charge == null) { + throw new SavingsAccountChargeNotFoundException(savingsAccountChargeId, getId()); + } return charge; } @@ -2704,7 +2796,9 @@ public class SavingsAccount extends AbstractPersistableCustom { validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public boolean allowOverdraft() { @@ -2724,7 +2818,9 @@ public class SavingsAccount extends AbstractPersistableCustom { } public boolean accountSubmittedAndActivationOnSameDate() { - if (getSubmittedOnLocalDate() == null || getActivationLocalDate() == null) { return false; } + if (getSubmittedOnLocalDate() == null || getActivationLocalDate() == null) { + return false; + } return getActivationLocalDate().isEqual(getSubmittedOnLocalDate()); } @@ -2777,16 +2873,28 @@ public class SavingsAccount extends AbstractPersistableCustom { } public boolean isTransactionAllowed(SavingsAccountTransactionType transactionType, LocalDate transactionDate) { - if (!isTransactionsAllowed()) { return false; } + if (!isTransactionsAllowed()) { + return false; + } Client client = getClient(); - if (client != null && !client.isActive()) { return false; } + if (client != null && !client.isActive()) { + return false; + } Group group = group(); - if (group != null && !group.isActive()) { return false; } + if (group != null && !group.isActive()) { + return false; + } - if (transactionDate == null) { return true; } - if (DateUtils.isDateInTheFuture(transactionDate) || transactionDate.isBefore(getActivationLocalDate())) { return false; } - if (transactionType.isCredit()) { return true; } + if (transactionDate == null) { + return true; + } + if (DateUtils.isDateInTheFuture(transactionDate) || transactionDate.isBefore(getActivationLocalDate())) { + return false; + } + if (transactionType.isCredit()) { + return true; + } return !isAccountLocked(transactionDate); } @@ -2801,12 +2909,16 @@ public class SavingsAccount extends AbstractPersistableCustom { if (isClosed()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.closed"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (isNotActive()) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("transaction.invalid.account.is.not.active"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } savingsAccountCharge.inactiavateCharge(inactivationOnDate); } @@ -2940,7 +3052,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName) .failWithCodeNoParameterAddedToErrorCode(SavingsApiConstants.ERROR_MSG_SAVINGS_ACCOUNT_NOT_ACTIVE); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue(); @@ -2970,7 +3084,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.blocked.state"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } this.sub_status = SavingsAccountSubStatusEnum.NONE.getValue(); actualChanges.put(SavingsApiConstants.subStatusParamName, SavingsEnumerations.subStatus(this.sub_status)); return actualChanges; @@ -2995,7 +3111,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName) .value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)).failWithCodeNoParameterAddedToErrorCode("currently.set"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (SavingsAccountSubStatusEnum.BLOCK_DEBIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) { this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue(); } else { @@ -3025,7 +3143,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.statusParamName) .failWithCodeNoParameterAddedToErrorCode("credits.are.not.blocked"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) { this.sub_status = SavingsAccountSubStatusEnum.BLOCK_DEBIT.getValue(); } else { @@ -3054,7 +3174,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName) .value(SavingsAccountSubStatusEnum.fromInt(currentSubstatus)).failWithCodeNoParameterAddedToErrorCode("currently.set"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (SavingsAccountSubStatusEnum.BLOCK_CREDIT.hasStateOf(SavingsAccountSubStatusEnum.fromInt(currentSubstatus))) { this.sub_status = SavingsAccountSubStatusEnum.BLOCK.getValue(); } else { @@ -3087,7 +3209,9 @@ public class SavingsAccount extends AbstractPersistableCustom { baseDataValidator.reset().parameter(SavingsApiConstants.subStatusParamName) .failWithCodeNoParameterAddedToErrorCode("debits.are.not.blocked"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) { this.sub_status = SavingsAccountSubStatusEnum.BLOCK_CREDIT.getValue(); } else { @@ -3107,7 +3231,9 @@ public class SavingsAccount extends AbstractPersistableCustom { public void validateForAccountBlock() { final SavingsAccountSubStatusEnum currentSubStatus = SavingsAccountSubStatusEnum.fromInt(this.getSubStatus()); - if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) { throw new SavingsAccountBlockedException(this.getId()); } + if (SavingsAccountSubStatusEnum.BLOCK.hasStateOf(currentSubStatus)) { + throw new SavingsAccountBlockedException(this.getId()); + } } public void validateForDebitBlock() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountAssembler.java index a42c0cc55..5c788d1e6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountAssembler.java @@ -133,7 +133,9 @@ public class SavingsAccountAssembler { if (clientId != null) { client = this.clientRepository.findOneWithNotFoundDetection(clientId); accountType = AccountType.INDIVIDUAL; - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } } final Long groupId = this.fromApiJsonHelper.extractLongNamed(groupIdParamName, element); @@ -141,13 +143,17 @@ public class SavingsAccountAssembler { group = this.groupRepository.findOneWithNotFoundDetection(groupId); accountType = AccountType.GROUP; if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(groupId); } + if (group.isCenter()) { + throw new CenterNotActiveException(groupId); + } throw new GroupNotActiveException(groupId); } } if (group != null && client != null) { - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(clientId, groupId); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(clientId, groupId); + } accountType = AccountType.JLG; } @@ -324,19 +330,25 @@ public class SavingsAccountAssembler { AccountType accountType = AccountType.INVALID; if (client != null) { accountType = AccountType.INDIVIDUAL; - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } if (group != null) { accountType = AccountType.GROUP; if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(group.getId()); } + if (group.isCenter()) { + throw new CenterNotActiveException(group.getId()); + } throw new GroupNotActiveException(group.getId()); } } if (group != null && client != null) { - if (!group.hasClientAsMember(client)) { throw new ClientNotInGroupException(client.getId(), group.getId()); } + if (!group.hasClientAsMember(client)) { + throw new ClientNotInGroupException(client.getId(), group.getId()); + } accountType = AccountType.JLG; } final SavingsProduct product = this.savingProductRepository.findById(productId).get(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java index 25706ea49..a447503f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountCharge.java @@ -689,14 +689,20 @@ public class SavingsAccountCharge extends AbstractPersistableCustom { } public boolean hasCurrencyCodeOf(final String matchingCurrencyCode) { - if (this.currencyCode() == null || matchingCurrencyCode == null) { return false; } + if (this.currencyCode() == null || matchingCurrencyCode == null) { + return false; + } return this.currencyCode().equalsIgnoreCase(matchingCurrencyCode); } @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (!(o instanceof SavingsAccountCharge)) { return false; } + if (this == o) { + return true; + } + if (!(o instanceof SavingsAccountCharge)) { + return false; + } SavingsAccountCharge that = (SavingsAccountCharge) o; return Objects.equals(penaltyCharge, that.penaltyCharge) && Objects.equals(paid, that.paid) && Objects.equals(waived, that.waived) && Objects.equals(status, that.status) && Objects.equals(savingsAccount, that.savingsAccount) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeAssembler.java index 9240144c0..71baa744d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeAssembler.java @@ -190,6 +190,8 @@ public class SavingsAccountChargeAssembler { isOneAnnualPresent = true; } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepositoryWrapper.java index 29c179d07..1f8b9ead3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountChargeRepositoryWrapper.java @@ -46,7 +46,9 @@ public class SavingsAccountChargeRepositoryWrapper { public SavingsAccountCharge findOneWithNotFoundDetection(final Long id, final Long savingsAccountId) { final SavingsAccountCharge savingsAccountCharge = this.repository.findByIdAndSavingsAccountId(id, savingsAccountId); - if (savingsAccountCharge == null) { throw new SavingsAccountChargeNotFoundException(id); } + if (savingsAccountCharge == null) { + throw new SavingsAccountChargeNotFoundException(id); + } return savingsAccountCharge; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java index 71c08248f..26b0de2a9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountRepositoryWrapper.java @@ -61,7 +61,9 @@ public class SavingsAccountRepositoryWrapper { @Transactional(readOnly = true) public SavingsAccount findOneWithNotFoundDetection(final Long savingsId, final DepositAccountType depositAccountType) { final SavingsAccount account = this.repository.findByIdAndDepositAccountType(savingsId, depositAccountType.getValue()); - if (account == null) { throw new SavingsAccountNotFoundException(savingsId); } + if (account == null) { + throw new SavingsAccountNotFoundException(savingsId); + } account.loadLazyCollections(); return account; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java index 065c12d52..5bb221f4b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransaction.java @@ -721,7 +721,9 @@ public final class SavingsAccountTransaction extends AbstractPersistableCustom { } private SavingsAccountChargePaidBy getSavingsAccountChargePaidBy() { - if (!CollectionUtils.isEmpty(this.savingsAccountChargesPaid)) { return this.savingsAccountChargesPaid.iterator().next(); } + if (!CollectionUtils.isEmpty(this.savingsAccountChargesPaid)) { + return this.savingsAccountChargesPaid.iterator().next(); + } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java index e4bcd1ffb..8af02b9e1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsProduct.java @@ -625,7 +625,9 @@ public class SavingsProduct extends AbstractPersistableCustom { .inMinMaxRange(0, 3); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public boolean isCashBasedAccountingEnabled() { @@ -651,7 +653,9 @@ public class SavingsProduct extends AbstractPersistableCustom { } public boolean update(final Set newSavingsProductCharges) { - if (newSavingsProductCharges == null) { return false; } + if (newSavingsProductCharges == null) { + return false; + } boolean updated = false; if (this.charges != null) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/exception/PostInterestAsOnDateException.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/exception/PostInterestAsOnDateException.java index 1bcccf04d..cb785ddde 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/exception/PostInterestAsOnDateException.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/exception/PostInterestAsOnDateException.java @@ -46,7 +46,9 @@ public class PostInterestAsOnDateException extends AbstractPlatformDomainRuleExc return "error.msg.nullDatePassed"; } else if (name().toString().equalsIgnoreCase("ACTIVATION_DATE")) { return "error.msg.before activation date"; - } else if (name().toString().equalsIgnoreCase("LAST_TRANSACTION_DATE")) { return "error.msg.countInterest"; } + } else if (name().toString().equalsIgnoreCase("LAST_TRANSACTION_DATE")) { + return "error.msg.countInterest"; + } return name().toString(); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java index d76b10dff..6f6d93a31 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java @@ -104,7 +104,9 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D sql.append("END"); Collection chartDatas = this.jdbcTemplate.query(sql.toString(), this.chartExtractor, new Object[] { chartId }); - if (chartDatas == null || chartDatas.isEmpty()) { throw new DepositAccountInterestRateChartNotFoundException(chartId); } + if (chartDatas == null || chartDatas.isEmpty()) { + throw new DepositAccountInterestRateChartNotFoundException(chartId); + } return chartDatas.iterator().next(); } @@ -149,7 +151,9 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D Collection chartDatas = this.jdbcTemplate.query(sql.toString(), this.chartExtractor, new Object[] { accountId }); - if (chartDatas == null || chartDatas.isEmpty()) { throw new DepositAccountInterestRateChartNotFoundException(accountId); } + if (chartDatas == null || chartDatas.isEmpty()) { + throw new DepositAccountInterestRateChartNotFoundException(accountId); + } return chartDatas.iterator().next(); } @@ -342,7 +346,9 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "ircdId"); // If there are not chart Slabs are associated then in // InterestRateChartExtractor the chart Slabs id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String description = rs.getString("ircdDescription"); final Integer fromPeriod = JdbcSupport.getInteger(rs, "ircdFromPeriod"); @@ -377,7 +383,9 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D final Long id = JdbcSupport.getLongDefaultToNullIfZero(rs, "iriId"); // If there are not Incentive are associated then in // InterestRateChartExtractor the incentive id will be null. - if (id == null) { return null; } + if (id == null) { + return null; + } final String attributeValue = rs.getString("attributeValue"); String attributeValueDesc = null; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java index a54431b96..0e5b90011 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java @@ -165,7 +165,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead this.context.authenticatedUser(); final DepositAccountMapper depositAccountMapper = this.getDepositAccountMapper(depositAccountType); - if (depositAccountMapper == null) { return null; } + if (depositAccountMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select "); @@ -185,7 +187,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead depositAccountType.resourceName()); final DepositAccountMapper depositAccountMapper = this.getDepositAccountMapper(depositAccountType); - if (depositAccountMapper == null) { return null; } + if (depositAccountMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select SQL_CALC_FOUND_ROWS "); @@ -232,7 +236,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead this.context.authenticatedUser(); final DepositAccountMapper depositAccountMapper = this.getDepositAccountMapper(depositAccountType); - if (depositAccountMapper == null) { return null; } + if (depositAccountMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select "); @@ -253,7 +259,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead this.context.authenticatedUser(); final DepositAccountMapper depositAccountMapper = this.getDepositAccountMapper(depositAccountType); - if (depositAccountMapper == null) { return null; } + if (depositAccountMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select "); @@ -953,7 +961,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead private DepositAccountMapper getDepositAccountMapper(final DepositAccountType depositAccountType) { if (depositAccountType.isFixedDeposit()) { return this.fixedDepositAccountRowMapper; - } else if (depositAccountType.isRecurringDeposit()) { return this.recurringDepositAccountRowMapper; } + } else if (depositAccountType.isRecurringDeposit()) { + return this.recurringDepositAccountRowMapper; + } return null; } @@ -1354,7 +1364,9 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead GroupGeneralData group) { if (depositAccountType.isFixedDeposit()) { return new FixedDepositAccountTemplateMapper(client, group); - } else if (depositAccountType.isRecurringDeposit()) { return new RecurringDepositAccountTemplateMapper(client, group); } + } else if (depositAccountType.isRecurringDeposit()) { + return new RecurringDepositAccountTemplateMapper(client, group); + } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java index 4245e3694..f833da2e0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java @@ -596,7 +596,9 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo errors.add(e); } } - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } @Override @@ -622,7 +624,9 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(transactionId, savingsId); - if (savingsAccountTransaction == null) { throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); } + if (savingsAccountTransaction == null) { + throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); + } if (!allowAccountTransferModification && this.accountTransfersReadPlatformService.isAccountTransfer(transactionId, PortfolioAccountType.SAVINGS)) { @@ -701,7 +705,9 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(transactionId, savingsId); - if (savingsAccountTransaction == null) { throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); } + if (savingsAccountTransaction == null) { + throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); + } if ((!savingsAccountTransaction.isDeposit() && !savingsAccountTransaction.isWithdrawal()) || savingsAccountTransaction.isReversed()) { @@ -798,11 +804,15 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo private void checkClientOrGroupActive(final SavingsAccount account) { final Client client = account.getClient(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = account.group(); if (group != null) { - if (group.isNotActive()) { throw new GroupNotActiveException(group.getId()); } + if (group.isNotActive()) { + throw new GroupNotActiveException(group.getId()); + } } } @@ -925,7 +935,9 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME + DepositsApiConstants.preMatureCloseAction); baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("can.not.close.as.premature"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.depositAccountDomainService.handleRDAccountPreMatureClosure(account, paymentDetail, user, command, @@ -1090,14 +1102,18 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo && this.holidayRepository.isHoliday(savingsAccount.officeId(), savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.on.holiday"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.a.nonworking.day"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -1145,14 +1161,18 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo && this.holidayRepository.isHoliday(savingsAccount.officeId(), savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.on.holiday"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.a.nonworking.day"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -1272,14 +1292,18 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo && this.holidayRepository.isHoliday(savingsAccountCharge.savingsAccount().officeId(), transactionDate)) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(transactionDate.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("transaction.not.allowed.transaction.date.is.on.holiday"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(transactionDate)) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(transactionDate.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("transaction.not.allowed.transaction.date.is.a.nonworking.day"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.payCharge(savingsAccountCharge, transactionDate, amountPaid, fmt); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index 80aa784fd..0fe3e9d9c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -545,7 +545,9 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl final Long clientId = command.longValueOfParameterNamed(SavingsApiConstants.clientIdParamName); if (clientId != null) { final Client client = this.clientRepository.findOneWithNotFoundDetection(clientId); - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } account.update(client); } else { final Client client = null; @@ -558,7 +560,9 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl if (groupId != null) { final Group group = this.groupRepository.findById(groupId).orElseThrow(() -> new GroupNotFoundException(groupId)); if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(groupId); } + if (group.isCenter()) { + throw new CenterNotActiveException(groupId); + } throw new GroupNotActiveException(groupId); } account.update(group); @@ -613,7 +617,9 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl baseDataValidator.reset().parameter(DepositsApiConstants.activatedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List relatedNotes = this.noteRepository.findBySavingsAccountId(savingsId); @@ -773,12 +779,16 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl private void checkClientOrGroupActive(final SavingsAccount account) { final Client client = account.getClient(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = account.group(); if (group != null) { if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(group.getId()); } + if (group.isCenter()) { + throw new CenterNotActiveException(group.getId()); + } throw new GroupNotActiveException(group.getId()); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositProductReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositProductReadPlatformServiceImpl.java index 9acf281b8..4e0b100f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositProductReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositProductReadPlatformServiceImpl.java @@ -65,7 +65,9 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead this.context.authenticatedUser(); final DepositProductMapper depositProductMapper = this.getDepositProductMapper(depositAccountType); - if (depositProductMapper == null) { return null; } + if (depositProductMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select "); @@ -93,7 +95,9 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead this.context.authenticatedUser(); final DepositProductMapper depositProductMapper = this.getDepositProductMapper(depositAccountType); - if (depositProductMapper == null) { return null; } + if (depositProductMapper == null) { + return null; + } final StringBuilder sqlBuilder = new StringBuilder(400); sqlBuilder.append("select "); @@ -369,7 +373,9 @@ public class DepositProductReadPlatformServiceImpl implements DepositProductRead private DepositProductMapper getDepositProductMapper(final DepositAccountType depositAccountType) { if (depositAccountType.isFixedDeposit()) { return this.fixedDepositProductRowMapper; - } else if (depositAccountType.isRecurringDeposit()) { return this.recurringDepositProductRowMapper; } + } else if (depositAccountType.isRecurringDeposit()) { + return this.recurringDepositProductRowMapper; + } return null; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java index ccdd96233..41bcf1909 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java @@ -48,12 +48,16 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateApproval(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList("approvedOnDate", "note", "locale", "dateFormat")); @@ -75,7 +79,9 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { public void validateRejection(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList("rejectedOnDate", "note", "locale", "dateFormat")); @@ -97,7 +103,9 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { public void validateApplicantWithdrawal(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set disbursementParameters = new HashSet<>(Arrays.asList("withdrawnOnDate", "note", "locale", "dateFormat")); @@ -118,7 +126,9 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { } public void validateForUndo(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Set undoSupportedParameters = new HashSet<>(Arrays.asList("note")); final Type typeOfMap = new TypeToken>() {}.getType(); @@ -135,6 +145,8 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { baseDataValidator.reset().parameter(note).value(noteText).notExceedingLengthOf(1000); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java index 18ada75dc..76ff80b65 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java @@ -521,7 +521,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } LocalDate today = DateUtils.getLocalDateOfTenant(); - if (transactionDate.isAfter(today)) { throw new PostInterestAsOnDateException(PostInterestAsOnExceptionType.FUTURE_DATE); } + if (transactionDate.isAfter(today)) { + throw new PostInterestAsOnDateException(PostInterestAsOnExceptionType.FUTURE_DATE); + } } postInterest(account, postInterestAs, transactionDate); @@ -587,7 +589,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(transactionId, savingsId); - if (savingsAccountTransaction == null) { throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); } + if (savingsAccountTransaction == null) { + throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); + } if (!allowAccountTransferModification && this.accountTransfersReadPlatformService.isAccountTransfer(transactionId, PortfolioAccountType.SAVINGS)) { @@ -658,7 +662,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository .findOneByIdAndSavingsAccountId(transactionId, savingsId); - if (savingsAccountTransaction == null) { throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); } + if (savingsAccountTransaction == null) { + throw new SavingsAccountTransactionNotFoundException(savingsId, transactionId); + } if (!(savingsAccountTransaction.isDeposit() || savingsAccountTransaction.isWithdrawal()) || savingsAccountTransaction.isReversed()) { @@ -757,11 +763,15 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi private void checkClientOrGroupActive(final SavingsAccount account) { final Client client = account.getClient(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = account.group(); if (group != null) { - if (group.isNotActive()) { throw new GroupNotActiveException(group.getId()); } + if (group.isNotActive()) { + throw new GroupNotActiveException(group.getId()); + } } } @@ -823,7 +833,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi break; } } - if (postInterestOnClosingDate == false) { throw new PostInterestClosingDateException(); } + if (postInterestOnClosingDate == false) { + throw new PostInterestClosingDateException(); + } } final Map changes = new LinkedHashMap<>(); @@ -1027,7 +1039,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.a.nonworking.day"); } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } savingsAccount.addCharge(fmt, savingsAccountCharge, chargeDefinition); this.savingsAccountChargeRepository.save(savingsAccountCharge); @@ -1072,14 +1086,18 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi && this.holidayRepository.isHoliday(savingsAccount.officeId(), savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.on.holiday"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(savingsAccountCharge.getDueLocalDate())) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(savingsAccountCharge.getDueLocalDate().toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("charge.due.date.is.a.nonworking.day"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } @@ -1196,14 +1214,18 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi && this.holidayRepository.isHoliday(savingsAccountCharge.savingsAccount().officeId(), transactionDate)) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(transactionDate.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("transaction.not.allowed.transaction.date.is.on.holiday"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } if (!this.configurationDomainService.allowTransactionsOnNonWorkingDayEnabled() && !this.workingDaysRepository.isWorkingDay(transactionDate)) { baseDataValidator.reset().parameter(dueAsOfDateParamName).value(transactionDate.toString(fmt)) .failWithCodeNoParameterAddedToErrorCode("transaction.not.allowed.transaction.date.is.a.nonworking.day"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } this.payCharge(savingsAccountCharge, transactionDate, amountPaid, fmt, user); @@ -1316,14 +1338,18 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi if (!savingsAccountCharge.isRecurringFee()) { baseDataValidator.reset().parameter(null).value(savingsAccountCharge.getId()) .failWithCodeNoParameterAddedToErrorCode("charge.inactivation.allowed.only.for.recurring.charges"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } else { final LocalDate nextDueDate = savingsAccountCharge.getNextDueDateFrom(inactivationOnDate); if (savingsAccountCharge.isChargeIsDue(nextDueDate)) { baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("inactivation.of.charge.not.allowed.when.charge.is.due"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } else if (savingsAccountCharge.isChargeIsOverPaid(nextDueDate)) { final List chargePayments = new ArrayList<>(); @@ -1357,7 +1383,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } private SavingsAccountTransaction getLastChargePayment(final List chargePayments) { - if (!CollectionUtils.isEmpty(chargePayments)) { return chargePayments.get(chargePayments.size() - 1); } + if (!CollectionUtils.isEmpty(chargePayments)) { + return chargePayments.get(chargePayments.size() - 1); + } return null; } @@ -1412,7 +1440,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi this.fromApiJsonDeserializer.validateForUnAssignSavingsOfficer(command.json()); final SavingsAccount savingsForUpdate = this.savingAccountRepositoryWrapper.findOneWithNotFoundDetection(savingsAccountId); - if (savingsForUpdate.getSavingsOfficer() == null) { throw new SavingsOfficerUnassignmentException(savingsAccountId); } + if (savingsForUpdate.getSavingsOfficer() == null) { + throw new SavingsOfficerUnassignmentException(savingsAccountId); + } final LocalDate dateOfSavingsOfficerUnassigned = command.localDateValueOfParameterNamed("unassignedDate"); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index 080b57dec..ac1438487 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -289,8 +289,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl .resetIsAcceptingChild(gsimRepository.findOneByIsAcceptingChildAndApplicationId(true, applicationId)); } } - } else // for applications other than GSIM - { + } else { + // for applications other than GSIM generateAccountNumber(account); } } @@ -370,7 +370,9 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl final Long clientId = command.longValueOfParameterNamed(SavingsApiConstants.clientIdParamName); if (clientId != null) { final Client client = this.clientRepository.findOneWithNotFoundDetection(clientId); - if (client.isNotActive()) { throw new ClientNotActiveException(clientId); } + if (client.isNotActive()) { + throw new ClientNotActiveException(clientId); + } account.update(client); } else { final Client client = null; @@ -383,7 +385,9 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl if (groupId != null) { final Group group = this.groupRepository.findById(groupId).orElseThrow(() -> new GroupNotFoundException(groupId)); if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(groupId); } + if (group.isCenter()) { + throw new CenterNotActiveException(groupId); + } throw new GroupNotActiveException(groupId); } account.update(group); @@ -457,7 +461,9 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl baseDataValidator.reset().parameter(SavingsApiConstants.activatedOnDateParamName) .failWithCodeNoParameterAddedToErrorCode("not.in.submittedandpendingapproval.state"); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } final List relatedNotes = this.noteRepository.findBySavingsAccountId(savingsId); @@ -704,12 +710,16 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl private void checkClientOrGroupActive(final SavingsAccount account) { final Client client = account.getClient(); if (client != null) { - if (client.isNotActive()) { throw new ClientNotActiveException(client.getId()); } + if (client.isNotActive()) { + throw new ClientNotActiveException(client.getId()); + } } final Group group = account.group(); if (group != null) { if (group.isNotActive()) { - if (group.isCenter()) { throw new CenterNotActiveException(group.getId()); } + if (group.isCenter()) { + throw new CenterNotActiveException(group.getId()); + } throw new GroupNotActiveException(group.getId()); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsEnumerations.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsEnumerations.java index d827e4180..b6e4fc575 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsEnumerations.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsEnumerations.java @@ -78,7 +78,9 @@ public class SavingsEnumerations { return preClosurePenaltyInterestOnType(id); } else if (typeName.equals(INTEREST_CALCULATION_DAYS_IN_YEAR)) { return interestCalculationDaysInYearType(id); - } else if (typeName.equals(RECURRING_FREQUENCY_TYPE)) { return depositPeriodFrequency(id); } + } else if (typeName.equals(RECURRING_FREQUENCY_TYPE)) { + return depositPeriodFrequency(id); + } return null; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java index 1c6368fee..4913793f9 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularServiceImpl.java @@ -83,7 +83,9 @@ public class SavingsSchedularServiceImpl implements SavingsSchedularService { totalPageSize = savingsAccounts.getTotalPages(); } while (page < totalPageSize); - if (!errors.isEmpty()) { throw new JobExecutionException(errors); } + if (!errors.isEmpty()) { + throw new JobExecutionException(errors); + } } @Override diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java index a261a8120..0273be19a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/data/AdHocQueryDataValidator.java @@ -73,7 +73,9 @@ public class AdHocQueryDataValidator { public void validateAdHocQueryParameters(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS); @@ -196,7 +198,9 @@ public class AdHocQueryDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public AdHocQuerySearchConditions retrieveSearchConditions(String json) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java index add89487f..068a3aacd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java @@ -143,7 +143,9 @@ public class SelfAccountTransferApiResource { Long transferLimit = this.tptBeneficiaryReadPlatformService.getTransferLimit(user.getId(), toAccount.getAccountId(), toAccount.getAccountType()); if (transferLimit != null && transferLimit > 0) { - if (transactionAmount.compareTo(new BigDecimal(transferLimit)) > 0) { throw new BeneficiaryTransferLimitExceededException(); } + if (transactionAmount.compareTo(new BigDecimal(transferLimit)) > 0) { + throw new BeneficiaryTransferLimitExceededException(); + } } if (this.configurationDomainService.isDailyTPTLimitEnabled()) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfAccountTemplateData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfAccountTemplateData.java index bcf8cbbed..b8fdd5ff3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfAccountTemplateData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfAccountTemplateData.java @@ -58,7 +58,9 @@ public class SelfAccountTemplateData implements Comparable validateCreate(String type, String apiRequestBodyAsJson) { - if (StringUtils.isBlank(apiRequestBodyAsJson)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(apiRequestBodyAsJson)) { + throw new InvalidJsonException(); + } JsonElement element = this.fromApiJsonHelper.parse(apiRequestBodyAsJson); @@ -181,6 +183,8 @@ public class SelfAccountTransferDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java index 908224140..09116180e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/data/SelfBeneficiariesTPTDataValidator.java @@ -62,7 +62,9 @@ public class SelfBeneficiariesTPTDataValidator { } public HashMap validateForCreate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_REQUEST_DATA_PARAMETERS); @@ -101,7 +103,9 @@ public class SelfBeneficiariesTPTDataValidator { } public HashMap validateForUpdate(String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_REQUEST_DATA_PARAMETERS); @@ -130,7 +134,9 @@ public class SelfBeneficiariesTPTDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java index c9895427e..49744f916 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java @@ -237,7 +237,9 @@ public class SelfClientsApiResource { private void validateAppuserClientsMapping(final Long clientId) { AppUser user = this.context.authenticatedUser(); final boolean mappedClientId = this.appUserClientMapperReadService.isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } @POST diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/data/SelfClientDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/data/SelfClientDataValidator.java index 6749d89fb..5a5b9e614 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/data/SelfClientDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/data/SelfClientDataValidator.java @@ -48,7 +48,9 @@ public class SelfClientDataValidator { unsupportedParams.add("exclude"); } - if (unsupportedParams.size() > 0) { throw new UnsupportedParameterException(unsupportedParams); } + if (unsupportedParams.size() > 0) { + throw new UnsupportedParameterException(unsupportedParams); + } } public void validateRetrieveOne(final UriInfo uriInfo) { @@ -59,7 +61,9 @@ public class SelfClientDataValidator { unsupportedParams.add("template"); } - if (unsupportedParams.size() > 0) { throw new UnsupportedParameterException(unsupportedParams); } + if (unsupportedParams.size() > 0) { + throw new UnsupportedParameterException(unsupportedParams); + } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/service/AppuserClientMapperReadServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/service/AppuserClientMapperReadServiceImpl.java index 3e21a21fc..764c6796e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/service/AppuserClientMapperReadServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/service/AppuserClientMapperReadServiceImpl.java @@ -51,7 +51,9 @@ public class AppuserClientMapperReadServiceImpl implements AppuserClientMapperRe AppUser user = this.context.authenticatedUser(); if (clientId != null) { final boolean mappedClientId = isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } else { throw new ClientNotFoundException(clientId); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java index 014eae373..c8b380a0b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java @@ -250,7 +250,9 @@ public class SelfLoansApiResource { public String stateTransitions(@PathParam("loanId") @ApiParam(value = "loanId") final Long loanId, @QueryParam("command") @ApiParam(value = "command") final String commandParam, @ApiParam(hidden = true) final String apiRequestBodyAsJson) { - if (!is(commandParam, "withdrawnByApplicant")) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (!is(commandParam, "withdrawnByApplicant")) { + throw new UnrecognizedQueryParamException("command", commandParam); + } validateAppuserLoanMapping(loanId); return this.loansApiResource.stateTransitions(loanId, commandParam, apiRequestBodyAsJson); } @@ -258,13 +260,17 @@ public class SelfLoansApiResource { private void validateAppuserLoanMapping(final Long loanId) { AppUser user = this.context.authenticatedUser(); final boolean isLoanMappedToUser = this.appuserLoansMapperReadService.isLoanMappedToUser(loanId, user.getId()); - if (!isLoanMappedToUser) { throw new LoanNotFoundException(loanId); } + if (!isLoanMappedToUser) { + throw new LoanNotFoundException(loanId); + } } private void validateAppuserClientsMapping(final Long clientId) { AppUser user = this.context.authenticatedUser(); final boolean mappedClientId = this.appUserClientMapperReadService.isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } private boolean is(final String commandParam, final String commandValue) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/data/SelfLoansDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/data/SelfLoansDataValidator.java index 204fe1aff..0e7fb21bb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/data/SelfLoansDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/data/SelfLoansDataValidator.java @@ -77,7 +77,9 @@ public class SelfLoansDataValidator { } public HashMap validateLoanApplication(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); @@ -92,7 +94,9 @@ public class SelfLoansDataValidator { final String clientId = this.fromApiJsonHelper.extractStringNamed(clientIdParameterName, element); baseDataValidator.reset().parameter(clientIdParameterName).value(clientId).notNull().longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } HashMap retAttr = new HashMap<>(); retAttr.put("clientId", Long.parseLong(clientId)); @@ -119,7 +123,9 @@ public class SelfLoansDataValidator { baseDataValidator.reset().parameter(clientIdParameterName).value(clientId).notNull().longGreaterThanZero(); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } HashMap retAttr = new HashMap<>(); if (clientId != null) { @@ -130,7 +136,9 @@ public class SelfLoansDataValidator { } private void throwExceptionIfReqd(List unsupportedParams) { - if (unsupportedParams.size() > 0) { throw new UnsupportedParameterException(unsupportedParams); } + if (unsupportedParams.size() > 0) { + throw new UnsupportedParameterException(unsupportedParams); + } } private void validateTemplate(final UriInfo uriInfo, List unsupportedParams) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java index f2b084fe9..047980ebc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java @@ -91,7 +91,9 @@ public class PocketApiResource { result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); } - if (result == null) { throw new UnrecognizedQueryParamException("command", commandParam); } + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam); + } return this.toApiJsonSerializer.serialize(result); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/data/PocketDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/data/PocketDataValidator.java index c94f06ed6..df4975508 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/data/PocketDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/data/PocketDataValidator.java @@ -57,7 +57,9 @@ public class PocketDataValidator { } public void validateForLinkingAccounts(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.linkingAccountsSupportedParameters); @@ -90,7 +92,9 @@ public class PocketDataValidator { } public void validateForDeLinkingAccounts(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.delinkingAccountsSupportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketAccountMappingRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketAccountMappingRepositoryWrapper.java index 9137608f6..4ea657830 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketAccountMappingRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketAccountMappingRepositoryWrapper.java @@ -49,7 +49,9 @@ public class PocketAccountMappingRepositoryWrapper { public PocketAccountMapping findByIdAndPocketIdWithNotFoundException(final Long id, final Long pocketId) { PocketAccountMapping pocketAccountMapping = this.pocketAccountMappingRepository.findByIdAndPocketId(id, pocketId); - if (pocketAccountMapping == null) { throw new MappingIdNotLinkedToPocketException(id); } + if (pocketAccountMapping == null) { + throw new MappingIdNotLinkedToPocketException(id); + } return pocketAccountMapping; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketRepositoryWrapper.java index 052d61354..85fc1987e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/domain/PocketRepositoryWrapper.java @@ -43,7 +43,9 @@ public class PocketRepositoryWrapper { public Long findByAppUserIdWithNotFoundDetection(final Long appUserId) { final Long pocketId = this.pocketRepository.findByAppUserId(appUserId); - if (pocketId == null) { throw new PocketNotFoundException(); } + if (pocketId == null) { + throw new PocketNotFoundException(); + } return pocketId; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationReadPlatformServiceImpl.java index ce265e667..5259d56b5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationReadPlatformServiceImpl.java @@ -43,7 +43,9 @@ public class SelfServiceRegistrationReadPlatformServiceImpl implements SelfServi params = new Object[] { accountNumber, firstName, lastName, mobileNumber }; } Integer count = this.jdbcTemplate.queryForObject(sql, params, Integer.class); - if (count == 0) { return false; } + if (count == 0) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java index 2f451bd69..7092e2b31 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/service/SelfServiceRegistrationWritePlatformServiceImpl.java @@ -222,10 +222,14 @@ public class SelfServiceRegistrationWritePlatformServiceImpl implements SelfServ private void throwExceptionIfValidationError(final List dataValidationErrors, String accountNumber, String firstName, String lastName, String mobileNumber, boolean isEmailAuthenticationMode) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } boolean isClientExist = this.selfServiceRegistrationReadPlatformService.isClientExist(accountNumber, firstName, lastName, mobileNumber, isEmailAuthenticationMode); - if (!isClientExist) { throw new ClientNotFoundException(); } + if (!isClientExist) { + throw new ClientNotFoundException(); + } } public static String randomAuthorizationTokenGeneration() { @@ -254,11 +258,15 @@ public class SelfServiceRegistrationWritePlatformServiceImpl implements SelfServ baseDataValidator.reset().parameter(SelfServiceApiConstants.authenticationTokenParamName).value(authenticationToken).notBlank() .notNull().notExceedingLengthOf(100); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } SelfServiceRegistration selfServiceRegistration = this.selfServiceRegistrationRepository .getRequestByIdAndAuthenticationToken(id, authenticationToken); - if (selfServiceRegistration == null) { throw new SelfServiceRegistrationNotFoundException(id, authenticationToken); } + if (selfServiceRegistration == null) { + throw new SelfServiceRegistrationNotFoundException(id, authenticationToken); + } username = selfServiceRegistration.getUsername(); Client client = selfServiceRegistration.getClient(); final boolean passwordNeverExpire = true; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java index b55a105ea..0fee886ff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java @@ -160,7 +160,9 @@ public class SelfSavingsApiResource { private void validateAppuserSavingsAccountMapping(final Long accountId) { AppUser user = this.context.authenticatedUser(); final boolean isMappedSavings = this.appuserSavingsMapperReadService.isSavingsMappedToUser(accountId, user.getId()); - if (!isMappedSavings) { throw new SavingsAccountNotFoundException(accountId); } + if (!isMappedSavings) { + throw new SavingsAccountNotFoundException(accountId); + } } @GET @@ -203,7 +205,9 @@ public class SelfSavingsApiResource { private void validateAppuserClientsMapping(final Long clientId) { AppUser user = this.context.authenticatedUser(); final boolean mappedClientId = this.appUserClientMapperReadService.isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/data/SelfSavingsDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/data/SelfSavingsDataValidator.java index 28bd16265..a188ca682 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/data/SelfSavingsDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/data/SelfSavingsDataValidator.java @@ -80,7 +80,9 @@ public class SelfSavingsDataValidator { } private void throwExceptionIfReqd(final List unsupportedParams) { - if (unsupportedParams.size() > 0) { throw new UnsupportedParameterException(unsupportedParams); } + if (unsupportedParams.size() > 0) { + throw new UnsupportedParameterException(unsupportedParams); + } } private void validateTemplate(final UriInfo uriInfo, List unsupportedParams) { @@ -91,7 +93,9 @@ public class SelfSavingsDataValidator { } public HashMap validateSavingsApplication(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) @@ -103,7 +107,9 @@ public class SelfSavingsDataValidator { baseDataValidator.reset().parameter(SelfSavingsAccountConstants.clientIdParameterName).value(clientId).notNull() .longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } HashMap parameterMap = new HashMap<>(); parameterMap.put(SelfSavingsAccountConstants.clientIdParameterName, clientId); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java index bee36019d..22983740e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java @@ -71,7 +71,9 @@ public class SelfUserApiResource { @ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = SelfUserApiResourceSwagger.PutSelfUserRequest.class) }) @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SelfUserApiResourceSwagger.PutSelfUserResponse.class) }) public String update(@ApiParam(hidden = true) final String apiRequestBodyAsJson) { - if (StringUtils.isBlank(apiRequestBodyAsJson)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(apiRequestBodyAsJson)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, apiRequestBodyAsJson, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java index 7561da257..00186d6df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java @@ -173,12 +173,16 @@ public class SelfShareAccountsApiResource { private void validateAppuserShareAccountMapping(final Long accountId) { AppUser user = this.context.authenticatedUser(); final boolean isMapped = this.appUserShareAccountsMapperReadPlatformService.isShareAccountsMappedToUser(accountId, user.getId()); - if (!isMapped) { throw new ShareAccountNotFoundException(accountId); } + if (!isMapped) { + throw new ShareAccountNotFoundException(accountId); + } } private void validateAppuserClientsMapping(final Long clientId) { AppUser user = this.context.authenticatedUser(); final boolean mappedClientId = this.appuserClientMapperReadService.isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/data/SelfShareAccountsDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/data/SelfShareAccountsDataValidator.java index c7661f14b..7371b6bba 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/data/SelfShareAccountsDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/data/SelfShareAccountsDataValidator.java @@ -44,7 +44,9 @@ public class SelfShareAccountsDataValidator { } public HashMap validateShareAccountApplication(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) @@ -55,7 +57,9 @@ public class SelfShareAccountsDataValidator { final String clientId = this.fromApiJsonHelper.extractStringNamed(ShareAccountApiConstants.clientid_paramname, element); baseDataValidator.reset().parameter(ShareAccountApiConstants.clientid_paramname).value(clientId).notNull().longGreaterThanZero(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } HashMap retAttr = new HashMap<>(); retAttr.put(ShareAccountApiConstants.clientid_paramname, Long.parseLong(clientId)); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java index 46b9cd8df..85d3f3d7f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java @@ -87,7 +87,9 @@ public class SelfScorecardApiResource { private void validateAppuserClientsMapping(final Long clientId) { AppUser user = this.context.authenticatedUser(); final boolean mappedClientId = this.appuserClientMapperReadService.isClientMappedToUser(clientId, user.getId()); - if (!mappedClientId) { throw new ClientNotFoundException(clientId); } + if (!mappedClientId) { + throw new ClientNotFoundException(clientId); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java index 0d7ada3d5..55e1b9bc5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java @@ -332,7 +332,9 @@ public class ShareAccountCharge extends AbstractPersistableCustom { } public boolean hasCurrencyCodeOf(final String matchingCurrencyCode) { - if (this.currencyCode() == null || matchingCurrencyCode == null) { return false; } + if (this.currencyCode() == null || matchingCurrencyCode == null) { + return false; + } return this.currencyCode().equalsIgnoreCase(matchingCurrencyCode); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java index 3101e0880..3be51c4f0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/serialization/ShareAccountDataSerializer.java @@ -120,7 +120,9 @@ public class ShareAccountDataSerializer { public ShareAccount validateAndCreate(JsonCommand jsonCommand) { - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.supportedParameters); @@ -177,7 +179,9 @@ public class ShareAccountDataSerializer { Integer lockinPeriod = this.fromApiJsonHelper.extractIntegerNamed(ShareAccountApiConstants.lockinperiod_paramname, element, locale); PeriodFrequencyType lockPeriodEnum = extractPeriodType(ShareAccountApiConstants.lockperiodfrequencytype_paramname, element); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId); if (!this.savingsAccountReadPlatformService.isAccountBelongsToClient(clientId, savingsAccountId, DepositAccountType.SAVINGS_DEPOSIT, @@ -256,7 +260,9 @@ public class ShareAccountDataSerializer { public Map validateAndUpdate(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), ShareAccountApiConstants.supportedParameters); @@ -439,14 +445,18 @@ public class ShareAccountDataSerializer { } createChargeTransaction(account); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } return actualChanges; } @SuppressWarnings("null") public Map validateAndApprove(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), approvalParameters); final List dataValidationErrors = new ArrayList<>(); @@ -471,7 +481,9 @@ public class ShareAccountDataSerializer { } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } AppUser approvedUser = this.platformSecurityContext.authenticatedUser(); account.approve(approvedDate.toDate(), approvedUser); @@ -524,7 +536,9 @@ public class ShareAccountDataSerializer { public Map validateAndUndoApprove(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters); final List dataValidationErrors = new ArrayList<>(); @@ -579,7 +593,9 @@ public class ShareAccountDataSerializer { @SuppressWarnings("null") public Map validateAndActivate(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), activateParameters); final List dataValidationErrors = new ArrayList<>(); @@ -597,7 +613,9 @@ public class ShareAccountDataSerializer { baseDataValidator.reset().parameter(ShareAccountApiConstants.activatedate_paramname).value(submittalDateAsString) .failWithCodeNoParameterAddedToErrorCode("cannot.be.before.approved.date"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } AppUser approvedUser = this.platformSecurityContext.authenticatedUser(); account.activate(activatedDate.toDate(), approvedUser); handlechargesOnActivation(account); @@ -659,7 +677,9 @@ public class ShareAccountDataSerializer { public Map validateAndApplyAddtionalShares(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), addtionalSharesParameters); final List dataValidationErrors = new ArrayList<>(); @@ -697,7 +717,9 @@ public class ShareAccountDataSerializer { .failWithCodeNoParameterAddedToErrorCode("purchase.transaction.date.cannot.be.before.existing.transactions"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } final BigDecimal unitPrice = shareProduct.deriveMarketPrice(requestedDate.toDate()); ShareAccountTransaction purchaseTransaction = new ShareAccountTransaction(requestedDate.toDate(), sharesRequested, unitPrice); account.addAdditionalPurchasedShares(purchaseTransaction); @@ -723,7 +745,9 @@ public class ShareAccountDataSerializer { public Map validateAndApproveAddtionalShares(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), addtionalSharesParameters); final List dataValidationErrors = new ArrayList<>(); @@ -749,7 +773,9 @@ public class ShareAccountDataSerializer { account.updateApprovedShares(Long.valueOf(totalShares)); } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } actualChanges.put(ShareAccountApiConstants.requestedshares_paramname, purchasedShares); return actualChanges; } @@ -772,7 +798,9 @@ public class ShareAccountDataSerializer { public Map validateAndRejectAddtionalShares(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), addtionalSharesParameters); JsonElement element = jsonCommand.parsedJson(); @@ -817,7 +845,9 @@ public class ShareAccountDataSerializer { public Map validateAndRedeemShares(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), addtionalSharesParameters); final List dataValidationErrors = new ArrayList<>(); @@ -843,7 +873,9 @@ public class ShareAccountDataSerializer { baseDataValidator.reset().parameter(ShareAccountApiConstants.requesteddate_paramname).value(requestedDate) .failWithCodeNoParameterAddedToErrorCode("redeem.transaction.date.cannot.be.before.existing.transactions"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } BigDecimal unitPrice = account.getShareProduct().deriveMarketPrice(requestedDate.toDate()); ShareAccountTransaction transaction = ShareAccountTransaction.createRedeemTransaction(requestedDate.toDate(), sharesRequested, unitPrice); @@ -863,12 +895,16 @@ public class ShareAccountDataSerializer { .value(redeemTransaction.getTotalShares()) .failWithCodeNoParameterAddedToErrorCode("cannot.be.redeemed.due.to.insufficient.shares"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } LocalDate redeemDate = new LocalDate(redeemTransaction.getPurchasedDate()); final Integer lockinPeriod = account.getLockinPeriodFrequency(); final PeriodFrequencyType periodType = account.getLockinPeriodFrequencyType(); - if (lockinPeriod == null && periodType == null) { return; } + if (lockinPeriod == null && periodType == null) { + return; + } Long totalSharesCanBeRedeemed = Long.valueOf(0); Long totalSharesPurchasedBeforeRedeem = Long.valueOf(0); boolean isPurchaseTransactionExist = false; @@ -908,7 +944,9 @@ public class ShareAccountDataSerializer { .value(redeemTransaction.getTotalShares()) .failWithCodeNoParameterAddedToErrorCode("cannot.be.redeemed.due.to.lockinperiod"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } private LocalDate deriveLockinPeriodDuration(final Integer lockinPeriod, final PeriodFrequencyType periodType, LocalDate purchaseDate) { @@ -962,7 +1000,9 @@ public class ShareAccountDataSerializer { public Map validateAndClose(JsonCommand jsonCommand, ShareAccount account) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), closeParameters); final List dataValidationErrors = new ArrayList<>(); @@ -970,7 +1010,9 @@ public class ShareAccountDataSerializer { JsonElement element = jsonCommand.parsedJson(); LocalDate closedDate = this.fromApiJsonHelper.extractLocalDateNamed(ShareAccountApiConstants.closeddate_paramname, element); baseDataValidator.reset().parameter(ShareAccountApiConstants.approveddate_paramname).value(closedDate).notNull(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } boolean isTransactionBeforeExistingTransactions = false; Set transactions = account.getShareAccountTransactions(); for (ShareAccountTransaction transaction : transactions) { @@ -987,7 +1029,9 @@ public class ShareAccountDataSerializer { .failWithCodeNoParameterAddedToErrorCode("share.account.cannot.be.closed.before.existing.transactions"); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } AppUser approvedUser = this.platformSecurityContext.authenticatedUser(); final BigDecimal unitPrice = account.getShareProduct().deriveMarketPrice(DateUtils.getDateOfTenant()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java index b9da48efe..f56785424 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountCommandsServiceImpl.java @@ -47,7 +47,9 @@ public class ShareAccountCommandsServiceImpl implements AccountsCommandsService final JsonElement parsedCommand = this.fromApiJsonHelper.parse(jsonBody); final JsonCommand jsonCommand = JsonCommand.from(jsonBody, parsedCommand, this.fromApiJsonHelper, null, null, null, null, null, null, null, null, null, null, null, null); - if (ShareAccountApiConstants.APPROVE_COMMAND.equals(command)) { return approveShareAccount(accountId, jsonCommand); } + if (ShareAccountApiConstants.APPROVE_COMMAND.equals(command)) { + return approveShareAccount(accountId, jsonCommand); + } if (ShareAccountApiConstants.REJECT_COMMAND.equals(command)) { return rejectShareAccount(accountId, jsonCommand); } else if (ShareAccountApiConstants.APPLY_ADDITIONALSHARES_COMMAND.equals(command)) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java index f83a92edd..23d5aed69 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/serialization/ShareProductDataSerializer.java @@ -97,7 +97,9 @@ public class ShareProductDataSerializer { } public ShareProduct validateAndCreate(JsonCommand jsonCommand) { - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), supportedParametersForCreate); @@ -195,7 +197,9 @@ public class ShareProductDataSerializer { for (ShareProductMarketPrice data : marketPriceSet) { data.setShareProduct(product); } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } return product; } @@ -265,7 +269,9 @@ public class ShareProductDataSerializer { public Map validateAndUpdate(JsonCommand jsonCommand, ShareProduct product) { Map actualChanges = new HashMap<>(); - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), supportedParametersForCreate); @@ -448,7 +454,9 @@ public class ShareProductDataSerializer { } } - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } BigDecimal shareCapitalValue; if (sharesIssued != null || unitPrice != null) { @@ -467,7 +475,9 @@ public class ShareProductDataSerializer { } public void validateDividendDetails(JsonCommand jsonCommand) { - if (StringUtils.isBlank(jsonCommand.json())) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(jsonCommand.json())) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, jsonCommand.json(), supportedParametersForDivident); @@ -490,7 +500,9 @@ public class ShareProductDataSerializer { .extractBigDecimalWithLocaleNamed(ShareProductApiConstants.dividendAmountParamName, element); baseDataValidator.reset().parameter(ShareProductApiConstants.dividendAmountParamName).value(dividendAmount).notBlank() .positiveAmount(); - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java index d5911895c..d0b765381 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductCommandsServiceImpl.java @@ -48,7 +48,9 @@ public class ShareProductCommandsServiceImpl implements ProductCommandsService { null, null, null, null, null, null, null); if (ShareProductApiConstants.PREIEW_DIVIDENDS_COMMAND_STRING.equals(command)) { return null; - } else if (ShareProductApiConstants.POST_DIVIDENdS_COMMAND_STRING.equals(command)) { return postDividends(productId, jsonCommand); } + } else if (ShareProductApiConstants.POST_DIVIDENdS_COMMAND_STRING.equals(command)) { + return postDividends(productId, jsonCommand); + } // throw unknow commandexception return CommandProcessingResult.empty(); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java index f6d966685..a033c764d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductDividendAssembler.java @@ -59,7 +59,9 @@ public class ShareProductDividendAssembler { product.getCurrency().currencyInMultiplesOf()); Collection shareAccountDatas = this.shareAccountReadPlatformService.retrieveAllShareAccountDataForDividends( productId, product.getAllowDividendCalculationForInactiveClients(), dividendPeriodStartDate); - if (shareAccountDatas == null || shareAccountDatas.isEmpty()) { throw new ShareAccountsNotFoundException(product.getId()); } + if (shareAccountDatas == null || shareAccountDatas.isEmpty()) { + throw new ShareAccountsNotFoundException(product.getId()); + } ShareProductDividendPayOutDetails productDividendPayOutDetails = null; int minimumActivePeriod = 0; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxComponentHistory.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxComponentHistory.java index 7205c11bf..b762d32af 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxComponentHistory.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxComponentHistory.java @@ -75,7 +75,9 @@ public class TaxComponentHistory extends AbstractAuditableCustom { } public boolean occursOnDayFromAndUpToAndIncluding(final LocalDate target) { - if (this.endDate == null) { return target != null && target.isAfter(startDate()); } + if (this.endDate == null) { + return target != null && target.isAfter(startDate()); + } return target != null && target.isAfter(startDate()) && !target.isAfter(endDate()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroup.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroup.java index bd31efea0..5f170ac09 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroup.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroup.java @@ -96,7 +96,9 @@ public class TaxGroup extends AbstractAuditableCustom { public TaxGroupMappings findOneBy(final TaxGroupMappings groupMapping) { if (groupMapping.getId() != null) { for (TaxGroupMappings groupMappings : this.taxGroupMappings) { - if (groupMappings.getId().equals(groupMapping.getId())) { return groupMappings; } + if (groupMappings.getId().equals(groupMapping.getId())) { + return groupMappings; + } } throw new TaxMappingNotFoundException(groupMapping.getId()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroupMappings.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroupMappings.java index c8dfca8c6..208a4b74b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroupMappings.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/domain/TaxGroupMappings.java @@ -87,7 +87,9 @@ public class TaxGroupMappings extends AbstractAuditableCustom { } public boolean occursOnDayFromAndUpToAndIncluding(final LocalDate target) { - if (this.endDate == null) { return target != null && target.isAfter(startDate()); } + if (this.endDate == null) { + return target != null && target.isAfter(startDate()); + } return target != null && target.isAfter(startDate()) && !target.isAfter(endDate()); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/serialization/TaxValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/serialization/TaxValidator.java index 9871e3a40..5b41ce556 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/serialization/TaxValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/serialization/TaxValidator.java @@ -77,7 +77,9 @@ public class TaxValidator { } public void validateForTaxComponentCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedTaxComponentCreateParameters); @@ -123,7 +125,9 @@ public class TaxValidator { } public void validateForTaxComponentUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedTaxComponentUpdateParameters); @@ -154,7 +158,9 @@ public class TaxValidator { } public void validateForTaxGroupCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedTaxGroupParameters); @@ -190,7 +196,9 @@ public class TaxValidator { } public void validateForTaxGroupUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedTaxGroupParameters); @@ -345,7 +353,9 @@ public class TaxValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/service/TaxAssembler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/service/TaxAssembler.java index a31bdb6f8..dc730360c 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/service/TaxAssembler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/service/TaxAssembler.java @@ -158,6 +158,8 @@ public class TaxAssembler { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java index 87852d2b6..cf697a5e5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/data/TransfersDataValidator.java @@ -72,12 +72,16 @@ public final class TransfersDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForClientsTransferBetweenGroups(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS); @@ -110,7 +114,9 @@ public final class TransfersDataValidator { public void validateForProposeClientTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS); @@ -132,7 +138,9 @@ public final class TransfersDataValidator { } public void validateForAcceptClientTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS); @@ -161,7 +169,9 @@ public final class TransfersDataValidator { } public void validateForProposeAndAcceptClientTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS); @@ -195,7 +205,9 @@ public final class TransfersDataValidator { } public void validateForRejectClientTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REJECT_CLIENT_TRANSFER_DATA_PARAMETERS); @@ -211,7 +223,9 @@ public final class TransfersDataValidator { } public void validateForWithdrawClientTransfer(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java index c76f870ce..6fc887ab1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java @@ -162,9 +162,13 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr final Boolean inheritDestinationGroupLoanOfficer, final Staff newLoanOfficer) { // next I shall validate that the client is present in this group - if (!sourceGroup.hasClientAsMember(client)) { throw new ClientNotInGroupException(client.getId(), sourceGroup.getId()); } + if (!sourceGroup.hasClientAsMember(client)) { + throw new ClientNotInGroupException(client.getId(), sourceGroup.getId()); + } // Is client active? - if (client.isNotActive()) { throw new ClientHasBeenClosedException(client.getId()); } + if (client.isNotActive()) { + throw new ClientHasBeenClosedException(client.getId()); + } /** * TODO: for now we need to ensure that only one collection sheet @@ -456,7 +460,9 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr if (destinationGroup == null) { throw new TransferNotSupportedException(TransferNotSupportedReason.CLIENT_DESTINATION_GROUP_NOT_SPECIFIED, client.getId()); - } else if (!destinationGroup.isActive()) { throw new GroupNotActiveException(destinationGroup.getId()); } + } else if (!destinationGroup.isActive()) { + throw new GroupNotActiveException(destinationGroup.getId()); + } transferClientBetweenGroups(Iterables.get(client.getGroups(), 0), client, destinationGroup, true, staff); } else if (client.getGroups().size() == 0 && destinationGroup != null) { client.getGroups().add(destinationGroup); @@ -516,7 +522,9 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr } private void validateClientAwaitingTransferAcceptance(final Client client) { - if (!client.isTransferInProgress()) { throw new ClientNotAwaitingTransferApprovalException(client.getId()); } + if (!client.isTransferInProgress()) { + throw new ClientNotAwaitingTransferApprovalException(client.getId()); + } } /** @@ -526,7 +534,9 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr **/ private void validateClientAwaitingTransferAcceptanceOnHold(final Client client) { - if (!client.isTransferInProgressOrOnHold()) { throw new ClientNotAwaitingTransferApprovalOrOnHoldException(client.getId()); } + if (!client.isTransferInProgressOrOnHold()) { + throw new ClientNotAwaitingTransferApprovalOrOnHoldException(client.getId()); + } } /** diff --git a/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java index 982a7c9e6..78b7df826 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java @@ -260,7 +260,9 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService } } LOG.info("{}: Savings accounts affected by update: {}", ThreadLocalContextUtil.getTenant().getName(), chargesDueData.size()); - if (!exceptions.isEmpty()) { throw new JobExecutionException(exceptions); } + if (!exceptions.isEmpty()) { + throw new JobExecutionException(exceptions); + } } @Transactional @@ -410,7 +412,9 @@ public class ScheduledJobRunnerServiceImpl implements ScheduledJobRunnerService } } - if (!exceptions.isEmpty()) { throw new JobExecutionException(exceptions); } + if (!exceptions.isEmpty()) { + throw new JobExecutionException(exceptions); + } } @Override diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java index 8fe3c86d2..ff12beb40 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java @@ -82,7 +82,9 @@ public class LookupTableApiResource { final List lookupTables = this.lookupTableService.findBySurvey(survey); - if (lookupTables != null) { return LookupTableMapper.map(lookupTables); } + if (lookupTables != null) { + return LookupTableMapper.map(lookupTables); + } return Collections.emptyList(); } @@ -102,7 +104,9 @@ public class LookupTableApiResource { final List lookupTables = this.lookupTableService.findByKey(key); - if (lookupTables == null || lookupTables.isEmpty()) { throw new LookupTableNotFoundException(key); } + if (lookupTables == null || lookupTables.isEmpty()) { + throw new LookupTableNotFoundException(key); + } return LookupTableMapper.map(lookupTables).get(0); } @@ -125,7 +129,9 @@ public class LookupTableApiResource { private Survey findSurvey(final Long surveyId) { final Survey survey = this.spmService.findById(surveyId); - if (survey == null) { throw new SurveyNotFoundException(surveyId); } + if (survey == null) { + throw new SurveyNotFoundException(surveyId); + } return survey; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/domain/SurveyValidator.java b/fineract-provider/src/main/java/org/apache/fineract/spm/domain/SurveyValidator.java index 2346c931e..c75a6fcbd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/spm/domain/SurveyValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/spm/domain/SurveyValidator.java @@ -86,7 +86,9 @@ public class SurveyValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/AppUserData.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/AppUserData.java index 813fc3f35..6fae85d1e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/AppUserData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/AppUserData.java @@ -143,12 +143,18 @@ public class AppUserData { @Override public boolean equals(Object o) { - if (this == o) { return true; } - if (o == null || !(o instanceof AppUserData)) { return false; } + if (this == o) { + return true; + } + if (o == null || !(o instanceof AppUserData)) { + return false; + } AppUserData that = (AppUserData) o; - if (id != null ? !id.equals(that.id) : that.id != null) { return false; } + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } return true; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java index 14c66cded..86959cb8b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/PasswordPreferencesDataValidator.java @@ -50,7 +50,9 @@ public class PasswordPreferencesDataValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS); diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/RoleData.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/RoleData.java index 6d6f5e973..2f9e2859a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/RoleData.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/data/RoleData.java @@ -44,7 +44,9 @@ public class RoleData implements Serializable { @Override public boolean equals(final Object obj) { - if (!(obj instanceof RoleData)) { return false; } + if (!(obj instanceof RoleData)) { + return false; + } final RoleData role = (RoleData) obj; return this.id.equals(role.id); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java index 6a3c5c6e6..ce63572d8 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUser.java @@ -456,7 +456,9 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser { public boolean hasNotPermissionForReport(final String reportName) { - if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", "REPORTING_SUPER_USER", "READ_" + reportName)) { return true; } + if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", "REPORTING_SUPER_USER", "READ_" + reportName)) { + return true; + } return false; } @@ -467,12 +469,16 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser { if (accessType.equalsIgnoreCase("READ")) { - if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", matchPermission)) { return true; } + if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", matchPermission)) { + return true; + } return false; } - if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", matchPermission)) { return true; } + if (hasNotPermissionForAnyOf("ALL_FUNCTIONS", matchPermission)) { + return true; + } return false; } @@ -512,7 +518,9 @@ public class AppUser extends AbstractPersistableCustom implements PlatformUser { final String authorizationMessage = "User has no authority to view " + resourceType.toLowerCase() + "s"; final String matchPermission = "READ_" + resourceType.toUpperCase(); - if (!hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", matchPermission)) { return; } + if (!hasNotPermissionForAnyOf("ALL_FUNCTIONS", "ALL_FUNCTIONS_READ", matchPermission)) { + return; + } throw new NoAuthorizationException(authorizationMessage); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java index dab22c2a0..e6cd09eaf 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserClientMapping.java @@ -49,11 +49,17 @@ public class AppUserClientMapping extends AbstractPersistableCustom { @Override public boolean equals(Object obj) { - if (null == obj) { return false; } + if (null == obj) { + return false; + } - if (this == obj) { return true; } + if (this == obj) { + return true; + } - if (!(obj instanceof AppUserClientMapping)) { return false; } + if (!(obj instanceof AppUserClientMapping)) { + return false; + } AppUserClientMapping that = (AppUserClientMapping) obj; diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserRepositoryWrapper.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserRepositoryWrapper.java index 2e9a13882..70e88b3bd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserRepositoryWrapper.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/domain/AppUserRepositoryWrapper.java @@ -35,7 +35,9 @@ public class AppUserRepositoryWrapper { public AppUser fetchSystemUser() { String userName = "system"; AppUser user = this.appUserRepository.findAppUserByName(userName); - if (user == null) { throw new UserNotFoundException(userName); } + if (user == null) { + throw new UserNotFoundException(userName); + } return user; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/serialization/PermissionsCommandFromApiJsonDeserializer.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/serialization/PermissionsCommandFromApiJsonDeserializer.java index a63f110ce..8b3d2acc0 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/serialization/PermissionsCommandFromApiJsonDeserializer.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/serialization/PermissionsCommandFromApiJsonDeserializer.java @@ -54,7 +54,9 @@ public final class PermissionsCommandFromApiJsonDeserializer extends AbstractFro @Override public PermissionsCommand commandFromApiJson(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserReadPlatformServiceImpl.java index c16473331..c4e89387b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserReadPlatformServiceImpl.java @@ -117,7 +117,9 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic this.context.authenticatedUser(); final AppUser user = this.appUserRepository.findById(userId).orElseThrow(() -> new UserNotFoundException(userId)); - if (user.isDeleted()) { throw new UserNotFoundException(userId); } + if (user.isDeleted()) { + throw new UserNotFoundException(userId); + } final Collection availableRoles = this.roleReadPlatformService.retrieveAll(); @@ -219,7 +221,9 @@ public class AppUserReadPlatformServiceImpl implements AppUserReadPlatformServic String sql = "select count(*) from m_appuser where username = ?"; Object[] params = new Object[] { username }; Integer count = this.jdbcTemplate.queryForObject(sql, params, Integer.class); - if (count == 0) { return false; } + if (count == 0) { + return false; + } return true; } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java index 47b35a399..8969ba556 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/AppUserWritePlatformServiceJpaRepositoryImpl.java @@ -321,7 +321,9 @@ public class AppUserWritePlatformServiceJpaRepositoryImpl implements AppUserWrit public CommandProcessingResult deleteUser(final Long userId) { final AppUser user = this.appUserRepository.findById(userId).orElseThrow(() -> new UserNotFoundException(userId)); - if (user.isDeleted()) { throw new UserNotFoundException(userId); } + if (user.isDeleted()) { + throw new UserNotFoundException(userId); + } user.delete(); this.topicDomainService.unsubcribeUserFromTopic(user); diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PasswordPreferencesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PasswordPreferencesWritePlatformServiceJpaRepositoryImpl.java index 8c1aa1515..10b79c8f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PasswordPreferencesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PasswordPreferencesWritePlatformServiceJpaRepositoryImpl.java @@ -76,7 +76,9 @@ public class PasswordPreferencesWritePlatformServiceJpaRepositoryImpl implements } } - if (!found) { throw new PasswordValidationPolicyNotFoundException(validationPolicyId); } + if (!found) { + throw new PasswordValidationPolicyNotFoundException(validationPolicyId); + } if (!changes.isEmpty()) { this.validationRepository.saveAll(validationPolicies); diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java index 51cc92b96..1d87f6dff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/PermissionWritePlatformServiceJpaRepositoryImpl.java @@ -92,7 +92,9 @@ public class PermissionWritePlatformServiceJpaRepositoryImpl implements Permissi if (allPermissions != null) { for (final Permission permission : allPermissions) { - if (permission.hasCode(permissionCode)) { return permission; } + if (permission.hasCode(permissionCode)) { + return permission; + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleDataValidator.java index 1bee97025..c96e6b7c3 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleDataValidator.java @@ -52,7 +52,9 @@ public final class RoleDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -72,7 +74,9 @@ public final class RoleDataValidator { } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -96,6 +100,8 @@ public final class RoleDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java index 44f7313ef..0ecaa6d62 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/RoleWritePlatformServiceJpaRepositoryImpl.java @@ -201,7 +201,9 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf if (allPermissions != null) { for (final Permission permission : allPermissions) { - if (permission.hasCode(permissionCode)) { return permission; } + if (permission.hasCode(permissionCode)) { + return permission; + } } } throw new PermissionNotFoundException(permissionCode); @@ -224,7 +226,9 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf * Roles associated with users can't be deleted */ final Integer count = this.roleRepository.getCountOfRolesAssociatedWithUsers(roleId); - if (count > 0) { throw new RoleAssociatedException("error.msg.role.associated.with.users.deleted", roleId); } + if (count > 0) { + throw new RoleAssociatedException("error.msg.role.associated.with.users.deleted", roleId); + } this.topicDomainService.deleteTopic(role); @@ -253,7 +257,9 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf * Roles associated with users can't be disable */ final Integer count = this.roleRepository.getCountOfRolesAssociatedWithUsers(roleId); - if (count > 0) { throw new RoleAssociatedException("error.msg.role.associated.with.users.disabled", roleId); } + if (count > 0) { + throw new RoleAssociatedException("error.msg.role.associated.with.users.disabled", roleId); + } /** * Disabling the role diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/UserDataValidator.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/UserDataValidator.java index 81e565093..b57152753 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/UserDataValidator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/service/UserDataValidator.java @@ -60,7 +60,9 @@ public final class UserDataValidator { } public void validateForCreate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); @@ -144,11 +146,15 @@ public final class UserDataValidator { } private void throwExceptionIfValidationWarningsExist(final List dataValidationErrors) { - if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } + if (!dataValidationErrors.isEmpty()) { + throw new PlatformApiDataValidationException(dataValidationErrors); + } } public void validateForUpdate(final String json) { - if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); + } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters);