galovics commented on code in PR #2437:
URL: https://github.com/apache/fineract/pull/2437#discussion_r928299457


##########
fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/accountrunningbalanceupdate/AccountRunningBalanceUpdateConfig.java:
##########
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.scheduledjobs.service.accountrunningbalanceupdate;
+
+import 
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import org.springframework.batch.core.Job;
+import org.springframework.batch.core.Step;
+import 
org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
+import 
org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
+import 
org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+@Configuration
+@EnableBatchProcessing
+public class AccountRunningBalanceUpdateConfig {
+
+    @Autowired
+    private JobBuilderFactory jobs;
+
+    @Autowired
+    private StepBuilderFactory steps;
+
+    @Bean
+    protected Step accountRunningBalanceUpdateStep(JdbcTemplate jdbcTemplate, 
DatabaseSpecificSQLGenerator sqlGenerator) {
+        return 
steps.get("accountRunningBalanceUpdate").tasklet(accountRunningBalanceUpdateTasklet(jdbcTemplate,
 sqlGenerator)).build();
+    }
+
+    @Bean
+    public Job accountRunningBalanceUpdateJob(JdbcTemplate jdbcTemplate, 
DatabaseSpecificSQLGenerator sqlGenerator) {
+        return 
jobs.get("taskletsJob").start(accountRunningBalanceUpdateStep(jdbcTemplate, 
sqlGenerator)).build();

Review Comment:
   Why do we call the job `taskletsJob`? It should be from the JobName enum for 
each and every job.



##########
fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/accountrunningbalanceupdate/AccountRunningBalanceUpdateTasklet.java:
##########
@@ -0,0 +1,210 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.scheduledjobs.service.accountrunningbalanceupdate;
+
+import java.math.BigDecimal;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.accounting.common.AccountingEnumerations;
+import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
+import org.apache.fineract.accounting.journalentry.data.JournalEntryData;
+import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
+import 
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import org.springframework.batch.core.StepContribution;
+import org.springframework.batch.core.scope.context.ChunkContext;
+import org.springframework.batch.core.step.tasklet.Tasklet;
+import org.springframework.batch.repeat.RepeatStatus;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+
+@Slf4j
+@RequiredArgsConstructor
+public class AccountRunningBalanceUpdateTasklet implements Tasklet {
+
+    private final JdbcTemplate jdbcTemplate;
+    private final DatabaseSpecificSQLGenerator sqlGenerator;
+    private final GLJournalEntryMapper entryMapper = new 
GLJournalEntryMapper();
+
+    @Override
+    public RepeatStatus execute(StepContribution contribution, ChunkContext 
chunkContext) throws Exception {
+        String dateFinder = "select MIN(je.entry_date) as entityDate from 
acc_gl_journal_entry  je "

Review Comment:
   Why did we copy the implementation from the 
`JournalEntryRunningBalanceUpdateServiceImpl`? In this case the Tasklet should 
be as simple as calling the original method. No copy paste please. :)



##########
fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/accountrunningbalanceupdate/AccountRunningBalanceUpdateConfig.java:
##########
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.scheduledjobs.service.accountrunningbalanceupdate;
+
+import 
org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
+import org.springframework.batch.core.Job;
+import org.springframework.batch.core.Step;
+import 
org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
+import 
org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
+import 
org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+@Configuration
+@EnableBatchProcessing

Review Comment:
   This can appear once in the ServerApplication class.



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/common/organisation/CampaignsTest.java:
##########
@@ -234,4 +234,11 @@ public void testSupportedActionsForCampaignWithError() {
         assertEquals(deletedCampaignId, campaignId);
 
     }
+
+    @Test
+    public void testUpdateSmsOutboundJobOutcome() throws InterruptedException {
+        Integer smsCampaign = campaignsHelper.createCampaign("Prospective 
Clients", 2);
+        String JobName = "Update SMS Outbound with Campaign Message";
+        // schedulerJobHelper.executeAndAwaitJob(JobName);

Review Comment:
   I assume this is just commented out by mistake. Please check.



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobName.java:
##########
@@ -18,43 +18,111 @@
  */
 package org.apache.fineract.infrastructure.jobs.service;
 
+import 
org.apache.fineract.scheduledjobs.service.accountrunningbalanceupdate.AccountRunningBalanceUpdateTasklet;
+import 
org.apache.fineract.scheduledjobs.service.addaccrualentries.AddAccrualEntriesTasklet;
+import 
org.apache.fineract.scheduledjobs.service.addperiodicaccrualentries.AddPeriodicAccrualEntriesTasklet;
+import 
org.apache.fineract.scheduledjobs.service.addperiodicaccrualentriesforloanswithincomepostedastransactions.AddPeriodicAccrualEntriesForLoansWithIncomePostedAsTransactionsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.applyannualfeeforsavings.ApplyAnnualFeeForSavingsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.applychargetooverdueloaninstallment.ApplyChargeToOverdueLoanInstallmentTasklet;
+import 
org.apache.fineract.scheduledjobs.service.applyholidaystoloans.ApplyHolidaysToLoansTasklet;
+import 
org.apache.fineract.scheduledjobs.service.executeemail.ExecuteEmailTasklet;
+import 
org.apache.fineract.scheduledjobs.service.executereportmailingjobs.ExecuteReportMailingJobsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.executestandinginstructions.ExecuteStandingInstructionsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.generateadhocclientschhedule.GenerateAdhocClientScheduleTasklet;
+import 
org.apache.fineract.scheduledjobs.service.generateloanlossprovisioning.GenerateLoanlossProvisioningTasklet;
+import 
org.apache.fineract.scheduledjobs.service.generaterdschedule.GenerateRdScheduleTasklet;
+import 
org.apache.fineract.scheduledjobs.service.getdeliveryreportsfromsmsgateway.GetDeliveryReportsFromSmsGatewayTasklet;
+import 
org.apache.fineract.scheduledjobs.service.increasebusinessdateby1day.IncreaseBusinessDateBy1DayTasklet;
+import 
org.apache.fineract.scheduledjobs.service.increasecobdateby1day.IncreaseCobDateBy1DayTasklet;
+import 
org.apache.fineract.scheduledjobs.service.payduesavingscharges.PayDueSavingsChargesTasklet;
+import 
org.apache.fineract.scheduledjobs.service.postdividentsforshares.PostDividentsForSharesTasklet;
+import 
org.apache.fineract.scheduledjobs.service.postinterestforsavings.PostInterestForSavingTasklet;
+import 
org.apache.fineract.scheduledjobs.service.recalculateinterestforloan.RecalculateInterestForLoanTasklet;
+import 
org.apache.fineract.scheduledjobs.service.sendmessagetosmsgateway.SendMessageToSmsGatewayTasklet;
+import 
org.apache.fineract.scheduledjobs.service.transferfeechargeforloans.TransferFeeChargeForLoansTasklet;
+import 
org.apache.fineract.scheduledjobs.service.transferinteresttosavings.TransferInterestToSavingsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updatedepositsaccountmaturitydetails.UpdateDepositsAccountMaturityDetailsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updateemailoutboundwithcampaignmessage.UpdateEmailOutboundWithCampaignMessageTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updateloanarrearsageing.UpdateLoanArrearsAgeingTasklet;
+import org.apache.fineract.scheduledjobs.service.updatenpa.UpdateNpaTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updatesavingsdormantaccounts.UpdateSavingsDormantAccountsTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updatesmsoutboundwithcampaignmessage.UpdateSmsOutboundWithCampaignMessageTasklet;
+import 
org.apache.fineract.scheduledjobs.service.updatetrialbalancedetails.UpdateTrialBalanceDetailsTasklet;
+import org.springframework.batch.core.step.tasklet.Tasklet;
+
 public enum JobName {
 
-    UPDATE_LOAN_ARREARS_AGEING("Update Loan Arrears Ageing"), 
APPLY_ANNUAL_FEE_FOR_SAVINGS(
-            "Apply Annual Fee For Savings"), APPLY_HOLIDAYS_TO_LOANS("Apply 
Holidays To Loans"), POST_INTEREST_FOR_SAVINGS(
-                    "Post Interest For Savings"), 
TRANSFER_FEE_CHARGE_FOR_LOANS(
-                            "Transfer Fee For Loans From Savings"), 
ACCOUNTING_RUNNING_BALANCE_UPDATE(
-                                    "Update Accounting Running Balances"), 
PAY_DUE_SAVINGS_CHARGES(
-                                            "Pay Due Savings Charges"), 
APPLY_CHARGE_TO_OVERDUE_LOAN_INSTALLMENT(
-                                                    "Apply penalty to overdue 
loans"), EXECUTE_STANDING_INSTRUCTIONS(
-                                                            "Execute Standing 
Instruction"), ADD_ACCRUAL_ENTRIES(
-                                                                    "Add 
Accrual Transactions"), UPDATE_NPA(
-                                                                            
"Update Non Performing Assets"), UPDATE_DEPOSITS_ACCOUNT_MATURITY_DETAILS(
-                                                                               
     "Update Deposit Accounts Maturity details"), TRANSFER_INTEREST_TO_SAVINGS(
-                                                                               
             "Transfer Interest To Savings"), ADD_PERIODIC_ACCRUAL_ENTRIES(
-                                                                               
                     "Add Periodic Accrual Transactions"), 
RECALCULATE_INTEREST_FOR_LOAN(
-                                                                               
                             "Recalculate Interest For Loans"), 
GENERATE_RD_SCEHDULE(
-                                                                               
                                     "Generate Mandatory Savings Schedule"), 
GENERATE_LOANLOSS_PROVISIONING(
-                                                                               
                                             "Generate Loan Loss 
Provisioning"), POST_DIVIDENTS_FOR_SHARES(
-                                                                               
                                                     "Post Dividends For 
Shares"), UPDATE_SAVINGS_DORMANT_ACCOUNTS(
-                                                                               
                                                             "Update Savings 
Dormant Accounts"), 
ADD_PERIODIC_ACCRUAL_ENTRIES_FOR_LOANS_WITH_INCOME_POSTED_AS_TRANSACTIONS(
-                                                                               
                                                                     "Add 
Accrual Transactions For Loans With Income Posted As Transactions"), 
EXECUTE_REPORT_MAILING_JOBS(
-                                                                               
                                                                             
"Execute Report Mailing Jobs"), UPDATE_SMS_OUTBOUND_WITH_CAMPAIGN_MESSAGE(
-                                                                               
                                                                                
     "Update SMS Outbound with Campaign Message"), SEND_MESSAGES_TO_SMS_GATEWAY(
-                                                                               
                                                                                
             "Send Messages to SMS Gateway"), 
GET_DELIVERY_REPORTS_FROM_SMS_GATEWAY(
-                                                                               
                                                                                
                     "Get Delivery Reports from SMS Gateway"), 
GENERATE_ADHOCCLIENT_SCEHDULE(
-                                                                               
                                                                                
                             "Generate AdhocClient Schedule"), 
UPDATE_EMAIL_OUTBOUND_WITH_CAMPAIGN_MESSAGE(
-                                                                               
                                                                                
                                     "Update Email Outbound with campaign 
message"), EXECUTE_EMAIL(
-                                                                               
                                                                                
                                             "Execute Email"), 
UPDATE_TRIAL_BALANCE_DETAILS(
-                                                                               
                                                                                
                                                     "Update Trial Balance 
Details"), EXECUTE_DIRTY_JOBS(
-                                                                               
                                                                                
                                                             "Execute All Dirty 
Jobs"), INCREASE_BUSINESS_DATE_BY_1_DAY(
-                                                                               
                                                                                
                                                                     "Increase 
Business Date by 1 day"), INCREASE_COB_DATE_BY_1_DAY(
-                                                                               
                                                                                
                                                                             
"Increase COB Date by 1 day");
+    UPDATE_LOAN_ARREARS_AGEING("Update Loan Arrears Ageing", 
UpdateLoanArrearsAgeingTasklet.class), APPLY_ANNUAL_FEE_FOR_SAVINGS(

Review Comment:
   You can put a `//` to the end of every enum value line and that'll preserve 
the formatting for spotless.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to