FINERACT-942 Remove use of printStackTrace and added checkstyle

This commit is contained in:
thesmallstar
2020-05-21 21:48:11 +02:00
committed by Michael Vorburger ⛑️
parent 1bff035d3c
commit 16fb971f45
41 changed files with 204 additions and 133 deletions
@@ -49,6 +49,7 @@
--> -->
<module name="TreeWalker"> <module name="TreeWalker">
<module name="SuppressWarningsHolder" />
<module name="RegexpSinglelineJava"> <module name="RegexpSinglelineJava">
<property name="format" value="System\.(out)|(err)\.print(ln)?\("/> <property name="format" value="System\.(out)|(err)\.print(ln)?\("/>
<property name="message" value="Line contains console output."/> <property name="message" value="Line contains console output."/>
@@ -66,6 +67,11 @@
</module> </module>
<module name="OneStatementPerLine"/> <module name="OneStatementPerLine"/>
<module name="EmptyStatement"/> <module name="EmptyStatement"/>
<module name="RegexpSinglelineJava">
<property name="format" value="\.printStackTrace?\("/>
<property name="message" value="Line contains printStacktrace()."/>
<property name="ignoreComments" value="false" />
</module>
<!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing): <!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing):
<module name="HiddenField"> <module name="HiddenField">
@@ -90,11 +96,7 @@
<property name="forbiddenImportsExcludesRegexp" value="" /> <property name="forbiddenImportsExcludesRegexp" value="" />
<message key="forbid.certain.imports" value="Use ''java.nio.charset.StandardCharsets'' instead of ''{0}''" /> <message key="forbid.certain.imports" value="Use ''java.nio.charset.StandardCharsets'' instead of ''{0}''" />
</module> </module>
<module name="RegexpSinglelineJava">
<property name="format" value="\.printStackTrace?\("/>
<property name="message" value="Line contains printStacktrace()."/>
<property name="ignoreComments" value="false" />
</module>
<module name="SuppressWarningsHolder" /> <module name="SuppressWarningsHolder" />
<module name="OuterTypeFilename"/> <module name="OuterTypeFilename"/>
<module name="IllegalTokenText"> <module name="IllegalTokenText">
@@ -556,7 +556,7 @@ public class AccountingScenarioIntegrationTest {
@Test @Test
@Ignore // TODO FINERACT-899 @Ignore // TODO FINERACT-899
public void checkPeriodicAccrualAccountingFlow() { public void checkPeriodicAccrualAccountingFlow() throws InterruptedException,ParseException {
final Account assetAccount = this.accountHelper.createAssetAccount(); final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount(); final Account expenseAccount = this.accountHelper.createExpenseAccount();
@@ -587,11 +587,8 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
// MAKE 1 // MAKE 1
LOG.info("Repayment 1 ......"); LOG.info("Repayment 1 ......");
@@ -673,7 +670,7 @@ public class AccountingScenarioIntegrationTest {
@Test @Test
@Ignore // TODO https://issues.apache.org/jira/browse/FINERACT-899 @Ignore // TODO https://issues.apache.org/jira/browse/FINERACT-899
public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() { public void checkPeriodicAccrualAccountingFlow_OVER_PAYMENT() throws InterruptedException,ParseException {
final Account assetAccount = this.accountHelper.createAssetAccount(); final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount(); final Account expenseAccount = this.accountHelper.createExpenseAccount();
@@ -704,11 +701,8 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
// MAKE 1 // MAKE 1
LOG.info("Repayment 1 ......"); LOG.info("Repayment 1 ......");
@@ -732,7 +726,7 @@ public class AccountingScenarioIntegrationTest {
@Test @Test
@Ignore // TODO https://issues.apache.org/jira/browse/FINERACT-899 @Ignore // TODO https://issues.apache.org/jira/browse/FINERACT-899
public void checkPeriodicAccrualAccountingTillCurrentDateFlow() { public void checkPeriodicAccrualAccountingTillCurrentDateFlow() throws InterruptedException,ParseException {
final Account assetAccount = this.accountHelper.createAssetAccount(); final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount(); final Account expenseAccount = this.accountHelper.createExpenseAccount();
@@ -793,11 +787,8 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry); this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
final String jobName = "Add Periodic Accrual Transactions"; final String jobName = "Add Periodic Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
loanID); loanID);
@@ -827,7 +818,7 @@ public class AccountingScenarioIntegrationTest {
} }
@Test @Test
public void checkPeriodicAccrualAccountingAPIFlow() { public void checkPeriodicAccrualAccountingAPIFlow() throws ParseException{
final Account assetAccount = this.accountHelper.createAssetAccount(); final Account assetAccount = this.accountHelper.createAssetAccount();
final Account incomeAccount = this.accountHelper.createIncomeAccount(); final Account incomeAccount = this.accountHelper.createIncomeAccount();
final Account expenseAccount = this.accountHelper.createExpenseAccount(); final Account expenseAccount = this.accountHelper.createExpenseAccount();
@@ -1066,14 +1057,10 @@ public class AccountingScenarioIntegrationTest {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON); return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
} }
private LocalDate getDateAsLocalDate(String dateAsString) { private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException{
LocalDate date = null; DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
try { LocalDate date = new LocalDate(df.parse(dateAsString));
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
date = new LocalDate(df.parse(dateAsString));
} catch (ParseException e) {
e.printStackTrace();
}
return date; return date;
} }
@@ -62,7 +62,6 @@ import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Client Loan Integration Test for checking Loan Application Repayments * Client Loan Integration Test for checking Loan Application Repayments
* Schedule, loan charges, penalties, loan repayments and verifying accounting * Schedule, loan charges, penalties, loan repayments and verifying accounting
@@ -2536,7 +2535,7 @@ public class ClientLoanIntegrationTest {
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 @Ignore // TODO FINERACT-885
public void loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled() { public void loanWithFlatCahargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
@@ -2646,11 +2645,8 @@ public class ClientLoanIntegrationTest {
* JournalEntry.TransactionType.DEBIT)); * JournalEntry.TransactionType.DEBIT));
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -2741,7 +2737,7 @@ public class ClientLoanIntegrationTest {
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 @Ignore // TODO FINERACT-885
public void loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() { public void loanWithCahargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
@@ -2854,11 +2850,8 @@ public class ClientLoanIntegrationTest {
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -2949,7 +2942,8 @@ public class ClientLoanIntegrationTest {
*/ */
@Test @Test
@Ignore // TODO FINERACT-885 @Ignore // TODO FINERACT-885
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled() { public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled()
throws InterruptedException {
this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec); this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, this.responseSpec);
this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec); this.schedulerJobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
@@ -3065,11 +3059,8 @@ public class ClientLoanIntegrationTest {
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
try {
this.schedulerJobHelper.executeJob(jobName); this.schedulerJobHelper.executeJob(jobName);
} catch (InterruptedException e) {
e.printStackTrace();
}
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -364,7 +364,7 @@ public class LoanDisbursementDetailsIntegrationTest {
} }
@Test @Test
public void createApproveAndValidateMultiDisburseLoan() { public void createApproveAndValidateMultiDisburseLoan() throws ParseException{
List<HashMap> createTranches = new ArrayList<>(); List<HashMap> createTranches = new ArrayList<>();
String id = null; String id = null;
@@ -399,13 +399,13 @@ public class LoanDisbursementDetailsIntegrationTest {
this.editLoanDisbursementDetails(); this.editLoanDisbursementDetails();
} }
private void editLoanDisbursementDetails() { private void editLoanDisbursementDetails() throws ParseException {
this.editDateAndPrincipalOfExistingTranche(); this.editDateAndPrincipalOfExistingTranche();
this.addNewDisbursementDetails(); this.addNewDisbursementDetails();
this.deleteDisbursmentDetails(); this.deleteDisbursmentDetails();
} }
private void addNewDisbursementDetails() { private void addNewDisbursementDetails() throws ParseException {
List<HashMap> addTranches = new ArrayList<>(); List<HashMap> addTranches = new ArrayList<>();
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec, ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
this.responseSpec, this.loanID, "disbursementDetails"); this.responseSpec, this.loanID, "disbursementDetails");
@@ -423,7 +423,7 @@ public class LoanDisbursementDetailsIntegrationTest {
addTranches, ""); addTranches, "");
} }
private void deleteDisbursmentDetails() { private void deleteDisbursmentDetails() throws ParseException{
List<HashMap> deleteTranches = new ArrayList<>(); List<HashMap> deleteTranches = new ArrayList<>();
ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec, ArrayList<HashMap> disbursementDetails = (ArrayList<HashMap>) this.loanTransactionHelper.getLoanDetail(this.requestSpec,
this.responseSpec, this.loanID, "disbursementDetails"); this.responseSpec, this.loanID, "disbursementDetails");
@@ -440,7 +440,7 @@ public class LoanDisbursementDetailsIntegrationTest {
deleteTranches, ""); deleteTranches, "");
} }
private void editDateAndPrincipalOfExistingTranche() { private void editDateAndPrincipalOfExistingTranche() throws ParseException{
String updatedExpectedDisbursementDate = "01 March 2014"; String updatedExpectedDisbursementDate = "01 March 2014";
String updatedPrincipal = "900"; String updatedPrincipal = "900";
/* Update */ /* Update */
@@ -456,16 +456,12 @@ public class LoanDisbursementDetailsIntegrationTest {
} }
private String formatExpectedDisbursementDate(String expectedDisbursementDate) { private String formatExpectedDisbursementDate(String expectedDisbursementDate) throws ParseException {
SimpleDateFormat source = new SimpleDateFormat("[yyyy, MM, dd]"); SimpleDateFormat source = new SimpleDateFormat("[yyyy, MM, dd]");
SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy"); SimpleDateFormat target = new SimpleDateFormat("dd MMMM yyyy");
String date = null; String date = target.format(source.parse(expectedDisbursementDate));
try {
date = target.format(source.parse(expectedDisbursementDate));
} catch (ParseException e) {
e.printStackTrace();
}
return date; return date;
} }
@@ -59,7 +59,7 @@ public class ProvisioningIntegrationTest {
private LoanTransactionHelper loanTransactionHelper; private LoanTransactionHelper loanTransactionHelper;
@Before @Before
public void setup() { public void setup() throws ParseException{
Utils.initializeRESTAssured(); Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
@@ -223,7 +223,7 @@ public class ProvisioningIntegrationTest {
return this.loanTransactionHelper.getLoanId(loanApplicationJSON); return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
} }
private boolean isAlreadyProvisioningEntriesCreated() { private boolean isAlreadyProvisioningEntriesCreated() throws ParseException {
ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec); ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec);
Map entries = transactionHelper.retrieveAllProvisioningEntries() ; Map entries = transactionHelper.retrieveAllProvisioningEntries() ;
ArrayList<Map> pageItems = (ArrayList)entries.get("pageItems") ; ArrayList<Map> pageItems = (ArrayList)entries.get("pageItems") ;
@@ -232,20 +232,16 @@ public class ProvisioningIntegrationTest {
for(Map item: pageItems) { for(Map item: pageItems) {
String date = (String)item.get("createdDate") ; String date = (String)item.get("createdDate") ;
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy"); DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy");
try { Date date1 = formatter.parse(date) ;
Date date1 = formatter.parse(date) ; DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy"); String formattedString = simple.format(Utils.getLocalDateOfTenant().toDate());
String formattedString = simple.format(Utils.getLocalDateOfTenant().toDate()); Date currentDate = simple.parse(formattedString) ;
Date currentDate = simple.parse(formattedString) ; if(date1.getTime() == currentDate.getTime()) {
if(date1.getTime() == currentDate.getTime()) { provisioningetryAlreadyCreated = true ;
provisioningetryAlreadyCreated = true ; break;
break ;
}
} catch (ParseException e) {
e.printStackTrace();
} }
} }
} }
return provisioningetryAlreadyCreated ; return provisioningetryAlreadyCreated;
} }
} }
@@ -192,15 +192,13 @@ public class Utils {
return (T) (jsonAttributeToGetBack == null ? json : from(json).get(jsonAttributeToGetBack)); return (T) (jsonAttributeToGetBack == null ? json : from(json).get(jsonAttributeToGetBack));
} }
public static String convertDateToURLFormat(final String dateToBeConvert) { public static String convertDateToURLFormat(final String dateToBeConvert) throws ParseException{
final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy", Locale.US); final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy", Locale.US);
final SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); final SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd");
String reformattedStr = ""; String reformattedStr = "";
try {
reformattedStr = newFormat.format(oldFormat.parse(dateToBeConvert)); reformattedStr = newFormat.format(oldFormat.parse(dateToBeConvert));
} catch (final ParseException e) {
e.printStackTrace();
}
return reformattedStr; return reformattedStr;
} }
@@ -46,13 +46,16 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class CenterImportHandler implements ImportHandler { public class CenterImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(CenterImportHandler.class);
private List<CenterData> centers; private List<CenterData> centers;
private List<CalendarData> meetings; private List<CalendarData> meetings;
private List<String>statuses; private List<String>statuses;
@@ -186,7 +189,7 @@ public class CenterImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Runtime Exception occured in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeCenterErrorMessage(centerId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeCenterErrorMessage(centerId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -42,10 +42,15 @@ import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ChartOfAccountsImportHandler implements ImportHandler { public class ChartOfAccountsImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(ChartOfAccountsImportHandler.class);
private List<GLAccountData> glAccounts; private List<GLAccountData> glAccounts;
private Workbook workbook; private Workbook workbook;
@@ -130,7 +135,7 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet,glAccount.getRowIndex(),errorMessage,ChartOfAcountsConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(chartOfAccountsSheet,glAccount.getRowIndex(),errorMessage,ChartOfAcountsConstants.STATUS_COL);
} }
@@ -42,11 +42,15 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ClientEntityImportHandler implements ImportHandler { public class ClientEntityImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(ClientEntityImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<ClientData> clients; private List<ClientData> clients;
@@ -203,7 +207,7 @@ public class ClientEntityImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(clientSheet,client.getRowIndex(),errorMessage,ClientEntityConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(clientSheet,client.getRowIndex(),errorMessage,ClientEntityConstants.STATUS_COL);
} }
@@ -40,12 +40,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ClientPersonImportHandler implements ImportHandler { public class ClientPersonImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(ClientPersonImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<ClientData> clients; private List<ClientData> clients;
@@ -187,7 +189,7 @@ public class ClientPersonImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(clientSheet,client.getRowIndex(),errorMessage,ClientPersonConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(clientSheet,client.getRowIndex(),errorMessage,ClientPersonConstants.STATUS_COL);
} }
@@ -48,12 +48,13 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class FixedDepositImportHandler implements ImportHandler { public class FixedDepositImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<FixedDepositAccountData> savings; private List<FixedDepositAccountData> savings;
@@ -290,7 +291,7 @@ public class FixedDepositImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeFixedDepositErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeFixedDepositErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -42,10 +42,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class FixedDepositTransactionImportHandler implements ImportHandler { public class FixedDepositTransactionImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositTransactionImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<SavingsAccountTransactionData> savingsTransactions; private List<SavingsAccountTransactionData> savingsTransactions;
private String savingsAccountId = ""; private String savingsAccountId = "";
@@ -138,7 +142,7 @@ public class FixedDepositTransactionImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL);
} }
@@ -46,11 +46,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class GroupImportHandler implements ImportHandler { public class GroupImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(GroupImportHandler.class);
private List<GroupGeneralData> groups; private List<GroupGeneralData> groups;
private List<CalendarData> meetings; private List<CalendarData> meetings;
private Workbook workbook; private Workbook workbook;
@@ -183,7 +186,7 @@ public class GroupImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeGroupErrorMessage(groupId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeGroupErrorMessage(groupId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -40,11 +40,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class GuarantorImportHandler implements ImportHandler { public class GuarantorImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(GuarantorImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<GuarantorData> guarantors; private List<GuarantorData> guarantors;
private Long loanAccountId ; private Long loanAccountId ;
@@ -137,7 +140,7 @@ public class GuarantorImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(addGuarantorSheet,guarantor.getRowIndex(),errorMessage,GuarantorConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(addGuarantorSheet,guarantor.getRowIndex(),errorMessage,GuarantorConstants.STATUS_COL);
} }
@@ -42,10 +42,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class JournalEntriesImportHandler implements ImportHandler { public class JournalEntriesImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(JournalEntriesImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<JournalEntryData> gltransaction; private List<JournalEntryData> gltransaction;
private LocalDate transactionDate; private LocalDate transactionDate;
@@ -212,7 +216,7 @@ public class JournalEntriesImportHandler implements ImportHandler {
IndexedColors.LIGHT_GREEN)); IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(addJournalEntriesSheet,transaction.getRowIndex(),errorMessage, JournalEntryConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(addJournalEntriesSheet,transaction.getRowIndex(),errorMessage, JournalEntryConstants.STATUS_COL);
} }
@@ -49,11 +49,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class LoanImportHandler implements ImportHandler { public class LoanImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(LoanImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<LoanAccountData> loans; private List<LoanAccountData> loans;
private List<LoanApprovalData> approvalDates; private List<LoanApprovalData> approvalDates;
@@ -339,7 +342,7 @@ public class LoanImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeLoanErrorMessage(loanId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeLoanErrorMessage(loanId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -40,10 +40,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class LoanRepaymentImportHandler implements ImportHandler { public class LoanRepaymentImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(LoanRepaymentImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<LoanTransactionData> loanRepayments; private List<LoanTransactionData> loanRepayments;
private Long loanAccountId; private Long loanAccountId;
@@ -121,7 +125,7 @@ public class LoanRepaymentImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(loanRepaymentSheet,loanRepayment.getRowIndex(),errorMessage,LoanRepaymentConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(loanRepaymentSheet,loanRepayment.getRowIndex(),errorMessage,LoanRepaymentConstants.STATUS_COL);
} }
@@ -38,11 +38,15 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class OfficeImportHandler implements ImportHandler { public class OfficeImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(OfficeImportHandler.class);
private List<OfficeData> offices; private List<OfficeData> offices;
private Workbook workbook; private Workbook workbook;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@@ -107,7 +111,7 @@ public class OfficeImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(officeSheet,office.getRowIndex(),errorMessage,OfficeConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(officeSheet,office.getRowIndex(),errorMessage,OfficeConstants.STATUS_COL);
} }
@@ -45,11 +45,15 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class RecurringDepositImportHandler implements ImportHandler { public class RecurringDepositImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(RecurringDepositImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<RecurringDepositAccountData> savings; private List<RecurringDepositAccountData> savings;
private List<SavingsApproval> approvalDates; private List<SavingsApproval> approvalDates;
@@ -286,7 +290,7 @@ public class RecurringDepositImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeRecurringDepositErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeRecurringDepositErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -43,11 +43,15 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class RecurringDepositTransactionImportHandler implements ImportHandler { public class RecurringDepositTransactionImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(RecurringDepositTransactionImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<SavingsAccountTransactionData> savingsTransactions; private List<SavingsAccountTransactionData> savingsTransactions;
private String savingsAccountId = ""; private String savingsAccountId = "";
@@ -141,12 +145,12 @@ public class RecurringDepositTransactionImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
} catch (AbstractPlatformDomainRuleException e) { } catch (AbstractPlatformDomainRuleException e) {
errorCount++; errorCount++;
e.printStackTrace(); LOG.error("Problem occurred in importEntity function",e);
errorMessage = e.getDefaultUserMessage(); errorMessage = e.getDefaultUserMessage();
ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL);
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL);
} }
@@ -46,11 +46,16 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class SavingsImportHandler implements ImportHandler { public class SavingsImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(SavingsImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<SavingsAccountData> savings; private List<SavingsAccountData> savings;
private List<SavingsApproval> approvalDates; private List<SavingsApproval> approvalDates;
@@ -277,7 +282,7 @@ public class SavingsImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
writeSavingsErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row); writeSavingsErrorMessage(savingsId,errorMessage,progressLevel,statusCell,errorReportCell,row);
} }
@@ -42,10 +42,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class SavingsTransactionImportHandler implements ImportHandler { public class SavingsTransactionImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(SavingsTransactionImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<SavingsAccountTransactionData> savingsTransactions; private List<SavingsAccountTransactionData> savingsTransactions;
private String savingsAccountId = ""; private String savingsAccountId = "";
@@ -140,7 +144,7 @@ public class SavingsTransactionImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(savingsTransactionSheet,transaction.getRowIndex(),errorMessage,TransactionConstants.STATUS_COL);
} }
@@ -40,10 +40,15 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class SharedAccountImportHandler implements ImportHandler { public class SharedAccountImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(SharedAccountImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<ShareAccountData> shareAccountDataList; private List<ShareAccountData> shareAccountDataList;
private List<String>statuses; private List<String>statuses;
@@ -161,7 +166,7 @@ public class SharedAccountImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(sharedAccountsSheet,shareAccountData.getRowIndex(),errorMessage,SharedAccountsConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(sharedAccountsSheet,shareAccountData.getRowIndex(),errorMessage,SharedAccountsConstants.STATUS_COL);
} }
@@ -38,11 +38,14 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class StaffImportHandler implements ImportHandler { public class StaffImportHandler implements ImportHandler {
private final static Logger LOG = LoggerFactory.getLogger(StaffImportHandler.class);
private List<StaffData> staffList; private List<StaffData> staffList;
private Workbook workbook; private Workbook workbook;
@@ -112,7 +115,7 @@ public class StaffImportHandler implements ImportHandler {
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(staffSheet,staff.getRowIndex(),errorMessage,StaffConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(staffSheet,staff.getRowIndex(),errorMessage,StaffConstants.STATUS_COL);
} }
@@ -37,10 +37,15 @@ import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class UserImportHandler implements ImportHandler{ public class UserImportHandler implements ImportHandler{
private final static Logger LOG = LoggerFactory.getLogger(UserImportHandler.class);
private Workbook workbook; private Workbook workbook;
private List<AppUserData> users; private List<AppUserData> users;
private List<String> statuses; private List<String> statuses;
@@ -124,7 +129,7 @@ public class UserImportHandler implements ImportHandler{
}catch (RuntimeException ex){ }catch (RuntimeException ex){
errorCount++; errorCount++;
ex.printStackTrace(); LOG.error("Problem occurred in importEntity function",ex);
errorMessage=ImportHandlerUtils.getErrorMessage(ex); errorMessage=ImportHandlerUtils.getErrorMessage(ex);
ImportHandlerUtils.writeErrorMessage(userSheet,user.getRowIndex(),errorMessage,UserConstants.STATUS_COL); ImportHandlerUtils.writeErrorMessage(userSheet,user.getRowIndex(),errorMessage,UserConstants.STATUS_COL);
} }
@@ -31,9 +31,12 @@ import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractWorkbookPopulator implements WorkbookPopulator { public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
private final static Logger LOG = LoggerFactory.getLogger(AbstractWorkbookPopulator.class);
protected void writeInt(int colIndex, Row row, int value) { protected void writeInt(int colIndex, Row row, int value) {
row.createCell(colIndex).setCellValue(value); row.createCell(colIndex).setCellValue(value);
} }
@@ -154,7 +157,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
} }
} }
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); LOG.error("Problem occurred in setClientAndGroupDateLookupTable function",e);
} }
} }
@@ -39,8 +39,11 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator { public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
private final static Logger LOG = LoggerFactory.getLogger(ChartOfAccountsWorkbook.class);
private List<GLAccountData> glAccounts; private List<GLAccountData> glAccounts;
private Map<String,List<String>> accountTypeToAccountNameAndTag; private Map<String,List<String>> accountTypeToAccountNameAndTag;
private Map<Integer,Integer[]>accountTypeToBeginEndIndexesofAccountNames; private Map<Integer,Integer[]>accountTypeToBeginEndIndexesofAccountNames;
@@ -159,7 +162,7 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
"\"\",(VLOOKUP($H"+(rowNo+1)+",$S$2:$T$"+(glAccounts.size()+1)+",2,FALSE)))"); "\"\",(VLOOKUP($H"+(rowNo+1)+",$S$2:$T$"+(glAccounts.size()+1)+",2,FALSE)))");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOG.error("Problem occurred in setDefaults function",e);
} }
} }
@@ -39,9 +39,11 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FixedDepositWorkbookPopulator extends AbstractWorkbookPopulator { public class FixedDepositWorkbookPopulator extends AbstractWorkbookPopulator {
private final static Logger LOG = LoggerFactory.getLogger(FixedDepositWorkbookPopulator.class);
private OfficeSheetPopulator officeSheetPopulator; private OfficeSheetPopulator officeSheetPopulator;
private ClientSheetPopulator clientSheetPopulator; private ClientSheetPopulator clientSheetPopulator;
private PersonnelSheetPopulator personnelSheetPopulator; private PersonnelSheetPopulator personnelSheetPopulator;
@@ -293,7 +295,7 @@ public class FixedDepositWorkbookPopulator extends AbstractWorkbookPopulator {
+ "))),\"\",INDIRECT(CONCATENATE(\"Term_Type_\",$C" + (rowNo + 1) + ")))"); + "))),\"\",INDIRECT(CONCATENATE(\"Term_Type_\",$C" + (rowNo + 1) + ")))");
} }
} catch (RuntimeException re) { } catch (RuntimeException re) {
re.printStackTrace(); LOG.error("Problem occurred in setDefaults function",re);
} }
} }
private void setLayout(Sheet worksheet) { private void setLayout(Sheet worksheet) {
@@ -47,8 +47,11 @@ import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellRangeAddressList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator { public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
private final static Logger LOG = LoggerFactory.getLogger(LoanRepaymentWorkbookPopulator.class);
private OfficeSheetPopulator officeSheetPopulator; private OfficeSheetPopulator officeSheetPopulator;
private ClientSheetPopulator clientSheetPopulator; private ClientSheetPopulator clientSheetPopulator;
private ExtrasSheetPopulator extrasSheetPopulator; private ExtrasSheetPopulator extrasSheetPopulator;
@@ -247,7 +250,7 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
try { try {
date = inputFormat.parse(loan.getDisbursementDate().toString()); date = inputFormat.parse(loan.getDisbursementDate().toString());
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); LOG.error("Problem occurred in populateLoansTable function",e);
} }
writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row, writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row,
outputFormat.format(date), dateCellStyle,dateFormat); outputFormat.format(date), dateCellStyle,dateFormat);
@@ -39,6 +39,8 @@ import org.apache.fineract.infrastructure.documentmanagement.domain.Document;
import org.apache.fineract.infrastructure.documentmanagement.service.DocumentWritePlatformService; import org.apache.fineract.infrastructure.documentmanagement.service.DocumentWritePlatformService;
import org.apache.fineract.infrastructure.security.service.TenantDetailsService; import org.apache.fineract.infrastructure.security.service.TenantDetailsService;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
@@ -46,8 +48,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BulkImportEventListener implements ApplicationListener<BulkImportEvent> { public class BulkImportEventListener implements ApplicationListener<BulkImportEvent> {
private final static Logger LOG = LoggerFactory.getLogger(BulkImportEventListener.class);
private final TenantDetailsService tenantDetailsService; private final TenantDetailsService tenantDetailsService;
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;
private final ImportDocumentRepository importRepository; private final ImportDocumentRepository importRepository;
@@ -163,7 +164,7 @@ public class BulkImportEventListener implements ApplicationListener<BulkImportEv
bos.close(); bos.close();
} }
} catch (IOException io) { } catch (IOException io) {
io.printStackTrace(); LOG.error("Problem occurred in onApplicationEvent function",io);
} }
byte[] bytes = bos.toByteArray(); byte[] bytes = bos.toByteArray();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
@@ -107,12 +107,14 @@ import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.service.RoleReadPlatformService; import org.apache.fineract.useradministration.service.RoleReadPlatformService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkbookPopulatorService { public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkbookPopulatorService {
private final static Logger LOG = LoggerFactory.getLogger(BulkImportWorkbookPopulatorServiceImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final OfficeReadPlatformService officeReadPlatformService; private final OfficeReadPlatformService officeReadPlatformService;
private final StaffReadPlatformService staffReadPlatformService; private final StaffReadPlatformService staffReadPlatformService;
@@ -260,7 +262,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
try { try {
workbook.write(baos); workbook.write(baos);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOG.error("Problem occurred in buildResponse function",e);
} }
final ResponseBuilder response = Response.ok(baos.toByteArray()); final ResponseBuilder response = Response.ok(baos.toByteArray());
@@ -55,6 +55,8 @@ import org.apache.tika.Tika;
import org.apache.tika.io.IOUtils; import org.apache.tika.io.IOUtils;
import org.apache.tika.io.TikaInputStream; import org.apache.tika.io.TikaInputStream;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@@ -64,6 +66,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService { public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService {
private final static Logger LOG = LoggerFactory.getLogger(BulkImportWorkbookServiceImpl.class);
private final ApplicationContext applicationContext; private final ApplicationContext applicationContext;
private final PlatformSecurityContext securityContext; private final PlatformSecurityContext securityContext;
private final DocumentWritePlatformService documentWritePlatformService; private final DocumentWritePlatformService documentWritePlatformService;
@@ -179,7 +182,7 @@ public class BulkImportWorkbookServiceImpl implements BulkImportWorkbookService
throw new GeneralPlatformDomainRuleException("error.msg.null","One or more of the given parameters not found"); throw new GeneralPlatformDomainRuleException("error.msg.null","One or more of the given parameters not found");
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LOG.error("Problem occurred in importWorkbook function",e);
throw new GeneralPlatformDomainRuleException("error.msg.io.exception","IO exception occured with "+fileDetail.getFileName()+" "+e.getMessage()); throw new GeneralPlatformDomainRuleException("error.msg.io.exception","IO exception occured with "+fileDetail.getFileName()+" "+e.getMessage());
} }
@@ -57,6 +57,7 @@ public class MultiException extends Exception {
} }
@Override @Override
@SuppressWarnings("RegexpSinglelineJava")
public String getMessage() { public String getMessage() {
int i = 0; int i = 0;
StringBuilder sb = new StringBuilder(super.getMessage()); StringBuilder sb = new StringBuilder(super.getMessage());
@@ -72,6 +73,7 @@ public class MultiException extends Exception {
} }
@Override @Override
@SuppressWarnings("RegexpSinglelineJava")
public void printStackTrace() { public void printStackTrace() {
LOG.info("{}", super.getMessage()); LOG.info("{}", super.getMessage());
int i = 0; int i = 0;
@@ -82,6 +84,7 @@ public class MultiException extends Exception {
} }
@Override @Override
@SuppressWarnings("RegexpSinglelineJava")
public void printStackTrace(PrintStream s) { public void printStackTrace(PrintStream s) {
s.println(super.getMessage()); s.println(super.getMessage());
int i = 0; int i = 0;
@@ -92,6 +95,7 @@ public class MultiException extends Exception {
} }
@Override @Override
@SuppressWarnings("RegexpSinglelineJava")
public void printStackTrace(PrintWriter s) { public void printStackTrace(PrintWriter s) {
s.println(super.getMessage()); s.println(super.getMessage());
int i = 0; int i = 0;
@@ -198,7 +198,7 @@ public class ImageData {
try { try {
fileInputStream.close(); fileInputStream.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); logger.error("Problem occurred in available function",e);
} }
} }
} }
@@ -47,7 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class FineractEntityAccessWriteServiceImpl implements FineractEntityAccessWriteService { public class FineractEntityAccessWriteServiceImpl implements FineractEntityAccessWriteService {
private final static Logger logger = LoggerFactory.getLogger(FineractEntityAccessWriteServiceImpl.class); private final static Logger LOG = LoggerFactory.getLogger(FineractEntityAccessWriteServiceImpl.class);
private final FineractEntityAccessRepository entityAccessRepository; private final FineractEntityAccessRepository entityAccessRepository;
private final FineractEntityRelationRepositoryWrapper fineractEntityRelationRepositoryWrapper; private final FineractEntityRelationRepositoryWrapper fineractEntityRelationRepositoryWrapper;
private final FineractEntityToEntityMappingRepository fineractEntityToEntityMappingRepository; private final FineractEntityToEntityMappingRepository fineractEntityToEntityMappingRepository;
@@ -164,8 +164,7 @@ public class FineractEntityAccessWriteServiceImpl implements FineractEntityAcces
} }
private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dve) { private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dve) {
LOG.error("Problem occurred in handleDataIntegrityIssues function",realCause);
realCause.printStackTrace();
if (realCause.getMessage().contains("rel_id_from_id_to_id")) { if (realCause.getMessage().contains("rel_id_from_id_to_id")) {
final String fromId = command.stringValueOfParameterNamed(FineractEntityApiResourceConstants.fromEnityType); final String fromId = command.stringValueOfParameterNamed(FineractEntityApiResourceConstants.fromEnityType);
final String toId = command.stringValueOfParameterNamed(FineractEntityApiResourceConstants.toEntityType); final String toId = command.stringValueOfParameterNamed(FineractEntityApiResourceConstants.toEntityType);
@@ -178,7 +177,7 @@ public class FineractEntityAccessWriteServiceImpl implements FineractEntityAcces
} }
private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) { private void logAsErrorUnexpectedDataIntegrityException(final Exception dve) {
logger.error("Error occured.", dve); LOG.error("Error occured.", dve);
} }
/* /*
@@ -26,6 +26,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConstants; import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConstants;
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobConfigurationData; import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobConfigurationData;
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobEmailData; import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobEmailData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessageHelper;
@@ -33,6 +35,7 @@ import org.springframework.stereotype.Service;
@Service @Service
public class ReportMailingJobEmailServiceImpl implements ReportMailingJobEmailService { public class ReportMailingJobEmailServiceImpl implements ReportMailingJobEmailService {
private final static Logger logger = LoggerFactory.getLogger(ReportMailingJobEmailServiceImpl.class);
private final ReportMailingJobConfigurationReadPlatformService reportMailingJobConfigurationReadPlatformService; private final ReportMailingJobConfigurationReadPlatformService reportMailingJobConfigurationReadPlatformService;
private Collection<ReportMailingJobConfigurationData> reportMailingJobConfigurationDataCollection; private Collection<ReportMailingJobConfigurationData> reportMailingJobConfigurationDataCollection;
@@ -77,7 +80,7 @@ public class ReportMailingJobEmailServiceImpl implements ReportMailingJobEmailSe
catch (MessagingException e) { catch (MessagingException e) {
// handle the exception // handle the exception
e.printStackTrace(); logger.error("Problem occurred in sendEmailWithAttachment function",e);
} }
} }
@@ -30,6 +30,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource; import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.jdbc.datasource.DataSourceUtils;
@@ -37,7 +39,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class ColumnValidator { public class ColumnValidator {
private final static Logger LOG = LoggerFactory.getLogger(ColumnValidator.class);
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
@Autowired @Autowired
@@ -84,7 +86,7 @@ public class ColumnValidator {
columns.add(rs.getString("column_name")); columns.add(rs.getString("column_name"));
} }
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); LOG.error("Problem occurred in getTableColumns function",e);
} }
return columns; return columns;
} }
@@ -34,6 +34,8 @@ import org.apache.fineract.mix.data.MixTaxonomyData;
import org.apache.fineract.mix.data.MixTaxonomyMappingData; import org.apache.fineract.mix.data.MixTaxonomyMappingData;
import org.apache.fineract.mix.data.XBRLData; import org.apache.fineract.mix.data.XBRLData;
import org.apache.fineract.mix.exception.XBRLMappingInvalidException; import org.apache.fineract.mix.exception.XBRLMappingInvalidException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.jdbc.support.rowset.SqlRowSet;
@@ -41,7 +43,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class XBRLResultServiceImpl implements XBRLResultService { public class XBRLResultServiceImpl implements XBRLResultService {
private final static Logger LOG = LoggerFactory.getLogger(XBRLResultServiceImpl.class);
private static final ScriptEngine SCRIPT_ENGINE = new ScriptEngineManager().getEngineByName("JavaScript"); private static final ScriptEngine SCRIPT_ENGINE = new ScriptEngineManager().getEngineByName("JavaScript");
private final MixTaxonomyMappingReadPlatformService readTaxonomyMappingService; private final MixTaxonomyMappingReadPlatformService readTaxonomyMappingService;
@@ -176,7 +178,7 @@ public class XBRLResultServiceImpl implements XBRLResultService {
eval = value.floatValue(); eval = value.floatValue();
} }
} catch (final ScriptException e) { } catch (final ScriptException e) {
e.printStackTrace(); LOG.error("Problem occurred in processMappingString function",e);
throw new IllegalArgumentException(e.getMessage()); throw new IllegalArgumentException(e.getMessage());
} }
@@ -51,9 +51,11 @@ import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CalendarUtils { public class CalendarUtils {
private final static Logger LOG = LoggerFactory.getLogger(CalendarUtils.class);
static { static {
System.setProperty("net.fortuna.ical4j.timezone.date.floating", "true"); System.setProperty("net.fortuna.ical4j.timezone.date.floating", "true");
} }
@@ -114,7 +116,7 @@ public class CalendarUtils {
try { try {
formattedDate = new Date(seedDateStr, "yyyy-MM-dd"); formattedDate = new Date(seedDateStr, "yyyy-MM-dd");
} catch (final ParseException e) { } catch (final ParseException e) {
e.printStackTrace(); LOG.error("Invalid date: {}" , seedDateStr, e);
} }
return formattedDate; return formattedDate;
} }
@@ -211,10 +213,10 @@ public class CalendarUtils {
return recur; return recur;
} catch (final ParseException e) { } catch (final ParseException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); LOG.error("Problem occurred in getICalRecur function",e);
} catch (final ValidationException e) { } catch (final ValidationException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); LOG.error("Problem occurred in getICalRecur function",e);
} }
return null; return null;
@@ -37,13 +37,15 @@ import org.apache.fineract.portfolio.client.domain.ClientFamilyMembers;
import org.apache.fineract.portfolio.client.domain.ClientFamilyMembersRepository; import org.apache.fineract.portfolio.client.domain.ClientFamilyMembersRepository;
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper; import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
import org.apache.fineract.portfolio.client.serialization.ClientFamilyMemberCommandFromApiJsonDeserializer; import org.apache.fineract.portfolio.client.serialization.ClientFamilyMemberCommandFromApiJsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamilyMembersWritePlatformService public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamilyMembersWritePlatformService
{ {
private final static Logger LOG = LoggerFactory.getLogger(ClientFamilyMembersWritePlatformServiceImpl.class);
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final CodeValueRepository codeValueRepository; private final CodeValueRepository codeValueRepository;
private final ClientFamilyMembersRepository clientFamilyRepository; private final ClientFamilyMembersRepository clientFamilyRepository;
@@ -265,7 +267,7 @@ public class ClientFamilyMembersWritePlatformServiceImpl implements ClientFamily
dateOfBirth=date; dateOfBirth=date;
} catch (ParseException e) { } catch (ParseException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); LOG.error("Problem occurred in addClientFamilyMember function",e);
} }
@@ -166,7 +166,7 @@ public class TemplateMergeService {
try { try {
br.close(); br.close();
} catch (final IOException e) { } catch (final IOException e) {
e.printStackTrace(); logger.error("Problem occurred in getStringFromInputStream function",e);
} }
} }
} }