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