FINERACT-821 Added and enforced NeedBraces Checkstyle

This commit is contained in:
Manthan Surkar
2020-05-27 00:13:22 +02:00
committed by Michael Vorburger ⛑️
parent 50d5d08378
commit 3e95c32e18
138 changed files with 1337 additions and 683 deletions
@@ -87,6 +87,7 @@
<property name="allowNonPrintableEscapes" value="true"/> <property name="allowNonPrintableEscapes" value="true"/>
</module> </module>
<module name="UpperEll"/> <module name="UpperEll"/>
<module name="NeedBraces"/>
<!-- 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">
@@ -126,7 +127,7 @@
<property name="option" value="TEXT"/> <property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module> </module>
<module name="NeedBraces"/>
<module name="LeftCurly" /> <module name="LeftCurly" />
<module name="RightCurly"> <module name="RightCurly">
<property name="option" value="alone"/> <property name="option" value="alone"/>
@@ -4540,8 +4540,9 @@ public class ClientLoanIntegrationTest {
builder = builder.withAccountingRulePeriodicAccrual(accounts); builder = builder.withAccountingRulePeriodicAccrual(accounts);
} }
if (isArrearsBasedOnOriginalSchedule) if (isArrearsBasedOnOriginalSchedule) {
builder = builder.withArrearsConfiguration(); builder = builder.withArrearsConfiguration();
}
final String loanProductJSON = builder.build(chargeId); final String loanProductJSON = builder.build(chargeId);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON); return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
@@ -86,7 +86,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions"); ArrayList<HashMap<String, Object>> transactions = (ArrayList<HashMap<String, Object>>) accountDetails.get("transactions");
HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2); HashMap<String, Object> interestPostingTransaction = transactions.get(transactions.size() - 2);
for (Entry<String, Object> entry : interestPostingTransaction.entrySet()) for (Entry<String, Object> entry : interestPostingTransaction.entrySet())
LOG.info("{} - {}",entry.getKey(), entry.getValue().toString()); {LOG.info("{} - {}",entry.getKey(), entry.getValue().toString());}
// 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily // 1st Dec 13 to 31st March 14 - 365 days, daily compounding using daily
// balance // balance
// 33.7016 obtained from formula in excel provided by Subramanya // 33.7016 obtained from formula in excel provided by Subramanya
@@ -122,9 +122,10 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
Boolean enabled = (Boolean) globalConfig.get(10).get("enabled"); Boolean enabled = (Boolean) globalConfig.get(10).get("enabled");
if (enabled != periodEndEnable) if (enabled != periodEndEnable) {
periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, periodEndConfigId = GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec,
periodEndConfigId.toString(), periodEndEnable); this.responseSpec, periodEndConfigId.toString(), periodEndEnable);
}
// Updating value for financial year beginning month // Updating value for financial year beginning month
Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id"); Integer financialYearBeginningConfigId = (Integer) globalConfig.get(11).get("id");
@@ -192,7 +192,9 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
builder = builder.withAccountingRulePeriodicAccrual(accounts); builder = builder.withAccountingRulePeriodicAccrual(accounts);
} }
if (isArrearsBasedOnOriginalSchedule) builder = builder.withArrearsConfiguration(); if (isArrearsBasedOnOriginalSchedule) {
builder = builder.withArrearsConfiguration();
}
final String loanProductJSON = builder.build(chargeId); final String loanProductJSON = builder.build(chargeId);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON); return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
@@ -121,8 +121,9 @@ public class ClientEntityImportHandlerTest {
firstClientRow.createCell(ClientEntityConstants.ADDRESS_ENABLED).setCellValue("False"); firstClientRow.createCell(ClientEntityConstants.ADDRESS_ENABLED).setCellValue("False");
File directory=new File(System.getProperty("user.home")+File.separator+"Fineract"+File.separator+"bulkimport"+File.separator+"integration_tests"+File.separator+"importhandler"+File.separator+"client") ; File directory=new File(System.getProperty("user.home")+File.separator+"Fineract"+File.separator+"bulkimport"+File.separator+"integration_tests"+File.separator+"importhandler"+File.separator+"client") ;
if (!directory.exists()) if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
}
File file= new File(directory+File.separator+"ClientEntity.xls"); File file= new File(directory+File.separator+"ClientEntity.xls");
OutputStream outputStream=new FileOutputStream(file); OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream); workbook.write(outputStream);
@@ -154,8 +154,9 @@ public class LoanImportHandlerTest {
String currentdirectory = new File("").getAbsolutePath(); String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+ File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"loan") ; "resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"loan") ;
if (!directory.exists()) if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
}
File file= new File(directory+File.separator+"Loan.xls"); File file= new File(directory+File.separator+"Loan.xls");
OutputStream outputStream=new FileOutputStream(file); OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream); workbook.write(outputStream);
@@ -78,8 +78,9 @@ public class OfficeImportHandlerTest {
String currentdirectory = new File("").getAbsolutePath(); String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+ File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"office"); "resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"office");
if (!directory.exists()) if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
}
File file= new File(directory+File.separator+"Office.xls"); File file= new File(directory+File.separator+"Office.xls");
OutputStream outputStream=new FileOutputStream(file); OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream); workbook.write(outputStream);
@@ -130,8 +130,9 @@ public class SavingsImportHandlerTest {
String currentdirectory = new File("").getAbsolutePath(); String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+ File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"savings") ; "resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"savings") ;
if (!directory.exists()) if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
}
File file= new File(directory+File.separator+"Savings.xls"); File file= new File(directory+File.separator+"Savings.xls");
OutputStream outputStream=new FileOutputStream(file); OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream); workbook.write(outputStream);
@@ -123,10 +123,18 @@ public class CenterDomain implements Comparable<CenterDomain> {
String officeName, String hierarchy, final int[] groupMembers) { String officeName, String hierarchy, final int[] groupMembers) {
// String ids = String.valueOf(id); // String ids = String.valueOf(id);
final HashMap map = new HashMap<>(); final HashMap map = new HashMap<>();
if (id != null) map.put("id", id); if (id != null) {
if (statusId != null) map.put("statusId", statusId); map.put("id", id);
if (statusCode != null) map.put("statusCode", statusCode); }
if (statusValue != null) map.put("statusValue", statusValue); if (statusId != null) {
map.put("statusId", statusId);
}
if (statusCode != null) {
map.put("statusCode", statusCode);
}
if (statusValue != null) {
map.put("statusValue", statusValue);
}
map.put("officeId", "1"); map.put("officeId", "1");
map.put("name", randomNameGenerator("Center_Name_", 5)); map.put("name", randomNameGenerator("Center_Name_", 5));
map.put("externalId", randomIDGenerator("ID_", 7)); map.put("externalId", randomIDGenerator("ID_", 7));
@@ -142,13 +150,18 @@ public class CenterDomain implements Comparable<CenterDomain> {
map.put("activationDate", activationDate); map.put("activationDate", activationDate);
} else { } else {
map.put("active", "false"); map.put("active", "false");
if (submittedDate == null) if (submittedDate == null) {
map.put("submittedOnDate", DateUtils.getDateOfTenant()); map.put("submittedOnDate", DateUtils.getDateOfTenant());
else } else {
map.put("submittedOnDate", submittedDate); map.put("submittedOnDate", submittedDate);
}
}
if (externalId != null) {
map.put("externalId", externalId);
}
if (groupMembers != null) {
map.put("groupMembers", groupMembers);
} }
if (externalId != null) map.put("externalId", externalId);
if (groupMembers != null) map.put("groupMembers", groupMembers);
LOG.info("{}",map.toString()); LOG.info("{}",map.toString());
return new Gson().toJson(map); return new Gson().toJson(map);
} }
@@ -213,17 +226,35 @@ public class CenterDomain implements Comparable<CenterDomain> {
public int hashCode() { public int hashCode() {
int hash = 1; int hash = 1;
if (this.id >= 0) hash += this.id; if (this.id >= 0) {
hash += this.id;
}
if (this.status != null) { if (this.status != null) {
if ((Double) this.status.get("id") >= 0) hash += (Double) this.status.get("id"); if ((Double) this.status.get("id") >= 0) {
if ((String) this.status.get("code") != null) hash += this.status.get("code").hashCode(); hash += (Double) this.status.get("id");
if ((String) this.status.get("value") != null) hash += this.status.get("value").hashCode(); }
if ((String) this.status.get("code") != null) {
hash += this.status.get("code").hashCode();
}
if ((String) this.status.get("value") != null) {
hash += this.status.get("value").hashCode();
}
}
if (this.name != null) {
hash += this.name.hashCode();
}
if (this.officeId >= 0) {
hash += this.officeId;
}
if (this.officeName != null) {
hash += this.officeName.hashCode();
}
if (this.hierarchy != null) {
hash += this.hierarchy.hashCode();
}
if (this.groupMembers != null) {
hash += this.groupMembers.hashCode();
} }
if (this.name != null) hash += this.name.hashCode();
if (this.officeId >= 0) hash += this.officeId;
if (this.officeName != null) hash += this.officeName.hashCode();
if (this.hierarchy != null) hash += this.hierarchy.hashCode();
if (this.groupMembers != null) hash += this.groupMembers.hashCode();
return hash; return hash;
} }
@@ -232,11 +263,15 @@ public class CenterDomain implements Comparable<CenterDomain> {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { return true; } if (obj == this) { return true; }
if (!(obj instanceof CenterDomain)) return false; if (!(obj instanceof CenterDomain)) {
return false;
}
CenterDomain cd = (CenterDomain) obj; CenterDomain cd = (CenterDomain) obj;
if (this.hashCode() == cd.hashCode()) return true; if (this.hashCode() == cd.hashCode()) {
return true;
}
return false; return false;
} }
@@ -57,7 +57,9 @@ public class CurrenciesHelper {
final String code) { final String code) {
ArrayList<CurrencyDomain> currenciesList = getAllCurrencies(requestSpec, responseSpec); ArrayList<CurrencyDomain> currenciesList = getAllCurrencies(requestSpec, responseSpec);
for (CurrencyDomain e : currenciesList) { for (CurrencyDomain e : currenciesList) {
if (e.getCode().equals(code)) return e; if (e.getCode().equals(code)) {
return e;
}
} }
return null; return null;
} }
@@ -109,12 +109,24 @@ public class CurrencyDomain implements Comparable<CurrencyDomain> {
public int hashCode() { public int hashCode() {
int hash = 1; int hash = 1;
if (this.name != null) hash += this.name.hashCode(); if (this.name != null) {
if (this.code != null) hash += this.code.hashCode(); hash += this.name.hashCode();
if (this.decimalPlaces >= 0) hash += this.decimalPlaces; }
if (this.displaySymbol != null) hash += this.displaySymbol.hashCode(); if (this.code != null) {
if (this.nameCode != null) hash += this.nameCode.hashCode(); hash += this.code.hashCode();
if (this.displayLabel != null) hash += this.displayLabel.hashCode(); }
if (this.decimalPlaces >= 0) {
hash += this.decimalPlaces;
}
if (this.displaySymbol != null) {
hash += this.displaySymbol.hashCode();
}
if (this.nameCode != null) {
hash += this.nameCode.hashCode();
}
if (this.displayLabel != null) {
hash += this.displayLabel.hashCode();
}
return hash; return hash;
} }
@@ -123,13 +135,17 @@ public class CurrencyDomain implements Comparable<CurrencyDomain> {
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == this) { return true; } if (obj == this) { return true; }
if (!(obj instanceof CurrencyDomain)) return false; if (!(obj instanceof CurrencyDomain)) {
return false;
}
CurrencyDomain cd = (CurrencyDomain) obj; CurrencyDomain cd = (CurrencyDomain) obj;
if (this.name.equals(cd.name) && this.code.equals(cd.code) && this.decimalPlaces == cd.decimalPlaces if (this.name.equals(cd.name) && this.code.equals(cd.code) && this.decimalPlaces == cd.decimalPlaces
&& this.displaySymbol.equals(cd.displaySymbol) && this.nameCode.equals(cd.nameCode) && this.displaySymbol.equals(cd.displaySymbol) && this.nameCode.equals(cd.nameCode)
&& this.displayLabel.equals(cd.displayLabel)) return true; && this.displayLabel.equals(cd.displayLabel)) {
return true;
}
return false; return false;
} }
@@ -114,18 +114,24 @@ public class OfficeDomain {
public int hashCode() { public int hashCode() {
int hash = 1; int hash = 1;
if (this.id > 0) if (this.id > 0) {
hash += this.id; hash += this.id;
if (this.name != null) }
if (this.name != null) {
hash += this.name.hashCode(); hash += this.name.hashCode();
if (this.nameDecorated != null) }
if (this.nameDecorated != null) {
hash += this.nameDecorated.hashCode(); hash += this.nameDecorated.hashCode();
if (this.externalId != null) }
if (this.externalId != null) {
hash += this.externalId.hashCode(); hash += this.externalId.hashCode();
if (this.openingDate != null) }
if (this.openingDate != null) {
hash += this.openingDate.hashCode(); hash += this.openingDate.hashCode();
if (this.hierarchy != null) }
if (this.hierarchy != null) {
hash += this.hierarchy.hashCode(); hash += this.hierarchy.hashCode();
}
return hash; return hash;
} }
@@ -136,8 +142,9 @@ public class OfficeDomain {
return true; return true;
} }
if (!(obj instanceof OfficeDomain)) if (!(obj instanceof OfficeDomain)) {
return false; return false;
}
OfficeDomain od = (OfficeDomain) obj; OfficeDomain od = (OfficeDomain) obj;
@@ -145,8 +152,9 @@ public class OfficeDomain {
&& this.nameDecorated.equals(od.getName()) && this.nameDecorated.equals(od.getName())
&& this.externalId.equals(od.getExternalId()) && this.externalId.equals(od.getExternalId())
&& this.openingDate.equals(od.getOpeningDate()) && this.openingDate.equals(od.getOpeningDate())
&& this.hierarchy.equals(od.getHierarchy())) && this.hierarchy.equals(od.getHierarchy())) {
return true; return true;
}
return false; return false;
} }
@@ -46,11 +46,13 @@ public class PaymentTypeHelper {
final Boolean isCashPayment, final Integer position) { final Boolean isCashPayment, final Integer position) {
HashMap hm = new HashMap(); HashMap hm = new HashMap();
hm.put("name", name); hm.put("name", name);
if (description != null) if (description != null) {
hm.put("description", description); hm.put("description", description);
}
hm.put("isCashPayment", isCashPayment); hm.put("isCashPayment", isCashPayment);
if (position != null) if (position != null) {
hm.put("position", position); hm.put("position", position);
}
// system.out.println("------------------------CREATING PAYMENT // system.out.println("------------------------CREATING PAYMENT
// TYPE-------------------------" + hm); // TYPE-------------------------" + hm);
@@ -172,7 +172,9 @@ public class ProvisioningIntegrationTest {
break ; //internal loop break ; //internal loop
} }
} }
if(!found) Assert.fail("No Category found with Id:"+requestedCategoryId); if(!found) {
Assert.fail("No Category found with Id:" + requestedCategoryId);
}
} }
} }
@@ -189,8 +189,9 @@ public class SavingsAccountHelper {
public HashMap approveSavingsOnDate(final Integer savingsID, final String approvalDate) { public HashMap approveSavingsOnDate(final Integer savingsID, final String approvalDate) {
LOG.info("--------------------------------- APPROVING SAVINGS APPLICATION ------------------------------------"); LOG.info("--------------------------------- APPROVING SAVINGS APPLICATION ------------------------------------");
final String savingsOperationURL = createSavingsOperationURL(APPROVE_SAVINGS_COMMAND, savingsID); final String savingsOperationURL = createSavingsOperationURL(APPROVE_SAVINGS_COMMAND, savingsID);
if (approvalDate == null || approvalDate.equals("")) if (approvalDate == null || approvalDate.equals("")) {
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock); return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock);
}
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock); return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock);
} }
@@ -752,8 +753,9 @@ public class SavingsAccountHelper {
LOG.info("--------------------------------- APPROVING GSIM SAVINGS APPLICATION ------------------------------------"); LOG.info("--------------------------------- APPROVING GSIM SAVINGS APPLICATION ------------------------------------");
final String savingsOperationURL = createSavingsGsimOperationURL(APPROVE_SAVINGS_COMMAND, gsimID); final String savingsOperationURL = createSavingsGsimOperationURL(APPROVE_SAVINGS_COMMAND, gsimID);
if (approvalDate == null || approvalDate.equals("")) if (approvalDate == null || approvalDate.equals("")) {
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock); return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJSON(), isBlock);
}
return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock); return performSavingApplicationActions(savingsOperationURL, getApproveSavingsAsJsonOnDate(approvalDate), isBlock);
} }
@@ -97,7 +97,9 @@ public class TrialBalance extends AbstractPersistableCustom {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!obj.getClass().equals(getClass())) return false; if (!obj.getClass().equals(getClass())) {
return false;
}
TrialBalance other = (TrialBalance) obj; TrialBalance other = (TrialBalance) obj;
return Objects.equals(other.officeId, officeId) return Objects.equals(other.officeId, officeId)
&& Objects.equals(other.glAccountId, glAccountId) && Objects.equals(other.glAccountId, glAccountId)
@@ -34,8 +34,9 @@ public class TrialBalanceRepositoryWrapper {
public List<TrialBalance> findNewByOfficeAndAccount(final Long officeId, final Long accountId){ public List<TrialBalance> findNewByOfficeAndAccount(final Long officeId, final Long accountId){
final List<TrialBalance> trialBalanceList=this.repository.findNewByOfficeAndAccount(officeId,accountId); final List<TrialBalance> trialBalanceList=this.repository.findNewByOfficeAndAccount(officeId,accountId);
if (trialBalanceList==null) if (trialBalanceList==null) {
throw new TrialBalanceNotFoundException(officeId,accountId); throw new TrialBalanceNotFoundException(officeId, accountId);
}
return trialBalanceList; return trialBalanceList;
} }
@@ -119,7 +119,9 @@ public class LoanProductProvisioningEntry extends AbstractPersistableCustom {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!obj.getClass().equals(getClass())) return false; if (!obj.getClass().equals(getClass())) {
return false;
}
LoanProductProvisioningEntry other = (LoanProductProvisioningEntry) obj; LoanProductProvisioningEntry other = (LoanProductProvisioningEntry) obj;
return Objects.equals(other.entry.getId(), this.entry.getId()) return Objects.equals(other.entry.getId(), this.entry.getId())
&& Objects.equals(other.criteriaId, this.criteriaId) && Objects.equals(other.criteriaId, this.criteriaId)
@@ -74,7 +74,9 @@ public class ProvisioningEntry extends AbstractPersistableCustom {
} }
public void setProvisioningEntries(Collection<LoanProductProvisioningEntry> provisioningEntries) { public void setProvisioningEntries(Collection<LoanProductProvisioningEntry> provisioningEntries) {
if(this.provisioningEntries == null) this.provisioningEntries = new HashSet<>(); if(this.provisioningEntries == null) {
this.provisioningEntries = new HashSet<>();
}
this.provisioningEntries.addAll(provisioningEntries) ; this.provisioningEntries.addAll(provisioningEntries) ;
} }
@@ -92,16 +92,30 @@ public class CommandContext {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) return true; if (this == obj) {
if (obj == null) return false; return true;
if (getClass() != obj.getClass()) return false; }
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
CommandContext other = (CommandContext) obj; CommandContext other = (CommandContext) obj;
if (this.method == null) { if (this.method == null) {
if (other.method != null) return false; if (other.method != null) {
} else if (!this.method.equals(other.method)) return false; return false;
}
} else if (!this.method.equals(other.method)) {
return false;
}
if (this.resource == null) { if (this.resource == null) {
if (other.resource != null) return false; if (other.resource != null) {
} else if (!this.resource.equals(other.resource)) return false; return false;
}
} else if (!this.resource.equals(other.resource)) {
return false;
}
return true; return true;
} }
@@ -77,14 +77,17 @@ public class BulkImportApiResource {
if (entityType.equals(GlobalEntityType.CLIENT.getCode())){ if (entityType.equals(GlobalEntityType.CLIENT.getCode())){
final Collection<ImportData> importForClientEntity = this.bulkImportWorkbookService.getImports(GlobalEntityType.CLIENTS_ENTTTY); final Collection<ImportData> importForClientEntity = this.bulkImportWorkbookService.getImports(GlobalEntityType.CLIENTS_ENTTTY);
final Collection<ImportData> importForClientPerson=this.bulkImportWorkbookService.getImports(GlobalEntityType.CLIENTS_PERSON); final Collection<ImportData> importForClientPerson=this.bulkImportWorkbookService.getImports(GlobalEntityType.CLIENTS_PERSON);
if (importForClientEntity!=null) if (importForClientEntity!=null) {
importData.addAll(importForClientEntity); importData.addAll(importForClientEntity);
if (importForClientPerson!=null) }
importData.addAll(importForClientPerson); if (importForClientPerson!=null) {
importData.addAll(importForClientPerson);
}
}else { }else {
final GlobalEntityType type = GlobalEntityType.fromCode(entityType); final GlobalEntityType type = GlobalEntityType.fromCode(entityType);
if (type == null) if (type == null) {
throw new ImportTypeNotFoundException(entityType); throw new ImportTypeNotFoundException(entityType);
}
importData = this.bulkImportWorkbookService.getImports(type); importData = this.bulkImportWorkbookService.getImports(type);
} }
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
@@ -64,8 +64,9 @@ public class ImportHandlerUtils {
public static Long readAsLong(int colIndex, Row row) { public static Long readAsLong(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == CellType.BLANK) if (c == null || c.getCellType() == CellType.BLANK) {
return null; return null;
}
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == CellType.FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
@@ -91,8 +92,9 @@ public class ImportHandlerUtils {
public static String readAsString(int colIndex, Row row) { public static String readAsString(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == CellType.BLANK) if (c == null || c.getCellType() == CellType.BLANK) {
return null; return null;
}
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == CellType.FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if (eval!=null) { if (eval!=null) {
@@ -131,16 +133,18 @@ public class ImportHandlerUtils {
public static String trimEmptyDecimalPortion(String result) { public static String trimEmptyDecimalPortion(String result) {
if(result != null && result.endsWith(".0")) if(result != null && result.endsWith(".0")) {
return result.split("\\.")[0]; return result.split("\\.")[0];
else } else {
return result; return result;
}
} }
public static LocalDate readAsDate(int colIndex, Row row) { public static LocalDate readAsDate(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if(c == null || c.getCellType() == CellType.BLANK) if(c == null || c.getCellType() == CellType.BLANK) {
return null; return null;
}
LocalDate localDate=new LocalDate(c.getDateCellValue()); LocalDate localDate=new LocalDate(c.getDateCellValue());
return localDate; return localDate;
@@ -148,8 +152,9 @@ public class ImportHandlerUtils {
public static Boolean readAsBoolean(int colIndex, Row row) { public static Boolean readAsBoolean(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if(c == null || c.getCellType() == CellType.BLANK) if(c == null || c.getCellType() == CellType.BLANK) {
return false; return false;
}
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == CellType.FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
@@ -162,21 +167,23 @@ public class ImportHandlerUtils {
return val.getBooleanValue(); return val.getBooleanValue();
} }
return false; return false;
}else if(c.getCellType()==CellType.BOOLEAN) }else if(c.getCellType()==CellType.BOOLEAN) {
return c.getBooleanCellValue(); return c.getBooleanCellValue();
else { } else {
String booleanString = row.getCell(colIndex).getStringCellValue().trim(); String booleanString = row.getCell(colIndex).getStringCellValue().trim();
if (booleanString.equalsIgnoreCase("TRUE")) if (booleanString.equalsIgnoreCase("TRUE")) {
return true; return true;
else } else {
return false; return false;
}
} }
} }
public static Integer readAsInt(int colIndex, Row row) { public static Integer readAsInt(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == CellType.BLANK) if (c == null || c.getCellType() == CellType.BLANK) {
return null; return null;
}
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == CellType.FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if(eval!=null) { if(eval!=null) {
@@ -198,8 +205,9 @@ public class ImportHandlerUtils {
public static Double readAsDouble(int colIndex, Row row) { public static Double readAsDouble(int colIndex, Row row) {
Cell c = row.getCell(colIndex); Cell c = row.getCell(colIndex);
if (c == null || c.getCellType() == CellType.BLANK) if (c == null || c.getCellType() == CellType.BLANK) {
return 0.0; return 0.0;
}
FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator(); FormulaEvaluator eval = row.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
if(c.getCellType() == CellType.FORMULA) { if(c.getCellType() == CellType.FORMULA) {
if (eval!=null) { if (eval!=null) {
@@ -221,8 +229,9 @@ public class ImportHandlerUtils {
} }
public static void writeString(int colIndex, Row row, String value) { public static void writeString(int colIndex, Row row, String value) {
if(value!=null) if(value!=null) {
row.createCell(colIndex).setCellValue(value); row.createCell(colIndex).setCellValue(value);
}
} }
public static CellStyle getCellStyle(Workbook workbook, IndexedColors color) { public static CellStyle getCellStyle(Workbook workbook, IndexedColors color) {
@@ -308,15 +317,20 @@ public class ImportHandlerUtils {
sheetName.equals(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME) || sheetName.equals(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME) ||
sheetName.equals(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME)|| sheetName.equals(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME)||
sheetName.equals(TemplatePopulateImportConstants.ROLES_SHEET_NAME)) { sheetName.equals(TemplatePopulateImportConstants.ROLES_SHEET_NAME)) {
if (row.getCell(cell.getColumnIndex() - 1).getCellType() == CellType.NUMERIC) if (row.getCell(cell.getColumnIndex() - 1).getCellType() == CellType.NUMERIC) {
return ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue()).longValue(); return ((Double) row.getCell(cell.getColumnIndex() - 1).getNumericCellValue())
.longValue();
}
return 0L; return 0L;
} else if (sheetName.equals(TemplatePopulateImportConstants.CLIENT_SHEET_NAME) || } else if (sheetName.equals(TemplatePopulateImportConstants.CLIENT_SHEET_NAME)
sheetName.equals(TemplatePopulateImportConstants.CENTER_SHEET_NAME) || || sheetName.equals(TemplatePopulateImportConstants.CENTER_SHEET_NAME)
sheetName.equals(TemplatePopulateImportConstants.GROUP_SHEET_NAME) || || sheetName.equals(TemplatePopulateImportConstants.GROUP_SHEET_NAME)
sheetName.equals(TemplatePopulateImportConstants.STAFF_SHEET_NAME)) || sheetName.equals(TemplatePopulateImportConstants.STAFF_SHEET_NAME)) {
if (row.getCell(cell.getColumnIndex() + 1).getCellType() == CellType.NUMERIC) if (row.getCell(cell.getColumnIndex() + 1).getCellType() == CellType.NUMERIC) {
return ((Double) row.getCell(cell.getColumnIndex() + 1).getNumericCellValue()).longValue(); return ((Double) row.getCell(cell.getColumnIndex() + 1).getNumericCellValue())
.longValue();
}
}
return 0L; return 0L;
} }
}else { }else {
@@ -363,14 +377,15 @@ public class ImportHandlerUtils {
public static String getFrequencyId(String frequency) { public static String getFrequencyId(String frequency) {
if (frequency!=null) { if (frequency!=null) {
if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAILY)) if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAILY)) {
frequency = "1"; frequency = "1";
else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKLY)) } else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKLY)) {
frequency = "2"; frequency = "2";
else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHLY)) } else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHLY)) {
frequency = "3"; frequency = "3";
else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARLY)) } else if (frequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARLY)) {
frequency = "4"; frequency = "4";
}
return frequency; return frequency;
}else { }else {
return null; return null;
@@ -379,21 +394,21 @@ public class ImportHandlerUtils {
public static String getRepeatsOnDayId(String repeatsOnDay) { public static String getRepeatsOnDayId(String repeatsOnDay) {
if (repeatsOnDay!=null) { if (repeatsOnDay!=null) {
if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.MONDAY)) if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.MONDAY)) {
repeatsOnDay = "1"; repeatsOnDay = "1";
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.TUESDAY)) } else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.TUESDAY)) {
repeatsOnDay = "2"; repeatsOnDay = "2";
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.WEDNESDAY)) } else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.WEDNESDAY)) {
repeatsOnDay = "3"; repeatsOnDay = "3";
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.THURSDAY)) } else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.THURSDAY)) {
repeatsOnDay = "4"; repeatsOnDay = "4";
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.FRIDAY)) } else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.FRIDAY)) {
repeatsOnDay = "5"; repeatsOnDay = "5";
} else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.SATURDAY)) {
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.SATURDAY))
repeatsOnDay = "6"; repeatsOnDay = "6";
else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.SUNDAY)) } else if (repeatsOnDay.equalsIgnoreCase(TemplatePopulateImportConstants.SUNDAY)) {
repeatsOnDay = "7"; repeatsOnDay = "7";
}
return repeatsOnDay; return repeatsOnDay;
}else { }else {
return null; return null;
@@ -101,15 +101,16 @@ public class CenterImportHandler implements ImportHandler {
Integer interval = ImportHandlerUtils.readAsInt(CenterConstants.INTERVAL_COL, row); Integer interval = ImportHandlerUtils.readAsInt(CenterConstants.INTERVAL_COL, row);
String repeatsOnDay = ImportHandlerUtils.readAsString(CenterConstants.REPEATS_ON_DAY_COL, row); String repeatsOnDay = ImportHandlerUtils.readAsString(CenterConstants.REPEATS_ON_DAY_COL, row);
EnumOptionData repeatsOnDayEnum=new EnumOptionData(null,null,ImportHandlerUtils.getRepeatsOnDayId(repeatsOnDay)); EnumOptionData repeatsOnDayEnum=new EnumOptionData(null,null,ImportHandlerUtils.getRepeatsOnDayId(repeatsOnDay));
if(meetingStartDate==null) if(meetingStartDate==null) {
return null; return null;
else { } else {
if(repeatsOnDay==null) if(repeatsOnDay==null) {
return CalendarData.importInstanceNoRepeatsOnDay(meetingStartDate, isRepeating, return CalendarData.importInstanceNoRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum, interval,
frequencyEnum, interval, row.getRowNum(),locale,dateFormat); row.getRowNum(), locale, dateFormat);
else } else {
return CalendarData.importInstanceWithRepeatsOnDay(meetingStartDate, isRepeating, return CalendarData.importInstanceWithRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum,
frequencyEnum, interval, repeatsOnDayEnum, row.getRowNum(),locale,dateFormat); interval, repeatsOnDayEnum, row.getRowNum(), locale, dateFormat);
}
} }
} }
@@ -136,8 +137,9 @@ public class CenterImportHandler implements ImportHandler {
List<GroupGeneralData> groupMembers = new ArrayList<GroupGeneralData>(); List<GroupGeneralData> groupMembers = new ArrayList<GroupGeneralData>();
for (int cellNo =CenterConstants. GROUP_NAMES_STARTING_COL; cellNo < CenterConstants.GROUP_NAMES_ENDING_COL; cellNo++) { for (int cellNo =CenterConstants. GROUP_NAMES_STARTING_COL; cellNo < CenterConstants.GROUP_NAMES_ENDING_COL; cellNo++) {
String groupName = ImportHandlerUtils.readAsString(cellNo, row); String groupName = ImportHandlerUtils.readAsString(cellNo, row);
if (groupName==null||groupName.equals("")) if (groupName==null||groupName.equals("")) {
break; break;
}
Long groupId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME), groupName); Long groupId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME), groupName);
GroupGeneralData group = new GroupGeneralData(groupId); GroupGeneralData group = new GroupGeneralData(groupId);
if (!containsGroupId(groupMembers,groupId)) { if (!containsGroupId(groupMembers,groupId)) {
@@ -179,11 +181,15 @@ public class CenterImportHandler implements ImportHandler {
result = importCenter(i, dateFormat); result = importCenter(i, dateFormat);
centerId = result.getGroupId().toString(); centerId = result.getGroupId().toString();
progressLevel = 1; progressLevel = 1;
} else } else {
centerId = ImportHandlerUtils.readAsInt(CenterConstants.CENTER_ID_COL, centerSheet.getRow(centers.get(i).getRowIndex())).toString(); centerId = ImportHandlerUtils
.readAsInt(CenterConstants.CENTER_ID_COL, centerSheet.getRow(centers.get(i).getRowIndex()))
.toString();
}
if (meetings.get(i) != null) if (meetings.get(i) != null) {
progressLevel = importCenterMeeting(result, i, dateFormat); progressLevel = importCenterMeeting(result, i, dateFormat);
}
successCount++; successCount++;
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
@@ -200,24 +206,27 @@ public class CenterImportHandler implements ImportHandler {
private void writeCenterErrorMessage(String centerId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeCenterErrorMessage(String centerId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if (progressLevel == 0) if (progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if (progressLevel == 1) } else if (progressLevel == 1) {
status = TemplatePopulateImportConstants.STATUS_MEETING_FAILED; status = TemplatePopulateImportConstants.STATUS_MEETING_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if (progressLevel > 0) if (progressLevel > 0) {
row.createCell(CenterConstants.CENTER_ID_COL).setCellValue(Integer.parseInt(centerId)); row.createCell(CenterConstants.CENTER_ID_COL).setCellValue(Integer.parseInt(centerId));
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if(status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if(status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if(status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) {
return 1; return 1;
}
return 0; return 0;
} }
private CommandProcessingResult importCenter(int rowIndex,String dateFormat) { private CommandProcessingResult importCenter(int rowIndex,String dateFormat) {
@@ -104,8 +104,9 @@ public class ChartOfAccountsImportHandler implements ImportHandler {
} }
String glCode=ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL,row); String glCode=ImportHandlerUtils.readAsString(ChartOfAcountsConstants.GL_CODE_COL,row);
Long tagId=null; Long tagId=null;
if(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL,row)!=null) if(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL,row)!=null) {
tagId=Long.parseLong(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL,row)); tagId = Long.parseLong(ImportHandlerUtils.readAsString(ChartOfAcountsConstants.TAG_ID_COL, row));
}
CodeValueData tagIdCodeValueData=new CodeValueData(tagId); CodeValueData tagIdCodeValueData=new CodeValueData(tagId);
String description=ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL,row); String description=ImportHandlerUtils.readAsString(ChartOfAcountsConstants.DESCRIPTION_COL,row);
return GLAccountData.importInstance(accountName,parentId,glCode,manualEntriesAllowed,accountTypeEnum, return GLAccountData.importInstance(accountName,parentId,glCode,manualEntriesAllowed,accountTypeEnum,
@@ -92,8 +92,9 @@ public class ClientEntityImportHandler implements ImportHandler {
LocalDate incorportionDate=ImportHandlerUtils.readAsDate(ClientEntityConstants.INCOPORATION_DATE_COL,row); LocalDate incorportionDate=ImportHandlerUtils.readAsDate(ClientEntityConstants.INCOPORATION_DATE_COL,row);
LocalDate incorporationTill=ImportHandlerUtils.readAsDate(ClientEntityConstants.INCOPORATION_VALID_TILL_COL,row); LocalDate incorporationTill=ImportHandlerUtils.readAsDate(ClientEntityConstants.INCOPORATION_VALID_TILL_COL,row);
String mobileNo=null; String mobileNo=null;
if (ImportHandlerUtils.readAsLong(ClientEntityConstants.MOBILE_NO_COL, row)!=null) if (ImportHandlerUtils.readAsLong(ClientEntityConstants.MOBILE_NO_COL, row)!=null) {
mobileNo = ImportHandlerUtils.readAsLong(ClientEntityConstants.MOBILE_NO_COL, row).toString(); mobileNo = ImportHandlerUtils.readAsLong(ClientEntityConstants.MOBILE_NO_COL, row).toString();
}
String clientType=ImportHandlerUtils.readAsString(ClientEntityConstants.CLIENT_TYPE_COL, row); String clientType=ImportHandlerUtils.readAsString(ClientEntityConstants.CLIENT_TYPE_COL, row);
Long clientTypeId = null; Long clientTypeId = null;
@@ -107,8 +108,9 @@ public class ClientEntityImportHandler implements ImportHandler {
Long clientClassicationId = null; Long clientClassicationId = null;
if (clientClassification!=null) { if (clientClassification!=null) {
String clientClassificationAr[] =clientClassification.split("-"); String clientClassificationAr[] =clientClassification.split("-");
if (clientClassificationAr[1] != null) if (clientClassificationAr[1] != null) {
clientClassicationId = Long.parseLong(clientClassificationAr[1]); clientClassicationId = Long.parseLong(clientClassificationAr[1]);
}
} }
String incorporationNo=ImportHandlerUtils.readAsString(ClientEntityConstants.INCOPORATION_NUMBER_COL,row); String incorporationNo=ImportHandlerUtils.readAsString(ClientEntityConstants.INCOPORATION_NUMBER_COL,row);
@@ -116,15 +118,17 @@ public class ClientEntityImportHandler implements ImportHandler {
Long mainBusinessId = null; Long mainBusinessId = null;
if (mainBusinessLine!=null) { if (mainBusinessLine!=null) {
String mainBusinessLineAr[] = ImportHandlerUtils.readAsString(ClientEntityConstants.MAIN_BUSINESS_LINE, row).split("-"); String mainBusinessLineAr[] = ImportHandlerUtils.readAsString(ClientEntityConstants.MAIN_BUSINESS_LINE, row).split("-");
if (mainBusinessLineAr[1] != null) if (mainBusinessLineAr[1] != null) {
mainBusinessId = Long.parseLong(mainBusinessLineAr[1]); mainBusinessId = Long.parseLong(mainBusinessLineAr[1]);
}
} }
String constitution= ImportHandlerUtils.readAsString(ClientEntityConstants.CONSTITUTION_COL,row); String constitution= ImportHandlerUtils.readAsString(ClientEntityConstants.CONSTITUTION_COL,row);
Long constitutionId = null; Long constitutionId = null;
if (constitution!=null) { if (constitution!=null) {
String constitutionAr[] = constitution.split("-"); String constitutionAr[] = constitution.split("-");
if (constitutionAr[1] != null) if (constitutionAr[1] != null) {
constitutionId = Long.parseLong(constitutionAr[1]); constitutionId = Long.parseLong(constitutionAr[1]);
}
} }
String remarks = ImportHandlerUtils.readAsString(ClientEntityConstants.REMARKS_COL, row); String remarks = ImportHandlerUtils.readAsString(ClientEntityConstants.REMARKS_COL, row);
@@ -148,8 +152,9 @@ public class ClientEntityImportHandler implements ImportHandler {
Long addressTypeId = null; Long addressTypeId = null;
if (addressType!=null) { if (addressType!=null) {
String addressTypeAr[] = addressType.split("-"); String addressTypeAr[] = addressType.split("-");
if (addressTypeAr[1] != null) if (addressTypeAr[1] != null) {
addressTypeId = Long.parseLong(addressTypeAr[1]); addressTypeId = Long.parseLong(addressTypeAr[1]);
}
} }
String street = ImportHandlerUtils.readAsString(ClientEntityConstants.STREET_COL, row); String street = ImportHandlerUtils.readAsString(ClientEntityConstants.STREET_COL, row);
String addressLine1 = ImportHandlerUtils.readAsString(ClientEntityConstants.ADDRESS_LINE_1_COL, row); String addressLine1 = ImportHandlerUtils.readAsString(ClientEntityConstants.ADDRESS_LINE_1_COL, row);
@@ -164,15 +169,17 @@ public class ClientEntityImportHandler implements ImportHandler {
Long stateProvinceId = null; Long stateProvinceId = null;
if (stateProvince!=null) { if (stateProvince!=null) {
String stateProvinceAr[] = stateProvince.split("-"); String stateProvinceAr[] = stateProvince.split("-");
if (stateProvinceAr[1] != null) if (stateProvinceAr[1] != null) {
stateProvinceId = Long.parseLong(stateProvinceAr[1]); stateProvinceId = Long.parseLong(stateProvinceAr[1]);
}
} }
String country= ImportHandlerUtils.readAsString(ClientEntityConstants.COUNTRY_COL, row); String country= ImportHandlerUtils.readAsString(ClientEntityConstants.COUNTRY_COL, row);
Long countryId = null; Long countryId = null;
if (country!=null) { if (country!=null) {
String countryAr[] = country.split("-"); String countryAr[] = country.split("-");
if (countryAr[1] != null) if (countryAr[1] != null) {
countryId = Long.parseLong(countryAr[1]); countryId = Long.parseLong(countryAr[1]);
}
} }
addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3, addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3,
city, postalCode, isActiveAddress, stateProvinceId, countryId); city, postalCode, isActiveAddress, stateProvinceId, countryId);
@@ -96,8 +96,9 @@ public class ClientPersonImportHandler implements ImportHandler {
activationDate=submittedOn; activationDate=submittedOn;
} }
String mobileNo=null; String mobileNo=null;
if (ImportHandlerUtils.readAsLong(ClientPersonConstants.MOBILE_NO_COL, row)!=null) if (ImportHandlerUtils.readAsLong(ClientPersonConstants.MOBILE_NO_COL, row)!=null) {
mobileNo = ImportHandlerUtils.readAsLong(ClientPersonConstants.MOBILE_NO_COL, row).toString(); mobileNo = ImportHandlerUtils.readAsLong(ClientPersonConstants.MOBILE_NO_COL, row).toString();
}
LocalDate dob = ImportHandlerUtils.readAsDate(ClientPersonConstants.DOB_COL, row); LocalDate dob = ImportHandlerUtils.readAsDate(ClientPersonConstants.DOB_COL, row);
String clientType=ImportHandlerUtils.readAsString(ClientPersonConstants.CLIENT_TYPE_COL, row); String clientType=ImportHandlerUtils.readAsString(ClientPersonConstants.CLIENT_TYPE_COL, row);
@@ -112,15 +113,17 @@ public class ClientPersonImportHandler implements ImportHandler {
Long genderId = null; Long genderId = null;
if (gender!=null) { if (gender!=null) {
String genderAr[] = gender.split("-"); String genderAr[] = gender.split("-");
if (genderAr[1] != null) if (genderAr[1] != null) {
genderId = Long.parseLong(genderAr[1]); genderId = Long.parseLong(genderAr[1]);
}
} }
String clientClassification= ImportHandlerUtils.readAsString(ClientPersonConstants.CLIENT_CLASSIFICATION_COL, row); String clientClassification= ImportHandlerUtils.readAsString(ClientPersonConstants.CLIENT_CLASSIFICATION_COL, row);
Long clientClassicationId = null; Long clientClassicationId = null;
if (clientClassification!=null) { if (clientClassification!=null) {
String clientClassificationAr[] = clientClassification.split("-"); String clientClassificationAr[] = clientClassification.split("-");
if (clientClassificationAr[1] != null) if (clientClassificationAr[1] != null) {
clientClassicationId = Long.parseLong(clientClassificationAr[1]); clientClassicationId = Long.parseLong(clientClassificationAr[1]);
}
} }
Boolean isStaff = ImportHandlerUtils.readAsBoolean(ClientPersonConstants.IS_STAFF_COL, row); Boolean isStaff = ImportHandlerUtils.readAsBoolean(ClientPersonConstants.IS_STAFF_COL, row);
@@ -132,8 +135,9 @@ public class ClientPersonImportHandler implements ImportHandler {
if (addressType!=null) { if (addressType!=null) {
String addressTypeAr[] = addressType.split("-"); String addressTypeAr[] = addressType.split("-");
if (addressTypeAr[1] != null) if (addressTypeAr[1] != null) {
addressTypeId = Long.parseLong(addressTypeAr[1]); addressTypeId = Long.parseLong(addressTypeAr[1]);
}
} }
String street = ImportHandlerUtils.readAsString(ClientPersonConstants.STREET_COL, row); String street = ImportHandlerUtils.readAsString(ClientPersonConstants.STREET_COL, row);
String addressLine1 = ImportHandlerUtils.readAsString(ClientPersonConstants.ADDRESS_LINE_1_COL, row); String addressLine1 = ImportHandlerUtils.readAsString(ClientPersonConstants.ADDRESS_LINE_1_COL, row);
@@ -148,15 +152,17 @@ public class ClientPersonImportHandler implements ImportHandler {
Long stateProvinceId = null; Long stateProvinceId = null;
if (stateProvince!=null) { if (stateProvince!=null) {
String stateProvinceAr[] = stateProvince.split("-"); String stateProvinceAr[] = stateProvince.split("-");
if (stateProvinceAr[1] != null) if (stateProvinceAr[1] != null) {
stateProvinceId = Long.parseLong(stateProvinceAr[1]); stateProvinceId = Long.parseLong(stateProvinceAr[1]);
}
} }
String country=ImportHandlerUtils.readAsString(ClientPersonConstants.COUNTRY_COL, row); String country=ImportHandlerUtils.readAsString(ClientPersonConstants.COUNTRY_COL, row);
Long countryId=null; Long countryId=null;
if (country!=null) { if (country!=null) {
String countryAr[] = country.split("-"); String countryAr[] = country.split("-");
if (countryAr[1] != null) if (countryAr[1] != null) {
countryId = Long.parseLong(countryAr[1]); countryId = Long.parseLong(countryAr[1]);
}
} }
addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3, addressDataObj = new AddressData(addressTypeId, street, addressLine1, addressLine2, addressLine3,
city, postalCode, isActiveAddress, stateProvinceId, countryId); city, postalCode, isActiveAddress, stateProvinceId, countryId);
@@ -104,27 +104,30 @@ public class FixedDepositImportHandler implements ImportHandler {
LocalDate closedOnDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.CLOSED_ON_DATE, row); LocalDate closedOnDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.CLOSED_ON_DATE, row);
Long onAccountClosureId = ImportHandlerUtils.readAsLong(FixedDepositConstants.ON_ACCOUNT_CLOSURE_ID, row); Long onAccountClosureId = ImportHandlerUtils.readAsLong(FixedDepositConstants.ON_ACCOUNT_CLOSURE_ID, row);
Long toSavingsAccountId = ImportHandlerUtils.readAsLong(FixedDepositConstants.TO_SAVINGS_ACCOUNT_ID, row); Long toSavingsAccountId = ImportHandlerUtils.readAsLong(FixedDepositConstants.TO_SAVINGS_ACCOUNT_ID, row);
if (closedOnDate!=null) if (closedOnDate!=null) {
return ClosingOfSavingsAccounts.importInstance(null, closedOnDate,onAccountClosureId,toSavingsAccountId, null, return ClosingOfSavingsAccounts.importInstance(null, closedOnDate, onAccountClosureId, toSavingsAccountId,
row.getRowNum(),locale,dateFormat); null, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private SavingsActivation readSavingsActivation(Row row,String locale,String dateFormat) { private SavingsActivation readSavingsActivation(Row row,String locale,String dateFormat) {
LocalDate activationDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.ACTIVATION_DATE_COL, row); LocalDate activationDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.ACTIVATION_DATE_COL, row);
if (activationDate!=null) if (activationDate!=null) {
return SavingsActivation.importInstance(activationDate, row.getRowNum(),locale,dateFormat); return SavingsActivation.importInstance(activationDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private SavingsApproval readSavingsApproval(Row row,String locale,String dateFormat) { private SavingsApproval readSavingsApproval(Row row,String locale,String dateFormat) {
LocalDate approvalDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.APPROVED_DATE_COL, row); LocalDate approvalDate = ImportHandlerUtils.readAsDate(FixedDepositConstants.APPROVED_DATE_COL, row);
if (approvalDate!=null) if (approvalDate!=null) {
return SavingsApproval.importInstance(approvalDate, row.getRowNum(),locale,dateFormat); return SavingsApproval.importInstance(approvalDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private FixedDepositAccountData readSavings(Row row,String locale,String dateFormat) { private FixedDepositAccountData readSavings(Row row,String locale,String dateFormat) {
@@ -138,16 +141,21 @@ public class FixedDepositImportHandler implements ImportHandler {
Long interestCompoundingPeriodTypeId = null; Long interestCompoundingPeriodTypeId = null;
EnumOptionData interestCompoundingPeriodTypeEnum=null; EnumOptionData interestCompoundingPeriodTypeEnum=null;
if (interestCompoundingPeriodType!=null) { if (interestCompoundingPeriodType!=null) {
if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_DAILY)) if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_DAILY)) {
interestCompoundingPeriodTypeId = 1L; interestCompoundingPeriodTypeId = 1L;
else if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_MONTHLY)) } else if (interestCompoundingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_MONTHLY)) {
interestCompoundingPeriodTypeId = 4L; interestCompoundingPeriodTypeId = 4L;
else if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_QUARTERLY)) } else if (interestCompoundingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_QUARTERLY)) {
interestCompoundingPeriodTypeId = 5L; interestCompoundingPeriodTypeId = 5L;
else if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_SEMI_ANNUALLY)) } else if (interestCompoundingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_SEMI_ANNUALLY)) {
interestCompoundingPeriodTypeId = 6L; interestCompoundingPeriodTypeId = 6L;
else if (interestCompoundingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_ANNUALLY)) } else if (interestCompoundingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_ANNUALLY)) {
interestCompoundingPeriodTypeId = 7L; interestCompoundingPeriodTypeId = 7L;
}
interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null); interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null);
} }
String interestPostingPeriodType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_POSTING_PERIOD_COL, row); String interestPostingPeriodType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_POSTING_PERIOD_COL, row);
@@ -155,34 +163,42 @@ public class FixedDepositImportHandler implements ImportHandler {
EnumOptionData interestPostingPeriodTypeEnum=null; EnumOptionData interestPostingPeriodTypeEnum=null;
if (interestCompoundingPeriodType!=null) { if (interestCompoundingPeriodType!=null) {
if (interestPostingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_MONTHLY)) if (interestPostingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_MONTHLY)) {
interestPostingPeriodTypeId = 4L; interestPostingPeriodTypeId = 4L;
else if (interestPostingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_QUARTERLY)) } else if (interestPostingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_QUARTERLY)) {
interestPostingPeriodTypeId = 5L; interestPostingPeriodTypeId = 5L;
else if (interestPostingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_ANNUALLY)) } else if (interestPostingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_COMPOUNDING_PERIOD_ANNUALLY)) {
interestPostingPeriodTypeId = 7L; interestPostingPeriodTypeId = 7L;
else if (interestPostingPeriodType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_BIANUALLY)) } else if (interestPostingPeriodType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_POSTING_PERIOD_BIANUALLY)) {
interestPostingPeriodTypeId = 6L; interestPostingPeriodTypeId = 6L;
}
interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null); interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null);
} }
String interestCalculationType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_CALCULATION_COL, row); String interestCalculationType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_CALCULATION_COL, row);
EnumOptionData interestCalculationTypeEnum=null; EnumOptionData interestCalculationTypeEnum=null;
if (interestCalculationType!=null) { if (interestCalculationType!=null) {
Long interestCalculationTypeId = null; Long interestCalculationTypeId = null;
if (interestCalculationType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAILY_BALANCE)) if (interestCalculationType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAILY_BALANCE)) {
interestCalculationTypeId = 1L; interestCalculationTypeId = 1L;
else if (interestCalculationType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_AVG_BALANCE)) } else if (interestCalculationType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_AVG_BALANCE)) {
interestCalculationTypeId = 2L; interestCalculationTypeId = 2L;
}
interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null); interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null);
} }
String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row); String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(FixedDepositConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row);
Long interestCalculationDaysInYearTypeId = null; Long interestCalculationDaysInYearTypeId = null;
EnumOptionData interestCalculationDaysInYearTypeEnum=null; EnumOptionData interestCalculationDaysInYearTypeEnum=null;
if (interestCalculationDaysInYearType!=null) { if (interestCalculationDaysInYearType!=null) {
if (interestCalculationDaysInYearType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAYS_IN_YEAR_360)) if (interestCalculationDaysInYearType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAYS_IN_YEAR_360)) {
interestCalculationDaysInYearTypeId = 360L; interestCalculationDaysInYearTypeId = 360L;
else if (interestCalculationDaysInYearType.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAYS_IN_YEAR_365)) } else if (interestCalculationDaysInYearType
.equalsIgnoreCase(TemplatePopulateImportConstants.INTEREST_CAL_DAYS_IN_YEAR_365)) {
interestCalculationDaysInYearTypeId = 365L; interestCalculationDaysInYearTypeId = 365L;
}
interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null); interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null);
} }
Integer lockinPeriodFrequency = ImportHandlerUtils.readAsInt(FixedDepositConstants.LOCKIN_PERIOD_COL, row); Integer lockinPeriodFrequency = ImportHandlerUtils.readAsInt(FixedDepositConstants.LOCKIN_PERIOD_COL, row);
@@ -191,14 +207,15 @@ public class FixedDepositImportHandler implements ImportHandler {
Long lockinPeriodFrequencyTypeId =null; Long lockinPeriodFrequencyTypeId =null;
EnumOptionData lockinPeriodFrequencyTypeEnum=null; EnumOptionData lockinPeriodFrequencyTypeEnum=null;
if (lockinPeriodFrequencyType!=null) { if (lockinPeriodFrequencyType!=null) {
if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAYS)) if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAYS)) {
lockinPeriodFrequencyTypeId = 0L; lockinPeriodFrequencyTypeId = 0L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKS)) } else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKS)) {
lockinPeriodFrequencyTypeId = 1L; lockinPeriodFrequencyTypeId = 1L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHS)) } else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHS)) {
lockinPeriodFrequencyTypeId = 2L; lockinPeriodFrequencyTypeId = 2L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARS)) } else if (lockinPeriodFrequencyType.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARS)) {
lockinPeriodFrequencyTypeId = 3L; lockinPeriodFrequencyTypeId = 3L;
}
lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null); lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null);
} }
BigDecimal depositAmount=null; BigDecimal depositAmount=null;
@@ -210,14 +227,15 @@ public class FixedDepositImportHandler implements ImportHandler {
String depositPeriodFrequency = ImportHandlerUtils.readAsString(FixedDepositConstants.DEPOSIT_PERIOD_FREQUENCY_COL, row); String depositPeriodFrequency = ImportHandlerUtils.readAsString(FixedDepositConstants.DEPOSIT_PERIOD_FREQUENCY_COL, row);
Long depositPeriodFrequencyId = null; Long depositPeriodFrequencyId = null;
if (depositPeriodFrequency!=null) { if (depositPeriodFrequency!=null) {
if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAYS)) if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_DAYS)) {
depositPeriodFrequencyId = 0L; depositPeriodFrequencyId = 0L;
else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKS)) } else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_WEEKS)) {
depositPeriodFrequencyId = 1L; depositPeriodFrequencyId = 1L;
else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHS)) } else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_MONTHS)) {
depositPeriodFrequencyId = 2L; depositPeriodFrequencyId = 2L;
else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARS)) } else if (depositPeriodFrequency.equalsIgnoreCase(TemplatePopulateImportConstants.FREQUENCY_YEARS)) {
depositPeriodFrequencyId = 3L; depositPeriodFrequencyId = 3L;
}
} }
String externalId = ImportHandlerUtils.readAsString(FixedDepositConstants.EXTERNAL_ID_COL, row); String externalId = ImportHandlerUtils.readAsString(FixedDepositConstants.EXTERNAL_ID_COL, row);
String clientName = ImportHandlerUtils.readAsString(FixedDepositConstants.CLIENT_NAME_COL, row); String clientName = ImportHandlerUtils.readAsString(FixedDepositConstants.CLIENT_NAME_COL, row);
@@ -228,10 +246,12 @@ public class FixedDepositImportHandler implements ImportHandler {
String charge2 = ImportHandlerUtils.readAsString(FixedDepositConstants.CHARGE_ID_2, row); String charge2 = ImportHandlerUtils.readAsString(FixedDepositConstants.CHARGE_ID_2, row);
if (charge1!=null) { if (charge1!=null) {
if (ImportHandlerUtils.readAsDouble(FixedDepositConstants.CHARGE_AMOUNT_1, row)!=null) if (ImportHandlerUtils.readAsDouble(FixedDepositConstants.CHARGE_AMOUNT_1, row)!=null) {
charges.add(new SavingsAccountChargeData(ImportHandlerUtils.readAsLong(FixedDepositConstants.CHARGE_ID_1, row), charges.add(new SavingsAccountChargeData(
BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(FixedDepositConstants.CHARGE_AMOUNT_1, row)), ImportHandlerUtils.readAsLong(FixedDepositConstants.CHARGE_ID_1, row),
ImportHandlerUtils.readAsDate(FixedDepositConstants.CHARGE_DUE_DATE_1, row))); BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(FixedDepositConstants.CHARGE_AMOUNT_1, row)),
ImportHandlerUtils.readAsDate(FixedDepositConstants.CHARGE_DUE_DATE_1, row)));
}
}else { }else {
charges.add(new SavingsAccountChargeData(ImportHandlerUtils.readAsLong(FixedDepositConstants.CHARGE_ID_1, row), charges.add(new SavingsAccountChargeData(ImportHandlerUtils.readAsLong(FixedDepositConstants.CHARGE_ID_1, row),
null, null,
@@ -277,14 +297,22 @@ public class FixedDepositImportHandler implements ImportHandler {
CommandProcessingResult result= importSavings(i,dateFormat); CommandProcessingResult result= importSavings(i,dateFormat);
savingsId = result.getSavingsId(); savingsId = result.getSavingsId();
progressLevel = 1; progressLevel = 1;
} else } else {
savingsId = ImportHandlerUtils.readAsLong(FixedDepositConstants.SAVINGS_ID_COL, savingsSheet.getRow(savings.get(i).getRowIndex())); savingsId = ImportHandlerUtils.readAsLong(FixedDepositConstants.SAVINGS_ID_COL,
savingsSheet.getRow(savings.get(i).getRowIndex()));
}
if (progressLevel <= 1) progressLevel = importSavingsApproval(savingsId, i,dateFormat); if (progressLevel <= 1) {
progressLevel = importSavingsApproval(savingsId, i, dateFormat);
}
if (progressLevel <= 2) progressLevel = importSavingsActivation(savingsId, i,dateFormat); if (progressLevel <= 2) {
progressLevel = importSavingsActivation(savingsId, i, dateFormat);
}
if (progressLevel <= 3) progressLevel = importSavingsClosing(savingsId, i,dateFormat); if (progressLevel <= 3) {
progressLevel = importSavingsClosing(savingsId, i, dateFormat);
}
successCount++; successCount++;
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
@@ -302,15 +330,19 @@ public class FixedDepositImportHandler implements ImportHandler {
} }
private void writeFixedDepositErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeFixedDepositErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if (progressLevel == 0) if (progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if (progressLevel == 1) } else if (progressLevel == 1) {
status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED; status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED;
else if (progressLevel == 2) status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED; } else if (progressLevel == 2) {
status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if (progressLevel > 0) row.createCell(FixedDepositConstants.SAVINGS_ID_COL).setCellValue(savingsId); if (progressLevel > 0) {
row.createCell(FixedDepositConstants.SAVINGS_ID_COL).setCellValue(savingsId);
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
@@ -340,8 +372,9 @@ public class FixedDepositImportHandler implements ImportHandler {
JsonObject chargeJsonOb =chargesJsonElement.getAsJsonObject(); JsonObject chargeJsonOb =chargesJsonElement.getAsJsonObject();
chargeJsonOb.remove("penalty"); chargeJsonOb.remove("penalty");
} }
if (chargesJsonAr.get(0).getAsJsonObject().toString().equals("{}")) if (chargesJsonAr.get(0).getAsJsonObject().toString().equals("{}")) {
savingsJsonob.remove("charges"); savingsJsonob.remove("charges");
}
String payload=savingsJsonob.toString(); String payload=savingsJsonob.toString();
final CommandWrapper commandRequest = new CommandWrapperBuilder() // final CommandWrapper commandRequest = new CommandWrapperBuilder() //
.createFixedDepositAccount() // .createFixedDepositAccount() //
@@ -380,11 +413,13 @@ public class FixedDepositImportHandler implements ImportHandler {
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) {
return 1; return 1;
else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) return 2; } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) {
return 2;
}
return 0; return 0;
} }
@@ -74,23 +74,28 @@ public class FixedDepositTransactionImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = savingsTransactionSheet.getRow(rowIndex); row = savingsTransactionSheet.getRow(rowIndex);
if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) {
savingsTransactions.add(readSavingsTransaction(row,locale,dateFormat)); savingsTransactions.add(readSavingsTransaction(row, locale, dateFormat));
}
} }
} }
private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale,String dateFormat) { private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale,String dateFormat) {
String savingsAccountIdCheck=null; String savingsAccountIdCheck=null;
if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) {
savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row).toString(); savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)
if(savingsAccountIdCheck!=null) .toString();
}
if(savingsAccountIdCheck!=null) {
savingsAccountId = savingsAccountIdCheck; savingsAccountId = savingsAccountIdCheck;
}
String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row); String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row);
SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType); SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType);
BigDecimal amount=null; BigDecimal amount=null;
if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) {
amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)); amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row));
}
LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row); LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row);
String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row); String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row);
@@ -98,13 +98,16 @@ public class GroupImportHandler implements ImportHandler {
Integer interval = ImportHandlerUtils.readAsInt(GroupConstants.INTERVAL_COL, row); Integer interval = ImportHandlerUtils.readAsInt(GroupConstants.INTERVAL_COL, row);
String repeatsOnDay = ImportHandlerUtils.readAsString(GroupConstants.REPEATS_ON_DAY_COL, row); String repeatsOnDay = ImportHandlerUtils.readAsString(GroupConstants.REPEATS_ON_DAY_COL, row);
EnumOptionData repeatsOnDayEnum=new EnumOptionData(null,null,ImportHandlerUtils.getRepeatsOnDayId(repeatsOnDay)); EnumOptionData repeatsOnDayEnum=new EnumOptionData(null,null,ImportHandlerUtils.getRepeatsOnDayId(repeatsOnDay));
if(meetingStartDate==null) if(meetingStartDate==null) {
return null; return null;
else { } else {
if(repeatsOnDay==null) if(repeatsOnDay==null) {
return CalendarData.importInstanceNoRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum, interval, row.getRowNum(),locale,dateFormat); return CalendarData.importInstanceNoRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum, interval,
else row.getRowNum(), locale, dateFormat);
return CalendarData.importInstanceWithRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum, interval, repeatsOnDayEnum, row.getRowNum(),locale,dateFormat); } else {
return CalendarData.importInstanceWithRepeatsOnDay(meetingStartDate, isRepeating, frequencyEnum,
interval, repeatsOnDayEnum, row.getRowNum(), locale, dateFormat);
}
} }
} }
private GroupGeneralData readGroup(Row row,String locale,String dateFormat) { private GroupGeneralData readGroup(Row row,String locale,String dateFormat) {
@@ -115,8 +118,10 @@ public class GroupImportHandler implements ImportHandler {
Long staffId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME), staffName); Long staffId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.STAFF_SHEET_NAME), staffName);
String centerName = ImportHandlerUtils.readAsString(GroupConstants.CENTER_NAME_COL, row); String centerName = ImportHandlerUtils.readAsString(GroupConstants.CENTER_NAME_COL, row);
Long centerId=null; Long centerId=null;
if(centerName!=null) if(centerName!=null) {
centerId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME), centerName); centerId = ImportHandlerUtils
.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME), centerName);
}
String externalId = ImportHandlerUtils.readAsString(GroupConstants.EXTERNAL_ID_COL, row); String externalId = ImportHandlerUtils.readAsString(GroupConstants.EXTERNAL_ID_COL, row);
Boolean active = ImportHandlerUtils.readAsBoolean(GroupConstants.ACTIVE_COL, row); Boolean active = ImportHandlerUtils.readAsBoolean(GroupConstants.ACTIVE_COL, row);
LocalDate submittedOnDate=ImportHandlerUtils.readAsDate(GroupConstants.SUBMITTED_ON_DATE_COL,row); LocalDate submittedOnDate=ImportHandlerUtils.readAsDate(GroupConstants.SUBMITTED_ON_DATE_COL,row);
@@ -133,8 +138,9 @@ public class GroupImportHandler implements ImportHandler {
List<ClientData> clientMembers = new ArrayList<>(); List<ClientData> clientMembers = new ArrayList<>();
for (int cellNo = GroupConstants.CLIENT_NAMES_STARTING_COL; cellNo <GroupConstants.CLIENT_NAMES_ENDING_COL; cellNo++) { for (int cellNo = GroupConstants.CLIENT_NAMES_STARTING_COL; cellNo <GroupConstants.CLIENT_NAMES_ENDING_COL; cellNo++) {
String clientName = ImportHandlerUtils.readAsString(cellNo, row); String clientName = ImportHandlerUtils.readAsString(cellNo, row);
if (clientName==null) if (clientName==null) {
break; break;
}
Long clientId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME), clientName); Long clientId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME), clientName);
ClientData clientData = ClientData.emptyInstance(clientId); ClientData clientData = ClientData.emptyInstance(clientId);
if (!containsClientId(clientMembers,clientId)) { if (!containsClientId(clientMembers,clientId)) {
@@ -176,11 +182,15 @@ public class GroupImportHandler implements ImportHandler {
result = importGroup(i,dateFormat); result = importGroup(i,dateFormat);
groupId = result.getGroupId().toString(); groupId = result.getGroupId().toString();
progressLevel = 1; progressLevel = 1;
} else } else {
groupId = ImportHandlerUtils.readAsInt(GroupConstants.GROUP_ID_COL, groupSheet.getRow(groups.get(i).getRowIndex())).toString(); groupId = ImportHandlerUtils
.readAsInt(GroupConstants.GROUP_ID_COL, groupSheet.getRow(groups.get(i).getRowIndex()))
.toString();
}
if(meetings.get(i) != null && groups.get(i).getCenterId() == null) if(meetings.get(i) != null && groups.get(i).getCenterId() == null) {
progressLevel = importGroupMeeting(result, i,dateFormat); progressLevel = importGroupMeeting(result, i, dateFormat);
}
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
@@ -196,15 +206,17 @@ public class GroupImportHandler implements ImportHandler {
} }
private void writeGroupErrorMessage(String groupId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeGroupErrorMessage(String groupId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if(progressLevel == 0) if(progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if(progressLevel == 1) } else if (progressLevel == 1) {
status =TemplatePopulateImportConstants.STATUS_MEETING_FAILED ; status = TemplatePopulateImportConstants.STATUS_MEETING_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if(progressLevel>0) if(progressLevel>0) {
row.createCell(GroupConstants.GROUP_ID_COL).setCellValue(Integer.parseInt(groupId)); row.createCell(GroupConstants.GROUP_ID_COL).setCellValue(Integer.parseInt(groupId));
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
private void setReportHeaders(Sheet groupSheet) { private void setReportHeaders(Sheet groupSheet) {
@@ -251,10 +263,11 @@ public class GroupImportHandler implements ImportHandler {
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if(status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if(status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if(status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_MEETING_FAILED)) {
return 1; return 1;
}
return 0; return 0;
} }
@@ -74,8 +74,9 @@ public class GuarantorImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = addGuarantorSheet.getRow(rowIndex); row = addGuarantorSheet.getRow(rowIndex);
if (ImportHandlerUtils.isNotImported(row, GuarantorConstants.STATUS_COL)) if (ImportHandlerUtils.isNotImported(row, GuarantorConstants.STATUS_COL)) {
guarantors.add(ReadGuarantor(row,locale,dateFormat)); guarantors.add(ReadGuarantor(row, locale, dateFormat));
}
} }
} }
@@ -90,10 +91,11 @@ public class GuarantorImportHandler implements ImportHandler {
Integer guarantorTypeId = null; Integer guarantorTypeId = null;
if (guarantorType!=null) { if (guarantorType!=null) {
if (guarantorType.equalsIgnoreCase(TemplatePopulateImportConstants.GUARANTOR_INTERNAL)) if (guarantorType.equalsIgnoreCase(TemplatePopulateImportConstants.GUARANTOR_INTERNAL)) {
guarantorTypeId = 1; guarantorTypeId = 1;
else if (guarantorType.equalsIgnoreCase(TemplatePopulateImportConstants.GUARANTOR_EXTERNAL)) } else if (guarantorType.equalsIgnoreCase(TemplatePopulateImportConstants.GUARANTOR_EXTERNAL)) {
guarantorTypeId = 3; guarantorTypeId = 3;
}
} }
String clientName = ImportHandlerUtils.readAsString(GuarantorConstants.ENTITY_ID_COL, row); String clientName = ImportHandlerUtils.readAsString(GuarantorConstants.ENTITY_ID_COL, row);
Long entityId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME), clientName); Long entityId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME), clientName);
@@ -101,11 +101,15 @@ public class JournalEntriesImportHandler implements ImportHandler {
workbook.getSheet(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME), debitGLAcct); workbook.getSheet(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME), debitGLAcct);
BigDecimal creditAmt=null; BigDecimal creditAmt=null;
if (ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_CREDIT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_CREDIT_COL, row)!=null) {
creditAmt = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_CREDIT_COL, row)); creditAmt = BigDecimal.valueOf(
ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_CREDIT_COL, row));
}
BigDecimal debitAmount=null; BigDecimal debitAmount=null;
if (ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_DEBIT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_DEBIT_COL, row)!=null) {
debitAmount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_DEBIT_COL, row)); debitAmount = BigDecimal.valueOf(
ImportHandlerUtils.readAsDouble(JournalEntryConstants.AMOUNT_DEBIT_COL, row));
}
if (creditGLAcct!=null) { if (creditGLAcct!=null) {
@@ -138,8 +142,9 @@ public class JournalEntriesImportHandler implements ImportHandler {
private JournalEntryData readAddJournalEntries(Row row,String locale,String dateFormat) { private JournalEntryData readAddJournalEntries(Row row,String locale,String dateFormat) {
LocalDate transactionDateCheck = ImportHandlerUtils.readAsDate(JournalEntryConstants.TRANSACION_ON_DATE_COL, row); LocalDate transactionDateCheck = ImportHandlerUtils.readAsDate(JournalEntryConstants.TRANSACION_ON_DATE_COL, row);
if (transactionDateCheck!=null) if (transactionDateCheck!=null) {
transactionDate = transactionDateCheck; transactionDate = transactionDateCheck;
}
String officeName = ImportHandlerUtils.readAsString(JournalEntryConstants.OFFICE_NAME_COL, row); String officeName = ImportHandlerUtils.readAsString(JournalEntryConstants.OFFICE_NAME_COL, row);
Long officeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME), officeName); Long officeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.OFFICE_SHEET_NAME), officeName);
@@ -101,22 +101,27 @@ public class LoanImportHandler implements ImportHandler {
private LoanTransactionData readLoanRepayment(Row row,String locale,String dateFormat) { private LoanTransactionData readLoanRepayment(Row row,String locale,String dateFormat) {
BigDecimal repaymentAmount=null; BigDecimal repaymentAmount=null;
if (ImportHandlerUtils.readAsDouble(LoanConstants.TOTAL_AMOUNT_REPAID_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(LoanConstants.TOTAL_AMOUNT_REPAID_COL, row)!=null) {
repaymentAmount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(LoanConstants.TOTAL_AMOUNT_REPAID_COL, row)); repaymentAmount = BigDecimal
.valueOf(ImportHandlerUtils.readAsDouble(LoanConstants.TOTAL_AMOUNT_REPAID_COL, row));
}
LocalDate lastRepaymentDate = ImportHandlerUtils.readAsDate(LoanConstants.LAST_REPAYMENT_DATE_COL, row); LocalDate lastRepaymentDate = ImportHandlerUtils.readAsDate(LoanConstants.LAST_REPAYMENT_DATE_COL, row);
String repaymentType = ImportHandlerUtils.readAsString(LoanConstants.REPAYMENT_TYPE_COL, row); String repaymentType = ImportHandlerUtils.readAsString(LoanConstants.REPAYMENT_TYPE_COL, row);
Long repaymentTypeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), repaymentType); Long repaymentTypeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), repaymentType);
if (repaymentAmount!=null&&lastRepaymentDate!=null&&repaymentType!=null&&repaymentTypeId!=null) if (repaymentAmount!=null&&lastRepaymentDate!=null&&repaymentType!=null&&repaymentTypeId!=null) {
return LoanTransactionData.importInstance(repaymentAmount, lastRepaymentDate, repaymentTypeId, row.getRowNum(),locale,dateFormat); return LoanTransactionData.importInstance(repaymentAmount, lastRepaymentDate, repaymentTypeId,
else row.getRowNum(), locale, dateFormat);
} else {
return null; return null;
}
} }
private DisbursementData readDisbursalData(Row row,String locale,String dateFormat) { private DisbursementData readDisbursalData(Row row,String locale,String dateFormat) {
LocalDate disbursedDate = ImportHandlerUtils.readAsDate(LoanConstants.DISBURSED_DATE_COL, row); LocalDate disbursedDate = ImportHandlerUtils.readAsDate(LoanConstants.DISBURSED_DATE_COL, row);
String linkAccountId=null; String linkAccountId=null;
if ( ImportHandlerUtils.readAsLong(LoanConstants.LINK_ACCOUNT_ID, row)!=null) if ( ImportHandlerUtils.readAsLong(LoanConstants.LINK_ACCOUNT_ID, row)!=null) {
linkAccountId = ImportHandlerUtils.readAsLong(LoanConstants.LINK_ACCOUNT_ID, row).toString(); linkAccountId = ImportHandlerUtils.readAsLong(LoanConstants.LINK_ACCOUNT_ID, row).toString();
}
if (disbursedDate!=null) { if (disbursedDate!=null) {
return DisbursementData.importInstance(disbursedDate,linkAccountId,row.getRowNum(),locale,dateFormat); return DisbursementData.importInstance(disbursedDate,linkAccountId,row.getRowNum(),locale,dateFormat);
@@ -126,10 +131,11 @@ public class LoanImportHandler implements ImportHandler {
private LoanApprovalData readLoanApproval(Row row,String locale,String dateFormat) { private LoanApprovalData readLoanApproval(Row row,String locale,String dateFormat) {
LocalDate approvedDate = ImportHandlerUtils.readAsDate(LoanConstants.APPROVED_DATE_COL, row); LocalDate approvedDate = ImportHandlerUtils.readAsDate(LoanConstants.APPROVED_DATE_COL, row);
if (approvedDate!=null) if (approvedDate!=null) {
return LoanApprovalData.importInstance(approvedDate, row.getRowNum(),locale,dateFormat); return LoanApprovalData.importInstance(approvedDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private LoanAccountData readLoan(Row row,String locale,String dateFormat) { private LoanAccountData readLoan(Row row,String locale,String dateFormat) {
@@ -142,25 +148,30 @@ public class LoanImportHandler implements ImportHandler {
LocalDate submittedOnDate = ImportHandlerUtils.readAsDate(LoanConstants.SUBMITTED_ON_DATE_COL, row); LocalDate submittedOnDate = ImportHandlerUtils.readAsDate(LoanConstants.SUBMITTED_ON_DATE_COL, row);
String fundName = ImportHandlerUtils.readAsString(LoanConstants.FUND_NAME_COL, row); String fundName = ImportHandlerUtils.readAsString(LoanConstants.FUND_NAME_COL, row);
Long fundId; Long fundId;
if (fundName == null) if (fundName == null) {
fundId = null; fundId = null;
else } else {
fundId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), fundName); fundId = ImportHandlerUtils
.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), fundName);
}
BigDecimal principal = null; BigDecimal principal = null;
if ( ImportHandlerUtils.readAsDouble(LoanConstants.PRINCIPAL_COL, row) != null) if ( ImportHandlerUtils.readAsDouble(LoanConstants.PRINCIPAL_COL, row) != null) {
principal = BigDecimal.valueOf( ImportHandlerUtils.readAsDouble(LoanConstants.PRINCIPAL_COL, row)); principal = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(LoanConstants.PRINCIPAL_COL, row));
}
Integer numberOfRepayments = ImportHandlerUtils.readAsInt(LoanConstants.NO_OF_REPAYMENTS_COL, row); Integer numberOfRepayments = ImportHandlerUtils.readAsInt(LoanConstants.NO_OF_REPAYMENTS_COL, row);
Integer repaidEvery = ImportHandlerUtils.readAsInt(LoanConstants.REPAID_EVERY_COL, row); Integer repaidEvery = ImportHandlerUtils.readAsInt(LoanConstants.REPAID_EVERY_COL, row);
String repaidEveryFrequency = ImportHandlerUtils.readAsString(LoanConstants.REPAID_EVERY_FREQUENCY_COL, row); String repaidEveryFrequency = ImportHandlerUtils.readAsString(LoanConstants.REPAID_EVERY_FREQUENCY_COL, row);
String repaidEveryFrequencyId = ""; String repaidEveryFrequencyId = "";
EnumOptionData repaidEveryFrequencyEnums = null; EnumOptionData repaidEveryFrequencyEnums = null;
if (repaidEveryFrequency != null) { if (repaidEveryFrequency != null) {
if (repaidEveryFrequency.equalsIgnoreCase("Days")) if (repaidEveryFrequency.equalsIgnoreCase("Days")) {
repaidEveryFrequencyId = "0"; repaidEveryFrequencyId = "0";
else if (repaidEveryFrequency.equalsIgnoreCase("Weeks")) } else if (repaidEveryFrequency.equalsIgnoreCase("Weeks")) {
repaidEveryFrequencyId = "1"; repaidEveryFrequencyId = "1";
else if (repaidEveryFrequency.equalsIgnoreCase("Months")) repaidEveryFrequencyId = "2"; } else if (repaidEveryFrequency.equalsIgnoreCase("Months")) {
repaidEveryFrequencyId = "2";
}
repaidEveryFrequencyEnums = new EnumOptionData(null, null, repaidEveryFrequencyId); repaidEveryFrequencyEnums = new EnumOptionData(null, null, repaidEveryFrequencyId);
} }
Integer loanTerm = ImportHandlerUtils.readAsInt(LoanConstants.LOAN_TERM_COL, row); Integer loanTerm = ImportHandlerUtils.readAsInt(LoanConstants.LOAN_TERM_COL, row);
@@ -168,66 +179,77 @@ public class LoanImportHandler implements ImportHandler {
EnumOptionData loanTermFrequencyEnum = null; EnumOptionData loanTermFrequencyEnum = null;
if (loanTermFrequency != null) { if (loanTermFrequency != null) {
String loanTermFrequencyId = ""; String loanTermFrequencyId = "";
if (loanTermFrequency.equalsIgnoreCase("Days")) if (loanTermFrequency.equalsIgnoreCase("Days")) {
loanTermFrequencyId = "0"; loanTermFrequencyId = "0";
else if (loanTermFrequency.equalsIgnoreCase("Weeks")) } else if (loanTermFrequency.equalsIgnoreCase("Weeks")) {
loanTermFrequencyId = "1"; loanTermFrequencyId = "1";
else if (loanTermFrequency.equalsIgnoreCase("Months")) } else if (loanTermFrequency.equalsIgnoreCase("Months")) {
loanTermFrequencyId = "2"; loanTermFrequencyId = "2";
}
loanTermFrequencyEnum = new EnumOptionData(null, null, loanTermFrequencyId); loanTermFrequencyEnum = new EnumOptionData(null, null, loanTermFrequencyId);
} }
BigDecimal nominalInterestRate = null; BigDecimal nominalInterestRate = null;
if ( ImportHandlerUtils.readAsDouble(LoanConstants.NOMINAL_INTEREST_RATE_COL, row) != null) if ( ImportHandlerUtils.readAsDouble(LoanConstants.NOMINAL_INTEREST_RATE_COL, row) != null) {
nominalInterestRate = BigDecimal.valueOf( ImportHandlerUtils.readAsDouble(LoanConstants.NOMINAL_INTEREST_RATE_COL, row)); nominalInterestRate = BigDecimal
.valueOf(ImportHandlerUtils.readAsDouble(LoanConstants.NOMINAL_INTEREST_RATE_COL, row));
}
String amortization = ImportHandlerUtils.readAsString(LoanConstants.AMORTIZATION_COL, row); String amortization = ImportHandlerUtils.readAsString(LoanConstants.AMORTIZATION_COL, row);
String amortizationId = ""; String amortizationId = "";
EnumOptionData amortizationEnumOption = null; EnumOptionData amortizationEnumOption = null;
if (amortization != null) { if (amortization != null) {
if (amortization.equalsIgnoreCase("Equal principal payments")) if (amortization.equalsIgnoreCase("Equal principal payments")) {
amortizationId = "0"; amortizationId = "0";
else if (amortization.equalsIgnoreCase("Equal installments")) amortizationId = "1"; } else if (amortization.equalsIgnoreCase("Equal installments")) {
amortizationId = "1";
}
amortizationEnumOption = new EnumOptionData(null, null, amortizationId); amortizationEnumOption = new EnumOptionData(null, null, amortizationId);
} }
String interestMethod = ImportHandlerUtils.readAsString(LoanConstants.INTEREST_METHOD_COL, row); String interestMethod = ImportHandlerUtils.readAsString(LoanConstants.INTEREST_METHOD_COL, row);
String interestMethodId = ""; String interestMethodId = "";
EnumOptionData interestMethodEnum = null; EnumOptionData interestMethodEnum = null;
if (interestMethod != null) { if (interestMethod != null) {
if (interestMethod.equalsIgnoreCase("Flat")) if (interestMethod.equalsIgnoreCase("Flat")) {
interestMethodId = "1"; interestMethodId = "1";
else if (interestMethod.equalsIgnoreCase("Declining Balance")) interestMethodId = "0"; } else if (interestMethod.equalsIgnoreCase("Declining Balance")) {
interestMethodId = "0";
}
interestMethodEnum = new EnumOptionData(null, null, interestMethodId); interestMethodEnum = new EnumOptionData(null, null, interestMethodId);
} }
String interestCalculationPeriod = ImportHandlerUtils.readAsString(LoanConstants.INTEREST_CALCULATION_PERIOD_COL, row); String interestCalculationPeriod = ImportHandlerUtils.readAsString(LoanConstants.INTEREST_CALCULATION_PERIOD_COL, row);
String interestCalculationPeriodId = ""; String interestCalculationPeriodId = "";
EnumOptionData interestCalculationPeriodEnum = null; EnumOptionData interestCalculationPeriodEnum = null;
if (interestCalculationPeriod != null) { if (interestCalculationPeriod != null) {
if (interestCalculationPeriod.equalsIgnoreCase("Daily")) if (interestCalculationPeriod.equalsIgnoreCase("Daily")) {
interestCalculationPeriodId = "0"; interestCalculationPeriodId = "0";
else if (interestCalculationPeriod.equalsIgnoreCase("Same as repayment period")) } else if (interestCalculationPeriod.equalsIgnoreCase("Same as repayment period")) {
interestCalculationPeriodId = "1"; interestCalculationPeriodId = "1";
}
interestCalculationPeriodEnum = new EnumOptionData(null, null, interestCalculationPeriodId); interestCalculationPeriodEnum = new EnumOptionData(null, null, interestCalculationPeriodId);
} }
BigDecimal arrearsTolerance = null; BigDecimal arrearsTolerance = null;
if ( ImportHandlerUtils.readAsDouble(LoanConstants.ARREARS_TOLERANCE_COL, row) != null) if ( ImportHandlerUtils.readAsDouble(LoanConstants.ARREARS_TOLERANCE_COL, row) != null) {
arrearsTolerance = BigDecimal.valueOf( ImportHandlerUtils.readAsDouble(LoanConstants.ARREARS_TOLERANCE_COL, row)); arrearsTolerance = BigDecimal
.valueOf(ImportHandlerUtils.readAsDouble(LoanConstants.ARREARS_TOLERANCE_COL, row));
}
String repaymentStrategy = ImportHandlerUtils.readAsString(LoanConstants.REPAYMENT_STRATEGY_COL, row); String repaymentStrategy = ImportHandlerUtils.readAsString(LoanConstants.REPAYMENT_STRATEGY_COL, row);
Long repaymentStrategyId = null; Long repaymentStrategyId = null;
if (repaymentStrategy!=null) { if (repaymentStrategy!=null) {
if (repaymentStrategy.equalsIgnoreCase("Penalties, Fees, Interest, Principal order")) if (repaymentStrategy.equalsIgnoreCase("Penalties, Fees, Interest, Principal order")) {
repaymentStrategyId = 1L; repaymentStrategyId = 1L;
else if (repaymentStrategy.equalsIgnoreCase("HeavensFamily Unique")) } else if (repaymentStrategy.equalsIgnoreCase("HeavensFamily Unique")) {
repaymentStrategyId = 2L; repaymentStrategyId = 2L;
else if (repaymentStrategy.equalsIgnoreCase("Creocore Unique")) } else if (repaymentStrategy.equalsIgnoreCase("Creocore Unique")) {
repaymentStrategyId = 3L; repaymentStrategyId = 3L;
else if (repaymentStrategy.equalsIgnoreCase("Overdue/Due Fee/Int,Principal")) } else if (repaymentStrategy.equalsIgnoreCase("Overdue/Due Fee/Int,Principal")) {
repaymentStrategyId = 4L; repaymentStrategyId = 4L;
else if (repaymentStrategy.equalsIgnoreCase("Principal, Interest, Penalties, Fees Order")) } else if (repaymentStrategy.equalsIgnoreCase("Principal, Interest, Penalties, Fees Order")) {
repaymentStrategyId = 5L; repaymentStrategyId = 5L;
else if (repaymentStrategy.equalsIgnoreCase("Interest, Principal, Penalties, Fees Order")) } else if (repaymentStrategy.equalsIgnoreCase("Interest, Principal, Penalties, Fees Order")) {
repaymentStrategyId = 6L; repaymentStrategyId = 6L;
else if (repaymentStrategy.equalsIgnoreCase("Early Repayment Strategy")) } else if (repaymentStrategy.equalsIgnoreCase("Early Repayment Strategy")) {
repaymentStrategyId = 7L; repaymentStrategyId = 7L;
}
} }
Integer graceOnPrincipalPayment = ImportHandlerUtils.readAsInt(LoanConstants.GRACE_ON_PRINCIPAL_PAYMENT_COL, row); Integer graceOnPrincipalPayment = ImportHandlerUtils.readAsInt(LoanConstants.GRACE_ON_PRINCIPAL_PAYMENT_COL, row);
Integer graceOnInterestPayment = ImportHandlerUtils.readAsInt(LoanConstants.GRACE_ON_INTEREST_PAYMENT_COL, row); Integer graceOnInterestPayment = ImportHandlerUtils.readAsInt(LoanConstants.GRACE_ON_INTEREST_PAYMENT_COL, row);
@@ -328,14 +350,22 @@ public class LoanImportHandler implements ImportHandler {
result = importLoan(i,dateFormat); result = importLoan(i,dateFormat);
loanId = result.getLoanId().toString(); loanId = result.getLoanId().toString();
progressLevel = 1; progressLevel = 1;
} else } else {
loanId = ImportHandlerUtils.readAsString(LoanConstants.LOAN_ID_COL, loanSheet.getRow(loans.get(i).getRowIndex())); loanId = ImportHandlerUtils.readAsString(LoanConstants.LOAN_ID_COL,
loanSheet.getRow(loans.get(i).getRowIndex()));
}
if (progressLevel <= 1 && approvalDates.get(i)!=null) progressLevel = importLoanApproval(result, i,dateFormat); if (progressLevel <= 1 && approvalDates.get(i)!=null) {
progressLevel = importLoanApproval(result, i, dateFormat);
}
if (progressLevel <= 2 && disbursalDates.get(i)!=null) progressLevel = importDisbursalData(result, i,dateFormat); if (progressLevel <= 2 && disbursalDates.get(i)!=null) {
progressLevel = importDisbursalData(result, i, dateFormat);
}
if (loanRepayments.get(i) != null) progressLevel = importLoanRepayment(result, i,dateFormat); if (loanRepayments.get(i) != null) {
progressLevel = importLoanRepayment(result, i, dateFormat);
}
successCount++; successCount++;
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
@@ -354,17 +384,21 @@ public class LoanImportHandler implements ImportHandler {
private void writeLoanErrorMessage(String loanId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeLoanErrorMessage(String loanId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if (progressLevel == 0) if (progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if (progressLevel == 1) } else if (progressLevel == 1) {
status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED; status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED;
else if (progressLevel == 2) } else if (progressLevel == 2) {
status = TemplatePopulateImportConstants.STATUS_DISBURSAL_FAILED; status = TemplatePopulateImportConstants.STATUS_DISBURSAL_FAILED;
else if (progressLevel == 3) status = TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED; } else if (progressLevel == 3) {
status = TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if (progressLevel > 0) row.createCell(LoanConstants.LOAN_ID_COL).setCellValue(Integer.parseInt(loanId)); if (progressLevel > 0) {
row.createCell(LoanConstants.LOAN_ID_COL).setCellValue(Integer.parseInt(loanId));
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
private void setReportHeaders(Sheet sheet) { private void setReportHeaders(Sheet sheet) {
@@ -459,13 +493,15 @@ public class LoanImportHandler implements ImportHandler {
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) {
return 1; return 1;
else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_FAILED)) {
return 2; return 2;
else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED)) return 3; } else if (status.equals(TemplatePopulateImportConstants.STATUS_DISBURSAL_REPAYMENT_FAILED)) {
return 3;
}
return 0; return 0;
} }
@@ -74,8 +74,9 @@ public class LoanRepaymentImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = loanRepaymentSheet.getRow(rowIndex); row = loanRepaymentSheet.getRow(rowIndex);
if(ImportHandlerUtils.isNotImported(row, LoanRepaymentConstants.STATUS_COL)) if(ImportHandlerUtils.isNotImported(row, LoanRepaymentConstants.STATUS_COL)) {
loanRepayments.add(readLoanRepayment(row,locale,dateFormat)); loanRepayments.add(readLoanRepayment(row, locale, dateFormat));
}
} }
} }
@@ -86,8 +87,10 @@ public class LoanRepaymentImportHandler implements ImportHandler {
loanAccountId = this.loanReadPlatformService.retrieveLoanIdByAccountNumber(loanAccountAr[0]); loanAccountId = this.loanReadPlatformService.retrieveLoanIdByAccountNumber(loanAccountAr[0]);
} }
BigDecimal repaymentAmount=null; BigDecimal repaymentAmount=null;
if (ImportHandlerUtils.readAsDouble(LoanRepaymentConstants.AMOUNT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(LoanRepaymentConstants.AMOUNT_COL, row)!=null) {
repaymentAmount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(LoanRepaymentConstants.AMOUNT_COL, row)); repaymentAmount = BigDecimal
.valueOf(ImportHandlerUtils.readAsDouble(LoanRepaymentConstants.AMOUNT_COL, row));
}
LocalDate repaymentDate = ImportHandlerUtils.readAsDate(LoanRepaymentConstants.REPAID_ON_DATE_COL, row); LocalDate repaymentDate = ImportHandlerUtils.readAsDate(LoanRepaymentConstants.REPAID_ON_DATE_COL, row);
String repaymentType = ImportHandlerUtils.readAsString(LoanRepaymentConstants.REPAYMENT_TYPE_COL, row); String repaymentType = ImportHandlerUtils.readAsString(LoanRepaymentConstants.REPAYMENT_TYPE_COL, row);
Long repaymentTypeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), repaymentType); Long repaymentTypeId = ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME), repaymentType);
@@ -96,18 +96,20 @@ public class RecurringDepositImportHandler implements ImportHandler {
private SavingsActivation readSavingsActivation(Row row,String locale, String dateFormat) { private SavingsActivation readSavingsActivation(Row row,String locale, String dateFormat) {
LocalDate activationDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.ACTIVATION_DATE_COL, row); LocalDate activationDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.ACTIVATION_DATE_COL, row);
if (activationDate!=null) if (activationDate!=null) {
return SavingsActivation.importInstance(activationDate, row.getRowNum(),locale,dateFormat); return SavingsActivation.importInstance(activationDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private SavingsApproval readSavingsApproval(Row row,String locale, String dateFormat) { private SavingsApproval readSavingsApproval(Row row,String locale, String dateFormat) {
LocalDate approvalDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.APPROVED_DATE_COL, row); LocalDate approvalDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.APPROVED_DATE_COL, row);
if (approvalDate!=null) if (approvalDate!=null) {
return SavingsApproval.importInstance(approvalDate, row.getRowNum(),locale,dateFormat); return SavingsApproval.importInstance(approvalDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private RecurringDepositAccountData readSavings(Row row,String locale, String dateFormat) { private RecurringDepositAccountData readSavings(Row row,String locale, String dateFormat) {
@@ -121,30 +123,32 @@ public class RecurringDepositImportHandler implements ImportHandler {
Long interestCompoundingPeriodTypeId = null; Long interestCompoundingPeriodTypeId = null;
EnumOptionData interestCompoundingPeriodTypeEnum=null; EnumOptionData interestCompoundingPeriodTypeEnum=null;
if (interestCompoundingPeriodType!=null) { if (interestCompoundingPeriodType!=null) {
if (interestCompoundingPeriodType.equalsIgnoreCase("Daily")) if (interestCompoundingPeriodType.equalsIgnoreCase("Daily")) {
interestCompoundingPeriodTypeId = 1L; interestCompoundingPeriodTypeId = 1L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Monthly")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Monthly")) {
interestCompoundingPeriodTypeId = 4L; interestCompoundingPeriodTypeId = 4L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Quarterly")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Quarterly")) {
interestCompoundingPeriodTypeId = 5L; interestCompoundingPeriodTypeId = 5L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Semi-Annual")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Semi-Annual")) {
interestCompoundingPeriodTypeId = 6L; interestCompoundingPeriodTypeId = 6L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Annually")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Annually")) {
interestCompoundingPeriodTypeId = 7L; interestCompoundingPeriodTypeId = 7L;
}
interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null); interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null);
} }
String interestPostingPeriodType = ImportHandlerUtils.readAsString(RecurringDepositConstants.INTEREST_POSTING_PERIOD_COL, row); String interestPostingPeriodType = ImportHandlerUtils.readAsString(RecurringDepositConstants.INTEREST_POSTING_PERIOD_COL, row);
Long interestPostingPeriodTypeId = null; Long interestPostingPeriodTypeId = null;
EnumOptionData interestPostingPeriodTypeEnum=null; EnumOptionData interestPostingPeriodTypeEnum=null;
if (interestPostingPeriodType!=null) { if (interestPostingPeriodType!=null) {
if (interestPostingPeriodType.equalsIgnoreCase("Monthly")) if (interestPostingPeriodType.equalsIgnoreCase("Monthly")) {
interestPostingPeriodTypeId = 4L; interestPostingPeriodTypeId = 4L;
else if (interestPostingPeriodType.equalsIgnoreCase("Quarterly")) } else if (interestPostingPeriodType.equalsIgnoreCase("Quarterly")) {
interestPostingPeriodTypeId = 5L; interestPostingPeriodTypeId = 5L;
else if (interestPostingPeriodType.equalsIgnoreCase("Annually")) } else if (interestPostingPeriodType.equalsIgnoreCase("Annually")) {
interestPostingPeriodTypeId = 7L; interestPostingPeriodTypeId = 7L;
else if (interestPostingPeriodType.equalsIgnoreCase("BiAnnual")) } else if (interestPostingPeriodType.equalsIgnoreCase("BiAnnual")) {
interestPostingPeriodTypeId = 6L; interestPostingPeriodTypeId = 6L;
}
interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null); interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null);
} }
@@ -152,20 +156,22 @@ public class RecurringDepositImportHandler implements ImportHandler {
Long interestCalculationTypeId = null; Long interestCalculationTypeId = null;
EnumOptionData interestCalculationTypeEnum=null; EnumOptionData interestCalculationTypeEnum=null;
if (interestCalculationType!=null) { if (interestCalculationType!=null) {
if (interestCalculationType.equalsIgnoreCase("Daily Balance")) if (interestCalculationType.equalsIgnoreCase("Daily Balance")) {
interestCalculationTypeId = 1L; interestCalculationTypeId = 1L;
else if (interestCalculationType.equalsIgnoreCase("Average Daily Balance")) } else if (interestCalculationType.equalsIgnoreCase("Average Daily Balance")) {
interestCalculationTypeId = 2L; interestCalculationTypeId = 2L;
}
interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null); interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null);
} }
String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(RecurringDepositConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row); String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(RecurringDepositConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row);
EnumOptionData interestCalculationDaysInYearTypeEnum=null; EnumOptionData interestCalculationDaysInYearTypeEnum=null;
Long interestCalculationDaysInYearTypeId = null; Long interestCalculationDaysInYearTypeId = null;
if (interestCalculationDaysInYearType!=null) { if (interestCalculationDaysInYearType!=null) {
if (interestCalculationDaysInYearType.equalsIgnoreCase("360 Days")) if (interestCalculationDaysInYearType.equalsIgnoreCase("360 Days")) {
interestCalculationDaysInYearTypeId = 360L; interestCalculationDaysInYearTypeId = 360L;
else if (interestCalculationDaysInYearType.equalsIgnoreCase("365 Days")) } else if (interestCalculationDaysInYearType.equalsIgnoreCase("365 Days")) {
interestCalculationDaysInYearTypeId = 365L; interestCalculationDaysInYearTypeId = 365L;
}
interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null); interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null);
} }
Integer lockinPeriodFrequency = ImportHandlerUtils.readAsInt(RecurringDepositConstants.LOCKIN_PERIOD_COL, row); Integer lockinPeriodFrequency = ImportHandlerUtils.readAsInt(RecurringDepositConstants.LOCKIN_PERIOD_COL, row);
@@ -173,45 +179,50 @@ public class RecurringDepositImportHandler implements ImportHandler {
Long lockinPeriodFrequencyTypeId = null; Long lockinPeriodFrequencyTypeId = null;
EnumOptionData lockinPeriodFrequencyTypeEnum=null; EnumOptionData lockinPeriodFrequencyTypeEnum=null;
if (lockinPeriodFrequencyType!=null) { if (lockinPeriodFrequencyType!=null) {
if (lockinPeriodFrequencyType.equalsIgnoreCase("Days")) if (lockinPeriodFrequencyType.equalsIgnoreCase("Days")) {
lockinPeriodFrequencyTypeId = 0L; lockinPeriodFrequencyTypeId = 0L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Weeks")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Weeks")) {
lockinPeriodFrequencyTypeId = 1L; lockinPeriodFrequencyTypeId = 1L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Months")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Months")) {
lockinPeriodFrequencyTypeId = 2L; lockinPeriodFrequencyTypeId = 2L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Years")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Years")) {
lockinPeriodFrequencyTypeId = 3L; lockinPeriodFrequencyTypeId = 3L;
}
lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null); lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null);
} }
BigDecimal depositAmount=null; BigDecimal depositAmount=null;
if (ImportHandlerUtils.readAsDouble(RecurringDepositConstants.RECURRING_DEPOSIT_AMOUNT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(RecurringDepositConstants.RECURRING_DEPOSIT_AMOUNT_COL, row)!=null) {
depositAmount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(RecurringDepositConstants.RECURRING_DEPOSIT_AMOUNT_COL, row)); depositAmount = BigDecimal.valueOf(
ImportHandlerUtils.readAsDouble(RecurringDepositConstants.RECURRING_DEPOSIT_AMOUNT_COL, row));
}
Integer depositPeriod = ImportHandlerUtils.readAsInt(RecurringDepositConstants.DEPOSIT_PERIOD_COL, row); Integer depositPeriod = ImportHandlerUtils.readAsInt(RecurringDepositConstants.DEPOSIT_PERIOD_COL, row);
String depositPeriodFrequency = ImportHandlerUtils.readAsString(RecurringDepositConstants.DEPOSIT_PERIOD_FREQUENCY_COL, row); String depositPeriodFrequency = ImportHandlerUtils.readAsString(RecurringDepositConstants.DEPOSIT_PERIOD_FREQUENCY_COL, row);
Long depositPeriodFrequencyId = null; Long depositPeriodFrequencyId = null;
if (depositPeriodFrequency!=null) { if (depositPeriodFrequency!=null) {
if (depositPeriodFrequency.equalsIgnoreCase("Days")) if (depositPeriodFrequency.equalsIgnoreCase("Days")) {
depositPeriodFrequencyId = 0L; depositPeriodFrequencyId = 0L;
else if (depositPeriodFrequency.equalsIgnoreCase("Weeks")) } else if (depositPeriodFrequency.equalsIgnoreCase("Weeks")) {
depositPeriodFrequencyId = 1L; depositPeriodFrequencyId = 1L;
else if (depositPeriodFrequency.equalsIgnoreCase("Months")) } else if (depositPeriodFrequency.equalsIgnoreCase("Months")) {
depositPeriodFrequencyId = 2L; depositPeriodFrequencyId = 2L;
else if (depositPeriodFrequency.equalsIgnoreCase("Years")) } else if (depositPeriodFrequency.equalsIgnoreCase("Years")) {
depositPeriodFrequencyId = 3L; depositPeriodFrequencyId = 3L;
}
} }
Integer recurringFrequency = ImportHandlerUtils.readAsInt(RecurringDepositConstants.DEPOSIT_FREQUENCY_COL, row); Integer recurringFrequency = ImportHandlerUtils.readAsInt(RecurringDepositConstants.DEPOSIT_FREQUENCY_COL, row);
String recurringFrequencyType = ImportHandlerUtils.readAsString(RecurringDepositConstants.DEPOSIT_FREQUENCY_TYPE_COL, row); String recurringFrequencyType = ImportHandlerUtils.readAsString(RecurringDepositConstants.DEPOSIT_FREQUENCY_TYPE_COL, row);
Long recurringFrequencyTypeId = null; Long recurringFrequencyTypeId = null;
EnumOptionData recurringFrequencyTypeEnum=null; EnumOptionData recurringFrequencyTypeEnum=null;
if (recurringFrequencyType!=null) { if (recurringFrequencyType!=null) {
if (recurringFrequencyType.equalsIgnoreCase("Days")) if (recurringFrequencyType.equalsIgnoreCase("Days")) {
recurringFrequencyTypeId = 0L; recurringFrequencyTypeId = 0L;
else if (recurringFrequencyType.equalsIgnoreCase("Weeks")) } else if (recurringFrequencyType.equalsIgnoreCase("Weeks")) {
recurringFrequencyTypeId = 1L; recurringFrequencyTypeId = 1L;
else if (recurringFrequencyType.equalsIgnoreCase("Months")) } else if (recurringFrequencyType.equalsIgnoreCase("Months")) {
recurringFrequencyTypeId = 2L; recurringFrequencyTypeId = 2L;
else if (recurringFrequencyType.equalsIgnoreCase("Years")) } else if (recurringFrequencyType.equalsIgnoreCase("Years")) {
recurringFrequencyTypeId = 3L; recurringFrequencyTypeId = 3L;
}
recurringFrequencyTypeEnum = new EnumOptionData(recurringFrequencyTypeId, null, null); recurringFrequencyTypeEnum = new EnumOptionData(recurringFrequencyTypeId, null, null);
} }
LocalDate depositStartDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.DEPOSIT_START_DATE_COL, row); LocalDate depositStartDate = ImportHandlerUtils.readAsDate(RecurringDepositConstants.DEPOSIT_START_DATE_COL, row);
@@ -279,12 +290,18 @@ public class RecurringDepositImportHandler implements ImportHandler {
CommandProcessingResult result= importSavings(i,dateFormat); CommandProcessingResult result= importSavings(i,dateFormat);
savingsId = result.getSavingsId(); savingsId = result.getSavingsId();
progressLevel = 1; progressLevel = 1;
} else } else {
savingsId = ImportHandlerUtils.readAsLong(RecurringDepositConstants.SAVINGS_ID_COL, savingsSheet.getRow(savings.get(i).getRowIndex())); savingsId = ImportHandlerUtils.readAsLong(RecurringDepositConstants.SAVINGS_ID_COL,
savingsSheet.getRow(savings.get(i).getRowIndex()));
}
if (progressLevel <= 1) progressLevel = importSavingsApproval(savingsId, i,dateFormat); if (progressLevel <= 1) {
progressLevel = importSavingsApproval(savingsId, i, dateFormat);
}
if (progressLevel <= 2) progressLevel = importSavingsActivation(savingsId, i,dateFormat); if (progressLevel <= 2) {
progressLevel = importSavingsActivation(savingsId, i, dateFormat);
}
successCount++; successCount++;
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
@@ -301,15 +318,19 @@ public class RecurringDepositImportHandler implements ImportHandler {
private void writeRecurringDepositErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeRecurringDepositErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if (progressLevel == 0) if (progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if (progressLevel == 1) } else if (progressLevel == 1) {
status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED; status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED;
else if (progressLevel == 2) status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED; } else if (progressLevel == 2) {
status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if (progressLevel > 0) row.createCell(RecurringDepositConstants.SAVINGS_ID_COL).setCellValue(savingsId); if (progressLevel > 0) {
row.createCell(RecurringDepositConstants.SAVINGS_ID_COL).setCellValue(savingsId);
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
@@ -366,11 +387,13 @@ public class RecurringDepositImportHandler implements ImportHandler {
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) {
return 1; return 1;
else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) return 2; } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) {
return 2;
}
return 0; return 0;
} }
@@ -77,23 +77,28 @@ public class RecurringDepositTransactionImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = savingsTransactionSheet.getRow(rowIndex); row = savingsTransactionSheet.getRow(rowIndex);
if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) {
savingsTransactions.add(readSavingsTransaction(row,locale,dateFormat)); savingsTransactions.add(readSavingsTransaction(row, locale, dateFormat));
}
} }
} }
private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale, String dateFormat) { private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale, String dateFormat) {
String savingsAccountIdCheck=null; String savingsAccountIdCheck=null;
if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) {
savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row).toString(); savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)
if(savingsAccountIdCheck!=null) .toString();
}
if(savingsAccountIdCheck!=null) {
savingsAccountId = savingsAccountIdCheck; savingsAccountId = savingsAccountIdCheck;
}
String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row); String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row);
SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType); SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType);
BigDecimal amount=null; BigDecimal amount=null;
if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) {
amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)); amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row));
}
LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row); LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row);
String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row); String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row);
@@ -96,18 +96,20 @@ public class SavingsImportHandler implements ImportHandler {
private SavingsActivation readSavingsActivation(Row row,String locale, String dateFormat) { private SavingsActivation readSavingsActivation(Row row,String locale, String dateFormat) {
LocalDate activationDate = ImportHandlerUtils.readAsDate( SavingsConstants.ACTIVATION_DATE_COL, row); LocalDate activationDate = ImportHandlerUtils.readAsDate( SavingsConstants.ACTIVATION_DATE_COL, row);
if (activationDate!=null) if (activationDate!=null) {
return SavingsActivation.importInstance(activationDate, row.getRowNum(),locale,dateFormat); return SavingsActivation.importInstance(activationDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private SavingsApproval readSavingsApproval(Row row,String locale, String dateFormat) { private SavingsApproval readSavingsApproval(Row row,String locale, String dateFormat) {
LocalDate approvalDate = ImportHandlerUtils.readAsDate( SavingsConstants.APPROVED_DATE_COL, row); LocalDate approvalDate = ImportHandlerUtils.readAsDate( SavingsConstants.APPROVED_DATE_COL, row);
if (approvalDate!=null) if (approvalDate!=null) {
return SavingsApproval.importInstance(approvalDate, row.getRowNum(),locale,dateFormat); return SavingsApproval.importInstance(approvalDate, row.getRowNum(), locale, dateFormat);
else } else {
return null; return null;
}
} }
private SavingsAccountData readSavings(Row row,String locale, String dateFormat) { private SavingsAccountData readSavings(Row row,String locale, String dateFormat) {
@@ -125,50 +127,54 @@ public class SavingsImportHandler implements ImportHandler {
Long interestCompoundingPeriodTypeId = null; Long interestCompoundingPeriodTypeId = null;
EnumOptionData interestCompoundingPeriodTypeEnum=null; EnumOptionData interestCompoundingPeriodTypeEnum=null;
if (interestCompoundingPeriodType!=null) { if (interestCompoundingPeriodType!=null) {
if (interestCompoundingPeriodType.equalsIgnoreCase("Daily")) if (interestCompoundingPeriodType.equalsIgnoreCase("Daily")) {
interestCompoundingPeriodTypeId = 1L; interestCompoundingPeriodTypeId = 1L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Monthly")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Monthly")) {
interestCompoundingPeriodTypeId = 4L; interestCompoundingPeriodTypeId = 4L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Quarterly")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Quarterly")) {
interestCompoundingPeriodTypeId = 5L; interestCompoundingPeriodTypeId = 5L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Semi-Annual")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Semi-Annual")) {
interestCompoundingPeriodTypeId = 6L; interestCompoundingPeriodTypeId = 6L;
else if (interestCompoundingPeriodType.equalsIgnoreCase("Annually")) } else if (interestCompoundingPeriodType.equalsIgnoreCase("Annually")) {
interestCompoundingPeriodTypeId = 7L; interestCompoundingPeriodTypeId = 7L;
}
interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null); interestCompoundingPeriodTypeEnum = new EnumOptionData(interestCompoundingPeriodTypeId, null, null);
} }
String interestPostingPeriodType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_POSTING_PERIOD_COL, row); String interestPostingPeriodType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_POSTING_PERIOD_COL, row);
Long interestPostingPeriodTypeId = null; Long interestPostingPeriodTypeId = null;
EnumOptionData interestPostingPeriodTypeEnum=null; EnumOptionData interestPostingPeriodTypeEnum=null;
if (interestPostingPeriodType!=null) { if (interestPostingPeriodType!=null) {
if (interestPostingPeriodType.equalsIgnoreCase("Monthly")) if (interestPostingPeriodType.equalsIgnoreCase("Monthly")) {
interestPostingPeriodTypeId = 4L; interestPostingPeriodTypeId = 4L;
else if (interestPostingPeriodType.equalsIgnoreCase("Quarterly")) } else if (interestPostingPeriodType.equalsIgnoreCase("Quarterly")) {
interestPostingPeriodTypeId = 5L; interestPostingPeriodTypeId = 5L;
else if (interestPostingPeriodType.equalsIgnoreCase("Annually")) } else if (interestPostingPeriodType.equalsIgnoreCase("Annually")) {
interestPostingPeriodTypeId = 7L; interestPostingPeriodTypeId = 7L;
else if (interestPostingPeriodType.equalsIgnoreCase("BiAnnual")) } else if (interestPostingPeriodType.equalsIgnoreCase("BiAnnual")) {
interestPostingPeriodTypeId = 6L; interestPostingPeriodTypeId = 6L;
}
interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null); interestPostingPeriodTypeEnum = new EnumOptionData(interestPostingPeriodTypeId, null, null);
} }
String interestCalculationType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_CALCULATION_COL, row); String interestCalculationType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_CALCULATION_COL, row);
Long interestCalculationTypeId = null; Long interestCalculationTypeId = null;
EnumOptionData interestCalculationTypeEnum=null; EnumOptionData interestCalculationTypeEnum=null;
if (interestCalculationType!=null) { if (interestCalculationType!=null) {
if (interestCalculationType.equalsIgnoreCase("Daily Balance")) if (interestCalculationType.equalsIgnoreCase("Daily Balance")) {
interestCalculationTypeId = 1L; interestCalculationTypeId = 1L;
else if (interestCalculationType.equalsIgnoreCase("Average Daily Balance")) } else if (interestCalculationType.equalsIgnoreCase("Average Daily Balance")) {
interestCalculationTypeId = 2L; interestCalculationTypeId = 2L;
}
interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null); interestCalculationTypeEnum = new EnumOptionData(interestCalculationTypeId, null, null);
} }
String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row); String interestCalculationDaysInYearType = ImportHandlerUtils.readAsString(SavingsConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row);
EnumOptionData interestCalculationDaysInYearTypeEnum=null; EnumOptionData interestCalculationDaysInYearTypeEnum=null;
Long interestCalculationDaysInYearTypeId = null; Long interestCalculationDaysInYearTypeId = null;
if (interestCalculationDaysInYearType!=null) { if (interestCalculationDaysInYearType!=null) {
if (interestCalculationDaysInYearType.equalsIgnoreCase("360 Days")) if (interestCalculationDaysInYearType.equalsIgnoreCase("360 Days")) {
interestCalculationDaysInYearTypeId = 360L; interestCalculationDaysInYearTypeId = 360L;
else if (interestCalculationDaysInYearType.equalsIgnoreCase("365 Days")) } else if (interestCalculationDaysInYearType.equalsIgnoreCase("365 Days")) {
interestCalculationDaysInYearTypeId = 365L; interestCalculationDaysInYearTypeId = 365L;
}
interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null); interestCalculationDaysInYearTypeEnum = new EnumOptionData(interestCalculationDaysInYearTypeId, null, null);
} }
BigDecimal minRequiredOpeningBalance=null; BigDecimal minRequiredOpeningBalance=null;
@@ -180,21 +186,24 @@ public class SavingsImportHandler implements ImportHandler {
Long lockinPeriodFrequencyTypeId = null; Long lockinPeriodFrequencyTypeId = null;
EnumOptionData lockinPeriodFrequencyTypeEnum=null; EnumOptionData lockinPeriodFrequencyTypeEnum=null;
if (lockinPeriodFrequencyType!=null) { if (lockinPeriodFrequencyType!=null) {
if (lockinPeriodFrequencyType.equalsIgnoreCase("Days")) if (lockinPeriodFrequencyType.equalsIgnoreCase("Days")) {
lockinPeriodFrequencyTypeId = 0L; lockinPeriodFrequencyTypeId = 0L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Weeks")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Weeks")) {
lockinPeriodFrequencyTypeId = 1L; lockinPeriodFrequencyTypeId = 1L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Months")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Months")) {
lockinPeriodFrequencyTypeId = 2L; lockinPeriodFrequencyTypeId = 2L;
else if (lockinPeriodFrequencyType.equalsIgnoreCase("Years")) } else if (lockinPeriodFrequencyType.equalsIgnoreCase("Years")) {
lockinPeriodFrequencyTypeId = 3L; lockinPeriodFrequencyTypeId = 3L;
}
lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null); lockinPeriodFrequencyTypeEnum = new EnumOptionData(lockinPeriodFrequencyTypeId, null, null);
} }
Boolean applyWithdrawalFeeForTransfers = ImportHandlerUtils.readAsBoolean(SavingsConstants.APPLY_WITHDRAWAL_FEE_FOR_TRANSFERS, row); Boolean applyWithdrawalFeeForTransfers = ImportHandlerUtils.readAsBoolean(SavingsConstants.APPLY_WITHDRAWAL_FEE_FOR_TRANSFERS, row);
String savingsType=null; String savingsType=null;
if (ImportHandlerUtils.readAsString(SavingsConstants.SAVINGS_TYPE_COL, row)!=null) if (ImportHandlerUtils.readAsString(SavingsConstants.SAVINGS_TYPE_COL, row)!=null) {
savingsType = ImportHandlerUtils.readAsString(SavingsConstants.SAVINGS_TYPE_COL, row).toLowerCase(Locale.ENGLISH); savingsType = ImportHandlerUtils.readAsString(SavingsConstants.SAVINGS_TYPE_COL, row)
.toLowerCase(Locale.ENGLISH);
}
String clientOrGroupName = ImportHandlerUtils.readAsString(SavingsConstants.CLIENT_NAME_COL, row); String clientOrGroupName = ImportHandlerUtils.readAsString(SavingsConstants.CLIENT_NAME_COL, row);
@@ -271,12 +280,18 @@ public class SavingsImportHandler implements ImportHandler {
CommandProcessingResult result = importSavings(i,dateFormat); CommandProcessingResult result = importSavings(i,dateFormat);
savingsId = result.getSavingsId(); savingsId = result.getSavingsId();
progressLevel = 1; progressLevel = 1;
} else } else {
savingsId = ImportHandlerUtils.readAsLong(SavingsConstants.SAVINGS_ID_COL, savingsSheet.getRow(savings.get(i).getRowIndex())); savingsId = ImportHandlerUtils.readAsLong(SavingsConstants.SAVINGS_ID_COL,
savingsSheet.getRow(savings.get(i).getRowIndex()));
}
if (progressLevel <= 1) progressLevel = importSavingsApproval(savingsId, i,dateFormat); if (progressLevel <= 1) {
progressLevel = importSavingsApproval(savingsId, i, dateFormat);
}
if (progressLevel <= 2) progressLevel = importSavingsActivation(savingsId, i,dateFormat); if (progressLevel <= 2) {
progressLevel = importSavingsActivation(savingsId, i, dateFormat);
}
successCount++; successCount++;
statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED); statusCell.setCellValue(TemplatePopulateImportConstants.STATUS_CELL_IMPORTED);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.LIGHT_GREEN));
@@ -294,15 +309,19 @@ public class SavingsImportHandler implements ImportHandler {
private void writeSavingsErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){ private void writeSavingsErrorMessage(Long savingsId,String errorMessage,int progressLevel,Cell statusCell,Cell errorReportCell,Row row){
String status = ""; String status = "";
if (progressLevel == 0) if (progressLevel == 0) {
status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED; status = TemplatePopulateImportConstants.STATUS_CREATION_FAILED;
else if (progressLevel == 1) } else if (progressLevel == 1) {
status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED; status = TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED;
else if (progressLevel == 2) status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED; } else if (progressLevel == 2) {
status = TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED;
}
statusCell.setCellValue(status); statusCell.setCellValue(status);
statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED)); statusCell.setCellStyle(ImportHandlerUtils.getCellStyle(workbook, IndexedColors.RED));
if (progressLevel > 0) row.createCell(SavingsConstants.SAVINGS_ID_COL).setCellValue(savingsId); if (progressLevel > 0) {
row.createCell(SavingsConstants.SAVINGS_ID_COL).setCellValue(savingsId);
}
errorReportCell.setCellValue(errorMessage); errorReportCell.setCellValue(errorMessage);
} }
@@ -359,11 +378,13 @@ public class SavingsImportHandler implements ImportHandler {
} }
private int getProgressLevel(String status) { private int getProgressLevel(String status) {
if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) if (status==null || status.equals(TemplatePopulateImportConstants.STATUS_CREATION_FAILED)) {
return 0; return 0;
else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) } else if (status.equals(TemplatePopulateImportConstants.STATUS_APPROVAL_FAILED)) {
return 1; return 1;
else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) return 2; } else if (status.equals(TemplatePopulateImportConstants.STATUS_ACTIVATION_FAILED)) {
return 2;
}
return 0; return 0;
} }
@@ -76,23 +76,28 @@ public class SavingsTransactionImportHandler implements ImportHandler {
for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) { for (int rowIndex = 1; rowIndex <= noOfEntries; rowIndex++) {
Row row; Row row;
row = savingsTransactionSheet.getRow(rowIndex); row = savingsTransactionSheet.getRow(rowIndex);
if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) if(ImportHandlerUtils.isNotImported(row, TransactionConstants.STATUS_COL)) {
savingsTransactions.add(readSavingsTransaction(row,locale,dateFormat)); savingsTransactions.add(readSavingsTransaction(row, locale, dateFormat));
}
} }
} }
private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale, String dateFormat) { private SavingsAccountTransactionData readSavingsTransaction(Row row,String locale, String dateFormat) {
String savingsAccountIdCheck=null; String savingsAccountIdCheck=null;
if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) if (ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)!=null) {
savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row).toString(); savingsAccountIdCheck = ImportHandlerUtils.readAsLong(TransactionConstants.SAVINGS_ACCOUNT_NO_COL, row)
if(savingsAccountIdCheck!=null) .toString();
}
if(savingsAccountIdCheck!=null) {
savingsAccountId = savingsAccountIdCheck; savingsAccountId = savingsAccountIdCheck;
}
String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row); String transactionType = ImportHandlerUtils.readAsString(TransactionConstants.TRANSACTION_TYPE_COL, row);
SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType); SavingsAccountTransactionEnumData savingsAccountTransactionEnumData=new SavingsAccountTransactionEnumData(null,null,transactionType);
BigDecimal amount=null; BigDecimal amount=null;
if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) if (ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)!=null) {
amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row)); amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(TransactionConstants.AMOUNT_COL, row));
}
LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row); LocalDate transactionDate = ImportHandlerUtils.readAsDate(TransactionConstants.TRANSACTION_DATE_COL, row);
String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row); String paymentType = ImportHandlerUtils.readAsString(TransactionConstants.PAYMENT_TYPE_COL, row);
@@ -129,8 +129,9 @@ public class SharedAccountImportHandler implements ImportHandler {
Long chargeId=ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME),chargeName); Long chargeId=ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.SHARED_PRODUCTS_SHEET_NAME),chargeName);
BigDecimal amount=null; BigDecimal amount=null;
if(ImportHandlerUtils.readAsDouble(cellNo+1,row)!=null) if(ImportHandlerUtils.readAsDouble(cellNo+1,row)!=null) {
amount=BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(cellNo+1,row)); amount = BigDecimal.valueOf(ImportHandlerUtils.readAsDouble(cellNo + 1, row));
}
ShareAccountChargeData shareAccountChargeData=new ShareAccountChargeData(chargeId,amount); ShareAccountChargeData shareAccountChargeData=new ShareAccountChargeData(chargeId,amount);
charges.add(shareAccountChargeData); charges.add(shareAccountChargeData);
@@ -84,8 +84,9 @@ public class StaffImportHandler implements ImportHandler {
String lastName = ImportHandlerUtils.readAsString(StaffConstants.LAST_NAME_COL, row); String lastName = ImportHandlerUtils.readAsString(StaffConstants.LAST_NAME_COL, row);
Boolean isLoanOfficer=ImportHandlerUtils.readAsBoolean(StaffConstants.IS_LOAN_OFFICER,row); Boolean isLoanOfficer=ImportHandlerUtils.readAsBoolean(StaffConstants.IS_LOAN_OFFICER,row);
String mobileNo=null; String mobileNo=null;
if (ImportHandlerUtils.readAsLong(StaffConstants.MOBILE_NO_COL,row)!=null) if (ImportHandlerUtils.readAsLong(StaffConstants.MOBILE_NO_COL,row)!=null) {
mobileNo=ImportHandlerUtils.readAsLong(StaffConstants.MOBILE_NO_COL,row).toString(); mobileNo = ImportHandlerUtils.readAsLong(StaffConstants.MOBILE_NO_COL, row).toString();
}
LocalDate joinedOnDate=ImportHandlerUtils.readAsDate(StaffConstants.JOINED_ON_COL,row); LocalDate joinedOnDate=ImportHandlerUtils.readAsDate(StaffConstants.JOINED_ON_COL,row);
String externalId=ImportHandlerUtils.readAsString(StaffConstants.EXTERNAL_ID_COL,row); String externalId=ImportHandlerUtils.readAsString(StaffConstants.EXTERNAL_ID_COL,row);
Boolean isActive=ImportHandlerUtils.readAsBoolean(StaffConstants.IS_ACTIVE_COL,row); Boolean isActive=ImportHandlerUtils.readAsBoolean(StaffConstants.IS_ACTIVE_COL,row);
@@ -96,11 +96,13 @@ public class UserImportHandler implements ImportHandler{
List<Long> rolesIds=new ArrayList<>(); List<Long> rolesIds=new ArrayList<>();
for (int cellNo=UserConstants.ROLE_NAME_START_COL;cellNo<UserConstants.ROLE_NAME_END_COL;cellNo++){ for (int cellNo=UserConstants.ROLE_NAME_START_COL;cellNo<UserConstants.ROLE_NAME_END_COL;cellNo++){
String roleName=ImportHandlerUtils.readAsString(cellNo,row); String roleName=ImportHandlerUtils.readAsString(cellNo,row);
if (roleName==null) if (roleName==null) {
break; break;
}
Long roleId=ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.ROLES_SHEET_NAME),roleName); Long roleId=ImportHandlerUtils.getIdByName(workbook.getSheet(TemplatePopulateImportConstants.ROLES_SHEET_NAME),roleName);
if (!rolesIds.contains(roleId)) if (!rolesIds.contains(roleId)) {
rolesIds.add(roleId); rolesIds.add(roleId);
}
} }
return AppUserData.importInstance(officeId,staffId,userName,firstName,lastName,email, return AppUserData.importInstance(officeId,staffId,userName,firstName,lastName,email,
autoGenPw,overridepw,rolesIds,row.getRowNum()); autoGenPw,overridepw,rolesIds,row.getRowNum());
@@ -126,8 +126,9 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
if (clients != null){ if (clients != null){
for (ClientData client : clients) { for (ClientData client : clients) {
Row row = sheet.getRow(++rowIndex); Row row = sheet.getRow(++rowIndex);
if (row == null) if (row == null) {
row = sheet.createRow(rowIndex); row = sheet.createRow(rowIndex);
}
writeString(nameCol, row, client.displayName().replaceAll("[ )(] ", "_") + "(" + client.id() + ")"); writeString(nameCol, row, client.displayName().replaceAll("[ )(] ", "_") + "(" + client.id() + ")");
if (client.getActivationDate() != null) { if (client.getActivationDate() != null) {
@@ -145,8 +146,9 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
if (groups != null) { if (groups != null) {
for (GroupGeneralData group : groups) { for (GroupGeneralData group : groups) {
Row row = sheet.getRow(++rowIndex); Row row = sheet.getRow(++rowIndex);
if (row == null) if (row == null) {
row = sheet.createRow(rowIndex); row = sheet.createRow(rowIndex);
}
writeString(nameCol, row, group.getName().replaceAll("[ )(] ", "_")); writeString(nameCol, row, group.getName().replaceAll("[ )(] ", "_"));
if (group.getActivationDate() != null) { if (group.getActivationDate() != null) {
@@ -91,8 +91,9 @@ public class CenterSheetPopulator extends AbstractWorkbookPopulator {
private void setLayout(Sheet worksheet) { private void setLayout(Sheet worksheet) {
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX); Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT); rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
for (int colIndex = 0; colIndex <= 10; colIndex++) for (int colIndex = 0; colIndex <= 10; colIndex++) {
worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
}
writeString(OFFICE_NAME_COL, rowHeader, "Office Names"); writeString(OFFICE_NAME_COL, rowHeader, "Office Names");
writeString(CENTER_NAME_COL, rowHeader, "Center Names"); writeString(CENTER_NAME_COL, rowHeader, "Center Names");
writeString(CENTER_ID_COL, rowHeader, "Center ID"); writeString(CENTER_ID_COL, rowHeader, "Center ID");
@@ -70,8 +70,9 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX); Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT); rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
worksheet.setColumnWidth(OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); worksheet.setColumnWidth(OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
for (int colIndex = 1; colIndex <= 10; colIndex++) for (int colIndex = 1; colIndex <= 10; colIndex++) {
worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
}
writeString(OFFICE_NAME_COL, rowHeader, "Office Names"); writeString(OFFICE_NAME_COL, rowHeader, "Office Names");
writeString(CLIENT_NAME_COL, rowHeader, "Client Names"); writeString(CLIENT_NAME_COL, rowHeader, "Client Names");
writeString(CLIENT_ID_COL, rowHeader, "Client ID"); writeString(CLIENT_ID_COL, rowHeader, "Client ID");
@@ -111,8 +112,9 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.name()); writeString(OFFICE_NAME_COL, row, office.name());
ArrayList<String> clientList = new ArrayList<String>(); ArrayList<String> clientList = new ArrayList<String>();
if (officeToClients.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) if (officeToClients.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) {
clientList = officeToClients.get(office.name().trim().replaceAll("[ )(]", "_")); clientList = officeToClients.get(office.name().trim().replaceAll("[ )(]", "_"));
}
if (!clientList.isEmpty()) { if (!clientList.isEmpty()) {
for (String clientName : clientList) { for (String clientName : clientList) {
writeString(CLIENT_NAME_COL, row, clientName); writeString(CLIENT_NAME_COL, row, clientName);
@@ -120,8 +122,9 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
row = clientSheet.createRow(++rowIndex); row = clientSheet.createRow(++rowIndex);
} }
officeNameToBeginEndIndexesOfClients.put(officeIndex++, new Integer[] { startIndex, rowIndex }); officeNameToBeginEndIndexesOfClients.put(officeIndex++, new Integer[] { startIndex, rowIndex });
} else } else {
officeIndex++; officeIndex++;
}
} }
} }
@@ -61,20 +61,22 @@ public class ExtrasSheetPopulator extends AbstractWorkbookPopulator {
int paymentTypeRowIndex = 1; int paymentTypeRowIndex = 1;
for (PaymentTypeData paymentType : paymentTypes) { for (PaymentTypeData paymentType : paymentTypes) {
Row row; Row row;
if (paymentTypeRowIndex < fundRowIndex) if (paymentTypeRowIndex < fundRowIndex) {
row = extrasSheet.getRow(paymentTypeRowIndex++); row = extrasSheet.getRow(paymentTypeRowIndex++);
else } else {
row = extrasSheet.createRow(paymentTypeRowIndex++); row = extrasSheet.createRow(paymentTypeRowIndex++);
}
writeLong(PAYMENT_TYPE_ID_COL, row, paymentType.getId()); writeLong(PAYMENT_TYPE_ID_COL, row, paymentType.getId());
writeString(PAYMENT_TYPE_NAME_COL, row, paymentType.getName().trim().replaceAll("[ )(]", "_")); writeString(PAYMENT_TYPE_NAME_COL, row, paymentType.getName().trim().replaceAll("[ )(]", "_"));
} }
int currencyCodeRowIndex = 1; int currencyCodeRowIndex = 1;
for (CurrencyData currencies : currencies) { for (CurrencyData currencies : currencies) {
Row row; Row row;
if (currencyCodeRowIndex < paymentTypeRowIndex) if (currencyCodeRowIndex < paymentTypeRowIndex) {
row = extrasSheet.getRow(currencyCodeRowIndex++); row = extrasSheet.getRow(currencyCodeRowIndex++);
else } else {
row = extrasSheet.createRow(currencyCodeRowIndex++); row = extrasSheet.createRow(currencyCodeRowIndex++);
}
writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_")); writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_"));
writeString(CURRENCY_CODE_COL, row, currencies.code()); writeString(CURRENCY_CODE_COL, row, currencies.code());
@@ -81,29 +81,42 @@ public class FixedDepositProductSheetPopulator extends AbstractWorkbookPopulator
writeInt(MIN_DEPOSIT_TERM_COL, row, product.getMinDepositTerm()); writeInt(MIN_DEPOSIT_TERM_COL, row, product.getMinDepositTerm());
writeString(MIN_DEPOSIT_TERM_TYPE_COL, row, product.getMinDepositTermType().getValue()); writeString(MIN_DEPOSIT_TERM_TYPE_COL, row, product.getMinDepositTermType().getValue());
if(product.getMinDepositAmount() != null) if(product.getMinDepositAmount() != null) {
writeBigDecimal(MIN_DEPOSIT_COL, row, product.getMinDepositAmount()); writeBigDecimal(MIN_DEPOSIT_COL, row, product.getMinDepositAmount());
if(product.getMaxDepositAmount() != null) }
if(product.getMaxDepositAmount() != null) {
writeBigDecimal(MAX_DEPOSIT_COL, row, product.getMaxDepositAmount()); writeBigDecimal(MAX_DEPOSIT_COL, row, product.getMaxDepositAmount());
if(product.getDepositAmount() != null) }
if(product.getDepositAmount() != null) {
writeBigDecimal(DEPOSIT_COL, row, product.getDepositAmount()); writeBigDecimal(DEPOSIT_COL, row, product.getDepositAmount());
if(product.getMaxDepositTerm() != null) }
if(product.getMaxDepositTerm() != null) {
writeInt(MAX_DEPOSIT_TERM_COL, row, product.getMaxDepositTerm()); writeInt(MAX_DEPOSIT_TERM_COL, row, product.getMaxDepositTerm());
if(product.getInMultiplesOfDepositTerm() != null) }
if(product.getInMultiplesOfDepositTerm() != null) {
writeInt(IN_MULTIPLES_OF_DEPOSIT_TERM_COL, row, product.getInMultiplesOfDepositTerm()); writeInt(IN_MULTIPLES_OF_DEPOSIT_TERM_COL, row, product.getInMultiplesOfDepositTerm());
if(product.getPreClosurePenalInterest() != null) }
if(product.getPreClosurePenalInterest() != null) {
writeBigDecimal(PRECLOSURE_PENAL_INTEREST_COL, row, product.getPreClosurePenalInterest()); writeBigDecimal(PRECLOSURE_PENAL_INTEREST_COL, row, product.getPreClosurePenalInterest());
if(product.getMaxDepositTermType() != null) }
if(product.getMaxDepositTermType() != null) {
writeString(MAX_DEPOSIT_TERM_TYPE_COL, row, product.getMaxDepositTermType().getValue()); writeString(MAX_DEPOSIT_TERM_TYPE_COL, row, product.getMaxDepositTermType().getValue());
if(product.getPreClosurePenalInterestOnType() != null) }
writeString(PRECLOSURE_INTEREST_TYPE_COL, row, product.getPreClosurePenalInterestOnType().getValue()); if(product.getPreClosurePenalInterestOnType() != null) {
if(product.getInMultiplesOfDepositTermType() != null) writeString(PRECLOSURE_INTEREST_TYPE_COL, row,
writeString(IN_MULTIPLES_OF_DEPOSIT_TERM_TYPE_COL, row, product.getInMultiplesOfDepositTermType().getValue()); product.getPreClosurePenalInterestOnType().getValue());
}
if(product.getInMultiplesOfDepositTermType() != null) {
writeString(IN_MULTIPLES_OF_DEPOSIT_TERM_TYPE_COL, row,
product.getInMultiplesOfDepositTermType().getValue());
}
if(product.getLockinPeriodFrequency() != null) if(product.getLockinPeriodFrequency() != null) {
writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency()); writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency());
if(product.getLockinPeriodFrequencyType() != null) }
if(product.getLockinPeriodFrequencyType() != null) {
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
}
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.code());
} }
@@ -60,8 +60,9 @@ public class GroupSheetPopulator extends AbstractWorkbookPopulator {
private void setLayout(Sheet worksheet) { private void setLayout(Sheet worksheet) {
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX); Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT); rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
for (int colIndex = 0; colIndex <= 10; colIndex++) for (int colIndex = 0; colIndex <= 10; colIndex++) {
worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); worksheet.setColumnWidth(colIndex, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
}
writeString(OFFICE_NAME_COL, rowHeader, "Office Names"); writeString(OFFICE_NAME_COL, rowHeader, "Office Names");
writeString(GROUP_NAME_COL, rowHeader, "Group Names"); writeString(GROUP_NAME_COL, rowHeader, "Group Names");
writeString(GROUP_ID_COL, rowHeader, "Group ID"); writeString(GROUP_ID_COL, rowHeader, "Group ID");
@@ -91,8 +92,9 @@ public class GroupSheetPopulator extends AbstractWorkbookPopulator {
writeString(OFFICE_NAME_COL, row, office.name()); writeString(OFFICE_NAME_COL, row, office.name());
ArrayList<String> groupsList = new ArrayList<>(); ArrayList<String> groupsList = new ArrayList<>();
if(officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) if(officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) {
groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_")); groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_"));
}
if(!groupsList.isEmpty()) { if(!groupsList.isEmpty()) {
for(String groupName : groupsList) { for(String groupName : groupsList) {
@@ -75,59 +75,72 @@ public class LoanProductSheetPopulator extends AbstractWorkbookPopulator {
Row row = productSheet.createRow(rowIndex++); Row row = productSheet.createRow(rowIndex++);
writeLong(ID_COL, row, product.getId()); writeLong(ID_COL, row, product.getId());
writeString(NAME_COL, row, product.getName().trim().replaceAll("[ )(]", "_")); writeString(NAME_COL, row, product.getName().trim().replaceAll("[ )(]", "_"));
if (product.getFundName() != null) if (product.getFundName() != null) {
writeString(FUND_NAME_COL, row, product.getFundName()); writeString(FUND_NAME_COL, row, product.getFundName());
}
writeBigDecimal(PRINCIPAL_COL, row, product.getPrincipal()); writeBigDecimal(PRINCIPAL_COL, row, product.getPrincipal());
if (product.getMinPrincipal() != null) if (product.getMinPrincipal() != null) {
writeBigDecimal(MIN_PRINCIPAL_COL, row, product.getMinPrincipal()); writeBigDecimal(MIN_PRINCIPAL_COL, row, product.getMinPrincipal());
else } else {
writeInt(MIN_PRINCIPAL_COL, row, 1); writeInt(MIN_PRINCIPAL_COL, row, 1);
if (product.getMaxPrincipal() != null) }
if (product.getMaxPrincipal() != null) {
writeBigDecimal(MAX_PRINCIPAL_COL, row, product.getMaxPrincipal()); writeBigDecimal(MAX_PRINCIPAL_COL, row, product.getMaxPrincipal());
else } else {
writeInt(MAX_PRINCIPAL_COL, row, 999999999); writeInt(MAX_PRINCIPAL_COL, row, 999999999);
}
writeInt(NO_OF_REPAYMENTS_COL, row, product.getNumberOfRepayments()); writeInt(NO_OF_REPAYMENTS_COL, row, product.getNumberOfRepayments());
if (product.getMinNumberOfRepayments() != null) if (product.getMinNumberOfRepayments() != null) {
writeInt(MIN_REPAYMENTS_COL, row, product.getMinNumberOfRepayments()); writeInt(MIN_REPAYMENTS_COL, row, product.getMinNumberOfRepayments());
else } else {
writeInt(MIN_REPAYMENTS_COL, row, 1); writeInt(MIN_REPAYMENTS_COL, row, 1);
if (product.getMaxNumberOfRepayments() != null) }
if (product.getMaxNumberOfRepayments() != null) {
writeInt(MAX_REPAYMENTS_COL, row, product.getMaxNumberOfRepayments()); writeInt(MAX_REPAYMENTS_COL, row, product.getMaxNumberOfRepayments());
else } else {
writeInt(MAX_REPAYMENTS_COL, row, 999999999); writeInt(MAX_REPAYMENTS_COL, row, 999999999);
}
writeInt(REPAYMENT_EVERY_COL, row, product.getRepaymentEvery()); writeInt(REPAYMENT_EVERY_COL, row, product.getRepaymentEvery());
writeString(REPAYMENT_FREQUENCY_COL, row, product.getRepaymentFrequencyType().getValue()); writeString(REPAYMENT_FREQUENCY_COL, row, product.getRepaymentFrequencyType().getValue());
writeBigDecimal(INTEREST_RATE_COL, row, product.getInterestRatePerPeriod()); writeBigDecimal(INTEREST_RATE_COL, row, product.getInterestRatePerPeriod());
if (product.getMinInterestRatePerPeriod() != null) if (product.getMinInterestRatePerPeriod() != null) {
writeBigDecimal(MIN_INTEREST_RATE_COL, row, product.getMinInterestRatePerPeriod()); writeBigDecimal(MIN_INTEREST_RATE_COL, row, product.getMinInterestRatePerPeriod());
else } else {
writeInt(MIN_INTEREST_RATE_COL, row, 1); writeInt(MIN_INTEREST_RATE_COL, row, 1);
if (product.getMaxInterestRatePerPeriod() != null) }
if (product.getMaxInterestRatePerPeriod() != null) {
writeBigDecimal(MAX_INTEREST_RATE_COL, row, product.getMaxInterestRatePerPeriod()); writeBigDecimal(MAX_INTEREST_RATE_COL, row, product.getMaxInterestRatePerPeriod());
else } else {
writeInt(MAX_INTEREST_RATE_COL, row, 999999999); writeInt(MAX_INTEREST_RATE_COL, row, 999999999);
}
writeString(INTEREST_RATE_FREQUENCY_COL, row, product.getInterestRateFrequencyType().getValue()); writeString(INTEREST_RATE_FREQUENCY_COL, row, product.getInterestRateFrequencyType().getValue());
writeString(AMORTIZATION_TYPE_COL, row, product.getAmortizationType().getValue()); writeString(AMORTIZATION_TYPE_COL, row, product.getAmortizationType().getValue());
writeString(INTEREST_TYPE_COL, row, product.getInterestType().getValue()); writeString(INTEREST_TYPE_COL, row, product.getInterestType().getValue());
writeString(INTEREST_CALCULATION_PERIOD_TYPE_COL, row, writeString(INTEREST_CALCULATION_PERIOD_TYPE_COL, row,
product.getInterestCalculationPeriodType().getValue()); product.getInterestCalculationPeriodType().getValue());
if (product.getInArrearsTolerance() != null) if (product.getInArrearsTolerance() != null) {
writeBigDecimal(IN_ARREARS_TOLERANCE_COL, row, product.getInArrearsTolerance()); writeBigDecimal(IN_ARREARS_TOLERANCE_COL, row, product.getInArrearsTolerance());
}
writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, row, product.getTransactionProcessingStrategyName()); writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, row, product.getTransactionProcessingStrategyName());
if (product.getGraceOnPrincipalPayment() != null) if (product.getGraceOnPrincipalPayment() != null) {
writeInt(GRACE_ON_PRINCIPAL_PAYMENT_COL, row, product.getGraceOnPrincipalPayment()); writeInt(GRACE_ON_PRINCIPAL_PAYMENT_COL, row, product.getGraceOnPrincipalPayment());
if (product.getGraceOnInterestPayment() != null) }
if (product.getGraceOnInterestPayment() != null) {
writeInt(GRACE_ON_INTEREST_PAYMENT_COL, row, product.getGraceOnInterestPayment()); writeInt(GRACE_ON_INTEREST_PAYMENT_COL, row, product.getGraceOnInterestPayment());
if (product.getGraceOnInterestCharged() != null) }
if (product.getGraceOnInterestCharged() != null) {
writeInt(GRACE_ON_INTEREST_CHARGED_COL, row, product.getGraceOnInterestCharged()); writeInt(GRACE_ON_INTEREST_CHARGED_COL, row, product.getGraceOnInterestCharged());
if (product.getStartDate() != null) }
writeDate(START_DATE_COL, row, product.getStartDate().toString(), dateCellStyle,dateFormat); if (product.getStartDate() != null) {
else writeDate(START_DATE_COL, row, product.getStartDate().toString(), dateCellStyle, dateFormat);
writeDate(START_DATE_COL, row, "1/1/1970", dateCellStyle,dateFormat); } else {
if (product.getCloseDate() != null) writeDate(START_DATE_COL, row, "1/1/1970", dateCellStyle, dateFormat);
writeDate(CLOSE_DATE_COL, row, product.getCloseDate().toString(), dateCellStyle,dateFormat); }
else if (product.getCloseDate() != null) {
writeDate(CLOSE_DATE_COL, row, "1/1/2040", dateCellStyle,dateFormat); writeDate(CLOSE_DATE_COL, row, product.getCloseDate().toString(), dateCellStyle, dateFormat);
} else {
writeDate(CLOSE_DATE_COL, row, "1/1/2040", dateCellStyle, dateFormat);
}
productSheet.protectSheet(""); productSheet.protectSheet("");
} }
@@ -91,8 +91,9 @@ public class PersonnelSheetPopulator extends AbstractWorkbookPopulator {
} }
officeNameToBeginEndIndexesOfStaff.put(officeIndex++, new Integer[]{startIndex, rowIndex}); officeNameToBeginEndIndexesOfStaff.put(officeIndex++, new Integer[]{startIndex, rowIndex});
} }
}else } else {
officeIndex++; officeIndex++;
}
} }
} }
@@ -114,8 +115,9 @@ public class PersonnelSheetPopulator extends AbstractWorkbookPopulator {
} }
private void setLayout(Sheet worksheet) { private void setLayout(Sheet worksheet) {
for (Integer i = 0; i < 3; i++) for (Integer i = 0; i < 3; i++) {
worksheet.setColumnWidth(i, TemplatePopulateImportConstants.MEDIUM_COL_SIZE); worksheet.setColumnWidth(i, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
}
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX); Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT); rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
writeString(OFFICE_NAME_COL, rowHeader, "Office Name"); writeString(OFFICE_NAME_COL, rowHeader, "Office Name");
@@ -84,36 +84,50 @@ public class RecurringDepositProductSheetPopulator extends AbstractWorkbookPopul
writeBoolean(PRECLOSURE_PENAL_APPLICABLE_COL, row, product.isPreClosurePenalApplicable()); writeBoolean(PRECLOSURE_PENAL_APPLICABLE_COL, row, product.isPreClosurePenalApplicable());
writeString(MIN_DEPOSIT_TERM_TYPE_COL, row, product.getMinDepositTermType().getValue()); writeString(MIN_DEPOSIT_TERM_TYPE_COL, row, product.getMinDepositTermType().getValue());
if(product.getMinDepositAmount() != null) if(product.getMinDepositAmount() != null) {
writeBigDecimal(MIN_DEPOSIT_COL, row, product.getMinDepositAmount()); writeBigDecimal(MIN_DEPOSIT_COL, row, product.getMinDepositAmount());
if(product.getMaxDepositAmount() != null) }
if(product.getMaxDepositAmount() != null) {
writeBigDecimal(MAX_DEPOSIT_COL, row, product.getMaxDepositAmount()); writeBigDecimal(MAX_DEPOSIT_COL, row, product.getMaxDepositAmount());
if(product.getDepositAmount() != null) }
if(product.getDepositAmount() != null) {
writeBigDecimal(DEPOSIT_COL, row, product.getDepositAmount()); writeBigDecimal(DEPOSIT_COL, row, product.getDepositAmount());
if(product.getMaxDepositTerm() != null) }
if(product.getMaxDepositTerm() != null) {
writeInt(MAX_DEPOSIT_TERM_COL, row, product.getMaxDepositTerm()); writeInt(MAX_DEPOSIT_TERM_COL, row, product.getMaxDepositTerm());
}
if(product.getMinDepositTerm() != null) if(product.getMinDepositTerm() != null) {
writeInt(MIN_DEPOSIT_TERM_COL, row, product.getMinDepositTerm()); writeInt(MIN_DEPOSIT_TERM_COL, row, product.getMinDepositTerm());
}
if(product.getInMultiplesOfDepositTerm() != null) if(product.getInMultiplesOfDepositTerm() != null) {
writeInt(IN_MULTIPLES_OF_DEPOSIT_TERM_COL, row, product.getInMultiplesOfDepositTerm()); writeInt(IN_MULTIPLES_OF_DEPOSIT_TERM_COL, row, product.getInMultiplesOfDepositTerm());
if(product.getPreClosurePenalInterest() != null) }
if(product.getPreClosurePenalInterest() != null) {
writeBigDecimal(PRECLOSURE_PENAL_INTEREST_COL, row, product.getPreClosurePenalInterest()); writeBigDecimal(PRECLOSURE_PENAL_INTEREST_COL, row, product.getPreClosurePenalInterest());
if(product.getMaxDepositTermType() != null) }
if(product.getMaxDepositTermType() != null) {
writeString(MAX_DEPOSIT_TERM_TYPE_COL, row, product.getMaxDepositTermType().getValue()); writeString(MAX_DEPOSIT_TERM_TYPE_COL, row, product.getMaxDepositTermType().getValue());
if(product.getPreClosurePenalInterestOnType() != null) }
writeString(PRECLOSURE_INTEREST_TYPE_COL, row, product.getPreClosurePenalInterestOnType().getValue()); if(product.getPreClosurePenalInterestOnType() != null) {
if(product.getInMultiplesOfDepositTermType() != null) writeString(PRECLOSURE_INTEREST_TYPE_COL, row,
writeString(IN_MULTIPLES_OF_DEPOSIT_TERM_TYPE_COL, row, product.getInMultiplesOfDepositTermType().getValue()); product.getPreClosurePenalInterestOnType().getValue());
}
if(product.getInMultiplesOfDepositTermType() != null) {
writeString(IN_MULTIPLES_OF_DEPOSIT_TERM_TYPE_COL, row,
product.getInMultiplesOfDepositTermType().getValue());
}
writeBoolean(ALLOW_WITHDRAWAL_COL, row, product.isAllowWithdrawal()); writeBoolean(ALLOW_WITHDRAWAL_COL, row, product.isAllowWithdrawal());
writeBoolean(ADJUST_ADVANCE_COL, row, product.isAdjustAdvanceTowardsFuturePayments()); writeBoolean(ADJUST_ADVANCE_COL, row, product.isAdjustAdvanceTowardsFuturePayments());
writeBoolean(IS_MANDATORY_DEPOSIT_COL, row, product.isMandatoryDeposit()); writeBoolean(IS_MANDATORY_DEPOSIT_COL, row, product.isMandatoryDeposit());
if(product.getLockinPeriodFrequency() != null) if(product.getLockinPeriodFrequency() != null) {
writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency()); writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency());
if(product.getLockinPeriodFrequencyType() != null) }
if(product.getLockinPeriodFrequencyType() != null) {
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
}
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.code());
} }
@@ -68,21 +68,26 @@ public class SavingsProductSheetPopulator extends AbstractWorkbookPopulator {
writeString(INTEREST_POSTING_PERIOD_COL, row, product.getInterestPostingPeriodType().getValue()); writeString(INTEREST_POSTING_PERIOD_COL, row, product.getInterestPostingPeriodType().getValue());
writeString(INTEREST_CALCULATION_COL, row, product.getInterestCalculationType().getValue()); writeString(INTEREST_CALCULATION_COL, row, product.getInterestCalculationType().getValue());
writeString(INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row, product.getInterestCalculationDaysInYearType().getValue()); writeString(INTEREST_CALCULATION_DAYS_IN_YEAR_COL, row, product.getInterestCalculationDaysInYearType().getValue());
if(product.getMinRequiredOpeningBalance() != null) if(product.getMinRequiredOpeningBalance() != null) {
writeBigDecimal(MIN_OPENING_BALANCE_COL, row, product.getMinRequiredOpeningBalance()); writeBigDecimal(MIN_OPENING_BALANCE_COL, row, product.getMinRequiredOpeningBalance());
if(product.getLockinPeriodFrequency() != null) }
if(product.getLockinPeriodFrequency() != null) {
writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency()); writeInt(LOCKIN_PERIOD_COL, row, product.getLockinPeriodFrequency());
if(product.getLockinPeriodFrequencyType() != null) }
if(product.getLockinPeriodFrequencyType() != null) {
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
}
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.code());
writeInt(DECIMAL_PLACES_COL, row, currency.decimalPlaces()); writeInt(DECIMAL_PLACES_COL, row, currency.decimalPlaces());
if(currency.currencyInMultiplesOf() != null) if(currency.currencyInMultiplesOf() != null) {
writeInt(IN_MULTIPLES_OF_COL, row, currency.currencyInMultiplesOf()); writeInt(IN_MULTIPLES_OF_COL, row, currency.currencyInMultiplesOf());
}
writeBoolean(WITHDRAWAL_FEE_COL, row, product.isWithdrawalFeeForTransfers()); writeBoolean(WITHDRAWAL_FEE_COL, row, product.isWithdrawalFeeForTransfers());
writeBoolean(ALLOW_OVERDRAFT_COL, row,product.isAllowOverdraft()); writeBoolean(ALLOW_OVERDRAFT_COL, row,product.isAllowOverdraft());
if(product.getOverdraftLimit() != null) if(product.getOverdraftLimit() != null) {
writeBigDecimal(OVERDRAFT_LIMIT_COL, row, product.getOverdraftLimit()); writeBigDecimal(OVERDRAFT_LIMIT_COL, row, product.getOverdraftLimit());
}
} }
productSheet.protectSheet(""); productSheet.protectSheet("");
} }
@@ -114,12 +114,14 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
int rowIndex; int rowIndex;
for(rowIndex = 1; rowIndex <= 11; rowIndex++) { for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
Row row = centerSheet.getRow(rowIndex); Row row = centerSheet.getRow(rowIndex);
if(row == null) if(row == null) {
row = centerSheet.createRow(rowIndex); row = centerSheet.createRow(rowIndex);
}
writeInt(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex); writeInt(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
} }
for(rowIndex = 1; rowIndex <= 3; rowIndex++) for(rowIndex = 1; rowIndex <= 3; rowIndex++) {
writeInt(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, centerSheet.getRow(rowIndex), rowIndex); writeInt(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, centerSheet.getRow(rowIndex), rowIndex);
}
String[] days = new String[]{ String[] days = new String[]{
TemplatePopulateImportConstants.MONDAY, TemplatePopulateImportConstants.MONDAY,
@@ -130,8 +132,9 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
TemplatePopulateImportConstants.SATURDAY, TemplatePopulateImportConstants.SATURDAY,
TemplatePopulateImportConstants.SUNDAY}; TemplatePopulateImportConstants.SUNDAY};
for(rowIndex = 1; rowIndex <= 7; rowIndex++) for(rowIndex = 1; rowIndex <= 7; rowIndex++) {
writeString(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, centerSheet.getRow(rowIndex), days[rowIndex-1]); writeString(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, centerSheet.getRow(rowIndex), days[rowIndex - 1]);
}
} }
private void setRules(Sheet worksheet,String dateFormat) { private void setRules(Sheet worksheet,String dateFormat) {
@@ -152,8 +152,9 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
try { try {
for (Integer rowNo = 1; rowNo < 3000; rowNo++) { for (Integer rowNo = 1; rowNo < 3000; rowNo++) {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if (row == null) if (row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(ChartOfAcountsConstants.PARENT_ID_COL, row, writeFormula(ChartOfAcountsConstants.PARENT_ID_COL, row,
"IF(ISERROR(VLOOKUP($E"+(rowNo+1)+",$Q$2:$R$"+(glAccounts.size()+1)+",2,FALSE))," + "IF(ISERROR(VLOOKUP($E"+(rowNo+1)+",$Q$2:$R$"+(glAccounts.size()+1)+",2,FALSE))," +
"\"\",(VLOOKUP($E"+(rowNo+1)+",$Q$2:$R$"+(glAccounts.size()+1)+",2,FALSE)))"); "\"\",(VLOOKUP($E"+(rowNo+1)+",$Q$2:$R$"+(glAccounts.size()+1)+",2,FALSE)))");
@@ -84,55 +84,62 @@ public class ClientEntityWorkbookPopulator extends AbstractWorkbookPopulator {
int rowIndex=0; int rowIndex=0;
for (CodeValueData clientTypeCodeValue:clientTypeCodeValues) { for (CodeValueData clientTypeCodeValue:clientTypeCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_CLIENT_TYPES,row,clientTypeCodeValue.getName()+"-"+clientTypeCodeValue.getId()); writeString(ClientEntityConstants.LOOKUP_CLIENT_TYPES,row,clientTypeCodeValue.getName()+"-"+clientTypeCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData clientClassificationCodeValue:clientClassificationCodeValues) { for (CodeValueData clientClassificationCodeValue:clientClassificationCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_CLIENT_CLASSIFICATION,row, writeString(ClientEntityConstants.LOOKUP_CLIENT_CLASSIFICATION,row,
clientClassificationCodeValue.getName()+"-"+clientClassificationCodeValue.getId()); clientClassificationCodeValue.getName()+"-"+clientClassificationCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData constitutionCodeValue:constitutionCodeValues) { for (CodeValueData constitutionCodeValue:constitutionCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_CONSTITUTION_COL,row, writeString(ClientEntityConstants.LOOKUP_CONSTITUTION_COL,row,
constitutionCodeValue.getName()+"-"+constitutionCodeValue.getId()); constitutionCodeValue.getName()+"-"+constitutionCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData mainBusinessCodeValue:mainBusinesslineCodeValues) { for (CodeValueData mainBusinessCodeValue:mainBusinesslineCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_MAIN_BUSINESS_LINE,row, writeString(ClientEntityConstants.LOOKUP_MAIN_BUSINESS_LINE,row,
mainBusinessCodeValue.getName()+"-"+mainBusinessCodeValue.getId()); mainBusinessCodeValue.getName()+"-"+mainBusinessCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData addressTypeCodeValue:addressTypesCodeValues) { for (CodeValueData addressTypeCodeValue:addressTypesCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_ADDRESS_TYPE,row, writeString(ClientEntityConstants.LOOKUP_ADDRESS_TYPE,row,
addressTypeCodeValue.getName()+"-"+addressTypeCodeValue.getId()); addressTypeCodeValue.getName()+"-"+addressTypeCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData stateCodeValue:stateProvinceCodeValues) { for (CodeValueData stateCodeValue:stateProvinceCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_STATE_PROVINCE,row, writeString(ClientEntityConstants.LOOKUP_STATE_PROVINCE,row,
stateCodeValue.getName()+"-"+stateCodeValue.getId()); stateCodeValue.getName()+"-"+stateCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData countryCodeValue: countryCodeValues) { for (CodeValueData countryCodeValue: countryCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientEntityConstants.LOOKUP_COUNTRY,row, writeString(ClientEntityConstants.LOOKUP_COUNTRY,row,
countryCodeValue.getName()+"-"+countryCodeValue.getId()); countryCodeValue.getName()+"-"+countryCodeValue.getId());
} }
@@ -81,46 +81,52 @@ public class ClientPersonWorkbookPopulator extends AbstractWorkbookPopulator {
int rowIndex=0; int rowIndex=0;
for (CodeValueData clientTypeCodeValue:clientTypeCodeValues) { for (CodeValueData clientTypeCodeValue:clientTypeCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_CLIENT_TYPES_COL,row,clientTypeCodeValue.getName()+ writeString(ClientPersonConstants.LOOKUP_CLIENT_TYPES_COL,row,clientTypeCodeValue.getName()+
"-"+clientTypeCodeValue.getId()); "-"+clientTypeCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData clientClassificationCodeValue:clientClassificationCodeValues) { for (CodeValueData clientClassificationCodeValue:clientClassificationCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_CLIENT_CLASSIFICATION_COL,row, writeString(ClientPersonConstants.LOOKUP_CLIENT_CLASSIFICATION_COL,row,
clientClassificationCodeValue.getName()+"-"+clientClassificationCodeValue.getId()); clientClassificationCodeValue.getName()+"-"+clientClassificationCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData genderCodeValue:genderCodeValues) { for (CodeValueData genderCodeValue:genderCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_GENDER_COL,row,genderCodeValue.getName()+"-"+genderCodeValue.getId()); writeString(ClientPersonConstants.LOOKUP_GENDER_COL,row,genderCodeValue.getName()+"-"+genderCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData addressTypeCodeValue:addressTypesCodeValues) { for (CodeValueData addressTypeCodeValue:addressTypesCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_ADDRESS_TYPE_COL,row, writeString(ClientPersonConstants.LOOKUP_ADDRESS_TYPE_COL,row,
addressTypeCodeValue.getName()+"-"+addressTypeCodeValue.getId()); addressTypeCodeValue.getName()+"-"+addressTypeCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData stateCodeValue:stateProvinceCodeValues) { for (CodeValueData stateCodeValue:stateProvinceCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_STATE_PROVINCE_COL,row,stateCodeValue.getName()+"-"+stateCodeValue.getId()); writeString(ClientPersonConstants.LOOKUP_STATE_PROVINCE_COL,row,stateCodeValue.getName()+"-"+stateCodeValue.getId());
} }
rowIndex=0; rowIndex=0;
for (CodeValueData countryCodeValue: countryCodeValues) { for (CodeValueData countryCodeValue: countryCodeValues) {
Row row =clientSheet.getRow(++rowIndex); Row row =clientSheet.getRow(++rowIndex);
if(row==null) if(row==null) {
row=clientSheet.createRow(rowIndex); row = clientSheet.createRow(rowIndex);
}
writeString(ClientPersonConstants.LOOKUP_COUNTRY_COL,row,countryCodeValue.getName()+"-"+countryCodeValue.getId()); writeString(ClientPersonConstants.LOOKUP_COUNTRY_COL,row,countryCodeValue.getName()+"-"+countryCodeValue.getId());
} }
@@ -74,8 +74,9 @@ public class FixedDepositTransactionWorkbookPopulator extends AbstractWorkbookPo
for(Integer rowNo = 1; rowNo < 3000; rowNo++) for(Integer rowNo = 1; rowNo < 3000; rowNo++)
{ {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if(row == null) if(row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))"); writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))");
writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))"); writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))");
} }
@@ -190,8 +191,10 @@ public class FixedDepositTransactionWorkbookPopulator extends AbstractWorkbookPo
writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")"); writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")");
writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo()); writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo());
writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName()); writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName());
if(savingsAccount.getMinRequiredOpeningBalance() != null) if(savingsAccount.getMinRequiredOpeningBalance() != null) {
writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row, savingsAccount.getMinRequiredOpeningBalance()); writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row,
savingsAccount.getMinRequiredOpeningBalance());
}
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" + writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" +
savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/" savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/" + savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
@@ -121,12 +121,14 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
int rowIndex; int rowIndex;
for(rowIndex = 1; rowIndex <= 11; rowIndex++) { for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
Row row = groupSheet.getRow(rowIndex); Row row = groupSheet.getRow(rowIndex);
if(row == null) if(row == null) {
row = groupSheet.createRow(rowIndex); row = groupSheet.createRow(rowIndex);
}
writeInt(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex); writeInt(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
} }
for(rowIndex = 1; rowIndex <= 3; rowIndex++) for(rowIndex = 1; rowIndex <= 3; rowIndex++) {
writeInt(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, groupSheet.getRow(rowIndex), rowIndex); writeInt(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, groupSheet.getRow(rowIndex), rowIndex);
}
String[] days = new String[]{ String[] days = new String[]{
TemplatePopulateImportConstants.MONDAY, TemplatePopulateImportConstants.MONDAY,
TemplatePopulateImportConstants.TUESDAY, TemplatePopulateImportConstants.TUESDAY,
@@ -135,8 +137,10 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
TemplatePopulateImportConstants.FRIDAY, TemplatePopulateImportConstants.FRIDAY,
TemplatePopulateImportConstants.SATURDAY, TemplatePopulateImportConstants.SATURDAY,
TemplatePopulateImportConstants.SUNDAY}; TemplatePopulateImportConstants.SUNDAY};
for(rowIndex = 1; rowIndex <= 7; rowIndex++) for(rowIndex = 1; rowIndex <= 7; rowIndex++) {
writeString(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, groupSheet.getRow(rowIndex), days[rowIndex-1]); writeString(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, groupSheet.getRow(rowIndex),
days[rowIndex - 1]);
}
} }
private void setRules(Sheet worksheet,String dateFormat){ private void setRules(Sheet worksheet,String dateFormat){
@@ -384,8 +384,9 @@ public class LoanWorkbookPopulator extends AbstractWorkbookPopulator {
doubleBorderStyle.setBorderRight(BorderStyle.THICK); doubleBorderStyle.setBorderRight(BorderStyle.THICK);
for (int colNo = 0; colNo < 35; colNo++) { for (int colNo = 0; colNo < 35; colNo++) {
Cell cell = rowHeader.getCell(colNo); Cell cell = rowHeader.getCell(colNo);
if (cell == null) if (cell == null) {
rowHeader.createCell(colNo); rowHeader.createCell(colNo);
}
rowHeader.getCell(colNo).setCellStyle(borderStyle); rowHeader.getCell(colNo).setCellStyle(borderStyle);
} }
rowHeader.getCell(LoanConstants.FIRST_REPAYMENT_COL).setCellStyle(doubleBorderStyle); rowHeader.getCell(LoanConstants.FIRST_REPAYMENT_COL).setCellStyle(doubleBorderStyle);
@@ -549,8 +550,9 @@ public class LoanWorkbookPopulator extends AbstractWorkbookPopulator {
graceOnInterestPaymentName.setNameName("GRACE_INTEREST_PAYMENT_" + productName); graceOnInterestPaymentName.setNameName("GRACE_INTEREST_PAYMENT_" + productName);
graceOnInterestChargedName.setNameName("GRACE_INTEREST_CHARGED_" + productName); graceOnInterestChargedName.setNameName("GRACE_INTEREST_CHARGED_" + productName);
startDateName.setNameName("START_DATE_" + productName); startDateName.setNameName("START_DATE_" + productName);
if (products.get(i).getFundName() != null) if (products.get(i).getFundName() != null) {
fundName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$C$" + (i + 2)); fundName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME + "!$C$" + (i + 2));
}
principalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$D$" + (i + 2)); principalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$D$" + (i + 2));
minPrincipalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$E$" + (i + 2)); minPrincipalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$E$" + (i + 2));
maxPrincipalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$F$" + (i + 2)); maxPrincipalName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME+"!$F$" + (i + 2));
@@ -83,16 +83,18 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
clientIdToClientExternalId =new HashMap<>(); clientIdToClientExternalId =new HashMap<>();
List<ClientData>allclients=clientSheetPopulator.getClients(); List<ClientData>allclients=clientSheetPopulator.getClients();
for (ClientData client: allclients) { for (ClientData client: allclients) {
if (client.getExternalId()!=null) if (client.getExternalId()!=null) {
clientIdToClientExternalId.put(client.getId(),client.getExternalId()); clientIdToClientExternalId.put(client.getId(), client.getExternalId());
}
} }
} }
private void setDefaults(Sheet worksheet,String dateFormat) { private void setDefaults(Sheet worksheet,String dateFormat) {
for (Integer rowNo = 1; rowNo < 3000; rowNo++) { for (Integer rowNo = 1; rowNo < 3000; rowNo++) {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if (row == null) if (row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(LoanRepaymentConstants.CLIENT_EXTERNAL_ID, row, writeFormula(LoanRepaymentConstants.CLIENT_EXTERNAL_ID, row,
"IF(ISERROR(VLOOKUP($B"+(rowNo+1)+",$R$2:$S$"+(allloans.size()+1)+",2,FALSE))," + "IF(ISERROR(VLOOKUP($B"+(rowNo+1)+",$R$2:$S$"+(allloans.size()+1)+",2,FALSE))," +
"\"\",(VLOOKUP($B"+(rowNo+1)+",$R$2:$S$"+(allloans.size()+1)+",2,FALSE)))"); "\"\",(VLOOKUP($B"+(rowNo+1)+",$R$2:$S$"+(allloans.size()+1)+",2,FALSE)))");
@@ -244,8 +246,10 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, row, loan.getAccountNo()+"-"+loan.getStatusStringValue()); writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, row, loan.getAccountNo()+"-"+loan.getStatusStringValue());
writeString(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, row, loan.getLoanProductName()); writeString(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, row, loan.getLoanProductName());
writeDouble(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, row, loan.getPrincipal().doubleValue()); writeDouble(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, row, loan.getPrincipal().doubleValue());
if (loan.getTotalOutstandingAmount() != null) if (loan.getTotalOutstandingAmount() != null) {
writeBigDecimal(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL, row, loan.getTotalOutstandingAmount()); writeBigDecimal(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL, row,
loan.getTotalOutstandingAmount());
}
if (loan.getDisbursementDate() != null) { if (loan.getDisbursementDate() != null) {
try { try {
date = inputFormat.parse(loan.getDisbursementDate().toString()); date = inputFormat.parse(loan.getDisbursementDate().toString());
@@ -109,8 +109,9 @@ public class OfficeWorkbookPopulator extends AbstractWorkbookPopulator {
private void setDefaults(final Sheet worksheet) { private void setDefaults(final Sheet worksheet) {
for (Integer rowNo = 1; rowNo < 3000; rowNo++) { for (Integer rowNo = 1; rowNo < 3000; rowNo++) {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if (row == null) if (row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(OfficeConstants.PARENT_OFFICE_ID_COL, row, writeFormula(OfficeConstants.PARENT_OFFICE_ID_COL, row,
"IF(ISERROR(VLOOKUP($B"+(rowNo+1)+",$H$2:$I$"+(offices.size()+1)+",2,FALSE)),\"\",(VLOOKUP($B"+(rowNo+1)+",$H$2:$I$"+(offices.size()+1)+",2,FALSE)))"); "IF(ISERROR(VLOOKUP($B"+(rowNo+1)+",$H$2:$I$"+(offices.size()+1)+",2,FALSE)),\"\",(VLOOKUP($B"+(rowNo+1)+",$H$2:$I$"+(offices.size()+1)+",2,FALSE)))");
} }
@@ -75,8 +75,9 @@ public class RecurringDepositTransactionWorkbookPopulator extends AbstractWorkbo
for(Integer rowNo = 1; rowNo < 3000; rowNo++) for(Integer rowNo = 1; rowNo < 3000; rowNo++)
{ {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if(row == null) if(row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))"); writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))");
writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))"); writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))");
} }
@@ -193,8 +194,10 @@ public class RecurringDepositTransactionWorkbookPopulator extends AbstractWorkbo
writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")"); writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")");
writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo()); writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo());
writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName()); writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName());
if(savingsAccount.getMinRequiredOpeningBalance() != null) if(savingsAccount.getMinRequiredOpeningBalance() != null) {
writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row, savingsAccount.getMinRequiredOpeningBalance()); writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row,
savingsAccount.getMinRequiredOpeningBalance());
}
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" + writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" +
savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/" savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/" + savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
@@ -74,8 +74,9 @@ public class SavingsTransactionsWorkbookPopulator extends AbstractWorkbookPopula
for(Integer rowNo = 1; rowNo < 3000; rowNo++) for(Integer rowNo = 1; rowNo < 3000; rowNo++)
{ {
Row row = worksheet.getRow(rowNo); Row row = worksheet.getRow(rowNo);
if(row == null) if(row == null) {
row = worksheet.createRow(rowNo); row = worksheet.createRow(rowNo);
}
writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))"); writeFormula(TransactionConstants.PRODUCT_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",2,FALSE))");
writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))"); writeFormula(TransactionConstants.OPENING_BALANCE_COL, row, "IF(ISERROR(VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE)),\"\",VLOOKUP($C"+ (rowNo+1) +",$Q$2:$S$" + (savingsAccounts.size() + 1) + ",3,FALSE))");
} }
@@ -190,8 +191,10 @@ public class SavingsTransactionsWorkbookPopulator extends AbstractWorkbookPopula
writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")"); writeString(TransactionConstants.LOOKUP_CLIENT_NAME_COL, row, savingsAccount.getClientName() + "(" + savingsAccount.getClientId() + ")");
writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo()); writeString(TransactionConstants.LOOKUP_ACCOUNT_NO_COL, row, savingsAccount.getAccountNo());
writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName()); writeString(TransactionConstants.LOOKUP_PRODUCT_COL, row, savingsAccount.getSavingsProductName());
if(savingsAccount.getMinRequiredOpeningBalance() != null) if(savingsAccount.getMinRequiredOpeningBalance() != null) {
writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row, savingsAccount.getMinRequiredOpeningBalance()); writeBigDecimal(TransactionConstants.LOOKUP_OPENING_BALANCE_COL, row,
savingsAccount.getMinRequiredOpeningBalance());
}
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" + writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,"" +
savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/" savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/" + savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
@@ -80,8 +80,12 @@ public class EmailBusinessRulesData {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EmailBusinessRulesData that = (EmailBusinessRulesData) o; EmailBusinessRulesData that = (EmailBusinessRulesData) o;
@@ -75,12 +75,18 @@ public class SmsBusinessRulesData {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SmsBusinessRulesData that = (SmsBusinessRulesData) o; SmsBusinessRulesData that = (SmsBusinessRulesData) o;
if (reportId != null ? !reportId.equals(that.reportId) : that.reportId != null) return false; if (reportId != null ? !reportId.equals(that.reportId) : that.reportId != null) {
return false;
}
return true; return true;
} }
@@ -168,7 +168,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
public Integer retrieveFinancialYearBeginningMonth() { public Integer retrieveFinancialYearBeginningMonth() {
final String propertyName = "financial-year-beginning-month"; final String propertyName = "financial-year-beginning-month";
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
if (property.isEnabled()) return property.getValue().intValue(); if (property.isEnabled()) {
return property.getValue().intValue();
}
return 1; return 1;
} }
@@ -306,8 +308,9 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName); final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
int defaultValue = 6; int defaultValue = 6;
int value = property.getValue().intValue(); int value = property.getValue().intValue();
if(value < 1) if(value < 1) {
return defaultValue; return defaultValue;
}
return value; return value;
} }
@@ -35,7 +35,9 @@ public class ExternalServicesPropertiesRepositoryWrapper {
public ExternalServicesProperties findOneByIdAndName(Long id, String name, String externalServiceName) { public ExternalServicesProperties findOneByIdAndName(Long id, String name, String externalServiceName) {
final ExternalServicesProperties externalServicesProperties = this.repository final ExternalServicesProperties externalServicesProperties = this.repository
.findOneByExternalServicePropertiesPK(name,id); .findOneByExternalServicePropertiesPK(name,id);
if (externalServicesProperties == null) throw new ExternalServiceConfigurationNotFoundException(externalServiceName, name); if (externalServicesProperties == null) {
throw new ExternalServiceConfigurationNotFoundException(externalServiceName, name);
}
return externalServicesProperties; return externalServicesProperties;
} }
} }
@@ -52,8 +52,12 @@ public class EnumOptionData implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (!(o instanceof EnumOptionData)) return false; return true;
}
if (!(o instanceof EnumOptionData)) {
return false;
}
EnumOptionData that = (EnumOptionData) o; EnumOptionData that = (EnumOptionData) o;
return id.equals(that.id) && return id.equals(that.id) &&
code.equals(that.code) && code.equals(that.code) &&
@@ -51,7 +51,9 @@ public class DatatableData implements Serializable {
for(ResultsetColumnHeaderData c : this.columnHeaderData){ for(ResultsetColumnHeaderData c : this.columnHeaderData){
if(c.getColumnName().equals(columnName)) return true; if(c.getColumnName().equals(columnName)) {
return true;
}
} }
return false; return false;
@@ -56,9 +56,13 @@ public class EntityDataTableChecksTemplateData implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
return true;
}
if (!(o instanceof EntityDataTableChecksTemplateData)) return false; if (!(o instanceof EntityDataTableChecksTemplateData)) {
return false;
}
EntityDataTableChecksTemplateData that = (EntityDataTableChecksTemplateData) o; EntityDataTableChecksTemplateData that = (EntityDataTableChecksTemplateData) o;
@@ -55,7 +55,7 @@ public enum EntityTables {
private static final Map<String, EntityTables> lookup = new HashMap<String, EntityTables>(); private static final Map<String, EntityTables> lookup = new HashMap<String, EntityTables>();
static { static {
for (EntityTables d : EntityTables.values()) for (EntityTables d : EntityTables.values())
lookup.put(d.getName(), d); { lookup.put(d.getName(), d);}
} }
private String name; private String name;
@@ -322,7 +322,9 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
private Integer getCategory(final JsonCommand command) { private Integer getCategory(final JsonCommand command) {
Integer category = command.integerValueOfParameterNamedDefaultToNullIfZero(DataTableApiConstant.categoryParamName); Integer category = command.integerValueOfParameterNamedDefaultToNullIfZero(DataTableApiConstant.categoryParamName);
if (category == null) category = DataTableApiConstant.CATEGORY_DEFAULT; if (category == null) {
category = DataTableApiConstant.CATEGORY_DEFAULT;
}
return category; return category;
} }
@@ -76,7 +76,9 @@ public class Hook extends AbstractAuditableCustom {
final Set<HookResource> events, final Template ugdTemplate) { final Set<HookResource> events, final Template ugdTemplate) {
final String displayName = command.stringValueOfParameterNamed(displayNameParamName); final String displayName = command.stringValueOfParameterNamed(displayNameParamName);
Boolean isActive = command.booleanObjectValueOfParameterNamed(isActiveParamName); Boolean isActive = command.booleanObjectValueOfParameterNamed(isActiveParamName);
if (isActive == null) isActive = false; if (isActive == null) {
isActive = false;
}
return new Hook(template, displayName, isActive, config, events, ugdTemplate); return new Hook(template, displayName, isActive, config, events, ugdTemplate);
} }
@@ -76,7 +76,9 @@ public class JobParameter extends AbstractPersistableCustom {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!obj.getClass().equals(getClass())) return false; if (!obj.getClass().equals(getClass())) {
return false;
}
JobParameter jobParameter = (JobParameter) obj; JobParameter jobParameter = (JobParameter) obj;
return Objects.equals(jobParameter.getJobId(), this.getJobId()) return Objects.equals(jobParameter.getJobId(), this.getJobId())
&& Objects.equals(jobParameter.getParameterName(), this.getParameterName()) && Objects.equals(jobParameter.getParameterName(), this.getParameterName())
@@ -54,8 +54,9 @@ public class ExtensionData {
} }
public static ExtensionData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static ExtensionData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -50,8 +50,9 @@ public class GeoCodeData {
} }
public static GeoCodeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static GeoCodeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -97,8 +97,9 @@ public class InteropAccountData extends CommandProcessingResult {
} }
public static InteropAccountData build(SavingsAccount account) { public static InteropAccountData build(SavingsAccount account) {
if (account == null) if (account == null) {
return null; return null;
}
List<InteropIdentifierData> ids = new ArrayList<>(); List<InteropIdentifierData> ids = new ArrayList<>();
for (InteropIdentifier identifier : account.getIdentifiers()) { for (InteropIdentifier identifier : account.getIdentifiers()) {
@@ -116,18 +117,24 @@ public class InteropAccountData extends CommandProcessingResult {
private static LocalDate calcStatusUpdateOn(@NotNull SavingsAccount account) { private static LocalDate calcStatusUpdateOn(@NotNull SavingsAccount account) {
LocalDate date = account.getClosedOnDate(); LocalDate date = account.getClosedOnDate();
if (date != null) if (date != null) {
return date; return date;
if ((date = account.getWithdrawnOnDate()) != null) }
if ((date = account.getWithdrawnOnDate()) != null) {
return date; return date;
if ((date = account.getActivationLocalDate()) != null) }
if ((date = account.getActivationLocalDate()) != null) {
return date; return date;
if ((date = account.getRejectedOnDate()) != null) }
if ((date = account.getRejectedOnDate()) != null) {
return date; return date;
if ((date = account.getApprovedOnDate()) != null) }
if ((date = account.getApprovedOnDate()) != null) {
return date; return date;
if ((date = account.getSubmittedOnDate()) != null) }
if ((date = account.getSubmittedOnDate()) != null) {
return date; return date;
}
return null; return null;
} }
} }
@@ -68,8 +68,9 @@ public class InteropIdentifierRequestData {
public static InteropIdentifierRequestData validateAndParse(final DataValidatorBuilder dataValidator, @NotNull InteropIdentifierType idType, public static InteropIdentifierRequestData validateAndParse(final DataValidatorBuilder dataValidator, @NotNull InteropIdentifierType idType,
@NotNull String idValue, String subIdOrType, JsonObject element, @NotNull String idValue, String subIdOrType, JsonObject element,
FromJsonHelper jsonHelper) { FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -95,13 +95,15 @@ public class InteropQuoteRequestData extends InteropRequestData {
public void normalizeAmounts(@NotNull MonetaryCurrency currency) { public void normalizeAmounts(@NotNull MonetaryCurrency currency) {
super.normalizeAmounts(currency); super.normalizeAmounts(currency);
if (fees != null) if (fees != null) {
fees.normalizeAmount(currency); fees.normalizeAmount(currency);
}
} }
public static InteropQuoteRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static InteropQuoteRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -159,8 +159,9 @@ public class InteropRequestData {
} }
public static InteropRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static InteropRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
String transactionCode = jsonHelper.extractStringNamed(PARAM_TRANSACTION_CODE, element); String transactionCode = jsonHelper.extractStringNamed(PARAM_TRANSACTION_CODE, element);
DataValidatorBuilder dataValidatorCopy = dataValidator.reset().parameter(PARAM_TRANSACTION_CODE).value(transactionCode).notBlank(); DataValidatorBuilder dataValidatorCopy = dataValidator.reset().parameter(PARAM_TRANSACTION_CODE).value(transactionCode).notBlank();
@@ -196,8 +197,10 @@ public class InteropRequestData {
if (extensionArray != null) { if (extensionArray != null) {
extensionList = new ArrayList<>(extensionArray.size()); extensionList = new ArrayList<>(extensionArray.size());
for (JsonElement jsonElement : extensionArray) { for (JsonElement jsonElement : extensionArray) {
if (jsonElement.isJsonObject()) if (jsonElement.isJsonObject()) {
extensionList.add(ExtensionData.validateAndParse(dataValidator, jsonElement.getAsJsonObject(), jsonHelper)); extensionList.add(
ExtensionData.validateAndParse(dataValidator, jsonElement.getAsJsonObject(), jsonHelper));
}
} }
} }
@@ -94,8 +94,9 @@ public class InteropTransactionData extends CommandProcessingResult {
} }
public static InteropTransactionData build(SavingsAccountTransaction transaction) { public static InteropTransactionData build(SavingsAccountTransaction transaction) {
if (transaction == null) if (transaction == null) {
return null; return null;
}
SavingsAccount savingsAccount = transaction.getSavingsAccount(); SavingsAccount savingsAccount = transaction.getSavingsAccount();
@@ -119,19 +120,22 @@ public class InteropTransactionData extends CommandProcessingResult {
int currLength = 0; int currLength = 0;
for (Note note : transaction.getNotes()) { for (Note note : transaction.getNotes()) {
String s = note.getNote(); String s = note.getNote();
if (s == null) if (s == null) {
continue; continue;
}
int availableLength = 500 - currLength; int availableLength = 500 - currLength;
if (availableLength <= 1) if (availableLength <= 1) {
break; break;
}
if (currLength > 0) { if (currLength > 0) {
sb.append(' '); sb.append(' ');
availableLength--; availableLength--;
} }
if (s.length() > availableLength) if (s.length() > availableLength) {
s = s.substring(availableLength); s = s.substring(availableLength);
}
sb.append(s); sb.append(s);
currLength = sb.length(); currLength = sb.length();
} }
@@ -63,8 +63,9 @@ public class InteropTransactionRequestData extends InteropRequestData {
} }
public static InteropTransactionRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static InteropTransactionRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -85,8 +85,9 @@ public class InteropTransactionTypeData {
public static InteropTransactionTypeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static InteropTransactionTypeData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -37,8 +37,9 @@ public class InteropTransactionsData extends CommandProcessingResult {
} }
public static InteropTransactionsData build(SavingsAccount account, @NotNull Predicate<SavingsAccountTransaction> filter) { public static InteropTransactionsData build(SavingsAccount account, @NotNull Predicate<SavingsAccountTransaction> filter) {
if (account == null) if (account == null) {
return null; return null;
}
List<InteropTransactionData> trans = account.getTransactions().stream().filter(filter).sorted((t1, t2) -> { List<InteropTransactionData> trans = account.getTransactions().stream().filter(filter).sorted((t1, t2) -> {
int i = t2.getDateOf().compareTo(t1.getDateOf()); int i = t2.getDateOf().compareTo(t1.getDateOf());
@@ -90,13 +90,15 @@ public class InteropTransferRequestData extends InteropRequestData {
public void normalizeAmounts(@NotNull MonetaryCurrency currency) { public void normalizeAmounts(@NotNull MonetaryCurrency currency) {
super.normalizeAmounts(currency); super.normalizeAmounts(currency);
if (fspFee != null) if (fspFee != null) {
fspFee.normalizeAmount(currency); fspFee.normalizeAmount(currency);
}
} }
public static InteropTransferRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static InteropTransferRequestData validateAndParse(final DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -59,14 +59,16 @@ public class MoneyData {
} }
public void normalizeAmount(@NotNull MonetaryCurrency currency) { public void normalizeAmount(@NotNull MonetaryCurrency currency) {
if (!currency.getCode().equals(this.currency)) if (!currency.getCode().equals(this.currency)) {
throw new UnsupportedOperationException("Internal error: Invalid currency " + currency.getCode()); throw new UnsupportedOperationException("Internal error: Invalid currency " + currency.getCode());
}
MathUtil.normalizeAmount(amount, currency); MathUtil.normalizeAmount(amount, currency);
} }
public static MoneyData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) { public static MoneyData validateAndParse(DataValidatorBuilder dataValidator, JsonObject element, FromJsonHelper jsonHelper) {
if (element == null) if (element == null) {
return null; return null;
}
jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS)); jsonHelper.checkForUnsupportedParameters(element, Arrays.asList(PARAMS));
@@ -153,14 +153,24 @@ public class InteropIdentifier extends AbstractPersistableCustom {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InteropIdentifier that = (InteropIdentifier) o; InteropIdentifier that = (InteropIdentifier) o;
if (!account.equals(that.account)) return false; if (!account.equals(that.account)) {
if (type != that.type) return false; return false;
if (!value.equals(that.value)) return false; }
if (type != that.type) {
return false;
}
if (!value.equals(that.value)) {
return false;
}
return subValueOrType != null ? subValueOrType.equals(that.subValueOrType) : that.subValueOrType == null; return subValueOrType != null ? subValueOrType.equals(that.subValueOrType) : that.subValueOrType == null;
} }
@@ -93,8 +93,9 @@ public class InteropDataValidator {
private JsonObject extractJsonObject(JsonCommand command) { private JsonObject extractJsonObject(JsonCommand command) {
String json = command.json(); String json = command.json();
if (StringUtils.isBlank(json)) if (StringUtils.isBlank(json)) {
throw new InvalidJsonException(); throw new InvalidJsonException();
}
final JsonElement element = jsonHelper.parse(json); final JsonElement element = jsonHelper.parse(json);
return element.getAsJsonObject(); return element.getAsJsonObject();
@@ -92,8 +92,12 @@ public class CurrencyData implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (!(o instanceof CurrencyData)) return false; return true;
}
if (!(o instanceof CurrencyData)) {
return false;
}
CurrencyData that = (CurrencyData) o; CurrencyData that = (CurrencyData) o;
return Objects.equals(decimalPlaces, that.decimalPlaces) && return Objects.equals(decimalPlaces, that.decimalPlaces) &&
Objects.equals(code, that.code) && Objects.equals(code, that.code) &&
@@ -49,7 +49,9 @@ public class ProvisioningCategoryData implements Comparable<ProvisioningCategory
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (!(obj instanceof ProvisioningCategoryData)) return false; if (!(obj instanceof ProvisioningCategoryData)) {
return false;
}
final ProvisioningCategoryData provisionCategoryData = (ProvisioningCategoryData) obj; final ProvisioningCategoryData provisionCategoryData = (ProvisioningCategoryData) obj;
return provisionCategoryData.id.equals(this.id); return provisionCategoryData.id.equals(this.id);
} }
@@ -240,17 +240,19 @@ public class TellerWritePlatformServiceJpaImpl implements TellerWritePlatformSer
hourStartTime = command.longValueOfParameterNamed("hourStartTime"); hourStartTime = command.longValueOfParameterNamed("hourStartTime");
minStartTime = command.longValueOfParameterNamed("minStartTime"); minStartTime = command.longValueOfParameterNamed("minStartTime");
if (minStartTime == 0) if (minStartTime == 0) {
startTime = hourStartTime.toString() + ":" + minStartTime.toString() + "0"; startTime = hourStartTime.toString() + ":" + minStartTime.toString() + "0";
else } else {
startTime = hourStartTime.toString() + ":" + minStartTime.toString(); startTime = hourStartTime.toString() + ":" + minStartTime.toString();
}
hourEndTime = command.longValueOfParameterNamed("hourEndTime"); hourEndTime = command.longValueOfParameterNamed("hourEndTime");
minEndTime = command.longValueOfParameterNamed("minEndTime"); minEndTime = command.longValueOfParameterNamed("minEndTime");
if (minEndTime == 0) if (minEndTime == 0) {
endTime = hourEndTime.toString() + ":" + minEndTime.toString() + "0"; endTime = hourEndTime.toString() + ":" + minEndTime.toString() + "0";
else } else {
endTime = hourEndTime.toString() + ":" + minEndTime.toString(); endTime = hourEndTime.toString() + ":" + minEndTime.toString();
}
} }
final Cashier cashier = Cashier.fromJson(tellerOffice, teller, staff, startTime, endTime, command); final Cashier cashier = Cashier.fromJson(tellerOffice, teller, staff, startTime, endTime, command);
@@ -509,8 +509,9 @@ public class AccountTransfersWritePlatformServiceImpl implements AccountTransfer
BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(fromLoanAccountId).getPaidInAdvance(); BigDecimal overpaid = this.loanReadPlatformService.retrieveTotalPaidInAdvance(fromLoanAccountId).getPaidInAdvance();
if (overpaid == null || overpaid.equals(BigDecimal.ZERO) || transactionAmount.floatValue() > overpaid.floatValue()) { if (overpaid == null || overpaid.equals(BigDecimal.ZERO) || transactionAmount.floatValue() > overpaid.floatValue()) {
if(overpaid == null) if(overpaid == null) {
overpaid = BigDecimal.ZERO; overpaid = BigDecimal.ZERO;
}
throw new InvalidPaidInAdvanceAmountException(overpaid.toPlainString()); throw new InvalidPaidInAdvanceAmountException(overpaid.toPlainString());
} }
@@ -494,8 +494,10 @@ public class CalendarData implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o){ return true;}
if (!(o instanceof CalendarData)) return false; if (!(o instanceof CalendarData)) {
return false;
}
CalendarData that = (CalendarData) o; CalendarData that = (CalendarData) o;
return Objects.equals(repeating, that.repeating) && return Objects.equals(repeating, that.repeating) &&
Objects.equals(id, that.id) && Objects.equals(id, that.id) &&
@@ -340,7 +340,9 @@ public class Calendar extends AbstractAuditableCustom {
} }
// if repeating is false then update recurrence to NULL // if repeating is false then update recurrence to NULL
if (!this.repeating) this.recurrence = null; if (!this.repeating) {
this.recurrence = null;
}
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CALENDAR_RESOURCE_NAME); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CALENDAR_RESOURCE_NAME);
@@ -62,7 +62,9 @@ public enum CalendarFrequencyType {
public static CalendarFrequencyType fromString(final String frequencyString) { public static CalendarFrequencyType fromString(final String frequencyString) {
CalendarFrequencyType frequency = CalendarFrequencyType.INVALID; CalendarFrequencyType frequency = CalendarFrequencyType.INVALID;
if (StringUtils.isEmpty(frequencyString)) return frequency; if (StringUtils.isEmpty(frequencyString)) {
return frequency;
}
if (frequencyString.equalsIgnoreCase(CalendarFrequencyType.DAILY.toString())) { if (frequencyString.equalsIgnoreCase(CalendarFrequencyType.DAILY.toString())) {
frequency = CalendarFrequencyType.DAILY; frequency = CalendarFrequencyType.DAILY;
@@ -79,7 +79,9 @@ public enum CalendarWeekDaysType {
public static CalendarWeekDaysType fromString(final String weekDayString) { public static CalendarWeekDaysType fromString(final String weekDayString) {
CalendarWeekDaysType weekDay = CalendarWeekDaysType.INVALID; CalendarWeekDaysType weekDay = CalendarWeekDaysType.INVALID;
if (StringUtils.isEmpty(weekDayString)) return weekDay; if (StringUtils.isEmpty(weekDayString)) {
return weekDay;
}
if (weekDayString.equalsIgnoreCase(CalendarWeekDaysType.MO.toString())) { if (weekDayString.equalsIgnoreCase(CalendarWeekDaysType.MO.toString())) {
weekDay = CalendarWeekDaysType.MO; weekDay = CalendarWeekDaysType.MO;
@@ -267,16 +267,19 @@ public class CalendarUtils {
} else if (recur.getFrequency().equals(Recur.Frequency.MONTHLY)) { } else if (recur.getFrequency().equals(Recur.Frequency.MONTHLY)) {
NumberList nthDays = recur.getSetPosList(); NumberList nthDays = recur.getSetPosList();
Integer nthDay = null; Integer nthDay = null;
if (!nthDays.isEmpty()) if (!nthDays.isEmpty()) {
nthDay = nthDays.get(0); nthDay = nthDays.get(0);
}
NumberList monthDays = recur.getMonthDayList(); NumberList monthDays = recur.getMonthDayList();
Integer monthDay = null; Integer monthDay = null;
if (!monthDays.isEmpty()) if (!monthDays.isEmpty()) {
monthDay = monthDays.get(0); monthDay = monthDays.get(0);
}
WeekDayList weekdays = recur.getDayList(); WeekDayList weekdays = recur.getDayList();
WeekDay weekDay = null; WeekDay weekDay = null;
if (!weekdays.isEmpty()) if (!weekdays.isEmpty()) {
weekDay = weekdays.get(0); weekDay = weekdays.get(0);
}
if (nthDay != null && weekDay != null) { if (nthDay != null && weekDay != null) {
NthDayType nthDayType = NthDayType.fromInt(nthDay); NthDayType nthDayType = NthDayType.fromInt(nthDay);
NthDayNameEnum nthDayName = NthDayNameEnum.from(nthDayType.toString()); NthDayNameEnum nthDayName = NthDayNameEnum.from(nthDayType.toString());
@@ -459,7 +462,9 @@ public class CalendarUtils {
public static CalendarWeekDaysType getRepeatsOnDay(final String recurringRule) { public static CalendarWeekDaysType getRepeatsOnDay(final String recurringRule) {
final Recur recur = CalendarUtils.getICalRecur(recurringRule); final Recur recur = CalendarUtils.getICalRecur(recurringRule);
final WeekDayList weekDays = recur.getDayList(); final WeekDayList weekDays = recur.getDayList();
if (weekDays.isEmpty()) return CalendarWeekDaysType.INVALID; if (weekDays.isEmpty()) {
return CalendarWeekDaysType.INVALID;
}
// supports only one day // supports only one day
WeekDay weekDay = weekDays.get(0); WeekDay weekDay = weekDays.get(0);
return CalendarWeekDaysType.fromString(weekDay.getDay().name()); return CalendarWeekDaysType.fromString(weekDay.getDay().name());
@@ -467,12 +472,17 @@ public class CalendarUtils {
public static NthDayType getRepeatsOnNthDayOfMonth(final String recurringRule) { public static NthDayType getRepeatsOnNthDayOfMonth(final String recurringRule) {
final Recur recur = CalendarUtils.getICalRecur(recurringRule); final Recur recur = CalendarUtils.getICalRecur(recurringRule);
NumberList monthDays = null; NumberList monthDays = null;
if(recur.getDayList().isEmpty()) if(recur.getDayList().isEmpty()) {
monthDays = recur.getMonthDayList(); monthDays = recur.getMonthDayList();
else } else {
monthDays = recur.getSetPosList(); monthDays = recur.getSetPosList();
if (monthDays.isEmpty()) return NthDayType.INVALID; }
if (!recur.getMonthDayList().isEmpty() && recur.getSetPosList().isEmpty()) return NthDayType.ONDAY; if (monthDays.isEmpty()) {
return NthDayType.INVALID;
}
if (!recur.getMonthDayList().isEmpty() && recur.getSetPosList().isEmpty()) {
return NthDayType.ONDAY;
}
Integer monthDay = monthDays.get(0); Integer monthDay = monthDays.get(0);
return NthDayType.fromInt(monthDay); return NthDayType.fromInt(monthDay);
} }
@@ -122,7 +122,9 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr
if (entityActivationDate == null || newCalendar.getStartDateLocalDate().isBefore(entityActivationDate)) { if (entityActivationDate == null || newCalendar.getStartDateLocalDate().isBefore(entityActivationDate)) {
final DateTimeFormatter formatter = DateTimeFormat.forPattern(command.dateFormat()).withLocale(command.extractLocale()); final DateTimeFormatter formatter = DateTimeFormat.forPattern(command.dateFormat()).withLocale(command.extractLocale());
String dateAsString = ""; String dateAsString = "";
if (entityActivationDate != null) dateAsString = formatter.print(entityActivationDate); if (entityActivationDate != null) {
dateAsString = formatter.print(entityActivationDate);
}
final String errorMessage = "cannot.be.before." + entityType.name().toLowerCase() + ".activation.date"; final String errorMessage = "cannot.be.before." + entityType.name().toLowerCase() + ".activation.date";
baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(dateAsString) baseDataValidator.reset().parameter(CalendarSupportedParameters.START_DATE.getValue()).value(dateAsString)
@@ -598,8 +598,12 @@ public class Charge extends AbstractPersistableCustom {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (!(o instanceof Charge)) return false; return true;
}
if (!(o instanceof Charge)) {
return false;
}
Charge other= (Charge) o; Charge other= (Charge) o;
return Objects.equals(name, other.name) && return Objects.equals(name, other.name) &&
Objects.equals(amount, other.amount) && Objects.equals(amount, other.amount) &&
@@ -66,8 +66,10 @@ public final class ClientDataValidator {
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) { if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName)); final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
if(clientNonPersonJson != null) if(clientNonPersonJson != null) {
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson,
ClientApiCollectionConstants.CLIENT_NON_PERSON_CREATE_REQUEST_DATA_PARAMETERS);
}
} }
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -346,8 +348,10 @@ public final class ClientDataValidator {
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) { if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.clientNonPersonDetailsParamName, element)) {
final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName)); final String clientNonPersonJson = this.fromApiJsonHelper.toJson(element.getAsJsonObject().get(ClientApiConstants.clientNonPersonDetailsParamName));
if(clientNonPersonJson != null) if(clientNonPersonJson != null) {
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson, ClientApiCollectionConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, clientNonPersonJson,
ClientApiCollectionConstants.CLIENT_NON_PERSON_UPDATE_REQUEST_DATA_PARAMETERS);
}
} }
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
@@ -79,14 +79,17 @@ public class ClientNonPerson extends AbstractPersistableCustom {
private ClientNonPerson(final Client client, final CodeValue constitution, final CodeValue mainBusinessLine, final String incorpNumber, final LocalDate incorpValidityTill, final String remarks) private ClientNonPerson(final Client client, final CodeValue constitution, final CodeValue mainBusinessLine, final String incorpNumber, final LocalDate incorpValidityTill, final String remarks)
{ {
if(client != null) if(client != null) {
this.client = client; this.client = client;
}
if(constitution != null) if(constitution != null) {
this.constitution = constitution; this.constitution = constitution;
}
if(mainBusinessLine != null) if(mainBusinessLine != null) {
this.mainBusinessLine = mainBusinessLine; this.mainBusinessLine = mainBusinessLine;
}
if (StringUtils.isNotBlank(incorpNumber)) { if (StringUtils.isNotBlank(incorpNumber)) {
this.incorpNumber = incorpNumber.trim(); this.incorpNumber = incorpNumber.trim();
@@ -495,8 +495,9 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final Integer legalFormEnum = JdbcSupport.getInteger(rs, "legalFormEnum"); final Integer legalFormEnum = JdbcSupport.getInteger(rs, "legalFormEnum");
EnumOptionData legalForm = null; EnumOptionData legalForm = null;
if(legalFormEnum != null) if(legalFormEnum != null) {
legalForm = ClientEnumerations.legalForm(legalFormEnum); legalForm = ClientEnumerations.legalForm(legalFormEnum);
}
final Long constitutionId = JdbcSupport.getLong(rs, "constitutionId"); final Long constitutionId = JdbcSupport.getLong(rs, "constitutionId");
final String constitutionValue = rs.getString("constitutionValue"); final String constitutionValue = rs.getString("constitutionValue");
@@ -679,8 +680,9 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
final Integer legalFormEnum = JdbcSupport.getInteger(rs, "legalFormEnum"); final Integer legalFormEnum = JdbcSupport.getInteger(rs, "legalFormEnum");
EnumOptionData legalForm = null; EnumOptionData legalForm = null;
if(legalFormEnum != null) if(legalFormEnum != null) {
legalForm = ClientEnumerations.legalForm(legalFormEnum); legalForm = ClientEnumerations.legalForm(legalFormEnum);
}
final Long constitutionId = JdbcSupport.getLong(rs, "constitutionId"); final Long constitutionId = JdbcSupport.getLong(rs, "constitutionId");
final String constitutionValue = rs.getString("constitutionValue"); final String constitutionValue = rs.getString("constitutionValue");

Some files were not shown because too many files have changed in this diff Show More