replace 51013 Tabs with 4 Spaces in 3122 Java files (FINERACT-821)
rpl -eRxjava "\t" " " .
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
68006ae8f2
commit
b0196049f1
@@ -45,12 +45,12 @@ import org.springframework.context.annotation.Import;
|
||||
*/
|
||||
public class ServerApplication {
|
||||
|
||||
@Import({ DataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
|
||||
private static class Configuration extends AbstractApplicationConfiguration { }
|
||||
@Import({ DataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
|
||||
private static class Configuration extends AbstractApplicationConfiguration { }
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
||||
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
||||
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+47
-47
@@ -49,57 +49,57 @@ import org.springframework.core.io.Resource;
|
||||
public class ServerWithMariaDB4jApplication {
|
||||
private final static Logger logger = LoggerFactory.getLogger(ServerWithMariaDB4jApplication.class);
|
||||
|
||||
@Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
|
||||
public static class Configuration extends AbstractApplicationConfiguration { }
|
||||
@Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class })
|
||||
public static class Configuration extends AbstractApplicationConfiguration { }
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
||||
if (!Desktop.isDesktopSupported()) {
|
||||
logger.info("Not going to open UI homepage in local web browser, because !Desktop.isDesktopSupported()");
|
||||
public static void main(String[] args) throws Exception {
|
||||
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
||||
if (!Desktop.isDesktopSupported()) {
|
||||
logger.info("Not going to open UI homepage in local web browser, because !Desktop.isDesktopSupported()");
|
||||
|
||||
} else {
|
||||
// apps/community-app/dist/community-app/index.html
|
||||
Resource distResource = ctx.getResource("file:" + System.getProperty("user.dir") +
|
||||
System.getProperty("file.separator") + "apps" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "dist" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "index.html");
|
||||
URI distURI = URI.create("https://localhost:8443/fineract-provider" +
|
||||
"/apps/community-app/index.html?baseApiUrl=https://localhost:8443" +
|
||||
"&tenantIdentifier=default#/");
|
||||
} else {
|
||||
// apps/community-app/dist/community-app/index.html
|
||||
Resource distResource = ctx.getResource("file:" + System.getProperty("user.dir") +
|
||||
System.getProperty("file.separator") + "apps" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "dist" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "index.html");
|
||||
URI distURI = URI.create("https://localhost:8443/fineract-provider" +
|
||||
"/apps/community-app/index.html?baseApiUrl=https://localhost:8443" +
|
||||
"&tenantIdentifier=default#/");
|
||||
|
||||
// apps/community-app/app/index.html
|
||||
Resource devResource = ctx.getResource("file:" + System.getProperty("user.dir") +
|
||||
System.getProperty("file.separator") + "apps" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "app" +
|
||||
System.getProperty("file.separator") + "index.html");
|
||||
URI devURI = URI.create("https://localhost:8443/fineract-provider" +
|
||||
"/apps/community-app/app/index.html?baseApiUrl=https://localhost:8443" +
|
||||
"&tenantIdentifier=default#/");
|
||||
// apps/community-app/app/index.html
|
||||
Resource devResource = ctx.getResource("file:" + System.getProperty("user.dir") +
|
||||
System.getProperty("file.separator") + "apps" +
|
||||
System.getProperty("file.separator") + "community-app" +
|
||||
System.getProperty("file.separator") + "app" +
|
||||
System.getProperty("file.separator") + "index.html");
|
||||
URI devURI = URI.create("https://localhost:8443/fineract-provider" +
|
||||
"/apps/community-app/app/index.html?baseApiUrl=https://localhost:8443" +
|
||||
"&tenantIdentifier=default#/");
|
||||
|
||||
if (distResource.exists()) {
|
||||
openWebBrowser(distURI);
|
||||
} else if (devResource.exists()) {
|
||||
openWebBrowser(devURI);
|
||||
} else {
|
||||
logger.error("Cannot open Fineract UI in browser; not found: " + distResource.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
|
||||
|
||||
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
||||
}
|
||||
if (distResource.exists()) {
|
||||
openWebBrowser(distURI);
|
||||
} else if (devResource.exists()) {
|
||||
openWebBrowser(devURI);
|
||||
} else {
|
||||
logger.error("Cannot open Fineract UI in browser; not found: " + distResource.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
|
||||
|
||||
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
||||
}
|
||||
|
||||
private static void openWebBrowser(URI uri) {
|
||||
try {
|
||||
logger.info("Opening Fineract UI in browser: " + uri.toString());
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} catch (IOException e) {
|
||||
logger.error("IOException when opening Fineract UI in browser: " + uri.toString(), e);
|
||||
}
|
||||
}
|
||||
private static void openWebBrowser(URI uri) {
|
||||
try {
|
||||
logger.info("Opening Fineract UI in browser: " + uri.toString());
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} catch (IOException e) {
|
||||
logger.error("IOException when opening Fineract UI in browser: " + uri.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -54,9 +54,9 @@ import com.google.gson.reflect.TypeToken;
|
||||
public final class AccrualAccountingDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> LOAN_PERIODIC_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(accrueTillParamName, AccrualAccountingConstants.localeParamName,
|
||||
AccrualAccountingConstants.dateFormatParamName));
|
||||
private static final Set<String> LOAN_PERIODIC_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(accrueTillParamName, AccrualAccountingConstants.localeParamName,
|
||||
AccrualAccountingConstants.dateFormatParamName));
|
||||
|
||||
@Autowired
|
||||
public AccrualAccountingDataValidator(final FromJsonHelper fromApiJsonfromApiJsonHelper) {
|
||||
|
||||
+1
-1
@@ -246,7 +246,7 @@ public class AccountingConstants {
|
||||
|
||||
private static List<FinancialActivityData> financialActivities;
|
||||
static {
|
||||
financialActivities = new ArrayList<>();
|
||||
financialActivities = new ArrayList<>();
|
||||
for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) {
|
||||
FinancialActivityData financialActivityData = convertToFinancialActivityData(type);
|
||||
financialActivities.add(financialActivityData);
|
||||
|
||||
+8
-8
@@ -23,13 +23,13 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class FinancialActivityAccountsConstants {
|
||||
private static final String idParamName = "id";
|
||||
private static final String factivityDataParamName = "financialActivityData";
|
||||
private static final String glAccountDataParamName = "glAccountData";
|
||||
private static final String glAccountOptionsParamName = "glAccountOptions";
|
||||
private static final String financialActivityOptionsParamName = "financialActivityOptions";
|
||||
private static final String idParamName = "id";
|
||||
private static final String factivityDataParamName = "financialActivityData";
|
||||
private static final String glAccountDataParamName = "glAccountData";
|
||||
private static final String glAccountOptionsParamName = "glAccountOptions";
|
||||
private static final String financialActivityOptionsParamName = "financialActivityOptions";
|
||||
public static final String resourceNameForPermission = "FINANCIALACTIVITYACCOUNT";
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, factivityDataParamName, glAccountDataParamName, glAccountOptionsParamName,
|
||||
financialActivityOptionsParamName));
|
||||
protected static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(idParamName, factivityDataParamName, glAccountDataParamName, glAccountOptionsParamName,
|
||||
financialActivityOptionsParamName));
|
||||
}
|
||||
|
||||
+5
-5
@@ -82,8 +82,8 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, dataIntegrityViolationException.getMostSpecificCause(), dataIntegrityViolationException);
|
||||
return CommandProcessingResult.empty();
|
||||
}catch(final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, throwable, ee);
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,9 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, dataIntegrityViolationException.getMostSpecificCause(), dataIntegrityViolationException);
|
||||
return CommandProcessingResult.empty();
|
||||
}catch(final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleFinancialActivityAccountDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.apache.fineract.accounting.glaccount.domain;
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -26,10 +26,10 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
* disable the gl account
|
||||
*/
|
||||
public class GLAccountDisableException extends
|
||||
AbstractPlatformDomainRuleException {
|
||||
AbstractPlatformDomainRuleException {
|
||||
|
||||
public GLAccountDisableException() {
|
||||
super("error.msg.glaccount.attached.to.product",
|
||||
"General Ledger Account is already attached to product.");
|
||||
}
|
||||
public GLAccountDisableException() {
|
||||
super("error.msg.glaccount.attached.to.product",
|
||||
"General Ledger Account is already attached to product.");
|
||||
}
|
||||
}
|
||||
|
||||
+17
-17
@@ -121,13 +121,13 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
try {
|
||||
final GLAccountCommand accountCommand = this.fromApiJsonDeserializer.commandFromApiJson(command.json());
|
||||
accountCommand.validateForUpdate();
|
||||
if (command.hasParameter(GLAccountJsonInputParams.DISABLED
|
||||
.getValue())
|
||||
&& command
|
||||
.booleanPrimitiveValueOfParameterNamed(GLAccountJsonInputParams.DISABLED
|
||||
.getValue())) {
|
||||
validateForAttachedProduct(glAccountId);
|
||||
}
|
||||
if (command.hasParameter(GLAccountJsonInputParams.DISABLED
|
||||
.getValue())
|
||||
&& command
|
||||
.booleanPrimitiveValueOfParameterNamed(GLAccountJsonInputParams.DISABLED
|
||||
.getValue())) {
|
||||
validateForAttachedProduct(glAccountId);
|
||||
}
|
||||
final Long parentId = command.longValueOfParameterNamed(GLAccountJsonInputParams.PARENT_ID.getValue());
|
||||
if (glAccountId.equals(parentId)) { throw new InvalidParentGLAccountHeadException(glAccountId, parentId); }
|
||||
// is the glAccount valid
|
||||
@@ -178,17 +178,17 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
}
|
||||
|
||||
private void validateForAttachedProduct(Long glAccountId) {
|
||||
String sql = "select count(*) from acc_product_mapping acc where acc.gl_account_id = ?";
|
||||
try {
|
||||
int count = this.jdbcTemplate.queryForObject(sql, Integer.class, glAccountId);
|
||||
if (count > 0) {
|
||||
throw new GLAccountDisableException();
|
||||
}
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
}
|
||||
}
|
||||
String sql = "select count(*) from acc_product_mapping acc where acc.gl_account_id = ?";
|
||||
try {
|
||||
int count = this.jdbcTemplate.queryForObject(sql, Integer.class, glAccountId);
|
||||
if (count > 0) {
|
||||
throw new GLAccountDisableException();
|
||||
}
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult deleteGLAccount(final Long glAccountId) {
|
||||
final GLAccount glAccount = this.glAccountRepository.findById(glAccountId)
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
|
||||
else if (savingsTransactionDTO.getTransactionType().isEscheat()) {
|
||||
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL.getValue(), CASH_ACCOUNTS_FOR_SAVINGS.ESCHEAT_LIABILITY.getValue(),
|
||||
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||
}
|
||||
/**
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
transactionId, transactionDate, amount);
|
||||
|
||||
}else{
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
|
||||
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
transactionDate, amount);
|
||||
}
|
||||
|
||||
+4
-4
@@ -138,7 +138,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceSql, entityDate, entityDate);
|
||||
for (Map<String, Object> entries : list) {
|
||||
Long accountId = Long.parseLong(entries.get("accountId").toString()); //Drizzle is returning Big Integer where as MySQL returns Long.
|
||||
Long accountId = Long.parseLong(entries.get("accountId").toString()); //Drizzle is returning Big Integer where as MySQL returns Long.
|
||||
if (!runningBalanceMap.containsKey(accountId)) {
|
||||
runningBalanceMap.put(accountId, (BigDecimal) entries.get("runningBalance"));
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
ArrayList<String> updateSql = new ArrayList<>();
|
||||
int batchIndex = 0;
|
||||
for (int index = 0 ; index < entryDatas.size() ; index++) {
|
||||
JournalEntryData entryData = entryDatas.get(index) ;
|
||||
JournalEntryData entryData = entryDatas.get(index) ;
|
||||
Map<Long, BigDecimal> officeRunningBalanceMap = null;
|
||||
if (officesRunningBalance.containsKey(entryData.getOfficeId())) {
|
||||
officeRunningBalanceMap = officesRunningBalance.get(entryData.getOfficeId());
|
||||
@@ -184,8 +184,8 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
batchIndex++ ;
|
||||
if (batchIndex == batchUpdateSize || index == entryDatas.size()-1) {
|
||||
// run a batch update of the 1000 update SQL statements
|
||||
String[] batch = new String[updateSql.size()] ;
|
||||
updateSql.toArray(batch) ;
|
||||
String[] batch = new String[updateSql.size()] ;
|
||||
updateSql.toArray(batch) ;
|
||||
this.jdbcTemplate.batchUpdate(batch);
|
||||
// reset counter and string array
|
||||
batchIndex = 0;
|
||||
|
||||
+8
-8
@@ -249,9 +249,9 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
}
|
||||
}
|
||||
if (credits.length != validCredits.length) {
|
||||
throw new JournalEntryRuntimeException("error.msg.glJournalEntry.invalid.credits", "Invalid Credits.");
|
||||
}
|
||||
if (credits.length != validCredits.length) {
|
||||
throw new JournalEntryRuntimeException("error.msg.glJournalEntry.invalid.credits", "Invalid Credits.");
|
||||
}
|
||||
}
|
||||
|
||||
if (debits != null && debits.length > 0) {
|
||||
@@ -264,11 +264,11 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
validDebits[i] = debit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debits.length != validDebits.length) {
|
||||
throw new JournalEntryRuntimeException("error.msg.glJournalEntry.invalid.debits","Invalid Debits");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debits.length != validDebits.length) {
|
||||
throw new JournalEntryRuntimeException("error.msg.glJournalEntry.invalid.debits","Invalid Debits");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDebitAndCreditAmounts(final SingleDebitOrCreditEntryCommand[] credits, final SingleDebitOrCreditEntryCommand[] debits) {
|
||||
|
||||
+2
-2
@@ -68,8 +68,8 @@ public class ProvisioningEntriesApiResource {
|
||||
private final DefaultToApiJsonSerializer<Object> entriesApiJsonSerializer;
|
||||
private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
|
||||
private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
|
||||
private static final Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(Arrays.asList
|
||||
(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM));
|
||||
@Autowired
|
||||
|
||||
+22
-22
@@ -95,50 +95,50 @@ public class LoanProductProvisioningEntry extends AbstractPersistableCustom<Long
|
||||
}
|
||||
|
||||
public BigDecimal getReservedAmount() {
|
||||
return this.reservedAmount;
|
||||
return this.reservedAmount;
|
||||
}
|
||||
public void addReservedAmount(BigDecimal value) {
|
||||
this.reservedAmount = this.reservedAmount.add(value);
|
||||
this.reservedAmount = this.reservedAmount.add(value);
|
||||
}
|
||||
|
||||
public Office getOffice() {
|
||||
return this.office;
|
||||
}
|
||||
return this.office;
|
||||
}
|
||||
|
||||
public GLAccount getLiabilityAccount() {
|
||||
return this.liabilityAccount;
|
||||
}
|
||||
public GLAccount getLiabilityAccount() {
|
||||
return this.liabilityAccount;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public GLAccount getExpenseAccount() {
|
||||
return this.expenseAccount;
|
||||
}
|
||||
public GLAccount getExpenseAccount() {
|
||||
return this.expenseAccount;
|
||||
}
|
||||
|
||||
// TODO Note that this domain class does equals() & hashCode() on getId() for @JoinColumn attributes, which not all other classes do...
|
||||
// TODO Note that this domain class does equals() & hashCode() on getId() for @JoinColumn attributes, which not all other classes do...
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
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)
|
||||
&& Objects.equals(other.office.getId(), this.office.getId())
|
||||
&& Objects.equals(other.currencyCode, this.currencyCode)
|
||||
&& Objects.equals(other.loanProduct.getId(), this.loanProduct.getId())
|
||||
&& Objects.equals(other.criteriaId, this.criteriaId)
|
||||
&& Objects.equals(other.office.getId(), this.office.getId())
|
||||
&& Objects.equals(other.currencyCode, this.currencyCode)
|
||||
&& Objects.equals(other.loanProduct.getId(), this.loanProduct.getId())
|
||||
&& Objects.equals(other.provisioningCategory.getId(), this.provisioningCategory.getId())
|
||||
&& Objects.equals(other.overdueInDays, this.overdueInDays)
|
||||
&& Objects.equals(other.reservedAmount, this.reservedAmount)
|
||||
&& Objects.equals(other.liabilityAccount.getId(), this.liabilityAccount.getId())
|
||||
&& Objects.equals(other.expenseAccount.getId(), this.expenseAccount.getId());
|
||||
&& Objects.equals(other.liabilityAccount.getId(), this.liabilityAccount.getId())
|
||||
&& Objects.equals(other.expenseAccount.getId(), this.expenseAccount.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// NOT return Objects.hash(entry, criteriaId, office, currencyCode, loanProduct, provisioningCategory, overdueInDays, reservedAmount, liabilityAccount, expenseAccount);
|
||||
// to remain consistent with the implementation in equals(), also use getId() here.
|
||||
return Objects.hash(entry.getId(), criteriaId, office.getId(), currencyCode, loanProduct.getId(), provisioningCategory.getId(), overdueInDays, reservedAmount, liabilityAccount.getId(), expenseAccount.getId());
|
||||
// to remain consistent with the implementation in equals(), also use getId() here.
|
||||
return Objects.hash(entry.getId(), criteriaId, office.getId(), currencyCode, loanProduct.getId(), provisioningCategory.getId(), overdueInDays, reservedAmount, liabilityAccount.getId(), expenseAccount.getId());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.springframework.data.repository.query.Param;
|
||||
|
||||
public interface ProvisioningEntryRepository extends JpaRepository<ProvisioningEntry, Long>, JpaSpecificationExecutor<ProvisioningEntry> {
|
||||
|
||||
//OPENJPA throws error if we use entry
|
||||
//OPENJPA throws error if we use entry
|
||||
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = :createdDate")
|
||||
ProvisioningEntry findByProvisioningEntryDate(@Param("createdDate") Date createdDate);
|
||||
|
||||
|
||||
+2
-2
@@ -46,8 +46,8 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class ProvisioningEntriesDefinitionJsonDeserializer implements ProvisioningEntriesApiConstants {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
|
||||
private static final Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class AdHocApiResource {
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String retrieveAll(@Context final UriInfo uriInfo) {
|
||||
|
||||
|
||||
this.context.authenticatedUser();
|
||||
final Collection<AdHocData> adhocs = this.adHocReadPlatformService.retrieveAllAdHocQuery();
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
|
||||
+71
-71
@@ -34,31 +34,31 @@ public class AdHocData {
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String name;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final String query;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final String tableName;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final String tableFields;
|
||||
@SuppressWarnings("unused")
|
||||
private final String email;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final String email;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isActive;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime createdOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long createdById;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final Long createdById;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long updatedById;
|
||||
@SuppressWarnings("unused")
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime updatedOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final String createdBy;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final String createdBy;
|
||||
|
||||
private final List<EnumOptionData> reportRunFrequencies;
|
||||
|
||||
private final Long reportRunFrequency;
|
||||
@@ -84,65 +84,65 @@ public class AdHocData {
|
||||
this.updatedOn=updatedOn;
|
||||
this.createdBy=createdBy;
|
||||
this.email=email;
|
||||
this.reportRunFrequencies = reportRunFrequencies;
|
||||
this.reportRunFrequency = reportRunFrequency;
|
||||
this.reportRunEvery = reportRunEvery;
|
||||
this.lastRun = lastRun;
|
||||
this.reportRunFrequencies = reportRunFrequencies;
|
||||
this.reportRunFrequency = reportRunFrequency;
|
||||
this.reportRunEvery = reportRunEvery;
|
||||
this.lastRun = lastRun;
|
||||
}
|
||||
public static AdHocData template() {
|
||||
List<EnumOptionData> reportRunFrequencies = Arrays.stream(ReportRunFrequency.values()).map(rrf -> new EnumOptionData(
|
||||
(long) rrf.getValue(), rrf.getCode(), rrf.getCode()
|
||||
)).collect(Collectors.toList());
|
||||
List<EnumOptionData> reportRunFrequencies = Arrays.stream(ReportRunFrequency.values()).map(rrf -> new EnumOptionData(
|
||||
(long) rrf.getValue(), rrf.getCode(), rrf.getCode()
|
||||
)).collect(Collectors.toList());
|
||||
|
||||
AdHocData adHocData = new AdHocData(null,null,null,null,null,false,null,null,null,null,null,null, reportRunFrequencies, null, null, null);
|
||||
return adHocData;
|
||||
AdHocData adHocData = new AdHocData(null,null,null,null,null,false,null,null,null,null,null,null, reportRunFrequencies, null, null, null);
|
||||
return adHocData;
|
||||
}
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getQuery() {
|
||||
return this.query;
|
||||
}
|
||||
public String getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
public String getTableFields() {
|
||||
return this.tableFields;
|
||||
}
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
public boolean isActive() {
|
||||
return this.isActive;
|
||||
}
|
||||
public DateTime getCreatedOn() {
|
||||
return this.createdOn;
|
||||
}
|
||||
public Long getCreatedById() {
|
||||
return this.createdById;
|
||||
}
|
||||
public Long getUpdatedById() {
|
||||
return this.updatedById;
|
||||
}
|
||||
public DateTime getUpdatedOn() {
|
||||
return this.updatedOn;
|
||||
}
|
||||
public String getCreatedBy() {
|
||||
return this.createdBy;
|
||||
}
|
||||
public List<EnumOptionData> getReportRunFrequencies() {
|
||||
return this.reportRunFrequencies;
|
||||
}
|
||||
public Long getReportRunFrequency() {
|
||||
return this.reportRunFrequency;
|
||||
}
|
||||
public Long getReportRunEvery() {
|
||||
return this.reportRunEvery;
|
||||
}
|
||||
public DateTime getLastRun() {
|
||||
return this.lastRun;
|
||||
}
|
||||
return this.id;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getQuery() {
|
||||
return this.query;
|
||||
}
|
||||
public String getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
public String getTableFields() {
|
||||
return this.tableFields;
|
||||
}
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
public boolean isActive() {
|
||||
return this.isActive;
|
||||
}
|
||||
public DateTime getCreatedOn() {
|
||||
return this.createdOn;
|
||||
}
|
||||
public Long getCreatedById() {
|
||||
return this.createdById;
|
||||
}
|
||||
public Long getUpdatedById() {
|
||||
return this.updatedById;
|
||||
}
|
||||
public DateTime getUpdatedOn() {
|
||||
return this.updatedOn;
|
||||
}
|
||||
public String getCreatedBy() {
|
||||
return this.createdBy;
|
||||
}
|
||||
public List<EnumOptionData> getReportRunFrequencies() {
|
||||
return this.reportRunFrequencies;
|
||||
}
|
||||
public Long getReportRunFrequency() {
|
||||
return this.reportRunFrequency;
|
||||
}
|
||||
public Long getReportRunEvery() {
|
||||
return this.reportRunEvery;
|
||||
}
|
||||
public DateTime getLastRun() {
|
||||
return this.lastRun;
|
||||
}
|
||||
}
|
||||
@@ -38,19 +38,19 @@ import org.apache.fineract.useradministration.domain.AppUser;
|
||||
@Table(name = "m_adhoc")
|
||||
public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
|
||||
|
||||
@Column(name = "name", length = 100)
|
||||
@Column(name = "name", length = 100)
|
||||
private String name;
|
||||
|
||||
@Column(name = "query", length = 2000)
|
||||
private String query;
|
||||
|
||||
|
||||
@Column(name = "table_name", length = 100)
|
||||
private String tableName;
|
||||
|
||||
|
||||
@Column(name = "table_fields", length = 2000)
|
||||
private String tableFields;
|
||||
|
||||
|
||||
@Column(name = "email", length = 500)
|
||||
private String email;
|
||||
|
||||
@@ -60,9 +60,9 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
|
||||
@Column(name = "report_run_every")
|
||||
private Long reportRunEvery;
|
||||
|
||||
@Column(name = "IsActive", nullable = false)
|
||||
@Column(name = "IsActive", nullable = false)
|
||||
private boolean isActive = false;
|
||||
|
||||
|
||||
private AdHoc(final String name, final String query,final String tableName,final String tableFields ,final String email, final Long reportRunFrequency, final Long reportRunEvery, final boolean isActive) {
|
||||
this.name = StringUtils.defaultIfEmpty(name, null);
|
||||
this.query=StringUtils.defaultIfEmpty(query,null);
|
||||
@@ -139,7 +139,7 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
final String paramisActive = "isActive";
|
||||
if (command.isChangeInBooleanParameterNamed(paramisActive, this.isActive)) {
|
||||
final Boolean newValue = command.booleanObjectValueOfParameterNamed(paramisActive);
|
||||
final Boolean newValue = command.booleanObjectValueOfParameterNamed(paramisActive);
|
||||
actualChanges.put(paramisActive, newValue);
|
||||
this.isActive = newValue;
|
||||
}
|
||||
@@ -147,28 +147,28 @@ public class AdHoc extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public String getTableFields() {
|
||||
return tableFields;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public String getTableFields() {
|
||||
return tableFields;
|
||||
}
|
||||
public boolean isActive() {
|
||||
return this.isActive;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void disableActive() {
|
||||
this.isActive = true;
|
||||
}
|
||||
public void enableActive() {
|
||||
this.isActive = false;
|
||||
this.isActive = false;
|
||||
}
|
||||
public Long getReportRunFrequency() {
|
||||
return this.reportRunFrequency;
|
||||
|
||||
+6
-6
@@ -98,16 +98,16 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
|
||||
public String schema() {
|
||||
return " r.id as id, r.name as name, r.query as query, r.table_name as tableName,r.table_fields as tableField ,r.IsActive as isActive ,r.email as email ,"
|
||||
+ " r.report_run_frequency_code, r.report_run_every, r.last_run, "
|
||||
+ " r.created_date as createdDate, r.createdby_id as createdById,cb.username as createdBy,r.lastmodifiedby_id as updatedById ,r.lastmodified_date as updatedOn "
|
||||
+ " r.created_date as createdDate, r.createdby_id as createdById,cb.username as createdBy,r.lastmodifiedby_id as updatedById ,r.lastmodified_date as updatedOn "
|
||||
+ " from m_adhoc r left join m_appuser cb on cb.id=r.createdby_id left join m_appuser mb on mb.id=r.lastmodifiedby_id";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdHocData retrieveNewAdHocDetails() {
|
||||
return AdHocData.template();
|
||||
}
|
||||
@Override
|
||||
public AdHocData retrieveNewAdHocDetails() {
|
||||
return AdHocData.template();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+8
-8
@@ -48,9 +48,9 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
|
||||
|
||||
@Autowired
|
||||
public AdHocScheduledJobRunnerServiceImpl(final RoutingDataSource dataSource,
|
||||
final AdHocReadPlatformService adHocReadPlatformService
|
||||
final AdHocReadPlatformService adHocReadPlatformService
|
||||
) {
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.adHocReadPlatformService = adHocReadPlatformService;
|
||||
|
||||
}
|
||||
@@ -59,12 +59,12 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
|
||||
@Override
|
||||
@CronTarget(jobName = JobName.GENERATE_ADHOCCLIENT_SCEHDULE)
|
||||
public void generateClientSchedule() {
|
||||
final Collection<AdHocData> adhocs = this.adHocReadPlatformService.retrieveAllActiveAdHocQuery();
|
||||
final Collection<AdHocData> adhocs = this.adHocReadPlatformService.retrieveAllActiveAdHocQuery();
|
||||
if(adhocs.size()>0){
|
||||
adhocs.forEach(adhoc->{
|
||||
boolean run = true;
|
||||
adhocs.forEach(adhoc->{
|
||||
boolean run = true;
|
||||
LocalDate next = null;
|
||||
if (adhoc.getReportRunFrequency() != null) {
|
||||
if (adhoc.getReportRunFrequency() != null) {
|
||||
if (adhoc.getLastRun() != null) {
|
||||
LocalDate start = adhoc.getLastRun().toLocalDate();
|
||||
LocalDate end = new DateTime().toLocalDate();
|
||||
@@ -113,9 +113,9 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
|
||||
} else {
|
||||
logger.info(ThreadLocalContextUtil.getTenant().getName() + ": Skipping execution of " + adhoc.getName() + ", scheduled for execution on " + next);
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
logger.info(ThreadLocalContextUtil.getTenant().getName() + "Nothing to update ");
|
||||
logger.info(ThreadLocalContextUtil.getTenant().getName() + "Nothing to update ");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -22,8 +22,8 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
|
||||
public class ClientDetailsNotFoundException extends AbstractPlatformDomainRuleException{
|
||||
|
||||
public ClientDetailsNotFoundException() {
|
||||
super("validation.msg.batch.jlg.no.clients.defined", "No Client details found", "");
|
||||
}
|
||||
public ClientDetailsNotFoundException() {
|
||||
super("validation.msg.batch.jlg.no.clients.defined", "No Client details found", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -70,12 +70,12 @@ public class ErrorHandler extends RuntimeException {
|
||||
*/
|
||||
public static ErrorInfo handler(final RuntimeException exception) {
|
||||
|
||||
if(exception instanceof AbstractPlatformDomainRuleException) {
|
||||
PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper() ;
|
||||
final String errorBody = jsonHelper
|
||||
if(exception instanceof AbstractPlatformDomainRuleException) {
|
||||
PlatformDomainRuleExceptionMapper mapper = new PlatformDomainRuleExceptionMapper() ;
|
||||
final String errorBody = jsonHelper
|
||||
.toJson(mapper.toResponse((AbstractPlatformDomainRuleException) exception).getEntity());
|
||||
return new ErrorInfo(500, 9999, errorBody);
|
||||
}else if (exception instanceof AbstractPlatformResourceNotFoundException) {
|
||||
return new ErrorInfo(500, 9999, errorBody);
|
||||
}else if (exception instanceof AbstractPlatformResourceNotFoundException) {
|
||||
|
||||
final PlatformResourceNotFoundExceptionMapper mapper = new PlatformResourceNotFoundExceptionMapper();
|
||||
final String errorBody = jsonHelper
|
||||
@@ -128,7 +128,7 @@ public class ErrorHandler extends RuntimeException {
|
||||
|
||||
return new ErrorInfo(500, 5001, errorBody);
|
||||
}else if(exception instanceof NonTransientDataAccessException) {
|
||||
return new ErrorInfo(400, 4001, "{\"Exception\": " + exception.getMessage()+"}");
|
||||
return new ErrorInfo(400, 4001, "{\"Exception\": " + exception.getMessage()+"}");
|
||||
}
|
||||
|
||||
return new ErrorInfo(500, 9999, "{\"Exception\": " + exception.toString() + "}");
|
||||
|
||||
+3
-3
@@ -95,8 +95,8 @@ public class BatchApiServiceImpl implements BatchApiService {
|
||||
|
||||
final List<BatchRequestNode> batchRequestNodes = this.resolutionHelper.getDependingRequests(requestList);
|
||||
if(batchRequestNodes.isEmpty()) {
|
||||
final BatchResponse response = new BatchResponse();
|
||||
ErrorInfo ex = ErrorHandler.handler(new ClientDetailsNotFoundException());
|
||||
final BatchResponse response = new BatchResponse();
|
||||
ErrorInfo ex = ErrorHandler.handler(new ClientDetailsNotFoundException());
|
||||
response.setStatusCode(500);
|
||||
response.setBody(ex.getMessage());
|
||||
responseList.add(response) ;
|
||||
@@ -222,7 +222,7 @@ public class BatchApiServiceImpl implements BatchApiService {
|
||||
|
||||
return errResponseList;
|
||||
}catch (final NonTransientDataAccessException ex) {
|
||||
ErrorInfo e = ErrorHandler.handler(ex);
|
||||
ErrorInfo e = ErrorHandler.handler(ex);
|
||||
BatchResponse errResponse = new BatchResponse();
|
||||
errResponse.setStatusCode(e.getStatusCode());
|
||||
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
}
|
||||
sql += extraCriteria;
|
||||
if(isExtraCritereaIncluded){
|
||||
this.columnValidator.validateSqlInjection(sql, extraCriteria);
|
||||
this.columnValidator.validateSqlInjection(sql, extraCriteria);
|
||||
}
|
||||
logger.info("sql: " + sql);
|
||||
|
||||
|
||||
+8
-8
@@ -2836,31 +2836,31 @@ public class CommandWrapperBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder addSelfServiceBeneficiaryTPT() {
|
||||
public CommandWrapperBuilder addSelfServiceBeneficiaryTPT() {
|
||||
this.actionName = "CREATE";
|
||||
this.entityName = "SSBENEFICIARYTPT";
|
||||
this.entityId = null;
|
||||
this.href = "/self/beneficiaries/tpt";
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder updateSelfServiceBeneficiaryTPT(final Long beneficiaryId) {
|
||||
public CommandWrapperBuilder updateSelfServiceBeneficiaryTPT(final Long beneficiaryId) {
|
||||
this.actionName = "UPDATE";
|
||||
this.entityName = "SSBENEFICIARYTPT";
|
||||
this.entityId = beneficiaryId;
|
||||
this.href = "/self/beneficiaries/tpt/"+beneficiaryId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder deleteSelfServiceBeneficiaryTPT(final Long beneficiaryId) {
|
||||
public CommandWrapperBuilder deleteSelfServiceBeneficiaryTPT(final Long beneficiaryId) {
|
||||
this.actionName = "DELETE";
|
||||
this.entityName = "SSBENEFICIARYTPT";
|
||||
this.entityId = beneficiaryId;
|
||||
this.href = "/self/beneficiaries/tpt/"+beneficiaryId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandWrapperBuilder createReportMailingJob(final String entityName) {
|
||||
public CommandWrapperBuilder createReportMailingJob(final String entityName) {
|
||||
this.actionName = "CREATE";
|
||||
this.entityName = entityName;
|
||||
this.entityId = null;
|
||||
@@ -3003,7 +3003,7 @@ public class CommandWrapperBuilder {
|
||||
this.href = "/savingsaccounts/" + accountId + "?command=unblock";
|
||||
return this;
|
||||
}
|
||||
public CommandWrapperBuilder disableAdHoc(Long adHocId) {
|
||||
public CommandWrapperBuilder disableAdHoc(Long adHocId) {
|
||||
this.actionName = "DISABLE";
|
||||
this.entityName = "ADHOC";
|
||||
this.entityId = adHocId;
|
||||
|
||||
+10
-10
@@ -66,10 +66,10 @@ public class AccountNumberFormatsApiResource {
|
||||
private final ToApiJsonSerializer<AccountNumberFormatData> toApiJsonSerializer;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountNumberFormatConstants.idParamName, AccountNumberFormatConstants.accountTypeParamName,
|
||||
AccountNumberFormatConstants.prefixTypeParamName, AccountNumberFormatConstants.accountTypeOptionsParamName,
|
||||
AccountNumberFormatConstants.prefixTypeOptionsParamName));
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountNumberFormatConstants.idParamName, AccountNumberFormatConstants.accountTypeParamName,
|
||||
AccountNumberFormatConstants.prefixTypeParamName, AccountNumberFormatConstants.accountTypeOptionsParamName,
|
||||
AccountNumberFormatConstants.prefixTypeOptionsParamName));
|
||||
|
||||
@Autowired
|
||||
public AccountNumberFormatsApiResource(final PlatformSecurityContext context,
|
||||
@@ -98,8 +98,8 @@ public class AccountNumberFormatsApiResource {
|
||||
AccountNumberFormatData accountNumberFormatData = this.accountNumberFormatReadPlatformService.retrieveTemplate(accountType);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -115,8 +115,8 @@ public class AccountNumberFormatsApiResource {
|
||||
.getAllAccountNumberFormats();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -139,8 +139,8 @@ public class AccountNumberFormatsApiResource {
|
||||
accountNumberFormatData.templateOnTop(templateData.getAccountTypeOptions(), templateData.getPrefixTypeOptions());
|
||||
}
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, accountNumberFormatData,
|
||||
ACCOUNT_NUMBER_FORMAT_RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+27
-27
@@ -49,8 +49,8 @@ public class AccountNumberFormatDataValidator {
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(
|
||||
AccountNumberFormatConstants.accountTypeParamName, AccountNumberFormatConstants.prefixTypeParamName));
|
||||
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AccountNumberFormatConstants.prefixTypeParamName));
|
||||
private static final Set<String> ACCOUNT_NUMBER_FORMAT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(AccountNumberFormatConstants.prefixTypeParamName));
|
||||
|
||||
@Autowired
|
||||
public AccountNumberFormatDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -61,8 +61,8 @@ public class AccountNumberFormatDataValidator {
|
||||
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ACCOUNT_NUMBER_FORMAT_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ACCOUNT_NUMBER_FORMAT_CREATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
@@ -105,31 +105,31 @@ public class AccountNumberFormatDataValidator {
|
||||
|
||||
}
|
||||
|
||||
public Set<Integer> determineValidAccountNumberPrefixes(
|
||||
EntityAccountType entityAccountType) {
|
||||
Set<AccountNumberPrefixType> validAccountNumberPrefixes = new HashSet<>();
|
||||
public Set<Integer> determineValidAccountNumberPrefixes(
|
||||
EntityAccountType entityAccountType) {
|
||||
Set<AccountNumberPrefixType> validAccountNumberPrefixes = new HashSet<>();
|
||||
|
||||
switch (entityAccountType) {
|
||||
case CLIENT:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForClientAccounts;
|
||||
break;
|
||||
switch (entityAccountType) {
|
||||
case CLIENT:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForClientAccounts;
|
||||
break;
|
||||
|
||||
case LOAN:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForLoanAccounts;
|
||||
break;
|
||||
case LOAN:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForLoanAccounts;
|
||||
break;
|
||||
|
||||
case SAVINGS:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
||||
break;
|
||||
case SAVINGS:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
||||
break;
|
||||
|
||||
case CENTER:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForCenters;
|
||||
break;
|
||||
|
||||
case GROUP:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||
break;
|
||||
}
|
||||
case CENTER:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForCenters;
|
||||
break;
|
||||
|
||||
case GROUP:
|
||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||
break;
|
||||
}
|
||||
|
||||
Set<Integer> validAccountNumberPrefixValues = new HashSet<>();
|
||||
for (AccountNumberPrefixType validAccountNumberPrefix : validAccountNumberPrefixes) {
|
||||
@@ -143,8 +143,8 @@ public class AccountNumberFormatDataValidator {
|
||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||
|
||||
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ACCOUNT_NUMBER_FORMAT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
|
||||
ACCOUNT_NUMBER_FORMAT_UPDATE_REQUEST_DATA_PARAMETERS);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
+2
-2
@@ -92,11 +92,11 @@ public enum EntityAccountType {
|
||||
}
|
||||
|
||||
public Boolean isCenterAccount(){
|
||||
return this.value.equals(EntityAccountType.CENTER.getValue());
|
||||
return this.value.equals(EntityAccountType.CENTER.getValue());
|
||||
}
|
||||
|
||||
public Boolean isGroupAccount(){
|
||||
return this.value.equals(EntityAccountType.GROUP.getValue());
|
||||
return this.value.equals(EntityAccountType.GROUP.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -80,9 +80,9 @@ public class AccountNumberFormatWritePlatformServiceJpaRepositoryImpl implements
|
||||
handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
|
||||
return CommandProcessingResult.empty();
|
||||
}catch (final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@ public class AccountNumberFormatWritePlatformServiceJpaRepositoryImpl implements
|
||||
handleDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
|
||||
return CommandProcessingResult.empty();
|
||||
} catch (final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ public class ImportHandlerUtils {
|
||||
|
||||
public static String trimEmptyDecimalPortion(String result) {
|
||||
if(result != null && result.endsWith(".0"))
|
||||
return result.split("\\.")[0];
|
||||
return result.split("\\.")[0];
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
+3
-3
@@ -177,9 +177,9 @@ public class ClientEntityImportHandler implements ImportHandler {
|
||||
addressList = new ArrayList<AddressData>(Arrays.asList(addressDataObj));
|
||||
}
|
||||
return ClientData.importClientEntityInstance(legalFormId,row.getRowNum(),name,officeId,clientTypeId,clientClassicationId,
|
||||
staffId, active, activationDate, submittedOn, externalId, incorportionDate, mobileNo,
|
||||
clientNonPersonData, addressList, locale, dateFormat);
|
||||
}
|
||||
staffId, active, activationDate, submittedOn, externalId, incorportionDate, mobileNo,
|
||||
clientNonPersonData, addressList, locale, dateFormat);
|
||||
}
|
||||
|
||||
public Count importEntity(String dateFormat) {
|
||||
Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_ENTITY_SHEET_NAME);
|
||||
|
||||
+3
-3
@@ -163,10 +163,10 @@ public class ClientPersonImportHandler implements ImportHandler {
|
||||
addressList = new ArrayList<AddressData>(Arrays.asList(addressDataObj));
|
||||
}
|
||||
return ClientData.importClientPersonInstance(legalFormId,row.getRowNum(),firstName,lastName,middleName,submittedOn,activationDate,active,externalId,
|
||||
officeId, staffId, mobileNo, dob, clientTypeId, genderId, clientClassicationId, isStaff,
|
||||
addressList, locale, dateFormat);
|
||||
officeId, staffId, mobileNo, dob, clientTypeId, genderId, clientClassicationId, isStaff,
|
||||
addressList, locale, dateFormat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Count importEntity(String dateFormat) {
|
||||
Sheet clientSheet=workbook.getSheet(TemplatePopulateImportConstants.CLIENT_PERSON_SHEET_NAME);
|
||||
|
||||
+15
-15
@@ -88,8 +88,8 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
}
|
||||
|
||||
protected void writeBigDecimal(int colIndex, Row row, BigDecimal value) {
|
||||
row.createCell(colIndex).setCellValue(((value != null) ? value.doubleValue() : 0));
|
||||
}
|
||||
row.createCell(colIndex).setCellValue(((value != null) ? value.doubleValue() : 0));
|
||||
}
|
||||
|
||||
protected void setOfficeDateLookupTable(Sheet sheet, List<OfficeData> offices, int officeNameCol,
|
||||
int activationDateCol,String dateFormat) {
|
||||
@@ -142,23 +142,23 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
|
||||
}
|
||||
}
|
||||
if (groups != null) {
|
||||
for (GroupGeneralData group : groups) {
|
||||
Row row = sheet.getRow(++rowIndex);
|
||||
if (row == null)
|
||||
row = sheet.createRow(rowIndex);
|
||||
writeString(nameCol, row, group.getName().replaceAll("[ )(] ", "_"));
|
||||
if (groups != null) {
|
||||
for (GroupGeneralData group : groups) {
|
||||
Row row = sheet.getRow(++rowIndex);
|
||||
if (row == null)
|
||||
row = sheet.createRow(rowIndex);
|
||||
writeString(nameCol, row, group.getName().replaceAll("[ )(] ", "_"));
|
||||
|
||||
if (group.getActivationDate() != null) {
|
||||
date = inputFormat.parse(group.getActivationDate().toString());
|
||||
writeDate(activationDateCol, row, outputFormat.format(date), dateCellStyle, dateFormat);
|
||||
}
|
||||
if (group.getActivationDate() != null) {
|
||||
date = inputFormat.parse(group.getActivationDate().toString());
|
||||
writeDate(activationDateCol, row, outputFormat.format(date), dateCellStyle, dateFormat);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+77
-77
@@ -31,93 +31,93 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CenterSheetPopulator extends AbstractWorkbookPopulator {
|
||||
private List<CenterData> allCenters;
|
||||
private List<OfficeData> offices;
|
||||
private List<CenterData> allCenters;
|
||||
private List<OfficeData> offices;
|
||||
|
||||
private Map<String, ArrayList<String>> officeToCenters;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfCenters;
|
||||
private Map<String, Long> centerNameToCenterId;
|
||||
private Map<String, ArrayList<String>> officeToCenters;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfCenters;
|
||||
private Map<String, Long> centerNameToCenterId;
|
||||
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int CENTER_NAME_COL = 1;
|
||||
private static final int CENTER_ID_COL = 2;
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int CENTER_NAME_COL = 1;
|
||||
private static final int CENTER_ID_COL = 2;
|
||||
|
||||
public CenterSheetPopulator(List<CenterData> centers, List<OfficeData> offices) {
|
||||
this.allCenters = centers;
|
||||
this.offices = offices;
|
||||
}
|
||||
public CenterSheetPopulator(List<CenterData> centers, List<OfficeData> offices) {
|
||||
this.allCenters = centers;
|
||||
this.offices = offices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet centerSheet = workbook.createSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME);
|
||||
setLayout(centerSheet);
|
||||
setOfficeToCentersMap();
|
||||
centerNameToCenterIdMap();
|
||||
populateCentersByOfficeName(centerSheet);
|
||||
centerSheet.protectSheet("");
|
||||
}
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet centerSheet = workbook.createSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME);
|
||||
setLayout(centerSheet);
|
||||
setOfficeToCentersMap();
|
||||
centerNameToCenterIdMap();
|
||||
populateCentersByOfficeName(centerSheet);
|
||||
centerSheet.protectSheet("");
|
||||
}
|
||||
|
||||
private void centerNameToCenterIdMap() {
|
||||
centerNameToCenterId = new HashMap<String, Long>();
|
||||
for (CenterData centerData : allCenters) {
|
||||
centerNameToCenterId.put(centerData.getName(), centerData.getId());
|
||||
}
|
||||
}
|
||||
private void centerNameToCenterIdMap() {
|
||||
centerNameToCenterId = new HashMap<String, Long>();
|
||||
for (CenterData centerData : allCenters) {
|
||||
centerNameToCenterId.put(centerData.getName(), centerData.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void populateCentersByOfficeName(Sheet centerSheet) {
|
||||
int rowIndex = 1, officeIndex = 0, startIndex = 1;
|
||||
officeNameToBeginEndIndexesOfCenters = new HashMap<Integer, Integer[]>();
|
||||
Row row = centerSheet.createRow(rowIndex);
|
||||
for (OfficeData office : offices) {
|
||||
startIndex = rowIndex + 1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> centersList = new ArrayList<String>();
|
||||
private void populateCentersByOfficeName(Sheet centerSheet) {
|
||||
int rowIndex = 1, officeIndex = 0, startIndex = 1;
|
||||
officeNameToBeginEndIndexesOfCenters = new HashMap<Integer, Integer[]>();
|
||||
Row row = centerSheet.createRow(rowIndex);
|
||||
for (OfficeData office : offices) {
|
||||
startIndex = rowIndex + 1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> centersList = new ArrayList<String>();
|
||||
|
||||
if (officeToCenters.containsKey(office.name().trim().replaceAll("[ )(]", "_"))){
|
||||
centersList = officeToCenters.get(office.name().trim().replaceAll("[ )(]", "_"));
|
||||
if (!centersList.isEmpty()) {
|
||||
for (String centerName : centersList) {
|
||||
writeString(CENTER_NAME_COL, row, centerName);
|
||||
writeLong(CENTER_ID_COL, row, centerNameToCenterId.get(centerName));
|
||||
row = centerSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfCenters.put(officeIndex++, new Integer[] { startIndex, rowIndex });
|
||||
} else {
|
||||
officeNameToBeginEndIndexesOfCenters.put(officeIndex++, new Integer[] { startIndex, rowIndex + 1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (officeToCenters.containsKey(office.name().trim().replaceAll("[ )(]", "_"))){
|
||||
centersList = officeToCenters.get(office.name().trim().replaceAll("[ )(]", "_"));
|
||||
if (!centersList.isEmpty()) {
|
||||
for (String centerName : centersList) {
|
||||
writeString(CENTER_NAME_COL, row, centerName);
|
||||
writeLong(CENTER_ID_COL, row, centerNameToCenterId.get(centerName));
|
||||
row = centerSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfCenters.put(officeIndex++, new Integer[] { startIndex, rowIndex });
|
||||
} else {
|
||||
officeNameToBeginEndIndexesOfCenters.put(officeIndex++, new Integer[] { startIndex, rowIndex + 1 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
|
||||
private void setOfficeToCentersMap() {
|
||||
officeToCenters = new HashMap<>();
|
||||
for (CenterData center : allCenters) {
|
||||
add(center.getOfficeName().trim().replaceAll("[ )(]", "_"), center.getName().trim());
|
||||
}
|
||||
}
|
||||
private void setOfficeToCentersMap() {
|
||||
officeToCenters = new HashMap<>();
|
||||
for (CenterData center : allCenters) {
|
||||
add(center.getOfficeName().trim().replaceAll("[ )(]", "_"), center.getName().trim());
|
||||
}
|
||||
}
|
||||
|
||||
// Guava Multi-map can reduce this.
|
||||
private void add(String key, String value) {
|
||||
ArrayList<String> values = officeToCenters.get(key);
|
||||
if (values == null) {
|
||||
values = new ArrayList<>();
|
||||
}
|
||||
values.add(value);
|
||||
officeToCenters.put(key, values);
|
||||
}
|
||||
// Guava Multi-map can reduce this.
|
||||
private void add(String key, String value) {
|
||||
ArrayList<String> values = officeToCenters.get(key);
|
||||
if (values == null) {
|
||||
values = new ArrayList<>();
|
||||
}
|
||||
values.add(value);
|
||||
officeToCenters.put(key, values);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer[]> getOfficeNameToBeginEndIndexesOfCenters() {
|
||||
return officeNameToBeginEndIndexesOfCenters;
|
||||
}
|
||||
public Map<Integer, Integer[]> getOfficeNameToBeginEndIndexesOfCenters() {
|
||||
return officeNameToBeginEndIndexesOfCenters;
|
||||
}
|
||||
|
||||
}
|
||||
+95
-95
@@ -31,114 +31,114 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientSheetPopulator extends AbstractWorkbookPopulator {
|
||||
private List<ClientData> allClients;
|
||||
private List<OfficeData> officesDataList;
|
||||
private List<ClientData> allClients;
|
||||
private List<OfficeData> officesDataList;
|
||||
|
||||
private Map<String, ArrayList<String>> officeToClients;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfClients;
|
||||
private Map<String, Long> clientNameToClientId;
|
||||
private Map<String, Long> clientNameToSavingsAccountIds;
|
||||
private Map<String, ArrayList<String>> officeToClients;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfClients;
|
||||
private Map<String, Long> clientNameToClientId;
|
||||
private Map<String, Long> clientNameToSavingsAccountIds;
|
||||
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int CLIENT_NAME_COL = 1;
|
||||
private static final int CLIENT_ID_COL = 2;
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int CLIENT_NAME_COL = 1;
|
||||
private static final int CLIENT_ID_COL = 2;
|
||||
|
||||
public ClientSheetPopulator(final List<ClientData> clients, final List<OfficeData> Offices) {
|
||||
this.allClients = clients;
|
||||
this.officesDataList = Offices;
|
||||
}
|
||||
public ClientSheetPopulator(final List<ClientData> clients, final List<OfficeData> Offices) {
|
||||
this.allClients = clients;
|
||||
this.officesDataList = Offices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet clientSheet = workbook.createSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME);
|
||||
setLayout(clientSheet);
|
||||
setOfficeToClientsMap();
|
||||
setClientNameToClientIdMap();
|
||||
populateClientsByOfficeName(clientSheet);
|
||||
clientSheet.protectSheet("");
|
||||
setClientNameToSavingsAccountsIdsMap();
|
||||
}
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet clientSheet = workbook.createSheet(TemplatePopulateImportConstants.CLIENT_SHEET_NAME);
|
||||
setLayout(clientSheet);
|
||||
setOfficeToClientsMap();
|
||||
setClientNameToClientIdMap();
|
||||
populateClientsByOfficeName(clientSheet);
|
||||
clientSheet.protectSheet("");
|
||||
setClientNameToSavingsAccountsIdsMap();
|
||||
}
|
||||
|
||||
private void setClientNameToClientIdMap() {
|
||||
clientNameToClientId = new HashMap<>();
|
||||
for (ClientData clientData : allClients) {
|
||||
clientNameToClientId.put(clientData.displayName().trim() + "(" + clientData.id() + ")",
|
||||
clientData.id());
|
||||
}
|
||||
}
|
||||
private void setClientNameToClientIdMap() {
|
||||
clientNameToClientId = new HashMap<>();
|
||||
for (ClientData clientData : allClients) {
|
||||
clientNameToClientId.put(clientData.displayName().trim() + "(" + clientData.id() + ")",
|
||||
clientData.id());
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
private void setLayout(Sheet worksheet) {
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
|
||||
private void setOfficeToClientsMap() {
|
||||
officeToClients = new HashMap<>();
|
||||
for (ClientData person : allClients) {
|
||||
addToOfficeClientMap(person.getOfficeName().trim().replaceAll("[ )(]", "_"),
|
||||
person.displayName().trim() + "(" + person.id() + ")");
|
||||
}
|
||||
}
|
||||
private void setOfficeToClientsMap() {
|
||||
officeToClients = new HashMap<>();
|
||||
for (ClientData person : allClients) {
|
||||
addToOfficeClientMap(person.getOfficeName().trim().replaceAll("[ )(]", "_"),
|
||||
person.displayName().trim() + "(" + person.id() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
private void setClientNameToSavingsAccountsIdsMap(){
|
||||
clientNameToSavingsAccountIds=new HashMap<>();
|
||||
for (ClientData client: allClients) {
|
||||
clientNameToSavingsAccountIds.put(client.displayName().trim() + "(" + client.id() + ")",client.getSavingsAccountId());
|
||||
}
|
||||
private void setClientNameToSavingsAccountsIdsMap(){
|
||||
clientNameToSavingsAccountIds=new HashMap<>();
|
||||
for (ClientData client: allClients) {
|
||||
clientNameToSavingsAccountIds.put(client.displayName().trim() + "(" + client.id() + ")",client.getSavingsAccountId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Guava Multi-map can reduce this.
|
||||
private void addToOfficeClientMap(String key, String value) {
|
||||
ArrayList<String> values = officeToClients.get(key);
|
||||
if (values == null) {
|
||||
values = new ArrayList<String>();
|
||||
}
|
||||
values.add(value);
|
||||
officeToClients.put(key, values);
|
||||
}
|
||||
// Guava Multi-map can reduce this.
|
||||
private void addToOfficeClientMap(String key, String value) {
|
||||
ArrayList<String> values = officeToClients.get(key);
|
||||
if (values == null) {
|
||||
values = new ArrayList<String>();
|
||||
}
|
||||
values.add(value);
|
||||
officeToClients.put(key, values);
|
||||
}
|
||||
|
||||
private void populateClientsByOfficeName(Sheet clientSheet) {
|
||||
int rowIndex = 1, startIndex = 1, officeIndex = 0;
|
||||
officeNameToBeginEndIndexesOfClients = new HashMap<>();
|
||||
Row row = clientSheet.createRow(rowIndex);
|
||||
for (OfficeData office : officesDataList) {
|
||||
startIndex = rowIndex + 1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> clientList = new ArrayList<String>();
|
||||
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);
|
||||
writeLong(CLIENT_ID_COL, row, clientNameToClientId.get(clientName));
|
||||
row = clientSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfClients.put(officeIndex++, new Integer[] { startIndex, rowIndex });
|
||||
} else
|
||||
officeIndex++;
|
||||
}
|
||||
}
|
||||
private void populateClientsByOfficeName(Sheet clientSheet) {
|
||||
int rowIndex = 1, startIndex = 1, officeIndex = 0;
|
||||
officeNameToBeginEndIndexesOfClients = new HashMap<>();
|
||||
Row row = clientSheet.createRow(rowIndex);
|
||||
for (OfficeData office : officesDataList) {
|
||||
startIndex = rowIndex + 1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> clientList = new ArrayList<String>();
|
||||
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);
|
||||
writeLong(CLIENT_ID_COL, row, clientNameToClientId.get(clientName));
|
||||
row = clientSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfClients.put(officeIndex++, new Integer[] { startIndex, rowIndex });
|
||||
} else
|
||||
officeIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ClientData> getClients() {
|
||||
return allClients;
|
||||
}
|
||||
public List<ClientData> getClients() {
|
||||
return allClients;
|
||||
}
|
||||
|
||||
public Integer getClientsSize() {
|
||||
return allClients.size();
|
||||
}
|
||||
public Integer getClientsSize() {
|
||||
return allClients.size();
|
||||
}
|
||||
|
||||
public Map<Integer, Integer[]> getOfficeNameToBeginEndIndexesOfClients() {
|
||||
return officeNameToBeginEndIndexesOfClients;
|
||||
}
|
||||
public Map<Integer, Integer[]> getOfficeNameToBeginEndIndexesOfClients() {
|
||||
return officeNameToBeginEndIndexesOfClients;
|
||||
}
|
||||
|
||||
public Map<String, Long> getClientNameToSavingsAccountIds() {
|
||||
return clientNameToSavingsAccountIds;
|
||||
}
|
||||
public Map<String, Long> getClientNameToSavingsAccountIds() {
|
||||
return clientNameToSavingsAccountIds;
|
||||
}
|
||||
}
|
||||
+75
-75
@@ -30,87 +30,87 @@ import java.util.List;
|
||||
|
||||
public class ExtrasSheetPopulator extends AbstractWorkbookPopulator {
|
||||
|
||||
private List<FundData> funds;
|
||||
private List<PaymentTypeData> paymentTypes;
|
||||
private List<CurrencyData> currencies;
|
||||
private List<FundData> funds;
|
||||
private List<PaymentTypeData> paymentTypes;
|
||||
private List<CurrencyData> currencies;
|
||||
|
||||
private static final int FUND_ID_COL = 0;
|
||||
private static final int FUND_NAME_COL = 1;
|
||||
private static final int PAYMENT_TYPE_ID_COL = 2;
|
||||
private static final int PAYMENT_TYPE_NAME_COL = 3;
|
||||
private static final int CURRENCY_CODE_COL = 4;
|
||||
private static final int CURRENCY_NAME_COL = 5;
|
||||
private static final int FUND_ID_COL = 0;
|
||||
private static final int FUND_NAME_COL = 1;
|
||||
private static final int PAYMENT_TYPE_ID_COL = 2;
|
||||
private static final int PAYMENT_TYPE_NAME_COL = 3;
|
||||
private static final int CURRENCY_CODE_COL = 4;
|
||||
private static final int CURRENCY_NAME_COL = 5;
|
||||
|
||||
|
||||
public ExtrasSheetPopulator(List<FundData> funds, List<PaymentTypeData> paymentTypes,
|
||||
List<CurrencyData> currencies) {
|
||||
this.funds = funds;
|
||||
this.paymentTypes = paymentTypes;
|
||||
this.currencies = currencies;
|
||||
}
|
||||
|
||||
public ExtrasSheetPopulator(List<FundData> funds, List<PaymentTypeData> paymentTypes,
|
||||
List<CurrencyData> currencies) {
|
||||
this.funds = funds;
|
||||
this.paymentTypes = paymentTypes;
|
||||
this.currencies = currencies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int fundRowIndex = 1;
|
||||
Sheet extrasSheet = workbook.createSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME);
|
||||
setLayout(extrasSheet);
|
||||
for (FundData fund : funds) {
|
||||
Row row = extrasSheet.createRow(fundRowIndex++);
|
||||
writeLong(FUND_ID_COL, row, fund.getId());
|
||||
writeString(FUND_NAME_COL, row, fund.getName());
|
||||
}
|
||||
int paymentTypeRowIndex = 1;
|
||||
for (PaymentTypeData paymentType : paymentTypes) {
|
||||
Row row;
|
||||
if (paymentTypeRowIndex < fundRowIndex)
|
||||
row = extrasSheet.getRow(paymentTypeRowIndex++);
|
||||
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)
|
||||
row = extrasSheet.getRow(currencyCodeRowIndex++);
|
||||
else
|
||||
row = extrasSheet.createRow(currencyCodeRowIndex++);
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int fundRowIndex = 1;
|
||||
Sheet extrasSheet = workbook.createSheet(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME);
|
||||
setLayout(extrasSheet);
|
||||
for (FundData fund : funds) {
|
||||
Row row = extrasSheet.createRow(fundRowIndex++);
|
||||
writeLong(FUND_ID_COL, row, fund.getId());
|
||||
writeString(FUND_NAME_COL, row, fund.getName());
|
||||
}
|
||||
int paymentTypeRowIndex = 1;
|
||||
for (PaymentTypeData paymentType : paymentTypes) {
|
||||
Row row;
|
||||
if (paymentTypeRowIndex < fundRowIndex)
|
||||
row = extrasSheet.getRow(paymentTypeRowIndex++);
|
||||
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)
|
||||
row = extrasSheet.getRow(currencyCodeRowIndex++);
|
||||
else
|
||||
row = extrasSheet.createRow(currencyCodeRowIndex++);
|
||||
|
||||
writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_"));
|
||||
writeString(CURRENCY_CODE_COL, row, currencies.code());
|
||||
}
|
||||
extrasSheet.protectSheet("");
|
||||
writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_"));
|
||||
writeString(CURRENCY_CODE_COL, row, currencies.code());
|
||||
}
|
||||
extrasSheet.protectSheet("");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(FUND_ID_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(FUND_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(PAYMENT_TYPE_ID_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(PAYMENT_TYPE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CURRENCY_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CURRENCY_CODE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(FUND_ID_COL, rowHeader, "Fund ID");
|
||||
writeString(FUND_NAME_COL, rowHeader, "Name");
|
||||
writeString(PAYMENT_TYPE_ID_COL, rowHeader, "Payment Type ID");
|
||||
writeString(PAYMENT_TYPE_NAME_COL, rowHeader, "Payment Type Name");
|
||||
writeString(CURRENCY_NAME_COL, rowHeader, "Currency Type ");
|
||||
writeString(CURRENCY_CODE_COL, rowHeader, "Currency Code ");
|
||||
}
|
||||
public Integer getFundsSize() {
|
||||
return funds.size();
|
||||
}
|
||||
public Integer getPaymentTypesSize() {
|
||||
return paymentTypes.size();
|
||||
}
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(FUND_ID_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(FUND_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(PAYMENT_TYPE_ID_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(PAYMENT_TYPE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CURRENCY_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CURRENCY_CODE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(FUND_ID_COL, rowHeader, "Fund ID");
|
||||
writeString(FUND_NAME_COL, rowHeader, "Name");
|
||||
writeString(PAYMENT_TYPE_ID_COL, rowHeader, "Payment Type ID");
|
||||
writeString(PAYMENT_TYPE_NAME_COL, rowHeader, "Payment Type Name");
|
||||
writeString(CURRENCY_NAME_COL, rowHeader, "Currency Type ");
|
||||
writeString(CURRENCY_CODE_COL, rowHeader, "Currency Code ");
|
||||
}
|
||||
public Integer getFundsSize() {
|
||||
return funds.size();
|
||||
}
|
||||
public Integer getPaymentTypesSize() {
|
||||
return paymentTypes.size();
|
||||
}
|
||||
|
||||
public Integer getCurrenciesSize() {
|
||||
return currencies.size();
|
||||
}
|
||||
public Integer getCurrenciesSize() {
|
||||
return currencies.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+33
-33
@@ -27,45 +27,45 @@ import org.apache.poi.ss.usermodel.Workbook;
|
||||
import java.util.List;
|
||||
|
||||
public class GlAccountSheetPopulator extends AbstractWorkbookPopulator {
|
||||
private List<GLAccountData> allGlAccounts;
|
||||
private List<GLAccountData> allGlAccounts;
|
||||
|
||||
private static final int ID_COL = 0;
|
||||
private static final int ACCOUNT_NAME_COL = 1;
|
||||
private static final int ID_COL = 0;
|
||||
private static final int ACCOUNT_NAME_COL = 1;
|
||||
|
||||
public GlAccountSheetPopulator(List<GLAccountData> glAccounts) {
|
||||
this.allGlAccounts = glAccounts;
|
||||
}
|
||||
public GlAccountSheetPopulator(List<GLAccountData> glAccounts) {
|
||||
this.allGlAccounts = glAccounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Sheet glAccountSheet = workbook.createSheet(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME);
|
||||
setLayout(glAccountSheet);
|
||||
populateglAccounts(glAccountSheet, rowIndex);
|
||||
glAccountSheet.protectSheet("");
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Sheet glAccountSheet = workbook.createSheet(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME);
|
||||
setLayout(glAccountSheet);
|
||||
populateglAccounts(glAccountSheet, rowIndex);
|
||||
glAccountSheet.protectSheet("");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(ACCOUNT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(ID_COL, rowHeader, "Gl Account ID");
|
||||
writeString(ACCOUNT_NAME_COL, rowHeader, "Gl Account Name");
|
||||
}
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(ACCOUNT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(ID_COL, rowHeader, "Gl Account ID");
|
||||
writeString(ACCOUNT_NAME_COL, rowHeader, "Gl Account Name");
|
||||
}
|
||||
|
||||
private void populateglAccounts(Sheet GlAccountSheet, int rowIndex) {
|
||||
for (GLAccountData glAccount : allGlAccounts) {
|
||||
Row row = GlAccountSheet.createRow(rowIndex);
|
||||
writeLong(ID_COL, row, glAccount.getId());
|
||||
writeString(ACCOUNT_NAME_COL, row, glAccount.getName().trim().replaceAll("[ )(]", "_"));
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
private void populateglAccounts(Sheet GlAccountSheet, int rowIndex) {
|
||||
for (GLAccountData glAccount : allGlAccounts) {
|
||||
Row row = GlAccountSheet.createRow(rowIndex);
|
||||
writeLong(ID_COL, row, glAccount.getId());
|
||||
writeString(ACCOUNT_NAME_COL, row, glAccount.getName().trim().replaceAll("[ )(]", "_"));
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getGlAccountNamesSize() {
|
||||
return allGlAccounts.size();
|
||||
}
|
||||
public Integer getGlAccountNamesSize() {
|
||||
return allGlAccounts.size();
|
||||
}
|
||||
|
||||
}
|
||||
+68
-68
@@ -32,49 +32,49 @@ import java.util.Map;
|
||||
|
||||
|
||||
public class GroupSheetPopulator extends AbstractWorkbookPopulator {
|
||||
private List<GroupGeneralData> groups;
|
||||
private List<OfficeData> offices;
|
||||
|
||||
private Map<String, ArrayList<String>> officeToGroups;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfGroups;
|
||||
private Map<String,Long> groupNameToGroupId;
|
||||
private List<GroupGeneralData> groups;
|
||||
private List<OfficeData> offices;
|
||||
|
||||
private Map<String, ArrayList<String>> officeToGroups;
|
||||
private Map<Integer, Integer[]> officeNameToBeginEndIndexesOfGroups;
|
||||
private Map<String,Long> groupNameToGroupId;
|
||||
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int GROUP_NAME_COL = 1;
|
||||
private static final int GROUP_ID_COL = 2;
|
||||
private static final int OFFICE_NAME_COL = 0;
|
||||
private static final int GROUP_NAME_COL = 1;
|
||||
private static final int GROUP_ID_COL = 2;
|
||||
|
||||
public GroupSheetPopulator(final List<GroupGeneralData> groups, final List<OfficeData> offices) {
|
||||
this.groups = groups;
|
||||
this.offices = offices;
|
||||
}
|
||||
public GroupSheetPopulator(final List<GroupGeneralData> groups, final List<OfficeData> offices) {
|
||||
this.groups = groups;
|
||||
this.offices = offices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet groupSheet = workbook.createSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME);
|
||||
setLayout(groupSheet);
|
||||
setGroupNameToGroupIdMap();
|
||||
setOfficeToGroupsMap();
|
||||
populateGroupsByOfficeName(groupSheet);
|
||||
groupSheet.protectSheet("");
|
||||
}
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet groupSheet = workbook.createSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME);
|
||||
setLayout(groupSheet);
|
||||
setGroupNameToGroupIdMap();
|
||||
setOfficeToGroupsMap();
|
||||
populateGroupsByOfficeName(groupSheet);
|
||||
groupSheet.protectSheet("");
|
||||
}
|
||||
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
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++)
|
||||
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");
|
||||
}
|
||||
|
||||
private void setOfficeToGroupsMap() {
|
||||
officeToGroups = new HashMap<>();
|
||||
for (GroupGeneralData group : groups) {
|
||||
add(group.getOfficeName().trim().replaceAll("[ )(]", "_"), group.getName().trim());
|
||||
}
|
||||
}
|
||||
//Guava Multi-map can reduce this.
|
||||
private void setOfficeToGroupsMap() {
|
||||
officeToGroups = new HashMap<>();
|
||||
for (GroupGeneralData group : groups) {
|
||||
add(group.getOfficeName().trim().replaceAll("[ )(]", "_"), group.getName().trim());
|
||||
}
|
||||
}
|
||||
//Guava Multi-map can reduce this.
|
||||
private void add(String key, String value) {
|
||||
ArrayList<String> values = officeToGroups.get(key);
|
||||
if (values == null) {
|
||||
@@ -84,43 +84,43 @@ public class GroupSheetPopulator extends AbstractWorkbookPopulator {
|
||||
officeToGroups.put(key, values);
|
||||
}
|
||||
private void populateGroupsByOfficeName(Sheet groupSheet) {
|
||||
int rowIndex = 1, officeIndex = 0, startIndex = 1;
|
||||
officeNameToBeginEndIndexesOfGroups = new HashMap<>();
|
||||
Row row = groupSheet.createRow(rowIndex);
|
||||
for(OfficeData office : offices) {
|
||||
startIndex = rowIndex+1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> groupsList = new ArrayList<>();
|
||||
|
||||
if(officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_")))
|
||||
groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_"));
|
||||
|
||||
if(!groupsList.isEmpty()) {
|
||||
for(String groupName : groupsList) {
|
||||
writeString(GROUP_NAME_COL, row, groupName);
|
||||
writeLong(GROUP_ID_COL, row, groupNameToGroupId.get(groupName));
|
||||
row = groupSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfGroups.put(officeIndex++, new Integer[]{startIndex, rowIndex});
|
||||
}
|
||||
else {
|
||||
officeNameToBeginEndIndexesOfGroups.put(officeIndex++, new Integer[]{startIndex, rowIndex+1});
|
||||
}
|
||||
}
|
||||
int rowIndex = 1, officeIndex = 0, startIndex = 1;
|
||||
officeNameToBeginEndIndexesOfGroups = new HashMap<>();
|
||||
Row row = groupSheet.createRow(rowIndex);
|
||||
for(OfficeData office : offices) {
|
||||
startIndex = rowIndex+1;
|
||||
writeString(OFFICE_NAME_COL, row, office.name());
|
||||
ArrayList<String> groupsList = new ArrayList<>();
|
||||
|
||||
if(officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_")))
|
||||
groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_"));
|
||||
|
||||
if(!groupsList.isEmpty()) {
|
||||
for(String groupName : groupsList) {
|
||||
writeString(GROUP_NAME_COL, row, groupName);
|
||||
writeLong(GROUP_ID_COL, row, groupNameToGroupId.get(groupName));
|
||||
row = groupSheet.createRow(++rowIndex);
|
||||
}
|
||||
officeNameToBeginEndIndexesOfGroups.put(officeIndex++, new Integer[]{startIndex, rowIndex});
|
||||
}
|
||||
else {
|
||||
officeNameToBeginEndIndexesOfGroups.put(officeIndex++, new Integer[]{startIndex, rowIndex+1});
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<GroupGeneralData> getGroups() {
|
||||
return groups;
|
||||
return groups;
|
||||
}
|
||||
public Integer getGroupsSize() {
|
||||
return groups.size();
|
||||
return groups.size();
|
||||
}
|
||||
public Map<Integer, Integer[]> getOfficeNameToBeginEndIndexesOfGroups() {
|
||||
return officeNameToBeginEndIndexesOfGroups;
|
||||
return officeNameToBeginEndIndexesOfGroups;
|
||||
}
|
||||
private void setGroupNameToGroupIdMap(){
|
||||
groupNameToGroupId=new HashMap<String,Long>();
|
||||
for (GroupGeneralData group : groups) {
|
||||
groupNameToGroupId.put(group.getName().trim(), group.getId());
|
||||
}
|
||||
groupNameToGroupId=new HashMap<String,Long>();
|
||||
for (GroupGeneralData group : groups) {
|
||||
groupNameToGroupId.put(group.getName().trim(), group.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
+161
-161
@@ -30,170 +30,170 @@ import java.util.List;
|
||||
|
||||
public class LoanProductSheetPopulator extends AbstractWorkbookPopulator {
|
||||
|
||||
private List<LoanProductData> products;
|
||||
|
||||
private static final int ID_COL = 0;
|
||||
private static final int NAME_COL = 1;
|
||||
private static final int FUND_NAME_COL = 2;
|
||||
private static final int PRINCIPAL_COL = 3;
|
||||
private static final int MIN_PRINCIPAL_COL = 4;
|
||||
private static final int MAX_PRINCIPAL_COL = 5;
|
||||
private static final int NO_OF_REPAYMENTS_COL = 6;
|
||||
private static final int MIN_REPAYMENTS_COL = 7;
|
||||
private static final int MAX_REPAYMENTS_COL = 8;
|
||||
private static final int REPAYMENT_EVERY_COL = 9;
|
||||
private static final int REPAYMENT_FREQUENCY_COL = 10;
|
||||
private static final int INTEREST_RATE_COL = 11;
|
||||
private static final int MIN_INTEREST_RATE_COL = 12;
|
||||
private static final int MAX_INTEREST_RATE_COL = 13;
|
||||
private static final int INTEREST_RATE_FREQUENCY_COL = 14;
|
||||
private static final int AMORTIZATION_TYPE_COL = 15;
|
||||
private static final int INTEREST_TYPE_COL = 16;
|
||||
private static final int INTEREST_CALCULATION_PERIOD_TYPE_COL = 17;
|
||||
private static final int IN_ARREARS_TOLERANCE_COL = 18;
|
||||
private static final int TRANSACTION_PROCESSING_STRATEGY_NAME_COL = 19;
|
||||
private static final int GRACE_ON_PRINCIPAL_PAYMENT_COL = 20;
|
||||
private static final int GRACE_ON_INTEREST_PAYMENT_COL = 21;
|
||||
private static final int GRACE_ON_INTEREST_CHARGED_COL = 22;
|
||||
private static final int START_DATE_COL = 23;
|
||||
private static final int CLOSE_DATE_COL = 24;
|
||||
private List<LoanProductData> products;
|
||||
|
||||
private static final int ID_COL = 0;
|
||||
private static final int NAME_COL = 1;
|
||||
private static final int FUND_NAME_COL = 2;
|
||||
private static final int PRINCIPAL_COL = 3;
|
||||
private static final int MIN_PRINCIPAL_COL = 4;
|
||||
private static final int MAX_PRINCIPAL_COL = 5;
|
||||
private static final int NO_OF_REPAYMENTS_COL = 6;
|
||||
private static final int MIN_REPAYMENTS_COL = 7;
|
||||
private static final int MAX_REPAYMENTS_COL = 8;
|
||||
private static final int REPAYMENT_EVERY_COL = 9;
|
||||
private static final int REPAYMENT_FREQUENCY_COL = 10;
|
||||
private static final int INTEREST_RATE_COL = 11;
|
||||
private static final int MIN_INTEREST_RATE_COL = 12;
|
||||
private static final int MAX_INTEREST_RATE_COL = 13;
|
||||
private static final int INTEREST_RATE_FREQUENCY_COL = 14;
|
||||
private static final int AMORTIZATION_TYPE_COL = 15;
|
||||
private static final int INTEREST_TYPE_COL = 16;
|
||||
private static final int INTEREST_CALCULATION_PERIOD_TYPE_COL = 17;
|
||||
private static final int IN_ARREARS_TOLERANCE_COL = 18;
|
||||
private static final int TRANSACTION_PROCESSING_STRATEGY_NAME_COL = 19;
|
||||
private static final int GRACE_ON_PRINCIPAL_PAYMENT_COL = 20;
|
||||
private static final int GRACE_ON_INTEREST_PAYMENT_COL = 21;
|
||||
private static final int GRACE_ON_INTEREST_CHARGED_COL = 22;
|
||||
private static final int START_DATE_COL = 23;
|
||||
private static final int CLOSE_DATE_COL = 24;
|
||||
|
||||
|
||||
|
||||
public LoanProductSheetPopulator(List<LoanProductData> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
|
||||
public LoanProductSheetPopulator(List<LoanProductData> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Sheet productSheet = workbook.createSheet(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME);
|
||||
setLayout(productSheet);
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
for (LoanProductData product : products) {
|
||||
Row row = productSheet.createRow(rowIndex++);
|
||||
writeLong(ID_COL, row, product.getId());
|
||||
writeString(NAME_COL, row, product.getName().trim().replaceAll("[ )(]", "_"));
|
||||
if (product.getFundName() != null)
|
||||
writeString(FUND_NAME_COL, row, product.getFundName());
|
||||
writeBigDecimal(PRINCIPAL_COL, row, product.getPrincipal());
|
||||
if (product.getMinPrincipal() != null)
|
||||
writeBigDecimal(MIN_PRINCIPAL_COL, row, product.getMinPrincipal());
|
||||
else
|
||||
writeInt(MIN_PRINCIPAL_COL, row, 1);
|
||||
if (product.getMaxPrincipal() != null)
|
||||
writeBigDecimal(MAX_PRINCIPAL_COL, row, product.getMaxPrincipal());
|
||||
else
|
||||
writeInt(MAX_PRINCIPAL_COL, row, 999999999);
|
||||
writeInt(NO_OF_REPAYMENTS_COL, row, product.getNumberOfRepayments());
|
||||
if (product.getMinNumberOfRepayments() != null)
|
||||
writeInt(MIN_REPAYMENTS_COL, row, product.getMinNumberOfRepayments());
|
||||
else
|
||||
writeInt(MIN_REPAYMENTS_COL, row, 1);
|
||||
if (product.getMaxNumberOfRepayments() != null)
|
||||
writeInt(MAX_REPAYMENTS_COL, row, product.getMaxNumberOfRepayments());
|
||||
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)
|
||||
writeBigDecimal(MIN_INTEREST_RATE_COL, row, product.getMinInterestRatePerPeriod());
|
||||
else
|
||||
writeInt(MIN_INTEREST_RATE_COL, row, 1);
|
||||
if (product.getMaxInterestRatePerPeriod() != null)
|
||||
writeBigDecimal(MAX_INTEREST_RATE_COL, row, product.getMaxInterestRatePerPeriod());
|
||||
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)
|
||||
writeBigDecimal(IN_ARREARS_TOLERANCE_COL, row, product.getInArrearsTolerance());
|
||||
writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, row, product.getTransactionProcessingStrategyName());
|
||||
if (product.getGraceOnPrincipalPayment() != null)
|
||||
writeInt(GRACE_ON_PRINCIPAL_PAYMENT_COL, row, product.getGraceOnPrincipalPayment());
|
||||
if (product.getGraceOnInterestPayment() != null)
|
||||
writeInt(GRACE_ON_INTEREST_PAYMENT_COL, row, product.getGraceOnInterestPayment());
|
||||
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);
|
||||
productSheet.protectSheet("");
|
||||
}
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Sheet productSheet = workbook.createSheet(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME);
|
||||
setLayout(productSheet);
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
for (LoanProductData product : products) {
|
||||
Row row = productSheet.createRow(rowIndex++);
|
||||
writeLong(ID_COL, row, product.getId());
|
||||
writeString(NAME_COL, row, product.getName().trim().replaceAll("[ )(]", "_"));
|
||||
if (product.getFundName() != null)
|
||||
writeString(FUND_NAME_COL, row, product.getFundName());
|
||||
writeBigDecimal(PRINCIPAL_COL, row, product.getPrincipal());
|
||||
if (product.getMinPrincipal() != null)
|
||||
writeBigDecimal(MIN_PRINCIPAL_COL, row, product.getMinPrincipal());
|
||||
else
|
||||
writeInt(MIN_PRINCIPAL_COL, row, 1);
|
||||
if (product.getMaxPrincipal() != null)
|
||||
writeBigDecimal(MAX_PRINCIPAL_COL, row, product.getMaxPrincipal());
|
||||
else
|
||||
writeInt(MAX_PRINCIPAL_COL, row, 999999999);
|
||||
writeInt(NO_OF_REPAYMENTS_COL, row, product.getNumberOfRepayments());
|
||||
if (product.getMinNumberOfRepayments() != null)
|
||||
writeInt(MIN_REPAYMENTS_COL, row, product.getMinNumberOfRepayments());
|
||||
else
|
||||
writeInt(MIN_REPAYMENTS_COL, row, 1);
|
||||
if (product.getMaxNumberOfRepayments() != null)
|
||||
writeInt(MAX_REPAYMENTS_COL, row, product.getMaxNumberOfRepayments());
|
||||
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)
|
||||
writeBigDecimal(MIN_INTEREST_RATE_COL, row, product.getMinInterestRatePerPeriod());
|
||||
else
|
||||
writeInt(MIN_INTEREST_RATE_COL, row, 1);
|
||||
if (product.getMaxInterestRatePerPeriod() != null)
|
||||
writeBigDecimal(MAX_INTEREST_RATE_COL, row, product.getMaxInterestRatePerPeriod());
|
||||
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)
|
||||
writeBigDecimal(IN_ARREARS_TOLERANCE_COL, row, product.getInArrearsTolerance());
|
||||
writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, row, product.getTransactionProcessingStrategyName());
|
||||
if (product.getGraceOnPrincipalPayment() != null)
|
||||
writeInt(GRACE_ON_PRINCIPAL_PAYMENT_COL, row, product.getGraceOnPrincipalPayment());
|
||||
if (product.getGraceOnInterestPayment() != null)
|
||||
writeInt(GRACE_ON_INTEREST_PAYMENT_COL, row, product.getGraceOnInterestPayment());
|
||||
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);
|
||||
productSheet.protectSheet("");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(FUND_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(NO_OF_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(REPAYMENT_EVERY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(REPAYMENT_FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_RATE_FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(AMORTIZATION_TYPE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_CALCULATION_PERIOD_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(IN_ARREARS_TOLERANCE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_PRINCIPAL_PAYMENT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_INTEREST_PAYMENT_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_INTEREST_CHARGED_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(START_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CLOSE_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
private void setLayout(Sheet worksheet) {
|
||||
worksheet.setColumnWidth(ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(FUND_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(NO_OF_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_REPAYMENTS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(REPAYMENT_EVERY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(REPAYMENT_FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MIN_INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(MAX_INTEREST_RATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_RATE_FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(AMORTIZATION_TYPE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(INTEREST_CALCULATION_PERIOD_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(IN_ARREARS_TOLERANCE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_PRINCIPAL_PAYMENT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_INTEREST_PAYMENT_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GRACE_ON_INTEREST_CHARGED_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(START_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CLOSE_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(ID_COL, rowHeader, "ID");
|
||||
writeString(NAME_COL, rowHeader, "Name");
|
||||
writeString(FUND_NAME_COL, rowHeader, "Fund");
|
||||
writeString(PRINCIPAL_COL, rowHeader, "Principal");
|
||||
writeString(MIN_PRINCIPAL_COL, rowHeader, "Min Principal");
|
||||
writeString(MAX_PRINCIPAL_COL, rowHeader, "Max Principal");
|
||||
writeString(NO_OF_REPAYMENTS_COL, rowHeader, "# of Repayments");
|
||||
writeString(MIN_REPAYMENTS_COL, rowHeader, "Min Repayments");
|
||||
writeString(MAX_REPAYMENTS_COL, rowHeader, "Max Repayments");
|
||||
writeString(REPAYMENT_EVERY_COL, rowHeader, "Repayment Every");
|
||||
writeString(REPAYMENT_FREQUENCY_COL, rowHeader, "Frequency");
|
||||
writeString(INTEREST_RATE_COL, rowHeader, "Interest");
|
||||
writeString(MIN_INTEREST_RATE_COL, rowHeader, "Min Interest");
|
||||
writeString(MAX_INTEREST_RATE_COL, rowHeader, "Max Interest");
|
||||
writeString(INTEREST_RATE_FREQUENCY_COL, rowHeader, "Frequency");
|
||||
writeString(AMORTIZATION_TYPE_COL, rowHeader, "Amortization Type");
|
||||
writeString(INTEREST_TYPE_COL, rowHeader, "Interest Type");
|
||||
writeString(INTEREST_CALCULATION_PERIOD_TYPE_COL, rowHeader, "Interest Calculation Period");
|
||||
writeString(IN_ARREARS_TOLERANCE_COL, rowHeader, "In Arrears Tolerance");
|
||||
writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, rowHeader, "Transaction Processing Strategy");
|
||||
writeString(GRACE_ON_PRINCIPAL_PAYMENT_COL, rowHeader, "Grace On Principal Payment");
|
||||
writeString(GRACE_ON_INTEREST_PAYMENT_COL, rowHeader, "Grace on Interest Payment");
|
||||
writeString(GRACE_ON_INTEREST_CHARGED_COL, rowHeader, "Grace on Interest Charged");
|
||||
writeString(START_DATE_COL, rowHeader, "Start Date");
|
||||
writeString(CLOSE_DATE_COL, rowHeader, "End Date");
|
||||
}
|
||||
public List<LoanProductData> getProducts(){
|
||||
return products;
|
||||
|
||||
}
|
||||
public Integer getProductsSize() {
|
||||
return products.size();
|
||||
}
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
writeString(ID_COL, rowHeader, "ID");
|
||||
writeString(NAME_COL, rowHeader, "Name");
|
||||
writeString(FUND_NAME_COL, rowHeader, "Fund");
|
||||
writeString(PRINCIPAL_COL, rowHeader, "Principal");
|
||||
writeString(MIN_PRINCIPAL_COL, rowHeader, "Min Principal");
|
||||
writeString(MAX_PRINCIPAL_COL, rowHeader, "Max Principal");
|
||||
writeString(NO_OF_REPAYMENTS_COL, rowHeader, "# of Repayments");
|
||||
writeString(MIN_REPAYMENTS_COL, rowHeader, "Min Repayments");
|
||||
writeString(MAX_REPAYMENTS_COL, rowHeader, "Max Repayments");
|
||||
writeString(REPAYMENT_EVERY_COL, rowHeader, "Repayment Every");
|
||||
writeString(REPAYMENT_FREQUENCY_COL, rowHeader, "Frequency");
|
||||
writeString(INTEREST_RATE_COL, rowHeader, "Interest");
|
||||
writeString(MIN_INTEREST_RATE_COL, rowHeader, "Min Interest");
|
||||
writeString(MAX_INTEREST_RATE_COL, rowHeader, "Max Interest");
|
||||
writeString(INTEREST_RATE_FREQUENCY_COL, rowHeader, "Frequency");
|
||||
writeString(AMORTIZATION_TYPE_COL, rowHeader, "Amortization Type");
|
||||
writeString(INTEREST_TYPE_COL, rowHeader, "Interest Type");
|
||||
writeString(INTEREST_CALCULATION_PERIOD_TYPE_COL, rowHeader, "Interest Calculation Period");
|
||||
writeString(IN_ARREARS_TOLERANCE_COL, rowHeader, "In Arrears Tolerance");
|
||||
writeString(TRANSACTION_PROCESSING_STRATEGY_NAME_COL, rowHeader, "Transaction Processing Strategy");
|
||||
writeString(GRACE_ON_PRINCIPAL_PAYMENT_COL, rowHeader, "Grace On Principal Payment");
|
||||
writeString(GRACE_ON_INTEREST_PAYMENT_COL, rowHeader, "Grace on Interest Payment");
|
||||
writeString(GRACE_ON_INTEREST_CHARGED_COL, rowHeader, "Grace on Interest Charged");
|
||||
writeString(START_DATE_COL, rowHeader, "Start Date");
|
||||
writeString(CLOSE_DATE_COL, rowHeader, "End Date");
|
||||
}
|
||||
public List<LoanProductData> getProducts(){
|
||||
return products;
|
||||
|
||||
}
|
||||
public Integer getProductsSize() {
|
||||
return products.size();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -72,11 +72,11 @@ public class OfficeSheetPopulator extends AbstractWorkbookPopulator {
|
||||
}
|
||||
|
||||
public List<String> getOfficeNames() {
|
||||
List<String> officeNames=new ArrayList<>();
|
||||
for (OfficeData office : offices) {
|
||||
officeNames.add(office.name());
|
||||
}
|
||||
return officeNames;
|
||||
List<String> officeNames=new ArrayList<>();
|
||||
for (OfficeData office : offices) {
|
||||
officeNames.add(office.name());
|
||||
}
|
||||
return officeNames;
|
||||
}
|
||||
|
||||
}
|
||||
+176
-176
@@ -37,152 +37,152 @@ import java.util.List;
|
||||
public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
|
||||
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private PersonnelSheetPopulator personnelSheetPopulator;
|
||||
private GroupSheetPopulator groupSheetPopulator;
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private PersonnelSheetPopulator personnelSheetPopulator;
|
||||
private GroupSheetPopulator groupSheetPopulator;
|
||||
|
||||
public CentersWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
PersonnelSheetPopulator personnelSheetPopulator,GroupSheetPopulator groupSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.personnelSheetPopulator = personnelSheetPopulator;
|
||||
this.groupSheetPopulator=groupSheetPopulator;
|
||||
}
|
||||
public CentersWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
PersonnelSheetPopulator personnelSheetPopulator,GroupSheetPopulator groupSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.personnelSheetPopulator = personnelSheetPopulator;
|
||||
this.groupSheetPopulator=groupSheetPopulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet centerSheet = workbook.createSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME);
|
||||
personnelSheetPopulator.populate(workbook,dateFormat);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
groupSheetPopulator.populate(workbook,dateFormat);
|
||||
setLayout(centerSheet);
|
||||
setLookupTable(centerSheet,dateFormat);
|
||||
setRules(centerSheet,dateFormat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet centerSheet = workbook.createSheet(TemplatePopulateImportConstants.CENTER_SHEET_NAME);
|
||||
personnelSheetPopulator.populate(workbook,dateFormat);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
groupSheetPopulator.populate(workbook,dateFormat);
|
||||
setLayout(centerSheet);
|
||||
setLookupTable(centerSheet,dateFormat);
|
||||
setRules(centerSheet,dateFormat);
|
||||
}
|
||||
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(0);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(CenterConstants.CENTER_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.STAFF_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.EXTERNAL_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.ACTIVE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.ACTIVATION_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.SUBMITTED_ON_DATE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.MEETING_START_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.IS_REPEATING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.INTERVAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.REPEATS_ON_DAY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.CENTER_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.FAILURE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.GROUP_NAMES_STARTING_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(0);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(CenterConstants.CENTER_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.STAFF_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.EXTERNAL_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.ACTIVE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.ACTIVATION_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.SUBMITTED_ON_DATE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.MEETING_START_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.IS_REPEATING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.INTERVAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.REPEATS_ON_DAY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.CENTER_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.FAILURE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.GROUP_NAMES_STARTING_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
|
||||
writeString(CenterConstants.CENTER_NAME_COL, rowHeader, "Center Name*");
|
||||
writeString(CenterConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(CenterConstants.STAFF_NAME_COL, rowHeader, "Staff Name*");
|
||||
writeString(CenterConstants.EXTERNAL_ID_COL, rowHeader, "External ID");
|
||||
writeString(CenterConstants.ACTIVE_COL, rowHeader, "Active*");
|
||||
writeString(CenterConstants.ACTIVATION_DATE_COL, rowHeader, "Activation Date*");
|
||||
writeString(CenterConstants.SUBMITTED_ON_DATE_COL,rowHeader,"Submitted On Date");
|
||||
writeString(CenterConstants.MEETING_START_DATE_COL, rowHeader, "Meeting Start Date* (On or After)");
|
||||
writeString(CenterConstants.IS_REPEATING_COL, rowHeader, "Repeat*");
|
||||
writeString(CenterConstants.FREQUENCY_COL, rowHeader, "Frequency*");
|
||||
writeString(CenterConstants.INTERVAL_COL, rowHeader, "Interval*");
|
||||
writeString(CenterConstants.REPEATS_ON_DAY_COL, rowHeader, "Repeats On*");
|
||||
writeString(CenterConstants.GROUP_NAMES_STARTING_COL,rowHeader,"Group Names* (Enter in consecutive cells horizontally)");
|
||||
writeString(CenterConstants.LOOKUP_OFFICE_NAME_COL, rowHeader, "Office Name");
|
||||
writeString(CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL, rowHeader, "Opening Date");
|
||||
writeString(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, rowHeader, "Repeat Normal Range");
|
||||
writeString(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, rowHeader, "Repeat Monthly Range");
|
||||
writeString(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, rowHeader, "If Repeat Weekly Range");
|
||||
}
|
||||
private void setLookupTable(Sheet centerSheet,String dateFormat) {
|
||||
setOfficeDateLookupTable(centerSheet, officeSheetPopulator.getOffices(), CenterConstants.LOOKUP_OFFICE_NAME_COL,CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL,dateFormat);
|
||||
int rowIndex;
|
||||
for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
|
||||
Row row = centerSheet.getRow(rowIndex);
|
||||
if(row == null)
|
||||
row = centerSheet.createRow(rowIndex);
|
||||
writeInt(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
|
||||
}
|
||||
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
|
||||
writeInt(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, centerSheet.getRow(rowIndex), rowIndex);
|
||||
writeString(CenterConstants.CENTER_NAME_COL, rowHeader, "Center Name*");
|
||||
writeString(CenterConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(CenterConstants.STAFF_NAME_COL, rowHeader, "Staff Name*");
|
||||
writeString(CenterConstants.EXTERNAL_ID_COL, rowHeader, "External ID");
|
||||
writeString(CenterConstants.ACTIVE_COL, rowHeader, "Active*");
|
||||
writeString(CenterConstants.ACTIVATION_DATE_COL, rowHeader, "Activation Date*");
|
||||
writeString(CenterConstants.SUBMITTED_ON_DATE_COL,rowHeader,"Submitted On Date");
|
||||
writeString(CenterConstants.MEETING_START_DATE_COL, rowHeader, "Meeting Start Date* (On or After)");
|
||||
writeString(CenterConstants.IS_REPEATING_COL, rowHeader, "Repeat*");
|
||||
writeString(CenterConstants.FREQUENCY_COL, rowHeader, "Frequency*");
|
||||
writeString(CenterConstants.INTERVAL_COL, rowHeader, "Interval*");
|
||||
writeString(CenterConstants.REPEATS_ON_DAY_COL, rowHeader, "Repeats On*");
|
||||
writeString(CenterConstants.GROUP_NAMES_STARTING_COL,rowHeader,"Group Names* (Enter in consecutive cells horizontally)");
|
||||
writeString(CenterConstants.LOOKUP_OFFICE_NAME_COL, rowHeader, "Office Name");
|
||||
writeString(CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL, rowHeader, "Opening Date");
|
||||
writeString(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, rowHeader, "Repeat Normal Range");
|
||||
writeString(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, rowHeader, "Repeat Monthly Range");
|
||||
writeString(CenterConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, rowHeader, "If Repeat Weekly Range");
|
||||
}
|
||||
private void setLookupTable(Sheet centerSheet,String dateFormat) {
|
||||
setOfficeDateLookupTable(centerSheet, officeSheetPopulator.getOffices(), CenterConstants.LOOKUP_OFFICE_NAME_COL,CenterConstants.LOOKUP_OFFICE_OPENING_DATE_COL,dateFormat);
|
||||
int rowIndex;
|
||||
for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
|
||||
Row row = centerSheet.getRow(rowIndex);
|
||||
if(row == null)
|
||||
row = centerSheet.createRow(rowIndex);
|
||||
writeInt(CenterConstants.LOOKUP_REPEAT_MONTHLY_COL, row, rowIndex);
|
||||
}
|
||||
for(rowIndex = 1; rowIndex <= 3; rowIndex++)
|
||||
writeInt(CenterConstants.LOOKUP_REPEAT_NORMAL_COL, centerSheet.getRow(rowIndex), rowIndex);
|
||||
|
||||
String[] days = new String[]{
|
||||
TemplatePopulateImportConstants.MONDAY,
|
||||
TemplatePopulateImportConstants.TUESDAY,
|
||||
TemplatePopulateImportConstants.WEDNESDAY,
|
||||
TemplatePopulateImportConstants.THURSDAY,
|
||||
TemplatePopulateImportConstants.FRIDAY,
|
||||
TemplatePopulateImportConstants.SATURDAY,
|
||||
TemplatePopulateImportConstants.SUNDAY};
|
||||
String[] days = new String[]{
|
||||
TemplatePopulateImportConstants.MONDAY,
|
||||
TemplatePopulateImportConstants.TUESDAY,
|
||||
TemplatePopulateImportConstants.WEDNESDAY,
|
||||
TemplatePopulateImportConstants.THURSDAY,
|
||||
TemplatePopulateImportConstants.FRIDAY,
|
||||
TemplatePopulateImportConstants.SATURDAY,
|
||||
TemplatePopulateImportConstants.SUNDAY};
|
||||
|
||||
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) {
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.OFFICE_NAME_COL,CenterConstants. OFFICE_NAME_COL);
|
||||
CellRangeAddressList staffNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.STAFF_NAME_COL,CenterConstants. STAFF_NAME_COL);
|
||||
CellRangeAddressList activationDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. ACTIVATION_DATE_COL,CenterConstants. ACTIVATION_DATE_COL);
|
||||
CellRangeAddressList activeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.ACTIVE_COL, CenterConstants.ACTIVE_COL);
|
||||
CellRangeAddressList submittedDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. SUBMITTED_ON_DATE_COL,CenterConstants.SUBMITTED_ON_DATE_COL);
|
||||
CellRangeAddressList meetingStartDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.MEETING_START_DATE_COL,CenterConstants. MEETING_START_DATE_COL);
|
||||
CellRangeAddressList isRepeatRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. IS_REPEATING_COL,CenterConstants. IS_REPEATING_COL);
|
||||
CellRangeAddressList repeatsRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.FREQUENCY_COL, CenterConstants.FREQUENCY_COL);
|
||||
CellRangeAddressList repeatsEveryRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.INTERVAL_COL,CenterConstants. INTERVAL_COL);
|
||||
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.REPEATS_ON_DAY_COL,CenterConstants. REPEATS_ON_DAY_COL);
|
||||
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
List<OfficeData> offices = officeSheetPopulator.getOffices();
|
||||
setNames(worksheet, offices);
|
||||
|
||||
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) {
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.OFFICE_NAME_COL,CenterConstants. OFFICE_NAME_COL);
|
||||
CellRangeAddressList staffNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.STAFF_NAME_COL,CenterConstants. STAFF_NAME_COL);
|
||||
CellRangeAddressList activationDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. ACTIVATION_DATE_COL,CenterConstants. ACTIVATION_DATE_COL);
|
||||
CellRangeAddressList activeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.ACTIVE_COL, CenterConstants.ACTIVE_COL);
|
||||
CellRangeAddressList submittedDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. SUBMITTED_ON_DATE_COL,CenterConstants.SUBMITTED_ON_DATE_COL);
|
||||
CellRangeAddressList meetingStartDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.MEETING_START_DATE_COL,CenterConstants. MEETING_START_DATE_COL);
|
||||
CellRangeAddressList isRepeatRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),CenterConstants. IS_REPEATING_COL,CenterConstants. IS_REPEATING_COL);
|
||||
CellRangeAddressList repeatsRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.FREQUENCY_COL, CenterConstants.FREQUENCY_COL);
|
||||
CellRangeAddressList repeatsEveryRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.INTERVAL_COL,CenterConstants. INTERVAL_COL);
|
||||
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(), CenterConstants.REPEATS_ON_DAY_COL,CenterConstants. REPEATS_ON_DAY_COL);
|
||||
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
List<OfficeData> offices = officeSheetPopulator.getOffices();
|
||||
setNames(worksheet, offices);
|
||||
|
||||
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint staffNameConstraint = validationHelper.
|
||||
createFormulaListConstraint("INDIRECT(CONCATENATE(\"Staff_\",$B1))");
|
||||
DataValidationConstraint activationDateConstraint = validationHelper.createDateConstraint
|
||||
(DataValidationConstraint.OperatorType.BETWEEN, "=VLOOKUP($B1,$IR$2:$IS" + (offices.size() + 1)+",2,FALSE)",
|
||||
"=TODAY()", dateFormat);
|
||||
DataValidationConstraint booleanConstraint = validationHelper.createExplicitListConstraint(new String[]{"True", "False"});
|
||||
DataValidationConstraint submittedOnDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.LESS_OR_EQUAL,
|
||||
"=$F1", null,dateFormat);
|
||||
DataValidationConstraint meetingStartDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=$F1", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint repeatsConstraint =
|
||||
validationHelper.createExplicitListConstraint(new String[]{
|
||||
TemplatePopulateImportConstants.FREQUENCY_DAILY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_WEEKLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_MONTHLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_YEARLY});
|
||||
DataValidationConstraint repeatsEveryConstraint = validationHelper.createFormulaListConstraint("INDIRECT($J1)");
|
||||
DataValidationConstraint repeatsOnConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE($J1,\"_DAYS\"))");
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint staffNameConstraint = validationHelper.
|
||||
createFormulaListConstraint("INDIRECT(CONCATENATE(\"Staff_\",$B1))");
|
||||
DataValidationConstraint activationDateConstraint = validationHelper.createDateConstraint
|
||||
(DataValidationConstraint.OperatorType.BETWEEN, "=VLOOKUP($B1,$IR$2:$IS" + (offices.size() + 1)+",2,FALSE)",
|
||||
"=TODAY()", dateFormat);
|
||||
DataValidationConstraint booleanConstraint = validationHelper.createExplicitListConstraint(new String[]{"True", "False"});
|
||||
DataValidationConstraint submittedOnDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.LESS_OR_EQUAL,
|
||||
"=$F1", null,dateFormat);
|
||||
DataValidationConstraint meetingStartDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=$F1", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint repeatsConstraint =
|
||||
validationHelper.createExplicitListConstraint(new String[]{
|
||||
TemplatePopulateImportConstants.FREQUENCY_DAILY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_WEEKLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_MONTHLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_YEARLY});
|
||||
DataValidationConstraint repeatsEveryConstraint = validationHelper.createFormulaListConstraint("INDIRECT($J1)");
|
||||
DataValidationConstraint repeatsOnConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE($J1,\"_DAYS\"))");
|
||||
|
||||
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation staffValidation = validationHelper.createValidation(staffNameConstraint, staffNameRange);
|
||||
DataValidation activationDateValidation = validationHelper.createValidation(activationDateConstraint, activationDateRange);
|
||||
DataValidation activeValidation = validationHelper.createValidation(booleanConstraint, activeRange);
|
||||
DataValidation submittedOnValidation=validationHelper.createValidation(submittedOnDateConstraint,submittedDateRange);
|
||||
DataValidation meetingStartDateValidation = validationHelper.createValidation(meetingStartDateConstraint, meetingStartDateRange);
|
||||
DataValidation isRepeatValidation = validationHelper.createValidation(booleanConstraint, isRepeatRange);
|
||||
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
|
||||
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
|
||||
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
|
||||
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation staffValidation = validationHelper.createValidation(staffNameConstraint, staffNameRange);
|
||||
DataValidation activationDateValidation = validationHelper.createValidation(activationDateConstraint, activationDateRange);
|
||||
DataValidation activeValidation = validationHelper.createValidation(booleanConstraint, activeRange);
|
||||
DataValidation submittedOnValidation=validationHelper.createValidation(submittedOnDateConstraint,submittedDateRange);
|
||||
DataValidation meetingStartDateValidation = validationHelper.createValidation(meetingStartDateConstraint, meetingStartDateRange);
|
||||
DataValidation isRepeatValidation = validationHelper.createValidation(booleanConstraint, isRepeatRange);
|
||||
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
|
||||
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
|
||||
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
|
||||
|
||||
|
||||
worksheet.addValidationData(activeValidation);
|
||||
worksheet.addValidationData(activeValidation);
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(staffValidation);
|
||||
worksheet.addValidationData(activationDateValidation);
|
||||
@@ -192,44 +192,44 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
worksheet.addValidationData(repeatsValidation);
|
||||
worksheet.addValidationData(repeatsEveryValidation);
|
||||
worksheet.addValidationData(repeatsOnValidation);
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet, List<OfficeData> offices) {
|
||||
Workbook centerWorkbook = worksheet.getWorkbook();
|
||||
Name officeCenter = centerWorkbook.createName();
|
||||
officeCenter.setNameName("Office");
|
||||
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME +"!$B$2:$B$" + (offices.size() + 1));
|
||||
|
||||
|
||||
//Repeat constraint names
|
||||
Name repeatsDaily = centerWorkbook.createName();
|
||||
repeatsDaily.setNameName("Daily");
|
||||
repeatsDaily.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsWeekly = centerWorkbook.createName();
|
||||
repeatsWeekly.setNameName("Weekly");
|
||||
repeatsWeekly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatYearly = centerWorkbook.createName();
|
||||
repeatYearly.setNameName("Yearly");
|
||||
repeatYearly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsMonthly = centerWorkbook.createName();
|
||||
repeatsMonthly.setNameName("Monthly");
|
||||
repeatsMonthly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IU$2:$IU$12");
|
||||
Name repeatsOnWeekly = centerWorkbook.createName();
|
||||
repeatsOnWeekly.setNameName("Weekly_Days");
|
||||
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IV$2:$IV$8");
|
||||
|
||||
|
||||
//Staff Names for each office
|
||||
for(Integer i = 0; i < offices.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
|
||||
Name loanOfficerName = centerWorkbook.createName();
|
||||
if(officeNameToBeginEndIndexesOfStaff != null) {
|
||||
loanOfficerName.setNameName("Staff_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet, List<OfficeData> offices) {
|
||||
Workbook centerWorkbook = worksheet.getWorkbook();
|
||||
Name officeCenter = centerWorkbook.createName();
|
||||
officeCenter.setNameName("Office");
|
||||
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME +"!$B$2:$B$" + (offices.size() + 1));
|
||||
|
||||
|
||||
//Repeat constraint names
|
||||
Name repeatsDaily = centerWorkbook.createName();
|
||||
repeatsDaily.setNameName("Daily");
|
||||
repeatsDaily.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsWeekly = centerWorkbook.createName();
|
||||
repeatsWeekly.setNameName("Weekly");
|
||||
repeatsWeekly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatYearly = centerWorkbook.createName();
|
||||
repeatYearly.setNameName("Yearly");
|
||||
repeatYearly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsMonthly = centerWorkbook.createName();
|
||||
repeatsMonthly.setNameName("Monthly");
|
||||
repeatsMonthly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IU$2:$IU$12");
|
||||
Name repeatsOnWeekly = centerWorkbook.createName();
|
||||
repeatsOnWeekly.setNameName("Weekly_Days");
|
||||
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+"!$IV$2:$IV$8");
|
||||
|
||||
|
||||
//Staff Names for each office
|
||||
for(Integer i = 0; i < offices.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
|
||||
Name loanOfficerName = centerWorkbook.createName();
|
||||
if(officeNameToBeginEndIndexesOfStaff != null) {
|
||||
loanOfficerName.setNameName("Staff_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+195
-195
@@ -32,167 +32,167 @@ import java.util.List;
|
||||
|
||||
public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private PersonnelSheetPopulator personnelSheetPopulator;
|
||||
private CenterSheetPopulator centerSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private PersonnelSheetPopulator personnelSheetPopulator;
|
||||
private CenterSheetPopulator centerSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
|
||||
public GroupsWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
PersonnelSheetPopulator personnelSheetPopulator, CenterSheetPopulator centerSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.personnelSheetPopulator = personnelSheetPopulator;
|
||||
this.centerSheetPopulator = centerSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
}
|
||||
public GroupsWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
PersonnelSheetPopulator personnelSheetPopulator, CenterSheetPopulator centerSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.personnelSheetPopulator = personnelSheetPopulator;
|
||||
this.centerSheetPopulator = centerSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet groupSheet = workbook.createSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME);
|
||||
personnelSheetPopulator.populate(workbook,dateFormat);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
centerSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
setLayout(groupSheet);
|
||||
setLookupTable(groupSheet,dateFormat);
|
||||
setRules(groupSheet,dateFormat);
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet groupSheet = workbook.createSheet(TemplatePopulateImportConstants.GROUP_SHEET_NAME);
|
||||
personnelSheetPopulator.populate(workbook,dateFormat);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
centerSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
setLayout(groupSheet);
|
||||
setLookupTable(groupSheet,dateFormat);
|
||||
setRules(groupSheet,dateFormat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(GroupConstants.NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.STAFF_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.CENTER_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.EXTERNAL_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.ACTIVE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.ACTIVATION_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.SUBMITTED_ON_DATE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.MEETING_START_DATE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.IS_REPEATING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.INTERVAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.REPEATS_ON_DAY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.GROUP_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.FAILURE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.CLIENT_NAMES_STARTING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_OFFICE_OPENING_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(GroupConstants.NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.STAFF_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.CENTER_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.EXTERNAL_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.ACTIVE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.ACTIVATION_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.SUBMITTED_ON_DATE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.MEETING_START_DATE_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.IS_REPEATING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.FREQUENCY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.INTERVAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.REPEATS_ON_DAY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.STATUS_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.GROUP_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.FAILURE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.CLIENT_NAMES_STARTING_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_OFFICE_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_OFFICE_OPENING_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
|
||||
writeString(GroupConstants.NAME_COL, rowHeader, "Group Name*");
|
||||
writeString(GroupConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(GroupConstants.STAFF_NAME_COL, rowHeader, "Staff Name*");
|
||||
writeString(GroupConstants.CENTER_NAME_COL, rowHeader, "Center Name");
|
||||
writeString(GroupConstants.EXTERNAL_ID_COL, rowHeader, "External ID");
|
||||
writeString(GroupConstants.ACTIVE_COL, rowHeader, "Active*");
|
||||
writeString(GroupConstants.ACTIVATION_DATE_COL, rowHeader, "Activation Date*");
|
||||
writeString(GroupConstants.SUBMITTED_ON_DATE_COL,rowHeader,"Submitted On Date *");
|
||||
writeString(GroupConstants.MEETING_START_DATE_COL, rowHeader, "Meeting Start Date* (On or After)");
|
||||
writeString(GroupConstants.IS_REPEATING_COL, rowHeader, "Repeat*");
|
||||
writeString(GroupConstants.FREQUENCY_COL, rowHeader, "Frequency*");
|
||||
writeString(GroupConstants.INTERVAL_COL, rowHeader, "Interval*");
|
||||
writeString(GroupConstants.REPEATS_ON_DAY_COL, rowHeader, "Repeats On*");
|
||||
writeString(GroupConstants.CLIENT_NAMES_STARTING_COL, rowHeader, "Client Names* (Enter in consecutive cells horizontally)");
|
||||
writeString(GroupConstants.LOOKUP_OFFICE_NAME_COL, rowHeader, "Office Name");
|
||||
writeString(GroupConstants.LOOKUP_OFFICE_OPENING_DATE_COL, rowHeader, "Opening Date");
|
||||
writeString(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, rowHeader, "Repeat Normal Range");
|
||||
writeString(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, rowHeader, "Repeat Monthly Range");
|
||||
writeString(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, rowHeader, "If Repeat Weekly Range");
|
||||
writeString(GroupConstants.NAME_COL, rowHeader, "Group Name*");
|
||||
writeString(GroupConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(GroupConstants.STAFF_NAME_COL, rowHeader, "Staff Name*");
|
||||
writeString(GroupConstants.CENTER_NAME_COL, rowHeader, "Center Name");
|
||||
writeString(GroupConstants.EXTERNAL_ID_COL, rowHeader, "External ID");
|
||||
writeString(GroupConstants.ACTIVE_COL, rowHeader, "Active*");
|
||||
writeString(GroupConstants.ACTIVATION_DATE_COL, rowHeader, "Activation Date*");
|
||||
writeString(GroupConstants.SUBMITTED_ON_DATE_COL,rowHeader,"Submitted On Date *");
|
||||
writeString(GroupConstants.MEETING_START_DATE_COL, rowHeader, "Meeting Start Date* (On or After)");
|
||||
writeString(GroupConstants.IS_REPEATING_COL, rowHeader, "Repeat*");
|
||||
writeString(GroupConstants.FREQUENCY_COL, rowHeader, "Frequency*");
|
||||
writeString(GroupConstants.INTERVAL_COL, rowHeader, "Interval*");
|
||||
writeString(GroupConstants.REPEATS_ON_DAY_COL, rowHeader, "Repeats On*");
|
||||
writeString(GroupConstants.CLIENT_NAMES_STARTING_COL, rowHeader, "Client Names* (Enter in consecutive cells horizontally)");
|
||||
writeString(GroupConstants.LOOKUP_OFFICE_NAME_COL, rowHeader, "Office Name");
|
||||
writeString(GroupConstants.LOOKUP_OFFICE_OPENING_DATE_COL, rowHeader, "Opening Date");
|
||||
writeString(GroupConstants.LOOKUP_REPEAT_NORMAL_COL, rowHeader, "Repeat Normal Range");
|
||||
writeString(GroupConstants.LOOKUP_REPEAT_MONTHLY_COL, rowHeader, "Repeat Monthly Range");
|
||||
writeString(GroupConstants.LOOKUP_IF_REPEAT_WEEKLY_COL, rowHeader, "If Repeat Weekly Range");
|
||||
|
||||
}
|
||||
}
|
||||
private void setLookupTable(Sheet groupSheet,String dateFormat) {
|
||||
setOfficeDateLookupTable(groupSheet, officeSheetPopulator.getOffices(),GroupConstants.LOOKUP_OFFICE_NAME_COL,
|
||||
GroupConstants. LOOKUP_OFFICE_OPENING_DATE_COL,dateFormat);
|
||||
int rowIndex;
|
||||
for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
|
||||
Row row = groupSheet.getRow(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);
|
||||
String[] days = new String[]{
|
||||
TemplatePopulateImportConstants.MONDAY,
|
||||
TemplatePopulateImportConstants.TUESDAY,
|
||||
TemplatePopulateImportConstants.WEDNESDAY,
|
||||
TemplatePopulateImportConstants.THURSDAY,
|
||||
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]);
|
||||
setOfficeDateLookupTable(groupSheet, officeSheetPopulator.getOffices(),GroupConstants.LOOKUP_OFFICE_NAME_COL,
|
||||
GroupConstants. LOOKUP_OFFICE_OPENING_DATE_COL,dateFormat);
|
||||
int rowIndex;
|
||||
for(rowIndex = 1; rowIndex <= 11; rowIndex++) {
|
||||
Row row = groupSheet.getRow(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);
|
||||
String[] days = new String[]{
|
||||
TemplatePopulateImportConstants.MONDAY,
|
||||
TemplatePopulateImportConstants.TUESDAY,
|
||||
TemplatePopulateImportConstants.WEDNESDAY,
|
||||
TemplatePopulateImportConstants.THURSDAY,
|
||||
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]);
|
||||
}
|
||||
|
||||
private void setRules(Sheet worksheet,String dateFormat){
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.OFFICE_NAME_COL, GroupConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList staffNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.STAFF_NAME_COL, GroupConstants.STAFF_NAME_COL);
|
||||
CellRangeAddressList centerNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.CENTER_NAME_COL, GroupConstants.CENTER_NAME_COL);
|
||||
CellRangeAddressList activeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.ACTIVE_COL, GroupConstants.ACTIVE_COL);
|
||||
CellRangeAddressList activationDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.ACTIVATION_DATE_COL,GroupConstants.ACTIVATION_DATE_COL);
|
||||
CellRangeAddressList submittedOnDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.SUBMITTED_ON_DATE_COL,GroupConstants.SUBMITTED_ON_DATE_COL);
|
||||
CellRangeAddressList meetingStartDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.MEETING_START_DATE_COL,GroupConstants.MEETING_START_DATE_COL);
|
||||
CellRangeAddressList isRepeatRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.IS_REPEATING_COL, GroupConstants.IS_REPEATING_COL);
|
||||
CellRangeAddressList repeatsRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants. FREQUENCY_COL, GroupConstants.FREQUENCY_COL);
|
||||
CellRangeAddressList repeatsEveryRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.INTERVAL_COL,GroupConstants. INTERVAL_COL);
|
||||
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.REPEATS_ON_DAY_COL, GroupConstants.REPEATS_ON_DAY_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
List<OfficeData> offices = officeSheetPopulator.getOffices();
|
||||
setNames(worksheet, offices);
|
||||
|
||||
DataValidationConstraint centerNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Center_\",$B1))");
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint staffNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Staff_\",$B1))");
|
||||
DataValidationConstraint booleanConstraint = validationHelper.createExplicitListConstraint(new String[]{"True", "False"});
|
||||
DataValidationConstraint activationDateConstraint = validationHelper.createDateConstraint
|
||||
(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=VLOOKUP($B1,$IR$2:$IS" + (offices.size() + 1)+",2,FALSE)", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint submittedOnDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.LESS_OR_EQUAL,
|
||||
"=$G1" ,null,dateFormat);
|
||||
DataValidationConstraint meetingStartDateConstraint = validationHelper.
|
||||
createDateConstraint(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=$G1", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint repeatsConstraint = validationHelper.createExplicitListConstraint(new String[]{
|
||||
TemplatePopulateImportConstants.FREQUENCY_DAILY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_WEEKLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_MONTHLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_YEARLY});
|
||||
DataValidationConstraint repeatsEveryConstraint = validationHelper.createFormulaListConstraint("INDIRECT($K1)");
|
||||
DataValidationConstraint repeatsOnConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE($K1,\"_DAYS\"))");
|
||||
|
||||
DataValidation centerValidation=validationHelper.createValidation(centerNameConstraint, centerNameRange);
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation staffValidation = validationHelper.createValidation(staffNameConstraint, staffNameRange);
|
||||
DataValidation activationDateValidation = validationHelper.createValidation(activationDateConstraint, activationDateRange);
|
||||
DataValidation activeValidation = validationHelper.createValidation(booleanConstraint, activeRange);
|
||||
DataValidation submittedOnDateValidation=validationHelper.createValidation(submittedOnDateConstraint,submittedOnDateRange);
|
||||
DataValidation meetingStartDateValidation = validationHelper.createValidation(meetingStartDateConstraint, meetingStartDateRange);
|
||||
DataValidation isRepeatValidation = validationHelper.createValidation(booleanConstraint, isRepeatRange);
|
||||
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
|
||||
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
|
||||
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
|
||||
|
||||
worksheet.addValidationData(centerValidation);
|
||||
worksheet.addValidationData(activeValidation);
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.OFFICE_NAME_COL, GroupConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList staffNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.STAFF_NAME_COL, GroupConstants.STAFF_NAME_COL);
|
||||
CellRangeAddressList centerNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.CENTER_NAME_COL, GroupConstants.CENTER_NAME_COL);
|
||||
CellRangeAddressList activeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.ACTIVE_COL, GroupConstants.ACTIVE_COL);
|
||||
CellRangeAddressList activationDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.ACTIVATION_DATE_COL,GroupConstants.ACTIVATION_DATE_COL);
|
||||
CellRangeAddressList submittedOnDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.SUBMITTED_ON_DATE_COL,GroupConstants.SUBMITTED_ON_DATE_COL);
|
||||
CellRangeAddressList meetingStartDateRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.MEETING_START_DATE_COL,GroupConstants.MEETING_START_DATE_COL);
|
||||
CellRangeAddressList isRepeatRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.IS_REPEATING_COL, GroupConstants.IS_REPEATING_COL);
|
||||
CellRangeAddressList repeatsRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants. FREQUENCY_COL, GroupConstants.FREQUENCY_COL);
|
||||
CellRangeAddressList repeatsEveryRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.INTERVAL_COL,GroupConstants. INTERVAL_COL);
|
||||
CellRangeAddressList repeatsOnRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GroupConstants.REPEATS_ON_DAY_COL, GroupConstants.REPEATS_ON_DAY_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
List<OfficeData> offices = officeSheetPopulator.getOffices();
|
||||
setNames(worksheet, offices);
|
||||
|
||||
DataValidationConstraint centerNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Center_\",$B1))");
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint staffNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Staff_\",$B1))");
|
||||
DataValidationConstraint booleanConstraint = validationHelper.createExplicitListConstraint(new String[]{"True", "False"});
|
||||
DataValidationConstraint activationDateConstraint = validationHelper.createDateConstraint
|
||||
(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=VLOOKUP($B1,$IR$2:$IS" + (offices.size() + 1)+",2,FALSE)", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint submittedOnDateConstraint =
|
||||
validationHelper.createDateConstraint(DataValidationConstraint.OperatorType.LESS_OR_EQUAL,
|
||||
"=$G1" ,null,dateFormat);
|
||||
DataValidationConstraint meetingStartDateConstraint = validationHelper.
|
||||
createDateConstraint(DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=$G1", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint repeatsConstraint = validationHelper.createExplicitListConstraint(new String[]{
|
||||
TemplatePopulateImportConstants.FREQUENCY_DAILY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_WEEKLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_MONTHLY,
|
||||
TemplatePopulateImportConstants.FREQUENCY_YEARLY});
|
||||
DataValidationConstraint repeatsEveryConstraint = validationHelper.createFormulaListConstraint("INDIRECT($K1)");
|
||||
DataValidationConstraint repeatsOnConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE($K1,\"_DAYS\"))");
|
||||
|
||||
DataValidation centerValidation=validationHelper.createValidation(centerNameConstraint, centerNameRange);
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation staffValidation = validationHelper.createValidation(staffNameConstraint, staffNameRange);
|
||||
DataValidation activationDateValidation = validationHelper.createValidation(activationDateConstraint, activationDateRange);
|
||||
DataValidation activeValidation = validationHelper.createValidation(booleanConstraint, activeRange);
|
||||
DataValidation submittedOnDateValidation=validationHelper.createValidation(submittedOnDateConstraint,submittedOnDateRange);
|
||||
DataValidation meetingStartDateValidation = validationHelper.createValidation(meetingStartDateConstraint, meetingStartDateRange);
|
||||
DataValidation isRepeatValidation = validationHelper.createValidation(booleanConstraint, isRepeatRange);
|
||||
DataValidation repeatsValidation = validationHelper.createValidation(repeatsConstraint, repeatsRange);
|
||||
DataValidation repeatsEveryValidation = validationHelper.createValidation(repeatsEveryConstraint, repeatsEveryRange);
|
||||
DataValidation repeatsOnValidation = validationHelper.createValidation(repeatsOnConstraint, repeatsOnRange);
|
||||
|
||||
worksheet.addValidationData(centerValidation);
|
||||
worksheet.addValidationData(activeValidation);
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(staffValidation);
|
||||
worksheet.addValidationData(activationDateValidation);
|
||||
@@ -204,51 +204,51 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
worksheet.addValidationData(repeatsOnValidation);
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet, List<OfficeData> offices) {
|
||||
Workbook centerWorkbook = worksheet.getWorkbook();
|
||||
Name officeCenter = centerWorkbook.createName();
|
||||
officeCenter.setNameName("Office");
|
||||
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (offices.size() + 1));
|
||||
|
||||
|
||||
//Repeat constraint names
|
||||
Name repeatsDaily = centerWorkbook.createName();
|
||||
repeatsDaily.setNameName("Daily");
|
||||
repeatsDaily.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsWeekly = centerWorkbook.createName();
|
||||
repeatsWeekly.setNameName("Weekly");
|
||||
repeatsWeekly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatYearly = centerWorkbook.createName();
|
||||
repeatYearly.setNameName("Yearly");
|
||||
repeatYearly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsMonthly = centerWorkbook.createName();
|
||||
repeatsMonthly.setNameName("Monthly");
|
||||
repeatsMonthly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IU$2:$IU$12");
|
||||
Name repeatsOnWeekly = centerWorkbook.createName();
|
||||
repeatsOnWeekly.setNameName("Weekly_Days");
|
||||
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IV$2:$IV$8");
|
||||
|
||||
|
||||
//Staff Names for each office & center Names for each office
|
||||
for(Integer i = 0; i < offices.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfCenters =centerSheetPopulator.getOfficeNameToBeginEndIndexesOfCenters().get(i);
|
||||
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
|
||||
private void setNames(Sheet worksheet, List<OfficeData> offices) {
|
||||
Workbook centerWorkbook = worksheet.getWorkbook();
|
||||
Name officeCenter = centerWorkbook.createName();
|
||||
officeCenter.setNameName("Office");
|
||||
officeCenter.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (offices.size() + 1));
|
||||
|
||||
|
||||
//Repeat constraint names
|
||||
Name repeatsDaily = centerWorkbook.createName();
|
||||
repeatsDaily.setNameName("Daily");
|
||||
repeatsDaily.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsWeekly = centerWorkbook.createName();
|
||||
repeatsWeekly.setNameName("Weekly");
|
||||
repeatsWeekly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatYearly = centerWorkbook.createName();
|
||||
repeatYearly.setNameName("Yearly");
|
||||
repeatYearly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IT$2:$IT$4");
|
||||
Name repeatsMonthly = centerWorkbook.createName();
|
||||
repeatsMonthly.setNameName("Monthly");
|
||||
repeatsMonthly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IU$2:$IU$12");
|
||||
Name repeatsOnWeekly = centerWorkbook.createName();
|
||||
repeatsOnWeekly.setNameName("Weekly_Days");
|
||||
repeatsOnWeekly.setRefersToFormula(TemplatePopulateImportConstants.GROUP_SHEET_NAME+"!$IV$2:$IV$8");
|
||||
|
||||
|
||||
//Staff Names for each office & center Names for each office
|
||||
for(Integer i = 0; i < offices.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfCenters =centerSheetPopulator.getOfficeNameToBeginEndIndexesOfCenters().get(i);
|
||||
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
|
||||
|
||||
Name loanOfficerName = centerWorkbook.createName();
|
||||
Name centerName=centerWorkbook.createName();
|
||||
Name loanOfficerName = centerWorkbook.createName();
|
||||
Name centerName=centerWorkbook.createName();
|
||||
|
||||
if(officeNameToBeginEndIndexesOfStaff != null) {
|
||||
loanOfficerName.setNameName("Staff_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME+
|
||||
"!$B$" + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
|
||||
}
|
||||
if (officeNameToBeginEndIndexesOfCenters!=null) {
|
||||
centerName.setNameName("Center_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
centerName.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+
|
||||
"!$B$" + officeNameToBeginEndIndexesOfCenters[0] + ":$B$" + officeNameToBeginEndIndexesOfCenters[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(officeNameToBeginEndIndexesOfStaff != null) {
|
||||
loanOfficerName.setNameName("Staff_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME+
|
||||
"!$B$" + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
|
||||
}
|
||||
if (officeNameToBeginEndIndexesOfCenters!=null) {
|
||||
centerName.setNameName("Center_" + offices.get(i).name().trim().replaceAll("[ )(]", "_"));
|
||||
centerName.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME+
|
||||
"!$B$" + officeNameToBeginEndIndexesOfCenters[0] + ":$B$" + officeNameToBeginEndIndexesOfCenters[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+216
-216
@@ -38,83 +38,83 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
private List<LoanAccountData> loans;
|
||||
private List<SavingsAccountData> savings;
|
||||
private List<CodeValueData>guarantorRelationshipTypes;
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
private List<LoanAccountData> loans;
|
||||
private List<SavingsAccountData> savings;
|
||||
private List<CodeValueData>guarantorRelationshipTypes;
|
||||
|
||||
public GuarantorWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator,
|
||||
List<LoanAccountData> loans, List<SavingsAccountData> savings,
|
||||
List<CodeValueData> guarantorRelationshipTypes) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
this.loans = loans;
|
||||
this.savings = savings;
|
||||
this.guarantorRelationshipTypes=guarantorRelationshipTypes;
|
||||
public GuarantorWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator,
|
||||
List<LoanAccountData> loans, List<SavingsAccountData> savings,
|
||||
List<CodeValueData> guarantorRelationshipTypes) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
this.loans = loans;
|
||||
this.savings = savings;
|
||||
this.guarantorRelationshipTypes=guarantorRelationshipTypes;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet addGuarantorSheet = workbook.createSheet(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME);
|
||||
setLayout(addGuarantorSheet);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
populateLoansTable(addGuarantorSheet,dateFormat);
|
||||
populateSavingsTable(addGuarantorSheet,dateFormat);
|
||||
populateGuarantorRelationshipTypes(addGuarantorSheet,dateFormat);
|
||||
setRules(addGuarantorSheet);
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet addGuarantorSheet = workbook.createSheet(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME);
|
||||
setLayout(addGuarantorSheet);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
populateLoansTable(addGuarantorSheet,dateFormat);
|
||||
populateSavingsTable(addGuarantorSheet,dateFormat);
|
||||
populateGuarantorRelationshipTypes(addGuarantorSheet,dateFormat);
|
||||
setRules(addGuarantorSheet);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(0);
|
||||
worksheet.setColumnWidth(GuarantorConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOAN_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.GUARANTO_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ENTITY_OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ENTITY_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.FIRST_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LAST_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ADDRESS_LINE_1_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ADDRESS_LINE_2_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CITY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.DOB_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ZIP_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.SAVINGS_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_CLIENT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_SAVINGS_CLIENT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_SAVINGS_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
writeString(GuarantorConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(GuarantorConstants.CLIENT_NAME_COL, rowHeader, "Client Name*");
|
||||
writeString(GuarantorConstants.LOAN_ACCOUNT_NO_COL, rowHeader, " Loan Account NO");
|
||||
writeString(GuarantorConstants.GUARANTO_TYPE_COL, rowHeader, "Guranter_type*");
|
||||
writeString(GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, rowHeader, "Client Relationship type*");
|
||||
writeString(GuarantorConstants.ENTITY_OFFICE_NAME_COL, rowHeader, "Guranter office");
|
||||
writeString(GuarantorConstants.ENTITY_ID_COL, rowHeader, "Gurantor client id*");
|
||||
writeString(GuarantorConstants.FIRST_NAME_COL, rowHeader, "First Name*");
|
||||
writeString(GuarantorConstants.LAST_NAME_COL, rowHeader, "Last Name");
|
||||
writeString(GuarantorConstants.ADDRESS_LINE_1_COL, rowHeader, "ADDRESS LINE 1");
|
||||
writeString(GuarantorConstants.ADDRESS_LINE_2_COL, rowHeader, "ADDRESS LINE 2");
|
||||
writeString(GuarantorConstants.CITY_COL, rowHeader, "City");
|
||||
writeString(GuarantorConstants.DOB_COL, rowHeader, "Date of Birth");
|
||||
writeString(GuarantorConstants.ZIP_COL, rowHeader, "Zip*");
|
||||
writeString(GuarantorConstants.SAVINGS_ID_COL, rowHeader, "Savings Account Id");
|
||||
writeString(GuarantorConstants.AMOUNT, rowHeader, "Amount");
|
||||
writeString(GuarantorConstants.LOOKUP_CLIENT_NAME_COL, rowHeader, "Lookup Client");
|
||||
writeString(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, rowHeader, "Lookup Loan Account");
|
||||
writeString(GuarantorConstants.LOOKUP_SAVINGS_CLIENT_NAME_COL, rowHeader, "Savings Lookup Client");
|
||||
writeString(GuarantorConstants.LOOKUP_SAVINGS_ACCOUNT_NO_COL, rowHeader, "Savings Lookup Account");
|
||||
|
||||
}
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(0);
|
||||
worksheet.setColumnWidth(GuarantorConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOAN_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.GUARANTO_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ENTITY_OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ENTITY_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.FIRST_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LAST_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ADDRESS_LINE_1_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ADDRESS_LINE_2_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.CITY_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.DOB_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.ZIP_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.SAVINGS_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.AMOUNT, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_CLIENT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_SAVINGS_CLIENT_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(GuarantorConstants.LOOKUP_SAVINGS_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
writeString(GuarantorConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(GuarantorConstants.CLIENT_NAME_COL, rowHeader, "Client Name*");
|
||||
writeString(GuarantorConstants.LOAN_ACCOUNT_NO_COL, rowHeader, " Loan Account NO");
|
||||
writeString(GuarantorConstants.GUARANTO_TYPE_COL, rowHeader, "Guranter_type*");
|
||||
writeString(GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, rowHeader, "Client Relationship type*");
|
||||
writeString(GuarantorConstants.ENTITY_OFFICE_NAME_COL, rowHeader, "Guranter office");
|
||||
writeString(GuarantorConstants.ENTITY_ID_COL, rowHeader, "Gurantor client id*");
|
||||
writeString(GuarantorConstants.FIRST_NAME_COL, rowHeader, "First Name*");
|
||||
writeString(GuarantorConstants.LAST_NAME_COL, rowHeader, "Last Name");
|
||||
writeString(GuarantorConstants.ADDRESS_LINE_1_COL, rowHeader, "ADDRESS LINE 1");
|
||||
writeString(GuarantorConstants.ADDRESS_LINE_2_COL, rowHeader, "ADDRESS LINE 2");
|
||||
writeString(GuarantorConstants.CITY_COL, rowHeader, "City");
|
||||
writeString(GuarantorConstants.DOB_COL, rowHeader, "Date of Birth");
|
||||
writeString(GuarantorConstants.ZIP_COL, rowHeader, "Zip*");
|
||||
writeString(GuarantorConstants.SAVINGS_ID_COL, rowHeader, "Savings Account Id");
|
||||
writeString(GuarantorConstants.AMOUNT, rowHeader, "Amount");
|
||||
writeString(GuarantorConstants.LOOKUP_CLIENT_NAME_COL, rowHeader, "Lookup Client");
|
||||
writeString(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, rowHeader, "Lookup Loan Account");
|
||||
writeString(GuarantorConstants.LOOKUP_SAVINGS_CLIENT_NAME_COL, rowHeader, "Savings Lookup Client");
|
||||
writeString(GuarantorConstants.LOOKUP_SAVINGS_ACCOUNT_NO_COL, rowHeader, "Savings Lookup Account");
|
||||
|
||||
}
|
||||
private void populateSavingsTable(Sheet addGuarantorSheet,String dateFormat) {
|
||||
Workbook workbook = addGuarantorSheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
@@ -154,68 +154,68 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
writeString(GuarantorConstants.LOOKUP_ACCOUNT_NO_COL, row, Long.parseLong(loan.getAccountNo())+"-"+loan.getStatusStringValue());
|
||||
}
|
||||
}
|
||||
private void populateGuarantorRelationshipTypes(Sheet addGuarantorSheet, String dateFormat) {
|
||||
Workbook workbook = addGuarantorSheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
int rowIndex = 1;
|
||||
Row row;
|
||||
for (CodeValueData relationshipType:guarantorRelationshipTypes) {
|
||||
if (addGuarantorSheet.getRow(rowIndex)==null){
|
||||
row=addGuarantorSheet.createRow(rowIndex++);
|
||||
}else {
|
||||
row=addGuarantorSheet.getRow(rowIndex++);
|
||||
}
|
||||
writeString(GuarantorConstants.LOOKUP_GUARANTOR_RELATIONSHIPS,row,relationshipType.getName()+"-"+relationshipType.getId());
|
||||
}
|
||||
private void populateGuarantorRelationshipTypes(Sheet addGuarantorSheet, String dateFormat) {
|
||||
Workbook workbook = addGuarantorSheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
int rowIndex = 1;
|
||||
Row row;
|
||||
for (CodeValueData relationshipType:guarantorRelationshipTypes) {
|
||||
if (addGuarantorSheet.getRow(rowIndex)==null){
|
||||
row=addGuarantorSheet.createRow(rowIndex++);
|
||||
}else {
|
||||
row=addGuarantorSheet.getRow(rowIndex++);
|
||||
}
|
||||
writeString(GuarantorConstants.LOOKUP_GUARANTOR_RELATIONSHIPS,row,relationshipType.getName()+"-"+relationshipType.getId());
|
||||
}
|
||||
|
||||
}
|
||||
private void setRules(Sheet worksheet) {
|
||||
}
|
||||
private void setRules(Sheet worksheet) {
|
||||
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.OFFICE_NAME_COL, GuarantorConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList clientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.CLIENT_NAME_COL, GuarantorConstants.CLIENT_NAME_COL);
|
||||
CellRangeAddressList entityofficeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.ENTITY_OFFICE_NAME_COL, GuarantorConstants.ENTITY_OFFICE_NAME_COL);
|
||||
CellRangeAddressList entityclientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.ENTITY_ID_COL, GuarantorConstants.ENTITY_ID_COL);
|
||||
CellRangeAddressList accountNumberRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.LOAN_ACCOUNT_NO_COL, GuarantorConstants.LOAN_ACCOUNT_NO_COL);
|
||||
CellRangeAddressList savingsaccountNumberRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.SAVINGS_ID_COL, GuarantorConstants.SAVINGS_ID_COL);
|
||||
CellRangeAddressList guranterTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.GUARANTO_TYPE_COL, GuarantorConstants.GUARANTO_TYPE_COL);
|
||||
CellRangeAddressList guranterRelationshipTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
|
||||
setNames(worksheet);
|
||||
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint clientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$A1))");
|
||||
DataValidationConstraint accountNumberConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Account_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($B1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint savingsaccountNumberConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"SavingsAccount_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($G1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint guranterTypeConstraint = validationHelper.createExplicitListConstraint(new String[] {
|
||||
TemplatePopulateImportConstants.GUARANTOR_INTERNAL,
|
||||
TemplatePopulateImportConstants.GUARANTOR_EXTERNAL});
|
||||
DataValidationConstraint guarantorRelationshipConstraint = validationHelper.createFormulaListConstraint("GuarantorRelationship");
|
||||
DataValidationConstraint entityofficeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint entityclientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$F1))");
|
||||
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation clientValidation = validationHelper.createValidation(clientNameConstraint, clientNameRange);
|
||||
DataValidation accountNumberValidation = validationHelper.createValidation(accountNumberConstraint, accountNumberRange);
|
||||
DataValidation savingsaccountNumberValidation = validationHelper.createValidation(savingsaccountNumberConstraint, savingsaccountNumberRange);
|
||||
DataValidation guranterTypeValidation = validationHelper.createValidation(guranterTypeConstraint, guranterTypeRange);
|
||||
DataValidation guarantorRelationshipValidation=validationHelper.createValidation(guarantorRelationshipConstraint,guranterRelationshipTypeRange);
|
||||
DataValidation entityofficeValidation = validationHelper.createValidation(entityofficeNameConstraint, entityofficeNameRange);
|
||||
DataValidation entityclientValidation = validationHelper.createValidation(entityclientNameConstraint, entityclientNameRange);
|
||||
|
||||
|
||||
worksheet.addValidationData(officeValidation);
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.OFFICE_NAME_COL, GuarantorConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList clientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.CLIENT_NAME_COL, GuarantorConstants.CLIENT_NAME_COL);
|
||||
CellRangeAddressList entityofficeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.ENTITY_OFFICE_NAME_COL, GuarantorConstants.ENTITY_OFFICE_NAME_COL);
|
||||
CellRangeAddressList entityclientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.ENTITY_ID_COL, GuarantorConstants.ENTITY_ID_COL);
|
||||
CellRangeAddressList accountNumberRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.LOAN_ACCOUNT_NO_COL, GuarantorConstants.LOAN_ACCOUNT_NO_COL);
|
||||
CellRangeAddressList savingsaccountNumberRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.SAVINGS_ID_COL, GuarantorConstants.SAVINGS_ID_COL);
|
||||
CellRangeAddressList guranterTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.GUARANTO_TYPE_COL, GuarantorConstants.GUARANTO_TYPE_COL);
|
||||
CellRangeAddressList guranterRelationshipTypeRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL, GuarantorConstants.CLIENT_RELATIONSHIP_TYPE_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet)worksheet);
|
||||
|
||||
setNames(worksheet);
|
||||
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint clientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$A1))");
|
||||
DataValidationConstraint accountNumberConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Account_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($B1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint savingsaccountNumberConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"SavingsAccount_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($G1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint guranterTypeConstraint = validationHelper.createExplicitListConstraint(new String[] {
|
||||
TemplatePopulateImportConstants.GUARANTOR_INTERNAL,
|
||||
TemplatePopulateImportConstants.GUARANTOR_EXTERNAL});
|
||||
DataValidationConstraint guarantorRelationshipConstraint = validationHelper.createFormulaListConstraint("GuarantorRelationship");
|
||||
DataValidationConstraint entityofficeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint entityclientNameConstraint = validationHelper.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$F1))");
|
||||
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation clientValidation = validationHelper.createValidation(clientNameConstraint, clientNameRange);
|
||||
DataValidation accountNumberValidation = validationHelper.createValidation(accountNumberConstraint, accountNumberRange);
|
||||
DataValidation savingsaccountNumberValidation = validationHelper.createValidation(savingsaccountNumberConstraint, savingsaccountNumberRange);
|
||||
DataValidation guranterTypeValidation = validationHelper.createValidation(guranterTypeConstraint, guranterTypeRange);
|
||||
DataValidation guarantorRelationshipValidation=validationHelper.createValidation(guarantorRelationshipConstraint,guranterRelationshipTypeRange);
|
||||
DataValidation entityofficeValidation = validationHelper.createValidation(entityofficeNameConstraint, entityofficeNameRange);
|
||||
DataValidation entityclientValidation = validationHelper.createValidation(entityclientNameConstraint, entityclientNameRange);
|
||||
|
||||
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(clientValidation);
|
||||
worksheet.addValidationData(accountNumberValidation);
|
||||
worksheet.addValidationData(guranterTypeValidation);
|
||||
@@ -223,92 +223,92 @@ public class GuarantorWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
worksheet.addValidationData(entityofficeValidation);
|
||||
worksheet.addValidationData(entityclientValidation);
|
||||
worksheet.addValidationData(savingsaccountNumberValidation);
|
||||
|
||||
}
|
||||
private void setNames(Sheet worksheet) {
|
||||
Workbook addGurarantorWorkbook = worksheet.getWorkbook();
|
||||
ArrayList<String> officeNames = new ArrayList<String>(officeSheetPopulator.getOfficeNames());
|
||||
|
||||
//Office Names
|
||||
Name officeGroup = addGurarantorWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (officeNames.size() + 1));
|
||||
|
||||
}
|
||||
private void setNames(Sheet worksheet) {
|
||||
Workbook addGurarantorWorkbook = worksheet.getWorkbook();
|
||||
ArrayList<String> officeNames = new ArrayList<String>(officeSheetPopulator.getOfficeNames());
|
||||
|
||||
//Office Names
|
||||
Name officeGroup = addGurarantorWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (officeNames.size() + 1));
|
||||
|
||||
//GurantorRelationshipTypes Names
|
||||
Name guarantorRelationshipsGroup = addGurarantorWorkbook.createName();
|
||||
guarantorRelationshipsGroup.setNameName("GuarantorRelationship");
|
||||
guarantorRelationshipsGroup.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CH$2:$CH$" + (guarantorRelationshipTypes.size() + 1));
|
||||
|
||||
//Clients Named after Offices
|
||||
for(Integer i = 0; i < officeNames.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfClients = clientSheetPopulator.getOfficeNameToBeginEndIndexesOfClients().get(i);
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
if(officeNameToBeginEndIndexesOfClients != null) {
|
||||
name.setNameName("Client_" + officeNames.get(i).trim().replaceAll("[ )(]", "_"));
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.CLIENT_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfClients[0] +
|
||||
":$B$" + officeNameToBeginEndIndexesOfClients[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//Counting clients with active loans and starting and end addresses of cells
|
||||
HashMap<String, Integer[]> clientNameToBeginEndIndexes = new HashMap<String, Integer[]>();
|
||||
ArrayList<String> clientsWithActiveLoans = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveLoans = new ArrayList<String>();
|
||||
int startIndex = 1, endIndex = 1;
|
||||
String clientName = "";
|
||||
String clientId = "";
|
||||
for(int i = 0; i < loans.size(); i++){
|
||||
if(!clientName.equals(loans.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
startIndex = i + 2;
|
||||
clientName = loans.get(i).getClientName();
|
||||
clientId = loans.get(i).getClientId().toString();
|
||||
clientsWithActiveLoans.add(clientName);
|
||||
clientIdsWithActiveLoans.add(clientId);
|
||||
}
|
||||
if(i == loans.size()-1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
}
|
||||
}
|
||||
|
||||
//Account Number Named after Clients
|
||||
for(int j = 0; j < clientsWithActiveLoans.size(); j++) {
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveLoans.get(j) + "_");
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CE$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[0] +
|
||||
":$CE$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[1]);
|
||||
}
|
||||
///savings
|
||||
//Counting clients with active savings and starting and end addresses of cells for naming
|
||||
ArrayList<String> clientsWithActiveSavings = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveSavings = new ArrayList<String>();
|
||||
clientName="";
|
||||
clientId="";
|
||||
for(int i = 0; i < savings.size(); i++){
|
||||
if(!clientName.equals(savings.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
startIndex = i + 2;
|
||||
clientName = savings.get(i).getClientName();
|
||||
clientId = savings.get(i).getClientId().toString();
|
||||
clientsWithActiveSavings.add(clientName);
|
||||
clientIdsWithActiveSavings.add(clientId);
|
||||
}
|
||||
if(i == savings.size()-1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
}
|
||||
}
|
||||
//Account Number Named after Clients
|
||||
for(int j = 0; j < clientsWithActiveSavings.size(); j++) {
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
name.setNameName("SavingsAccount_" + clientsWithActiveSavings.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[0] +
|
||||
":$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[1]);
|
||||
}
|
||||
|
||||
}
|
||||
//GurantorRelationshipTypes Names
|
||||
Name guarantorRelationshipsGroup = addGurarantorWorkbook.createName();
|
||||
guarantorRelationshipsGroup.setNameName("GuarantorRelationship");
|
||||
guarantorRelationshipsGroup.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CH$2:$CH$" + (guarantorRelationshipTypes.size() + 1));
|
||||
|
||||
//Clients Named after Offices
|
||||
for(Integer i = 0; i < officeNames.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfClients = clientSheetPopulator.getOfficeNameToBeginEndIndexesOfClients().get(i);
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
if(officeNameToBeginEndIndexesOfClients != null) {
|
||||
name.setNameName("Client_" + officeNames.get(i).trim().replaceAll("[ )(]", "_"));
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.CLIENT_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfClients[0] +
|
||||
":$B$" + officeNameToBeginEndIndexesOfClients[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//Counting clients with active loans and starting and end addresses of cells
|
||||
HashMap<String, Integer[]> clientNameToBeginEndIndexes = new HashMap<String, Integer[]>();
|
||||
ArrayList<String> clientsWithActiveLoans = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveLoans = new ArrayList<String>();
|
||||
int startIndex = 1, endIndex = 1;
|
||||
String clientName = "";
|
||||
String clientId = "";
|
||||
for(int i = 0; i < loans.size(); i++){
|
||||
if(!clientName.equals(loans.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
startIndex = i + 2;
|
||||
clientName = loans.get(i).getClientName();
|
||||
clientId = loans.get(i).getClientId().toString();
|
||||
clientsWithActiveLoans.add(clientName);
|
||||
clientIdsWithActiveLoans.add(clientId);
|
||||
}
|
||||
if(i == loans.size()-1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
}
|
||||
}
|
||||
|
||||
//Account Number Named after Clients
|
||||
for(int j = 0; j < clientsWithActiveLoans.size(); j++) {
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveLoans.get(j) + "_");
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CE$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[0] +
|
||||
":$CE$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[1]);
|
||||
}
|
||||
///savings
|
||||
//Counting clients with active savings and starting and end addresses of cells for naming
|
||||
ArrayList<String> clientsWithActiveSavings = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveSavings = new ArrayList<String>();
|
||||
clientName="";
|
||||
clientId="";
|
||||
for(int i = 0; i < savings.size(); i++){
|
||||
if(!clientName.equals(savings.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
startIndex = i + 2;
|
||||
clientName = savings.get(i).getClientName();
|
||||
clientId = savings.get(i).getClientId().toString();
|
||||
clientsWithActiveSavings.add(clientName);
|
||||
clientIdsWithActiveSavings.add(clientId);
|
||||
}
|
||||
if(i == savings.size()-1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[]{startIndex, endIndex});
|
||||
}
|
||||
}
|
||||
//Account Number Named after Clients
|
||||
for(int j = 0; j < clientsWithActiveSavings.size(); j++) {
|
||||
Name name = addGurarantorWorkbook.createName();
|
||||
name.setNameName("SavingsAccount_" + clientsWithActiveSavings.get(j).replaceAll(" ", "_") + "_" + clientIdsWithActiveSavings.get(j) + "_");
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.GUARANTOR_SHEET_NAME+"!$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[0] +
|
||||
":$CG$" + clientNameToBeginEndIndexes.get(clientsWithActiveSavings.get(j))[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+134
-134
@@ -34,158 +34,158 @@ import java.util.ArrayList;
|
||||
|
||||
|
||||
public class JournalEntriesWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private GlAccountSheetPopulator glAccountSheetPopulator;
|
||||
private ExtrasSheetPopulator extrasSheetPopulator;
|
||||
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private GlAccountSheetPopulator glAccountSheetPopulator;
|
||||
private ExtrasSheetPopulator extrasSheetPopulator;
|
||||
|
||||
public JournalEntriesWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
GlAccountSheetPopulator glAccountSheetPopulator, ExtrasSheetPopulator extrasSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.glAccountSheetPopulator = glAccountSheetPopulator;
|
||||
this.extrasSheetPopulator = extrasSheetPopulator;
|
||||
}
|
||||
public JournalEntriesWorkbookPopulator(OfficeSheetPopulator officeSheetPopulator,
|
||||
GlAccountSheetPopulator glAccountSheetPopulator, ExtrasSheetPopulator extrasSheetPopulator) {
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.glAccountSheetPopulator = glAccountSheetPopulator;
|
||||
this.extrasSheetPopulator = extrasSheetPopulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet addJournalEntriesSheet = workbook.createSheet(TemplatePopulateImportConstants.JOURNAL_ENTRY_SHEET_NAME);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
glAccountSheetPopulator.populate(workbook,dateFormat);
|
||||
extrasSheetPopulator.populate(workbook,dateFormat);
|
||||
setRules(addJournalEntriesSheet);
|
||||
setDefaults(addJournalEntriesSheet);
|
||||
setLayout(addJournalEntriesSheet);
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.TRANSACION_ON_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.CURRENCY_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.PAYMENT_TYPE_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.TRANSACTION_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.AMOUNT_CREDIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.AMOUNT_DEBIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.ACCOUNT_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.CHECK_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.ROUTING_CODE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.RECEIPT_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.BANK_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.COMMENTS_COL,TemplatePopulateImportConstants.EXTRALARGE_COL_SIZE);
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet addJournalEntriesSheet = workbook.createSheet(TemplatePopulateImportConstants.JOURNAL_ENTRY_SHEET_NAME);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
glAccountSheetPopulator.populate(workbook,dateFormat);
|
||||
extrasSheetPopulator.populate(workbook,dateFormat);
|
||||
setRules(addJournalEntriesSheet);
|
||||
setDefaults(addJournalEntriesSheet);
|
||||
setLayout(addJournalEntriesSheet);
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.TRANSACION_ON_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.CURRENCY_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.PAYMENT_TYPE_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.TRANSACTION_ID_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.AMOUNT_CREDIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.AMOUNT_DEBIT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.ACCOUNT_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.CHECK_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.ROUTING_CODE_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.RECEIPT_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.BANK_NO_COL,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(JournalEntryConstants.COMMENTS_COL,TemplatePopulateImportConstants.EXTRALARGE_COL_SIZE);
|
||||
|
||||
writeString(JournalEntryConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(JournalEntryConstants.TRANSACION_ON_DATE_COL, rowHeader, "Transaction On *");
|
||||
writeString(JournalEntryConstants.CURRENCY_NAME_COL, rowHeader, "Currecy Type*");
|
||||
writeString(JournalEntryConstants.PAYMENT_TYPE_ID_COL, rowHeader, "Payment Type*");
|
||||
writeString(JournalEntryConstants.TRANSACTION_ID_COL, rowHeader, "Transaction Id*");
|
||||
writeString(JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, rowHeader, "Credit Account Type*");
|
||||
writeString(JournalEntryConstants.AMOUNT_CREDIT_COL, rowHeader, "Amount*");
|
||||
writeString(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, rowHeader, "Debit Account Type*");
|
||||
writeString(JournalEntryConstants.AMOUNT_DEBIT_COL, rowHeader, "Amount*");
|
||||
writeString(JournalEntryConstants.ACCOUNT_NO_COL,rowHeader,"Account#");
|
||||
writeString(JournalEntryConstants.CHECK_NO_COL,rowHeader,"Cheque#");
|
||||
writeString(JournalEntryConstants.ROUTING_CODE_COL,rowHeader,"Routing code");
|
||||
writeString(JournalEntryConstants.RECEIPT_NO_COL,rowHeader,"Receipt#");
|
||||
writeString(JournalEntryConstants.BANK_NO_COL,rowHeader,"Bank#");
|
||||
writeString(JournalEntryConstants.COMMENTS_COL,rowHeader,"Comments");
|
||||
writeString(JournalEntryConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(JournalEntryConstants.TRANSACION_ON_DATE_COL, rowHeader, "Transaction On *");
|
||||
writeString(JournalEntryConstants.CURRENCY_NAME_COL, rowHeader, "Currecy Type*");
|
||||
writeString(JournalEntryConstants.PAYMENT_TYPE_ID_COL, rowHeader, "Payment Type*");
|
||||
writeString(JournalEntryConstants.TRANSACTION_ID_COL, rowHeader, "Transaction Id*");
|
||||
writeString(JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, rowHeader, "Credit Account Type*");
|
||||
writeString(JournalEntryConstants.AMOUNT_CREDIT_COL, rowHeader, "Amount*");
|
||||
writeString(JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, rowHeader, "Debit Account Type*");
|
||||
writeString(JournalEntryConstants.AMOUNT_DEBIT_COL, rowHeader, "Amount*");
|
||||
writeString(JournalEntryConstants.ACCOUNT_NO_COL,rowHeader,"Account#");
|
||||
writeString(JournalEntryConstants.CHECK_NO_COL,rowHeader,"Cheque#");
|
||||
writeString(JournalEntryConstants.ROUTING_CODE_COL,rowHeader,"Routing code");
|
||||
writeString(JournalEntryConstants.RECEIPT_NO_COL,rowHeader,"Receipt#");
|
||||
writeString(JournalEntryConstants.BANK_NO_COL,rowHeader,"Bank#");
|
||||
writeString(JournalEntryConstants.COMMENTS_COL,rowHeader,"Comments");
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private void setRules(Sheet worksheet) {
|
||||
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.OFFICE_NAME_COL,JournalEntryConstants. OFFICE_NAME_COL);
|
||||
}
|
||||
|
||||
private void setRules(Sheet worksheet) {
|
||||
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.OFFICE_NAME_COL,JournalEntryConstants. OFFICE_NAME_COL);
|
||||
|
||||
CellRangeAddressList currencyCodeRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.CURRENCY_NAME_COL, JournalEntryConstants.CURRENCY_NAME_COL);
|
||||
CellRangeAddressList currencyCodeRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.CURRENCY_NAME_COL, JournalEntryConstants.CURRENCY_NAME_COL);
|
||||
|
||||
CellRangeAddressList paymenttypeRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.PAYMENT_TYPE_ID_COL, JournalEntryConstants.PAYMENT_TYPE_ID_COL);
|
||||
CellRangeAddressList paymenttypeRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.PAYMENT_TYPE_ID_COL, JournalEntryConstants.PAYMENT_TYPE_ID_COL);
|
||||
|
||||
CellRangeAddressList glaccountCreditRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL);
|
||||
CellRangeAddressList glaccountCreditRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL, JournalEntryConstants.GL_ACCOUNT_ID_CREDIT_COL);
|
||||
|
||||
CellRangeAddressList glaccountDebitRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL);
|
||||
CellRangeAddressList glaccountDebitRange = new CellRangeAddressList(
|
||||
1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL, JournalEntryConstants.GL_ACCOUNT_ID_DEBIT_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper(
|
||||
(HSSFSheet) worksheet);
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper(
|
||||
(HSSFSheet) worksheet);
|
||||
|
||||
setNames(worksheet);
|
||||
setNames(worksheet);
|
||||
|
||||
DataValidationConstraint officeNameConstraint = validationHelper
|
||||
.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint currencyCodeConstraint = validationHelper
|
||||
.createFormulaListConstraint("Currency");
|
||||
DataValidationConstraint paymentTypeConstraint = validationHelper
|
||||
.createFormulaListConstraint("PaymentType");
|
||||
DataValidationConstraint officeNameConstraint = validationHelper
|
||||
.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint currencyCodeConstraint = validationHelper
|
||||
.createFormulaListConstraint("Currency");
|
||||
DataValidationConstraint paymentTypeConstraint = validationHelper
|
||||
.createFormulaListConstraint("PaymentType");
|
||||
|
||||
DataValidationConstraint glaccountConstraint = validationHelper
|
||||
.createFormulaListConstraint("GlAccounts");
|
||||
DataValidationConstraint glaccountConstraint = validationHelper
|
||||
.createFormulaListConstraint("GlAccounts");
|
||||
|
||||
DataValidation officeValidation = validationHelper
|
||||
.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation currencyCodeValidation = validationHelper
|
||||
.createValidation(currencyCodeConstraint, currencyCodeRange);
|
||||
DataValidation paymentTypeValidation = validationHelper
|
||||
.createValidation(paymentTypeConstraint, paymenttypeRange);
|
||||
DataValidation officeValidation = validationHelper
|
||||
.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation currencyCodeValidation = validationHelper
|
||||
.createValidation(currencyCodeConstraint, currencyCodeRange);
|
||||
DataValidation paymentTypeValidation = validationHelper
|
||||
.createValidation(paymentTypeConstraint, paymenttypeRange);
|
||||
|
||||
DataValidation glaccountCreditValidation = validationHelper
|
||||
.createValidation(glaccountConstraint, glaccountCreditRange);
|
||||
DataValidation glaccountDebitValidation = validationHelper
|
||||
.createValidation(glaccountConstraint, glaccountDebitRange);
|
||||
DataValidation glaccountCreditValidation = validationHelper
|
||||
.createValidation(glaccountConstraint, glaccountCreditRange);
|
||||
DataValidation glaccountDebitValidation = validationHelper
|
||||
.createValidation(glaccountConstraint, glaccountDebitRange);
|
||||
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(currencyCodeValidation);
|
||||
worksheet.addValidationData(paymentTypeValidation);
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(currencyCodeValidation);
|
||||
worksheet.addValidationData(paymentTypeValidation);
|
||||
|
||||
worksheet.addValidationData(glaccountCreditValidation);
|
||||
worksheet.addValidationData(glaccountDebitValidation);
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet) {
|
||||
Workbook addJournalEntriesWorkbook = worksheet.getWorkbook();
|
||||
ArrayList<String> officeNames = new ArrayList<>(officeSheetPopulator.getOfficeNames());
|
||||
// Office Names
|
||||
Name officeGroup = addJournalEntriesWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$"
|
||||
+ (officeNames.size() + 1));
|
||||
// Payment Type Name
|
||||
Name paymentTypeGroup = addJournalEntriesWorkbook.createName();
|
||||
paymentTypeGroup.setNameName("PaymentType");
|
||||
paymentTypeGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$D$2:$D$"
|
||||
+ (extrasSheetPopulator.getPaymentTypesSize() + 1));
|
||||
// Currency Type Name
|
||||
Name currencyGroup = addJournalEntriesWorkbook.createName();
|
||||
currencyGroup.setNameName("Currency");
|
||||
currencyGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$F$2:$F$"
|
||||
+ (extrasSheetPopulator.getCurrenciesSize() + 1));
|
||||
worksheet.addValidationData(glaccountCreditValidation);
|
||||
worksheet.addValidationData(glaccountDebitValidation);
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet) {
|
||||
Workbook addJournalEntriesWorkbook = worksheet.getWorkbook();
|
||||
ArrayList<String> officeNames = new ArrayList<>(officeSheetPopulator.getOfficeNames());
|
||||
// Office Names
|
||||
Name officeGroup = addJournalEntriesWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$"
|
||||
+ (officeNames.size() + 1));
|
||||
// Payment Type Name
|
||||
Name paymentTypeGroup = addJournalEntriesWorkbook.createName();
|
||||
paymentTypeGroup.setNameName("PaymentType");
|
||||
paymentTypeGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$D$2:$D$"
|
||||
+ (extrasSheetPopulator.getPaymentTypesSize() + 1));
|
||||
// Currency Type Name
|
||||
Name currencyGroup = addJournalEntriesWorkbook.createName();
|
||||
currencyGroup.setNameName("Currency");
|
||||
currencyGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$F$2:$F$"
|
||||
+ (extrasSheetPopulator.getCurrenciesSize() + 1));
|
||||
|
||||
// Account Name
|
||||
Name glaccountGroup = addJournalEntriesWorkbook.createName();
|
||||
glaccountGroup.setNameName("GlAccounts");
|
||||
glaccountGroup.setRefersToFormula(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME+"!$B$2:$B$"
|
||||
+ (glAccountSheetPopulator.getGlAccountNamesSize() + 1));
|
||||
}
|
||||
|
||||
private void setDefaults(Sheet worksheet) {
|
||||
for (Integer rowNo = 1; rowNo < 1000; rowNo++) {
|
||||
Row row = worksheet.createRow(rowNo);
|
||||
}
|
||||
// Account Name
|
||||
Name glaccountGroup = addJournalEntriesWorkbook.createName();
|
||||
glaccountGroup.setNameName("GlAccounts");
|
||||
glaccountGroup.setRefersToFormula(TemplatePopulateImportConstants.GL_ACCOUNTS_SHEET_NAME+"!$B$2:$B$"
|
||||
+ (glAccountSheetPopulator.getGlAccountNamesSize() + 1));
|
||||
}
|
||||
|
||||
private void setDefaults(Sheet worksheet) {
|
||||
for (Integer rowNo = 1; rowNo < 1000; rowNo++) {
|
||||
Row row = worksheet.createRow(rowNo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+503
-503
File diff suppressed because it is too large
Load Diff
+237
-237
@@ -38,262 +38,262 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
private ExtrasSheetPopulator extrasSheetPopulator;
|
||||
private List<LoanAccountData> allloans;
|
||||
private Map<Long,String> clientIdToClientExternalId;
|
||||
private OfficeSheetPopulator officeSheetPopulator;
|
||||
private ClientSheetPopulator clientSheetPopulator;
|
||||
private ExtrasSheetPopulator extrasSheetPopulator;
|
||||
private List<LoanAccountData> allloans;
|
||||
private Map<Long,String> clientIdToClientExternalId;
|
||||
|
||||
public LoanRepaymentWorkbookPopulator(List<LoanAccountData> loans, OfficeSheetPopulator officeSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator, ExtrasSheetPopulator extrasSheetPopulator) {
|
||||
this.allloans = loans;
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
this.extrasSheetPopulator = extrasSheetPopulator;
|
||||
}
|
||||
public LoanRepaymentWorkbookPopulator(List<LoanAccountData> loans, OfficeSheetPopulator officeSheetPopulator,
|
||||
ClientSheetPopulator clientSheetPopulator, ExtrasSheetPopulator extrasSheetPopulator) {
|
||||
this.allloans = loans;
|
||||
this.officeSheetPopulator = officeSheetPopulator;
|
||||
this.clientSheetPopulator = clientSheetPopulator;
|
||||
this.extrasSheetPopulator = extrasSheetPopulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet loanRepaymentSheet = workbook.createSheet(TemplatePopulateImportConstants.LOAN_REPAYMENT_SHEET_NAME);
|
||||
setLayout(loanRepaymentSheet);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
extrasSheetPopulator.populate(workbook,dateFormat);
|
||||
setClientIdToClientExternalId();
|
||||
populateLoansTable(loanRepaymentSheet,dateFormat);
|
||||
setRules(loanRepaymentSheet,dateFormat);
|
||||
setDefaults(loanRepaymentSheet,dateFormat);
|
||||
}
|
||||
@Override
|
||||
public void populate(Workbook workbook,String dateFormat) {
|
||||
Sheet loanRepaymentSheet = workbook.createSheet(TemplatePopulateImportConstants.LOAN_REPAYMENT_SHEET_NAME);
|
||||
setLayout(loanRepaymentSheet);
|
||||
officeSheetPopulator.populate(workbook,dateFormat);
|
||||
clientSheetPopulator.populate(workbook,dateFormat);
|
||||
extrasSheetPopulator.populate(workbook,dateFormat);
|
||||
setClientIdToClientExternalId();
|
||||
populateLoansTable(loanRepaymentSheet,dateFormat);
|
||||
setRules(loanRepaymentSheet,dateFormat);
|
||||
setDefaults(loanRepaymentSheet,dateFormat);
|
||||
}
|
||||
|
||||
private void setClientIdToClientExternalId() {
|
||||
clientIdToClientExternalId =new HashMap<>();
|
||||
List<ClientData>allclients=clientSheetPopulator.getClients();
|
||||
for (ClientData client: allclients) {
|
||||
if (client.getExternalId()!=null)
|
||||
clientIdToClientExternalId.put(client.getId(),client.getExternalId());
|
||||
}
|
||||
}
|
||||
private void setClientIdToClientExternalId() {
|
||||
clientIdToClientExternalId =new HashMap<>();
|
||||
List<ClientData>allclients=clientSheetPopulator.getClients();
|
||||
for (ClientData client: allclients) {
|
||||
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)
|
||||
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)))");
|
||||
writeFormula(LoanRepaymentConstants.PRODUCT_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",2,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",2,FALSE))");
|
||||
writeFormula(LoanRepaymentConstants.PRINCIPAL_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",3,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",3,FALSE))");
|
||||
writeFormula(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",4,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",4,FALSE))");
|
||||
private void setDefaults(Sheet worksheet,String dateFormat) {
|
||||
for (Integer rowNo = 1; rowNo < 3000; rowNo++) {
|
||||
Row row = worksheet.getRow(rowNo);
|
||||
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)))");
|
||||
writeFormula(LoanRepaymentConstants.PRODUCT_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",2,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",2,FALSE))");
|
||||
writeFormula(LoanRepaymentConstants.PRINCIPAL_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",3,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",3,FALSE))");
|
||||
writeFormula(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",4,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",4,FALSE))");
|
||||
|
||||
writeFormula(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",5,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",5,FALSE))");
|
||||
Workbook workbook=worksheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
row.getCell(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL).setCellStyle(dateCellStyle);
|
||||
}
|
||||
}
|
||||
writeFormula(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL, row,
|
||||
"IF(ISERROR(VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",5,FALSE)),\"\",VLOOKUP($D" + (rowNo + 1) + ",$T$2:$X$" + (allloans.size() + 1)
|
||||
+ ",5,FALSE))");
|
||||
Workbook workbook=worksheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
row.getCell(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL).setCellStyle(dateCellStyle);
|
||||
}
|
||||
}
|
||||
|
||||
private void setRules(Sheet worksheet,String dateFormat) {
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
LoanRepaymentConstants.OFFICE_NAME_COL, LoanRepaymentConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList clientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
LoanRepaymentConstants.CLIENT_NAME_COL, LoanRepaymentConstants.CLIENT_NAME_COL);
|
||||
CellRangeAddressList accountNumberRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL);
|
||||
CellRangeAddressList repaymentTypeRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.REPAYMENT_TYPE_COL, LoanRepaymentConstants.REPAYMENT_TYPE_COL);
|
||||
CellRangeAddressList repaymentDateRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.REPAID_ON_DATE_COL, LoanRepaymentConstants.REPAID_ON_DATE_COL);
|
||||
private void setRules(Sheet worksheet,String dateFormat) {
|
||||
CellRangeAddressList officeNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
LoanRepaymentConstants.OFFICE_NAME_COL, LoanRepaymentConstants.OFFICE_NAME_COL);
|
||||
CellRangeAddressList clientNameRange = new CellRangeAddressList(1, SpreadsheetVersion.EXCEL97.getLastRowIndex(),
|
||||
LoanRepaymentConstants.CLIENT_NAME_COL, LoanRepaymentConstants.CLIENT_NAME_COL);
|
||||
CellRangeAddressList accountNumberRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL);
|
||||
CellRangeAddressList repaymentTypeRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.REPAYMENT_TYPE_COL, LoanRepaymentConstants.REPAYMENT_TYPE_COL);
|
||||
CellRangeAddressList repaymentDateRange = new CellRangeAddressList(1,
|
||||
SpreadsheetVersion.EXCEL97.getLastRowIndex(), LoanRepaymentConstants.REPAID_ON_DATE_COL, LoanRepaymentConstants.REPAID_ON_DATE_COL);
|
||||
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet) worksheet);
|
||||
DataValidationHelper validationHelper = new HSSFDataValidationHelper((HSSFSheet) worksheet);
|
||||
|
||||
setNames(worksheet);
|
||||
setNames(worksheet);
|
||||
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint clientNameConstraint = validationHelper
|
||||
.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$A1))");
|
||||
DataValidationConstraint accountNumberConstraint = validationHelper.createFormulaListConstraint(
|
||||
"INDIRECT(CONCATENATE(\"Account_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($B1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint paymentTypeConstraint = validationHelper.createFormulaListConstraint("PaymentTypes");
|
||||
DataValidationConstraint repaymentDateConstraint = validationHelper.createDateConstraint(
|
||||
DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=VLOOKUP($D1,$T$2:$X$" + (allloans.size() + 1) + ",4,FALSE)", "=TODAY()", dateFormat);
|
||||
DataValidationConstraint officeNameConstraint = validationHelper.createFormulaListConstraint("Office");
|
||||
DataValidationConstraint clientNameConstraint = validationHelper
|
||||
.createFormulaListConstraint("INDIRECT(CONCATENATE(\"Client_\",$A1))");
|
||||
DataValidationConstraint accountNumberConstraint = validationHelper.createFormulaListConstraint(
|
||||
"INDIRECT(CONCATENATE(\"Account_\",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($B1,\" \",\"_\"),\"(\",\"_\"),\")\",\"_\")))");
|
||||
DataValidationConstraint paymentTypeConstraint = validationHelper.createFormulaListConstraint("PaymentTypes");
|
||||
DataValidationConstraint repaymentDateConstraint = validationHelper.createDateConstraint(
|
||||
DataValidationConstraint.OperatorType.BETWEEN,
|
||||
"=VLOOKUP($D1,$T$2:$X$" + (allloans.size() + 1) + ",4,FALSE)", "=TODAY()", dateFormat);
|
||||
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation clientValidation = validationHelper.createValidation(clientNameConstraint, clientNameRange);
|
||||
DataValidation accountNumberValidation = validationHelper.createValidation(accountNumberConstraint,
|
||||
accountNumberRange);
|
||||
DataValidation repaymentTypeValidation = validationHelper.createValidation(paymentTypeConstraint,
|
||||
repaymentTypeRange);
|
||||
DataValidation repaymentDateValidation = validationHelper.createValidation(repaymentDateConstraint,
|
||||
repaymentDateRange);
|
||||
DataValidation officeValidation = validationHelper.createValidation(officeNameConstraint, officeNameRange);
|
||||
DataValidation clientValidation = validationHelper.createValidation(clientNameConstraint, clientNameRange);
|
||||
DataValidation accountNumberValidation = validationHelper.createValidation(accountNumberConstraint,
|
||||
accountNumberRange);
|
||||
DataValidation repaymentTypeValidation = validationHelper.createValidation(paymentTypeConstraint,
|
||||
repaymentTypeRange);
|
||||
DataValidation repaymentDateValidation = validationHelper.createValidation(repaymentDateConstraint,
|
||||
repaymentDateRange);
|
||||
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(clientValidation);
|
||||
worksheet.addValidationData(accountNumberValidation);
|
||||
worksheet.addValidationData(repaymentTypeValidation);
|
||||
worksheet.addValidationData(repaymentDateValidation);
|
||||
worksheet.addValidationData(officeValidation);
|
||||
worksheet.addValidationData(clientValidation);
|
||||
worksheet.addValidationData(accountNumberValidation);
|
||||
worksheet.addValidationData(repaymentTypeValidation);
|
||||
worksheet.addValidationData(repaymentDateValidation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setNames(Sheet worksheet) {
|
||||
ArrayList<String> officeNames = new ArrayList<>(officeSheetPopulator.getOfficeNames());
|
||||
Workbook loanRepaymentWorkbook = worksheet.getWorkbook();
|
||||
// Office Names
|
||||
Name officeGroup = loanRepaymentWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (officeNames.size() + 1));
|
||||
private void setNames(Sheet worksheet) {
|
||||
ArrayList<String> officeNames = new ArrayList<>(officeSheetPopulator.getOfficeNames());
|
||||
Workbook loanRepaymentWorkbook = worksheet.getWorkbook();
|
||||
// Office Names
|
||||
Name officeGroup = loanRepaymentWorkbook.createName();
|
||||
officeGroup.setNameName("Office");
|
||||
officeGroup.setRefersToFormula(TemplatePopulateImportConstants.OFFICE_SHEET_NAME+"!$B$2:$B$" + (officeNames.size() + 1));
|
||||
|
||||
// Clients Named after Offices
|
||||
for (Integer i = 0; i < officeNames.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfClients = clientSheetPopulator
|
||||
.getOfficeNameToBeginEndIndexesOfClients().get(i);
|
||||
Name name = loanRepaymentWorkbook.createName();
|
||||
if (officeNameToBeginEndIndexesOfClients != null) {
|
||||
name.setNameName("Client_" + officeNames.get(i).trim().replaceAll("[ )(]", "_"));
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.CLIENT_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfClients[0] + ":$B$"
|
||||
+ officeNameToBeginEndIndexesOfClients[1]);
|
||||
}
|
||||
}
|
||||
// Clients Named after Offices
|
||||
for (Integer i = 0; i < officeNames.size(); i++) {
|
||||
Integer[] officeNameToBeginEndIndexesOfClients = clientSheetPopulator
|
||||
.getOfficeNameToBeginEndIndexesOfClients().get(i);
|
||||
Name name = loanRepaymentWorkbook.createName();
|
||||
if (officeNameToBeginEndIndexesOfClients != null) {
|
||||
name.setNameName("Client_" + officeNames.get(i).trim().replaceAll("[ )(]", "_"));
|
||||
name.setRefersToFormula(TemplatePopulateImportConstants.CLIENT_SHEET_NAME+"!$B$" + officeNameToBeginEndIndexesOfClients[0] + ":$B$"
|
||||
+ officeNameToBeginEndIndexesOfClients[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Counting clients with active loans and starting and end addresses of
|
||||
// cells
|
||||
HashMap<String, Integer[]> clientNameToBeginEndIndexes = new HashMap<String, Integer[]>();
|
||||
ArrayList<String> clientsWithActiveLoans = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveLoans = new ArrayList<String>();
|
||||
int startIndex = 1, endIndex = 1;
|
||||
String clientName = "";
|
||||
String clientId = "";
|
||||
for (int i = 0; i < allloans.size(); i++) {
|
||||
if (!clientName.equals(allloans.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[] { startIndex, endIndex });
|
||||
startIndex = i + 2;
|
||||
clientName = allloans.get(i).getClientName();
|
||||
clientId = allloans.get(i).getClientId().toString();
|
||||
if (!clientsWithActiveLoans.contains(clientName)) {
|
||||
clientsWithActiveLoans.add(clientName);
|
||||
clientIdsWithActiveLoans.add(clientId);
|
||||
}
|
||||
}
|
||||
if (i == allloans.size() - 1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[] { startIndex, endIndex });
|
||||
}
|
||||
}
|
||||
// Counting clients with active loans and starting and end addresses of
|
||||
// cells
|
||||
HashMap<String, Integer[]> clientNameToBeginEndIndexes = new HashMap<String, Integer[]>();
|
||||
ArrayList<String> clientsWithActiveLoans = new ArrayList<String>();
|
||||
ArrayList<String> clientIdsWithActiveLoans = new ArrayList<String>();
|
||||
int startIndex = 1, endIndex = 1;
|
||||
String clientName = "";
|
||||
String clientId = "";
|
||||
for (int i = 0; i < allloans.size(); i++) {
|
||||
if (!clientName.equals(allloans.get(i).getClientName())) {
|
||||
endIndex = i + 1;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[] { startIndex, endIndex });
|
||||
startIndex = i + 2;
|
||||
clientName = allloans.get(i).getClientName();
|
||||
clientId = allloans.get(i).getClientId().toString();
|
||||
if (!clientsWithActiveLoans.contains(clientName)) {
|
||||
clientsWithActiveLoans.add(clientName);
|
||||
clientIdsWithActiveLoans.add(clientId);
|
||||
}
|
||||
}
|
||||
if (i == allloans.size() - 1) {
|
||||
endIndex = i + 2;
|
||||
clientNameToBeginEndIndexes.put(clientName, new Integer[] { startIndex, endIndex });
|
||||
}
|
||||
}
|
||||
|
||||
// Account Number Named after Clients
|
||||
for (int j = 0; j < clientsWithActiveLoans.size(); j++) {
|
||||
Name name = loanRepaymentWorkbook.createName();
|
||||
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replace(" ", "_") + "_"
|
||||
+ clientIdsWithActiveLoans.get(j) + "_");
|
||||
name.setRefersToFormula(
|
||||
TemplatePopulateImportConstants.LOAN_REPAYMENT_SHEET_NAME+"!$T$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[0] + ":$T$"
|
||||
+ clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[1]);
|
||||
}
|
||||
// Account Number Named after Clients
|
||||
for (int j = 0; j < clientsWithActiveLoans.size(); j++) {
|
||||
Name name = loanRepaymentWorkbook.createName();
|
||||
name.setNameName("Account_" + clientsWithActiveLoans.get(j).replace(" ", "_") + "_"
|
||||
+ clientIdsWithActiveLoans.get(j) + "_");
|
||||
name.setRefersToFormula(
|
||||
TemplatePopulateImportConstants.LOAN_REPAYMENT_SHEET_NAME+"!$T$" + clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[0] + ":$T$"
|
||||
+ clientNameToBeginEndIndexes.get(clientsWithActiveLoans.get(j))[1]);
|
||||
}
|
||||
|
||||
// Payment Type Name
|
||||
Name paymentTypeGroup = loanRepaymentWorkbook.createName();
|
||||
paymentTypeGroup.setNameName("PaymentTypes");
|
||||
paymentTypeGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$D$2:$D$" + (extrasSheetPopulator.getPaymentTypesSize() + 1));
|
||||
}
|
||||
// Payment Type Name
|
||||
Name paymentTypeGroup = loanRepaymentWorkbook.createName();
|
||||
paymentTypeGroup.setNameName("PaymentTypes");
|
||||
paymentTypeGroup.setRefersToFormula(TemplatePopulateImportConstants.EXTRAS_SHEET_NAME+"!$D$2:$D$" + (extrasSheetPopulator.getPaymentTypesSize() + 1));
|
||||
}
|
||||
|
||||
private void populateLoansTable(Sheet loanRepaymentSheet,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Row row;
|
||||
Workbook workbook = loanRepaymentSheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = null;
|
||||
Collections.sort(allloans,new LoanComparatorByStatusActive());
|
||||
for (LoanAccountData loan : allloans) {
|
||||
row = loanRepaymentSheet.createRow(rowIndex++);
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, row, loan.getClientName() + "(" + loan.getClientId() + ")");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,row, clientIdToClientExternalId.get(loan.getClientId()));
|
||||
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.getDisbursementDate() != null) {
|
||||
try {
|
||||
date = inputFormat.parse(loan.getDisbursementDate().toString());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row,
|
||||
outputFormat.format(date), dateCellStyle,dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void populateLoansTable(Sheet loanRepaymentSheet,String dateFormat) {
|
||||
int rowIndex = 1;
|
||||
Row row;
|
||||
Workbook workbook = loanRepaymentSheet.getWorkbook();
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = null;
|
||||
Collections.sort(allloans,new LoanComparatorByStatusActive());
|
||||
for (LoanAccountData loan : allloans) {
|
||||
row = loanRepaymentSheet.createRow(rowIndex++);
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, row, loan.getClientName() + "(" + loan.getClientId() + ")");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,row, clientIdToClientExternalId.get(loan.getClientId()));
|
||||
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.getDisbursementDate() != null) {
|
||||
try {
|
||||
date = inputFormat.parse(loan.getDisbursementDate().toString());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row,
|
||||
outputFormat.format(date), dateCellStyle,dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CLIENT_EXTERNAL_ID,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.PRODUCT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL,TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL,TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.AMOUNT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.REPAID_ON_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.REPAYMENT_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CHECK_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.RECEIPT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.ROUTING_CODE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.BANK_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL,TemplatePopulateImportConstants.LARGE_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
writeString(LoanRepaymentConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(LoanRepaymentConstants.CLIENT_NAME_COL, rowHeader, "Client Name*");
|
||||
writeString(LoanRepaymentConstants.CLIENT_EXTERNAL_ID,rowHeader,"Client Ext.Id");
|
||||
writeString(LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, rowHeader, "Loan Account No.*");
|
||||
writeString(LoanRepaymentConstants.PRODUCT_COL, rowHeader, "Product Name");
|
||||
writeString(LoanRepaymentConstants.PRINCIPAL_COL, rowHeader, "Principal");
|
||||
writeString(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL,rowHeader,"Total Outstanding Amount");
|
||||
writeString(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL,rowHeader,"Loan Disbursement Date");
|
||||
writeString(LoanRepaymentConstants.AMOUNT_COL, rowHeader, "Amount Repaid*");
|
||||
writeString(LoanRepaymentConstants.REPAID_ON_DATE_COL, rowHeader, "Date*");
|
||||
writeString(LoanRepaymentConstants.REPAYMENT_TYPE_COL, rowHeader, "Type*");
|
||||
writeString(LoanRepaymentConstants.ACCOUNT_NO_COL, rowHeader, "Account No");
|
||||
writeString(LoanRepaymentConstants.CHECK_NO_COL, rowHeader, "Check No");
|
||||
writeString(LoanRepaymentConstants.RECEIPT_NO_COL, rowHeader, "Receipt No");
|
||||
writeString(LoanRepaymentConstants.ROUTING_CODE_COL, rowHeader, "Routing Code");
|
||||
writeString(LoanRepaymentConstants.BANK_NO_COL, rowHeader, "Bank No");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, rowHeader, "Lookup Client");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,rowHeader,"Lookup ClientExtId");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, rowHeader, "Lookup Account");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, rowHeader, "Lookup Product");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, rowHeader, "Lookup Principal");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL,rowHeader,"Lookup Total Outstanding amount");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, rowHeader, "Lookup Loan Disbursement Date");
|
||||
private void setLayout(Sheet worksheet) {
|
||||
Row rowHeader = worksheet.createRow(TemplatePopulateImportConstants.ROWHEADER_INDEX);
|
||||
rowHeader.setHeight(TemplatePopulateImportConstants.ROW_HEADER_HEIGHT);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.OFFICE_NAME_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CLIENT_EXTERNAL_ID,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.PRODUCT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL,TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL,TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.AMOUNT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.REPAID_ON_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.REPAYMENT_TYPE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.CHECK_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.RECEIPT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.ROUTING_CODE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.BANK_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, TemplatePopulateImportConstants.MEDIUM_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL,TemplatePopulateImportConstants.LARGE_COL_SIZE);
|
||||
worksheet.setColumnWidth(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, TemplatePopulateImportConstants.SMALL_COL_SIZE);
|
||||
writeString(LoanRepaymentConstants.OFFICE_NAME_COL, rowHeader, "Office Name*");
|
||||
writeString(LoanRepaymentConstants.CLIENT_NAME_COL, rowHeader, "Client Name*");
|
||||
writeString(LoanRepaymentConstants.CLIENT_EXTERNAL_ID,rowHeader,"Client Ext.Id");
|
||||
writeString(LoanRepaymentConstants.LOAN_ACCOUNT_NO_COL, rowHeader, "Loan Account No.*");
|
||||
writeString(LoanRepaymentConstants.PRODUCT_COL, rowHeader, "Product Name");
|
||||
writeString(LoanRepaymentConstants.PRINCIPAL_COL, rowHeader, "Principal");
|
||||
writeString(LoanRepaymentConstants.TOTAL_OUTSTANDING_AMOUNT_COL,rowHeader,"Total Outstanding Amount");
|
||||
writeString(LoanRepaymentConstants.LOAN_DISBURSEMENT_DATE_COL,rowHeader,"Loan Disbursement Date");
|
||||
writeString(LoanRepaymentConstants.AMOUNT_COL, rowHeader, "Amount Repaid*");
|
||||
writeString(LoanRepaymentConstants.REPAID_ON_DATE_COL, rowHeader, "Date*");
|
||||
writeString(LoanRepaymentConstants.REPAYMENT_TYPE_COL, rowHeader, "Type*");
|
||||
writeString(LoanRepaymentConstants.ACCOUNT_NO_COL, rowHeader, "Account No");
|
||||
writeString(LoanRepaymentConstants.CHECK_NO_COL, rowHeader, "Check No");
|
||||
writeString(LoanRepaymentConstants.RECEIPT_NO_COL, rowHeader, "Receipt No");
|
||||
writeString(LoanRepaymentConstants.ROUTING_CODE_COL, rowHeader, "Routing Code");
|
||||
writeString(LoanRepaymentConstants.BANK_NO_COL, rowHeader, "Bank No");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_NAME_COL, rowHeader, "Lookup Client");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_CLIENT_EXTERNAL_ID,rowHeader,"Lookup ClientExtId");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_ACCOUNT_NO_COL, rowHeader, "Lookup Account");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_PRODUCT_COL, rowHeader, "Lookup Product");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_PRINCIPAL_COL, rowHeader, "Lookup Principal");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL,rowHeader,"Lookup Total Outstanding amount");
|
||||
writeString(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, rowHeader, "Lookup Loan Disbursement Date");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+414
-414
@@ -131,12 +131,12 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
||||
final LoanReadPlatformService loanReadPlatformService,
|
||||
final GLAccountReadPlatformService glAccountReadPlatformService,
|
||||
final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
|
||||
final CodeValueReadPlatformService codeValueReadPlatformService,
|
||||
final SavingsProductReadPlatformService savingsProductReadPlatformService,
|
||||
final ProductReadPlatformService productReadPlatformService,
|
||||
final ChargeReadPlatformService chargeReadPlatformService,
|
||||
final DepositProductReadPlatformService depositProductReadPlatformService,
|
||||
final RoleReadPlatformService roleReadPlatformService) {
|
||||
final CodeValueReadPlatformService codeValueReadPlatformService,
|
||||
final SavingsProductReadPlatformService savingsProductReadPlatformService,
|
||||
final ProductReadPlatformService productReadPlatformService,
|
||||
final ChargeReadPlatformService chargeReadPlatformService,
|
||||
final DepositProductReadPlatformService depositProductReadPlatformService,
|
||||
final RoleReadPlatformService roleReadPlatformService) {
|
||||
this.officeReadPlatformService = officeReadPlatformService;
|
||||
this.staffReadPlatformService = staffReadPlatformService;
|
||||
this.context = context;
|
||||
@@ -158,84 +158,84 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
||||
this.roleReadPlatformService=roleReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response getTemplate(String entityType, Long officeId, Long staffId,final String dateFormat) {
|
||||
WorkbookPopulator populator=null;
|
||||
final Workbook workbook=new HSSFWorkbook();
|
||||
if(entityType!=null){
|
||||
if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_PERSON.toString())||
|
||||
entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_ENTTTY.toString())) {
|
||||
populator = populateClientWorkbook(entityType,officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CENTERS.toString())) {
|
||||
populator=populateCenterWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GROUPS.toString())) {
|
||||
populator = populateGroupsWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.LOANS.toString())) {
|
||||
populator = populateLoanWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.LOAN_TRANSACTIONS.toString())) {
|
||||
populator = populateLoanRepaymentWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GL_JOURNAL_ENTRIES.toString())) {
|
||||
populator = populateJournalEntriesWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GUARANTORS.toString())) {
|
||||
populator = populateGuarantorWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.OFFICES.toString())) {
|
||||
populator=populateOfficeWorkbook();
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CHART_OF_ACCOUNTS.toString())) {
|
||||
populator=populateChartOfAccountsWorkbook();
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.STAFF.toString())) {
|
||||
populator=populateStaffWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SHARE_ACCOUNTS.toString())) {
|
||||
populator=populateSharedAcountsWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SAVINGS_ACCOUNT.toString())) {
|
||||
populator=populateSavingsAccountWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SAVINGS_TRANSACTIONS.toString())) {
|
||||
populator=populateSavingsTransactionWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS.toString())) {
|
||||
populator=populateRecurringDepositWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS_TRANSACTIONS.toString())) {
|
||||
populator=populateRecurringDepositTransactionWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.FIXED_DEPOSIT_ACCOUNTS.toString())) {
|
||||
populator = populateFixedDepositWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.FIXED_DEPOSIT_TRANSACTIONS.toString())){
|
||||
populator=populateFixedDepositTransactionsWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.USERS.toString())){
|
||||
populator=populateUserWorkbook(officeId,staffId);
|
||||
}else {
|
||||
throw new GeneralPlatformDomainRuleException("error.msg.unable.to.find.resource",
|
||||
"Unable to find requested resource");
|
||||
}
|
||||
populator.populate(workbook,dateFormat);
|
||||
return buildResponse(workbook, entityType);
|
||||
}else {
|
||||
throw new GeneralPlatformDomainRuleException("error.msg.given.entity.type.null",
|
||||
"Given Entity type is null");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Response getTemplate(String entityType, Long officeId, Long staffId,final String dateFormat) {
|
||||
WorkbookPopulator populator=null;
|
||||
final Workbook workbook=new HSSFWorkbook();
|
||||
if(entityType!=null){
|
||||
if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_PERSON.toString())||
|
||||
entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_ENTTTY.toString())) {
|
||||
populator = populateClientWorkbook(entityType,officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CENTERS.toString())) {
|
||||
populator=populateCenterWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GROUPS.toString())) {
|
||||
populator = populateGroupsWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.LOANS.toString())) {
|
||||
populator = populateLoanWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.LOAN_TRANSACTIONS.toString())) {
|
||||
populator = populateLoanRepaymentWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GL_JOURNAL_ENTRIES.toString())) {
|
||||
populator = populateJournalEntriesWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.GUARANTORS.toString())) {
|
||||
populator = populateGuarantorWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.OFFICES.toString())) {
|
||||
populator=populateOfficeWorkbook();
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.CHART_OF_ACCOUNTS.toString())) {
|
||||
populator=populateChartOfAccountsWorkbook();
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.STAFF.toString())) {
|
||||
populator=populateStaffWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SHARE_ACCOUNTS.toString())) {
|
||||
populator=populateSharedAcountsWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SAVINGS_ACCOUNT.toString())) {
|
||||
populator=populateSavingsAccountWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.SAVINGS_TRANSACTIONS.toString())) {
|
||||
populator=populateSavingsTransactionWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS.toString())) {
|
||||
populator=populateRecurringDepositWorkbook(officeId,staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.RECURRING_DEPOSIT_ACCOUNTS_TRANSACTIONS.toString())) {
|
||||
populator=populateRecurringDepositTransactionWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.FIXED_DEPOSIT_ACCOUNTS.toString())) {
|
||||
populator = populateFixedDepositWorkbook(officeId, staffId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.FIXED_DEPOSIT_TRANSACTIONS.toString())){
|
||||
populator=populateFixedDepositTransactionsWorkbook(officeId);
|
||||
}else if (entityType.trim().equalsIgnoreCase(GlobalEntityType.USERS.toString())){
|
||||
populator=populateUserWorkbook(officeId,staffId);
|
||||
}else {
|
||||
throw new GeneralPlatformDomainRuleException("error.msg.unable.to.find.resource",
|
||||
"Unable to find requested resource");
|
||||
}
|
||||
populator.populate(workbook,dateFormat);
|
||||
return buildResponse(workbook, entityType);
|
||||
}else {
|
||||
throw new GeneralPlatformDomainRuleException("error.msg.given.entity.type.null",
|
||||
"Given Entity type is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateClientWorkbook(final String entityType ,final Long officeId, final Long staffId) {
|
||||
private WorkbookPopulator populateClientWorkbook(final String entityType ,final Long officeId, final Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<CodeValueData> clientTypeCodeValues =fetchCodeValuesByCodeName("ClientType");
|
||||
List<CodeValueData> clientClassification=fetchCodeValuesByCodeName("ClientClassification");
|
||||
List<CodeValueData> addressTypesCodeValues=fetchCodeValuesByCodeName("ADDRESS_TYPE");
|
||||
List<CodeValueData> stateProvinceCodeValues=fetchCodeValuesByCodeName("STATE");
|
||||
List<CodeValueData> countryCodeValues=fetchCodeValuesByCodeName("COUNTRY");
|
||||
if(entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_PERSON.toString())) {
|
||||
List<CodeValueData> genderCodeValues = fetchCodeValuesByCodeName("Gender");
|
||||
return new ClientPersonWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), clientTypeCodeValues, genderCodeValues, clientClassification
|
||||
, addressTypesCodeValues, stateProvinceCodeValues, countryCodeValues);
|
||||
}else if(entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_ENTTTY.toString())){
|
||||
List<CodeValueData> constitutionCodeValues=fetchCodeValuesByCodeName("Constitution");
|
||||
List<CodeValueData> mainBusinessline=fetchCodeValuesByCodeName("Main Business Line");
|
||||
return new ClientEntityWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), clientTypeCodeValues, constitutionCodeValues,mainBusinessline,
|
||||
clientClassification, addressTypesCodeValues, stateProvinceCodeValues, countryCodeValues);
|
||||
}
|
||||
return null;
|
||||
List<CodeValueData> clientClassification=fetchCodeValuesByCodeName("ClientClassification");
|
||||
List<CodeValueData> addressTypesCodeValues=fetchCodeValuesByCodeName("ADDRESS_TYPE");
|
||||
List<CodeValueData> stateProvinceCodeValues=fetchCodeValuesByCodeName("STATE");
|
||||
List<CodeValueData> countryCodeValues=fetchCodeValuesByCodeName("COUNTRY");
|
||||
if(entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_PERSON.toString())) {
|
||||
List<CodeValueData> genderCodeValues = fetchCodeValuesByCodeName("Gender");
|
||||
return new ClientPersonWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), clientTypeCodeValues, genderCodeValues, clientClassification
|
||||
, addressTypesCodeValues, stateProvinceCodeValues, countryCodeValues);
|
||||
}else if(entityType.trim().equalsIgnoreCase(GlobalEntityType.CLIENTS_ENTTTY.toString())){
|
||||
List<CodeValueData> constitutionCodeValues=fetchCodeValuesByCodeName("Constitution");
|
||||
List<CodeValueData> mainBusinessline=fetchCodeValuesByCodeName("Main Business Line");
|
||||
return new ClientEntityWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), clientTypeCodeValues, constitutionCodeValues,mainBusinessline,
|
||||
clientClassification, addressTypesCodeValues, stateProvinceCodeValues, countryCodeValues);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Response buildResponse(final Workbook workbook, final String entity) {
|
||||
@@ -279,395 +279,395 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
||||
return staff;
|
||||
}
|
||||
private List<CodeValueData> fetchCodeValuesByCodeName(String codeName){
|
||||
List<CodeValueData> codeValues=null;
|
||||
if (codeName!=null){
|
||||
codeValues=(List)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName);
|
||||
}else {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return codeValues;
|
||||
List<CodeValueData> codeValues=null;
|
||||
if (codeName!=null){
|
||||
codeValues=(List)codeValueReadPlatformService.retrieveCodeValuesByCode(codeName);
|
||||
}else {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return codeValues;
|
||||
}
|
||||
private List<SavingsProductData>fetchSavingsProducts(){
|
||||
List<SavingsProductData> savingsProducts=(List)savingsProductReadPlatformService.retrieveAll();
|
||||
return savingsProducts;
|
||||
List<SavingsProductData> savingsProducts=(List)savingsProductReadPlatformService.retrieveAll();
|
||||
return savingsProducts;
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateCenterWorkbook(Long officeId,Long staffId){
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
return new CentersWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices),new GroupSheetPopulator(groups,offices));
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
return new CentersWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices),new GroupSheetPopulator(groups,offices));
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateGroupsWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CENTER_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<CenterData> centers = fetchCenters(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
return new GroupsWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), new CenterSheetPopulator(centers, offices),
|
||||
new ClientSheetPopulator(clients, offices));
|
||||
}
|
||||
private List<CenterData> fetchCenters(Long officeId) {
|
||||
List<CenterData>centers=null;
|
||||
if (officeId==null) {
|
||||
centers=(List<CenterData>) this.centerReadPlatformService.retrieveAll(null, null);
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
centers = (List<CenterData>)centerReadPlatformService.retrieveAll(searchParameters,null);
|
||||
}
|
||||
|
||||
return centers;
|
||||
}
|
||||
private List<ClientData> fetchClients(Long officeId) {
|
||||
List<ClientData> clients=null;
|
||||
if (officeId==null) {
|
||||
Page<ClientData> clientDataPage =this.clientReadPlatformService.retrieveAll(null);
|
||||
if (clientDataPage!=null){
|
||||
clients=new ArrayList<>();
|
||||
for (ClientData client: clientDataPage.getPageItems()) {
|
||||
clients.add(client);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
Page<ClientData> clientDataPage =this.clientReadPlatformService.retrieveAll(searchParameters);
|
||||
if (clientDataPage!=null){
|
||||
clients=new ArrayList<>();
|
||||
for (ClientData client: clientDataPage.getPageItems()) {
|
||||
clients.add(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
return clients;
|
||||
}
|
||||
private WorkbookPopulator populateGroupsWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CENTER_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<CenterData> centers = fetchCenters(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
return new GroupsWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new PersonnelSheetPopulator(staff, offices), new CenterSheetPopulator(centers, offices),
|
||||
new ClientSheetPopulator(clients, offices));
|
||||
}
|
||||
private List<CenterData> fetchCenters(Long officeId) {
|
||||
List<CenterData>centers=null;
|
||||
if (officeId==null) {
|
||||
centers=(List<CenterData>) this.centerReadPlatformService.retrieveAll(null, null);
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
centers = (List<CenterData>)centerReadPlatformService.retrieveAll(searchParameters,null);
|
||||
}
|
||||
|
||||
return centers;
|
||||
}
|
||||
private List<ClientData> fetchClients(Long officeId) {
|
||||
List<ClientData> clients=null;
|
||||
if (officeId==null) {
|
||||
Page<ClientData> clientDataPage =this.clientReadPlatformService.retrieveAll(null);
|
||||
if (clientDataPage!=null){
|
||||
clients=new ArrayList<>();
|
||||
for (ClientData client: clientDataPage.getPageItems()) {
|
||||
clients.add(client);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
Page<ClientData> clientDataPage =this.clientReadPlatformService.retrieveAll(searchParameters);
|
||||
if (clientDataPage!=null){
|
||||
clients=new ArrayList<>();
|
||||
for (ClientData client: clientDataPage.getPageItems()) {
|
||||
clients.add(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
return clients;
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateLoanWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.LOAN_PRODUCT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
List<LoanProductData> loanproducts = fetchLoanProducts();
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
return new LoanWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new GroupSheetPopulator(groups, offices), new PersonnelSheetPopulator(staff, offices),
|
||||
new LoanProductSheetPopulator(loanproducts), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
private WorkbookPopulator populateLoanWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.LOAN_PRODUCT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
List<LoanProductData> loanproducts = fetchLoanProducts();
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
return new LoanWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new GroupSheetPopulator(groups, offices), new PersonnelSheetPopulator(staff, offices),
|
||||
new LoanProductSheetPopulator(loanproducts), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
|
||||
private List<CurrencyData> fetchCurrencies() {
|
||||
List<CurrencyData> currencies =(List<CurrencyData>) this.currencyReadPlatformService.
|
||||
retrieveAllPlatformCurrencies();
|
||||
return currencies;
|
||||
}
|
||||
private List<CurrencyData> fetchCurrencies() {
|
||||
List<CurrencyData> currencies =(List<CurrencyData>) this.currencyReadPlatformService.
|
||||
retrieveAllPlatformCurrencies();
|
||||
return currencies;
|
||||
}
|
||||
|
||||
private List<PaymentTypeData> fetchPaymentTypes() {
|
||||
List<PaymentTypeData> paymentTypeData =(List<PaymentTypeData>) this.paymentTypeReadPlatformService
|
||||
.retrieveAllPaymentTypes();
|
||||
return paymentTypeData;
|
||||
}
|
||||
private List<PaymentTypeData> fetchPaymentTypes() {
|
||||
List<PaymentTypeData> paymentTypeData =(List<PaymentTypeData>) this.paymentTypeReadPlatformService
|
||||
.retrieveAllPaymentTypes();
|
||||
return paymentTypeData;
|
||||
}
|
||||
|
||||
private List<FundData> fetchFunds() {
|
||||
List<FundData> funds =(List<FundData>) this.fundReadPlatformService.retrieveAllFunds();
|
||||
return funds;
|
||||
}
|
||||
private List<FundData> fetchFunds() {
|
||||
List<FundData> funds =(List<FundData>) this.fundReadPlatformService.retrieveAllFunds();
|
||||
return funds;
|
||||
}
|
||||
|
||||
private List<LoanProductData> fetchLoanProducts() {
|
||||
List<LoanProductData>loanproducts =(List<LoanProductData>) this.loanProductReadPlatformService
|
||||
.retrieveAllLoanProducts();
|
||||
return loanproducts;
|
||||
}
|
||||
private List<LoanProductData> fetchLoanProducts() {
|
||||
List<LoanProductData>loanproducts =(List<LoanProductData>) this.loanProductReadPlatformService
|
||||
.retrieveAllLoanProducts();
|
||||
return loanproducts;
|
||||
}
|
||||
|
||||
private List<GroupGeneralData> fetchGroups(Long officeId) {
|
||||
List<GroupGeneralData> groups = null;
|
||||
if (officeId == null) {
|
||||
groups = (List<GroupGeneralData>) this.groupReadPlatformService.retrieveAll(null, null);
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
groups = (List<GroupGeneralData>)groupReadPlatformService.retrieveAll(searchParameters,null);
|
||||
}
|
||||
private List<GroupGeneralData> fetchGroups(Long officeId) {
|
||||
List<GroupGeneralData> groups = null;
|
||||
if (officeId == null) {
|
||||
groups = (List<GroupGeneralData>) this.groupReadPlatformService.retrieveAll(null, null);
|
||||
} else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
groups = (List<GroupGeneralData>)groupReadPlatformService.retrieveAll(searchParameters,null);
|
||||
}
|
||||
|
||||
return groups;
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateLoanRepaymentWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<LoanAccountData> loans = fetchLoanAccounts(officeId);
|
||||
return new LoanRepaymentWorkbookPopulator(loans, new OfficeSheetPopulator(offices),
|
||||
new ClientSheetPopulator(clients, offices), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
private WorkbookPopulator populateLoanRepaymentWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<LoanAccountData> loans = fetchLoanAccounts(officeId);
|
||||
return new LoanRepaymentWorkbookPopulator(loans, new OfficeSheetPopulator(offices),
|
||||
new ClientSheetPopulator(clients, offices), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
|
||||
private List<LoanAccountData> fetchLoanAccounts(final Long officeId) {
|
||||
List<LoanAccountData> loanAccounts = null;
|
||||
if(officeId==null){
|
||||
loanAccounts= loanReadPlatformService.retrieveAll(null).getPageItems();
|
||||
}else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
loanAccounts = loanReadPlatformService.retrieveAll(searchParameters).getPageItems();
|
||||
}
|
||||
return loanAccounts;
|
||||
}
|
||||
private List<LoanAccountData> fetchLoanAccounts(final Long officeId) {
|
||||
List<LoanAccountData> loanAccounts = null;
|
||||
if(officeId==null){
|
||||
loanAccounts= loanReadPlatformService.retrieveAll(null).getPageItems();
|
||||
}else {
|
||||
SearchParameters searchParameters = SearchParameters.from(null, officeId, null, null, null);
|
||||
loanAccounts = loanReadPlatformService.retrieveAll(searchParameters).getPageItems();
|
||||
}
|
||||
return loanAccounts;
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateJournalEntriesWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<GLAccountData> glAccounts = fetchGLAccounts();
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
return new JournalEntriesWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new GlAccountSheetPopulator(glAccounts), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
private WorkbookPopulator populateJournalEntriesWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<GLAccountData> glAccounts = fetchGLAccounts();
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
return new JournalEntriesWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new GlAccountSheetPopulator(glAccounts), new ExtrasSheetPopulator(funds, paymentTypes, currencies));
|
||||
}
|
||||
|
||||
private List<GLAccountData> fetchGLAccounts() {
|
||||
List<GLAccountData> glaccounts = (List<GLAccountData>) this.glAccountReadPlatformService.
|
||||
retrieveAllGLAccounts(null, null, null,
|
||||
null, null, null);
|
||||
return glaccounts;
|
||||
}
|
||||
private List<GLAccountData> fetchGLAccounts() {
|
||||
List<GLAccountData> glaccounts = (List<GLAccountData>) this.glAccountReadPlatformService.
|
||||
retrieveAllGLAccounts(null, null, null,
|
||||
null, null, null);
|
||||
return glaccounts;
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateGuarantorWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData>clients=fetchClients(officeId);
|
||||
List<LoanAccountData> loans = fetchLoanAccounts(officeId);
|
||||
List<SavingsAccountData> savingsaccounts = fetchSavingsAccounts(officeId);
|
||||
List<CodeValueData> guarantorRelationshipTypes=fetchCodeValuesByCodeName("GuarantorRelationship");
|
||||
return new GuarantorWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new ClientSheetPopulator(clients, offices),loans,savingsaccounts,guarantorRelationshipTypes);
|
||||
}
|
||||
private WorkbookPopulator populateGuarantorWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData>clients=fetchClients(officeId);
|
||||
List<LoanAccountData> loans = fetchLoanAccounts(officeId);
|
||||
List<SavingsAccountData> savingsaccounts = fetchSavingsAccounts(officeId);
|
||||
List<CodeValueData> guarantorRelationshipTypes=fetchCodeValuesByCodeName("GuarantorRelationship");
|
||||
return new GuarantorWorkbookPopulator(new OfficeSheetPopulator(offices),
|
||||
new ClientSheetPopulator(clients, offices),loans,savingsaccounts,guarantorRelationshipTypes);
|
||||
}
|
||||
|
||||
private List<SavingsAccountData> fetchSavingsAccounts(Long officeId) {
|
||||
List<SavingsAccountData> savingsAccounts=null;
|
||||
if (officeId!=null) {
|
||||
String activeAccounts="sa.status_enum = 300";
|
||||
SearchParameters searchParameters = SearchParameters.from(activeAccounts, officeId, null, null, null);
|
||||
savingsAccounts = savingsAccountReadPlatformService.retrieveAll(searchParameters).getPageItems();;
|
||||
}else {
|
||||
savingsAccounts= savingsAccountReadPlatformService.retrieveAll(null).getPageItems();
|
||||
}
|
||||
return savingsAccounts;
|
||||
}
|
||||
private List<SavingsAccountData> fetchSavingsAccounts(Long officeId) {
|
||||
List<SavingsAccountData> savingsAccounts=null;
|
||||
if (officeId!=null) {
|
||||
String activeAccounts="sa.status_enum = 300";
|
||||
SearchParameters searchParameters = SearchParameters.from(activeAccounts, officeId, null, null, null);
|
||||
savingsAccounts = savingsAccountReadPlatformService.retrieveAll(searchParameters).getPageItems();;
|
||||
}else {
|
||||
savingsAccounts= savingsAccountReadPlatformService.retrieveAll(null).getPageItems();
|
||||
}
|
||||
return savingsAccounts;
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateOfficeWorkbook() {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(null);
|
||||
return new OfficeWorkbookPopulator(offices);
|
||||
}
|
||||
private WorkbookPopulator populateOfficeWorkbook() {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(null);
|
||||
return new OfficeWorkbookPopulator(offices);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private WorkbookPopulator populateChartOfAccountsWorkbook() {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
||||
List<GLAccountData> glAccounts = fetchGLAccounts();
|
||||
return new ChartOfAccountsWorkbook(glAccounts);
|
||||
}
|
||||
private WorkbookPopulator populateChartOfAccountsWorkbook() {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
||||
List<GLAccountData> glAccounts = fetchGLAccounts();
|
||||
return new ChartOfAccountsWorkbook(glAccounts);
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateStaffWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
List<OfficeData> offices=fetchOffices(officeId);
|
||||
return new StaffWorkbookPopulator(new OfficeSheetPopulator(offices));
|
||||
}
|
||||
private WorkbookPopulator populateStaffWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
List<OfficeData> offices=fetchOffices(officeId);
|
||||
return new StaffWorkbookPopulator(new OfficeSheetPopulator(offices));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private WorkbookPopulator populateSharedAcountsWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.SHARED_ACCOUNT_ENTITY_TYPE);
|
||||
List<ShareProductData> shareProductDataList=fetchSharedProducts();
|
||||
List<ChargeData> chargesForShares=fetchChargesForShares();
|
||||
List<ClientData> clientDataList=fetchClients(officeId);
|
||||
List<OfficeData>officeDataList=fetchOffices(officeId);
|
||||
List<SavingsAccountData> savingsAccounts = fetchSavingsAccounts(officeId);
|
||||
return new SharedAccountWorkBookPopulator(new SharedProductsSheetPopulator(shareProductDataList,chargesForShares),
|
||||
new ClientSheetPopulator(clientDataList,officeDataList),new SavingsAccountSheetPopulator(savingsAccounts));
|
||||
}
|
||||
private WorkbookPopulator populateSharedAcountsWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.SHARED_ACCOUNT_ENTITY_TYPE);
|
||||
List<ShareProductData> shareProductDataList=fetchSharedProducts();
|
||||
List<ChargeData> chargesForShares=fetchChargesForShares();
|
||||
List<ClientData> clientDataList=fetchClients(officeId);
|
||||
List<OfficeData>officeDataList=fetchOffices(officeId);
|
||||
List<SavingsAccountData> savingsAccounts = fetchSavingsAccounts(officeId);
|
||||
return new SharedAccountWorkBookPopulator(new SharedProductsSheetPopulator(shareProductDataList,chargesForShares),
|
||||
new ClientSheetPopulator(clientDataList,officeDataList),new SavingsAccountSheetPopulator(savingsAccounts));
|
||||
}
|
||||
|
||||
private List<ChargeData> fetchChargesForShares() {
|
||||
List<ChargeData>chargesForShares=(List<ChargeData>) chargeReadPlatformService.retrieveSharesApplicableCharges();
|
||||
return chargesForShares;
|
||||
}
|
||||
private List<ChargeData> fetchChargesForShares() {
|
||||
List<ChargeData>chargesForShares=(List<ChargeData>) chargeReadPlatformService.retrieveSharesApplicableCharges();
|
||||
return chargesForShares;
|
||||
}
|
||||
|
||||
private List<ShareProductData> fetchSharedProducts() {
|
||||
List<ProductData> productDataList = productReadPlatformService.retrieveAllProducts(0,50).getPageItems() ;
|
||||
List<ShareProductData> sharedProductDataList=new ArrayList<>();
|
||||
if(productDataList!=null) {
|
||||
for (ProductData data : productDataList) {
|
||||
ShareProductData shareProduct = (ShareProductData) data;
|
||||
sharedProductDataList.add(shareProduct);
|
||||
}
|
||||
}
|
||||
return sharedProductDataList;
|
||||
}
|
||||
private List<ShareProductData> fetchSharedProducts() {
|
||||
List<ProductData> productDataList = productReadPlatformService.retrieveAllProducts(0,50).getPageItems() ;
|
||||
List<ShareProductData> sharedProductDataList=new ArrayList<>();
|
||||
if(productDataList!=null) {
|
||||
for (ProductData data : productDataList) {
|
||||
ShareProductData shareProduct = (ShareProductData) data;
|
||||
sharedProductDataList.add(shareProduct);
|
||||
}
|
||||
}
|
||||
return sharedProductDataList;
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateSavingsAccountWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.SAVINGS_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
List<SavingsProductData> savingsProducts=fetchSavingsProducts();
|
||||
return new SavingsWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new GroupSheetPopulator(groups, offices), new PersonnelSheetPopulator(staff, offices),
|
||||
new SavingsProductSheetPopulator(savingsProducts));
|
||||
}
|
||||
private WorkbookPopulator populateSavingsAccountWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GROUP_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.SAVINGS_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<GroupGeneralData> groups = fetchGroups(officeId);
|
||||
List<SavingsProductData> savingsProducts=fetchSavingsProducts();
|
||||
return new SavingsWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new GroupSheetPopulator(groups, offices), new PersonnelSheetPopulator(staff, offices),
|
||||
new SavingsProductSheetPopulator(savingsProducts));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private WorkbookPopulator populateSavingsTransactionWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new SavingsTransactionsWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
private WorkbookPopulator populateSavingsTransactionWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new SavingsTransactionsWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
|
||||
|
||||
private WorkbookPopulator populateRecurringDepositWorkbook(Long officeId,Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.RECURRING_DEPOSIT_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<RecurringDepositProductData> recurringDepositProducts = fetchRecurringDepositProducts();
|
||||
return new RecurringDepositWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new PersonnelSheetPopulator(staff,offices),new RecurringDepositProductSheetPopulator(recurringDepositProducts));
|
||||
}
|
||||
private WorkbookPopulator populateRecurringDepositWorkbook(Long officeId,Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.RECURRING_DEPOSIT_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<RecurringDepositProductData> recurringDepositProducts = fetchRecurringDepositProducts();
|
||||
return new RecurringDepositWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new PersonnelSheetPopulator(staff,offices),new RecurringDepositProductSheetPopulator(recurringDepositProducts));
|
||||
}
|
||||
|
||||
private List<RecurringDepositProductData> fetchRecurringDepositProducts() {
|
||||
List<DepositProductData> depositProducts=(List<DepositProductData>)depositProductReadPlatformService
|
||||
.retrieveAll(DepositAccountType.RECURRING_DEPOSIT);
|
||||
List<RecurringDepositProductData> recurringDepositProducts=new ArrayList<>();
|
||||
for (DepositProductData depositproduct: depositProducts) {
|
||||
RecurringDepositProductData recurringDepositProduct= (RecurringDepositProductData) depositproduct;
|
||||
recurringDepositProducts.add(recurringDepositProduct);
|
||||
}
|
||||
return recurringDepositProducts;
|
||||
}
|
||||
private List<RecurringDepositProductData> fetchRecurringDepositProducts() {
|
||||
List<DepositProductData> depositProducts=(List<DepositProductData>)depositProductReadPlatformService
|
||||
.retrieveAll(DepositAccountType.RECURRING_DEPOSIT);
|
||||
List<RecurringDepositProductData> recurringDepositProducts=new ArrayList<>();
|
||||
for (DepositProductData depositproduct: depositProducts) {
|
||||
RecurringDepositProductData recurringDepositProduct= (RecurringDepositProductData) depositproduct;
|
||||
recurringDepositProducts.add(recurringDepositProduct);
|
||||
}
|
||||
return recurringDepositProducts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private WorkbookPopulator populateRecurringDepositTransactionWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new RecurringDepositTransactionWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
private WorkbookPopulator populateRecurringDepositTransactionWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new RecurringDepositTransactionWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateFixedDepositWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FIXED_DEPOSIT_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<FixedDepositProductData> fixedDepositProducts = fetchFixedDepositProducts();
|
||||
return new FixedDepositWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new PersonnelSheetPopulator(staff,offices),new FixedDepositProductSheetPopulator(fixedDepositProducts));
|
||||
private WorkbookPopulator populateFixedDepositWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.STAFF_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FIXED_DEPOSIT_PRODUCT_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<FixedDepositProductData> fixedDepositProducts = fetchFixedDepositProducts();
|
||||
return new FixedDepositWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new PersonnelSheetPopulator(staff,offices),new FixedDepositProductSheetPopulator(fixedDepositProducts));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private List<FixedDepositProductData> fetchFixedDepositProducts() {
|
||||
List<DepositProductData> depositProducts=(List<DepositProductData>)depositProductReadPlatformService
|
||||
.retrieveAll(DepositAccountType.FIXED_DEPOSIT);
|
||||
List<FixedDepositProductData> fixedDepositProducts=new ArrayList<>();
|
||||
for (DepositProductData depositproduct: depositProducts) {
|
||||
FixedDepositProductData fixedDepositProduct= (FixedDepositProductData) depositproduct;
|
||||
fixedDepositProducts.add(fixedDepositProduct);
|
||||
}
|
||||
return fixedDepositProducts;
|
||||
private List<FixedDepositProductData> fetchFixedDepositProducts() {
|
||||
List<DepositProductData> depositProducts=(List<DepositProductData>)depositProductReadPlatformService
|
||||
.retrieveAll(DepositAccountType.FIXED_DEPOSIT);
|
||||
List<FixedDepositProductData> fixedDepositProducts=new ArrayList<>();
|
||||
for (DepositProductData depositproduct: depositProducts) {
|
||||
FixedDepositProductData fixedDepositProduct= (FixedDepositProductData) depositproduct;
|
||||
fixedDepositProducts.add(fixedDepositProduct);
|
||||
}
|
||||
return fixedDepositProducts;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateUserWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.USER_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<RoleData> roles=fetchRoles();
|
||||
return new UserWorkbookPopulator(new OfficeSheetPopulator(offices), new PersonnelSheetPopulator(staff,offices),
|
||||
new RoleSheetPopulator(roles));
|
||||
}
|
||||
private WorkbookPopulator populateUserWorkbook(Long officeId, Long staffId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.USER_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<StaffData> staff = fetchStaff(staffId);
|
||||
List<RoleData> roles=fetchRoles();
|
||||
return new UserWorkbookPopulator(new OfficeSheetPopulator(offices), new PersonnelSheetPopulator(staff,offices),
|
||||
new RoleSheetPopulator(roles));
|
||||
}
|
||||
|
||||
private List<RoleData> fetchRoles() {
|
||||
List<RoleData> rolesList= (List<RoleData>) roleReadPlatformService.retrieveAllActiveRoles();
|
||||
return rolesList;
|
||||
}
|
||||
private List<RoleData> fetchRoles() {
|
||||
List<RoleData> rolesList= (List<RoleData>) roleReadPlatformService.retrieveAllActiveRoles();
|
||||
return rolesList;
|
||||
}
|
||||
|
||||
private WorkbookPopulator populateFixedDepositTransactionsWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new FixedDepositTransactionWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
private WorkbookPopulator populateFixedDepositTransactionsWorkbook(Long officeId) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.OFFICE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CLIENT_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.FUNDS_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.PAYMENT_TYPE_ENTITY_TYPE);
|
||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.CURRENCY_ENTITY_TYPE);
|
||||
List<OfficeData> offices = fetchOffices(officeId);
|
||||
List<ClientData> clients = fetchClients(officeId);
|
||||
List<FundData> funds = fetchFunds();
|
||||
List<PaymentTypeData> paymentTypes = fetchPaymentTypes();
|
||||
List<CurrencyData> currencies = fetchCurrencies();
|
||||
List<SavingsAccountData> savingsAccounts=fetchSavingsAccounts(officeId);
|
||||
return new FixedDepositTransactionWorkbookPopulator(new OfficeSheetPopulator(offices), new ClientSheetPopulator(clients, offices),
|
||||
new ExtrasSheetPopulator(funds, paymentTypes, currencies),savingsAccounts);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -115,9 +115,9 @@ public class EmailCampaignValidator {
|
||||
final Long businessRuleId = this.fromApiJsonHelper.extractLongNamed(EmailCampaignValidator.businessRuleId,element);
|
||||
baseDataValidator.reset().parameter(EmailCampaignValidator.businessRuleId).value(businessRuleId).notNull().integerGreaterThanZero();
|
||||
|
||||
final String emailSubject = this.fromApiJsonHelper.extractStringNamed(EmailCampaignValidator.emailSubject, element);
|
||||
final String emailSubject = this.fromApiJsonHelper.extractStringNamed(EmailCampaignValidator.emailSubject, element);
|
||||
baseDataValidator.reset().parameter(EmailCampaignValidator.emailSubject).value(emailSubject).notBlank().notExceedingLengthOf(50);
|
||||
|
||||
|
||||
final String emailMessage = this.fromApiJsonHelper.extractStringNamed(EmailCampaignValidator.emailMessage, element);
|
||||
baseDataValidator.reset().parameter(EmailCampaignValidator.emailMessage).value(emailMessage).notBlank().notExceedingLengthOf(480);
|
||||
|
||||
|
||||
+33
-33
@@ -22,42 +22,42 @@ package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
* Immutable data object representing an Email configuration.
|
||||
*/
|
||||
public class EmailConfigurationData {
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
|
||||
private final String name;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
|
||||
private final String name;
|
||||
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* @return an instance of the EmailConfigurationData class
|
||||
**/
|
||||
public static EmailConfigurationData instance(Long id, String name, String value) {
|
||||
return new EmailConfigurationData(id, name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* EmailConfigurationData constructor
|
||||
**/
|
||||
private EmailConfigurationData(Long id, String name, String value) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of the EmailConfigurationData class
|
||||
**/
|
||||
public static EmailConfigurationData instance(Long id, String name, String value) {
|
||||
return new EmailConfigurationData(id, name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* EmailConfigurationData constructor
|
||||
**/
|
||||
private EmailConfigurationData(Long id, String name, String value) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+89
-89
@@ -35,126 +35,126 @@ public class EmailData {
|
||||
private final Long staffId;
|
||||
private final EnumOptionData status;
|
||||
private final String emailAddress;
|
||||
private final String emailSubject;
|
||||
private final String emailSubject;
|
||||
private final String emailMessage;
|
||||
private final EnumOptionData emailAttachmentFileFormat;
|
||||
private final ReportData stretchyReport;
|
||||
private final String stretchyReportParamMap;
|
||||
private final List<EnumOptionData> emailAttachmentFileFormatOptions;
|
||||
private final List<EnumOptionData> stretchyReportParamDateOptions;
|
||||
private final EnumOptionData emailAttachmentFileFormat;
|
||||
private final ReportData stretchyReport;
|
||||
private final String stretchyReportParamMap;
|
||||
private final List<EnumOptionData> emailAttachmentFileFormatOptions;
|
||||
private final List<EnumOptionData> stretchyReportParamDateOptions;
|
||||
private final String campaignName;
|
||||
private final LocalDate sentDate;
|
||||
private final String errorMessage;
|
||||
private final LocalDate sentDate;
|
||||
private final String errorMessage;
|
||||
|
||||
|
||||
public static EmailData instance(final Long id,final Long groupId, final Long clientId, final Long staffId, final EnumOptionData status,
|
||||
final String emailAddress, final String emailSubject,
|
||||
final String message, final EnumOptionData emailAttachmentFileFormat, final ReportData stretchyReport,
|
||||
final String stretchyReportParamMap, final List<EnumOptionData> emailAttachmentFileFormatOptions,
|
||||
final List<EnumOptionData> stretchyReportParamDateOptions, final String campaignName, final LocalDate sentDate,final String errorMessage) {
|
||||
public static EmailData instance(final Long id,final Long groupId, final Long clientId, final Long staffId, final EnumOptionData status,
|
||||
final String emailAddress, final String emailSubject,
|
||||
final String message, final EnumOptionData emailAttachmentFileFormat, final ReportData stretchyReport,
|
||||
final String stretchyReportParamMap, final List<EnumOptionData> emailAttachmentFileFormatOptions,
|
||||
final List<EnumOptionData> stretchyReportParamDateOptions, final String campaignName, final LocalDate sentDate,final String errorMessage) {
|
||||
return new EmailData(id, groupId, clientId, staffId, status, emailAddress, emailSubject, message,
|
||||
emailAttachmentFileFormat,stretchyReport,stretchyReportParamMap,emailAttachmentFileFormatOptions,
|
||||
stretchyReportParamDateOptions,campaignName,sentDate,errorMessage);
|
||||
emailAttachmentFileFormat,stretchyReport,stretchyReportParamMap,emailAttachmentFileFormatOptions,
|
||||
stretchyReportParamDateOptions,campaignName,sentDate,errorMessage);
|
||||
}
|
||||
|
||||
private EmailData(final Long id,final Long groupId, final Long clientId, final Long staffId, final EnumOptionData status, final String emailAddress, final String emailSubject, final String message,
|
||||
final EnumOptionData emailAttachmentFileFormat, final ReportData stretchyReport, final String stretchyReportParamMap,
|
||||
final List<EnumOptionData> emailAttachmentFileFormatOptions, final List<EnumOptionData> stretchyReportParamDateOptions,
|
||||
final String campaignName,final LocalDate sentDate,final String errorMessage) {
|
||||
final EnumOptionData emailAttachmentFileFormat, final ReportData stretchyReport, final String stretchyReportParamMap,
|
||||
final List<EnumOptionData> emailAttachmentFileFormatOptions, final List<EnumOptionData> stretchyReportParamDateOptions,
|
||||
final String campaignName,final LocalDate sentDate,final String errorMessage) {
|
||||
this.id = id;
|
||||
this.groupId = groupId;
|
||||
this.clientId = clientId;
|
||||
this.staffId = staffId;
|
||||
this.status = status;
|
||||
this.emailAddress = emailAddress;
|
||||
this.emailSubject = emailSubject;
|
||||
this.emailSubject = emailSubject;
|
||||
this.emailMessage = message;
|
||||
this.emailAttachmentFileFormat = emailAttachmentFileFormat;
|
||||
this.stretchyReport = stretchyReport;
|
||||
this.stretchyReportParamMap = stretchyReportParamMap;
|
||||
this.emailAttachmentFileFormatOptions = emailAttachmentFileFormatOptions;
|
||||
this.stretchyReportParamDateOptions = stretchyReportParamDateOptions;
|
||||
this.emailAttachmentFileFormat = emailAttachmentFileFormat;
|
||||
this.stretchyReport = stretchyReport;
|
||||
this.stretchyReportParamMap = stretchyReportParamMap;
|
||||
this.emailAttachmentFileFormatOptions = emailAttachmentFileFormatOptions;
|
||||
this.stretchyReportParamDateOptions = stretchyReportParamDateOptions;
|
||||
this.campaignName = campaignName;
|
||||
this.sentDate = sentDate;
|
||||
this.errorMessage = errorMessage;
|
||||
this.sentDate = sentDate;
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groupId
|
||||
*/
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
/**
|
||||
* @return the groupId
|
||||
*/
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the clientId
|
||||
*/
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
/**
|
||||
* @return the clientId
|
||||
*/
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the staffId
|
||||
*/
|
||||
public Long getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
/**
|
||||
* @return the staffId
|
||||
*/
|
||||
public Long getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public EnumOptionData getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
public EnumOptionData getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getErrorMessage() {return this.errorMessage;}
|
||||
public String getErrorMessage() {return this.errorMessage;}
|
||||
|
||||
/**
|
||||
* @return the emailAddress
|
||||
*/
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
/**
|
||||
* @return the emailAddress
|
||||
*/
|
||||
public String getEmailAddress() {
|
||||
return emailAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return emailMessage;
|
||||
}
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return emailMessage;
|
||||
}
|
||||
|
||||
public String getCampaignName() {return this.campaignName;}
|
||||
public String getCampaignName() {return this.campaignName;}
|
||||
|
||||
public LocalDate getSentDate() { return this.sentDate; }
|
||||
public LocalDate getSentDate() { return this.sentDate; }
|
||||
|
||||
public String getEmailSubject() {
|
||||
return emailSubject;
|
||||
}
|
||||
public String getEmailSubject() {
|
||||
return emailSubject;
|
||||
}
|
||||
|
||||
public EnumOptionData getEmailAttachmentFileFormat() {
|
||||
return emailAttachmentFileFormat;
|
||||
}
|
||||
public EnumOptionData getEmailAttachmentFileFormat() {
|
||||
return emailAttachmentFileFormat;
|
||||
}
|
||||
|
||||
public ReportData getStretchyReport() {
|
||||
return stretchyReport;
|
||||
}
|
||||
public ReportData getStretchyReport() {
|
||||
return stretchyReport;
|
||||
}
|
||||
|
||||
public String getStretchyReportParamMap() {
|
||||
return stretchyReportParamMap;
|
||||
}
|
||||
public String getStretchyReportParamMap() {
|
||||
return stretchyReportParamMap;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getEmailAttachmentFileFormatOptions() {
|
||||
return emailAttachmentFileFormatOptions;
|
||||
}
|
||||
public List<EnumOptionData> getEmailAttachmentFileFormatOptions() {
|
||||
return emailAttachmentFileFormatOptions;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getStretchyReportParamDateOptions() {
|
||||
return stretchyReportParamDateOptions;
|
||||
}
|
||||
public List<EnumOptionData> getStretchyReportParamDateOptions() {
|
||||
return stretchyReportParamDateOptions;
|
||||
}
|
||||
}
|
||||
+26
-26
@@ -27,34 +27,34 @@ import javax.persistence.Table;
|
||||
@Entity
|
||||
@Table(name = "scheduled_email_configuration")
|
||||
public class EmailConfiguration extends AbstractPersistableCustom<Long> {
|
||||
@Column(name = "name", nullable = false)
|
||||
@Column(name = "name", nullable = false)
|
||||
private String name;
|
||||
|
||||
@Column(name = "value", nullable = false)
|
||||
|
||||
@Column(name = "value", nullable = false)
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* EmailConfiguration constructor
|
||||
**/
|
||||
protected EmailConfiguration() {}
|
||||
|
||||
/**
|
||||
* EmailConfiguration constructor
|
||||
**/
|
||||
public EmailConfiguration(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* EmailConfiguration constructor
|
||||
**/
|
||||
protected EmailConfiguration() {}
|
||||
|
||||
/**
|
||||
* EmailConfiguration constructor
|
||||
**/
|
||||
public EmailConfiguration(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,5 +22,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface EmailConfigurationRepository extends JpaRepository<EmailConfiguration, Long>, JpaSpecificationExecutor<EmailConfiguration> {
|
||||
EmailConfiguration findByName(String name);
|
||||
EmailConfiguration findByName(String name);
|
||||
}
|
||||
|
||||
+8
-8
@@ -82,7 +82,7 @@ public class EmailMessage extends AbstractPersistableCustom<Long> {
|
||||
|
||||
public static EmailMessage instance(final Group group, final Client client, final Staff staff, final EmailCampaign emailCampaign, final EmailMessageStatusType statusType,
|
||||
final String emailSubject, final String message, final String sourceAddress, final String emailAddress, final String campaignName) {
|
||||
return new EmailMessage(group, client, staff,emailCampaign, statusType, emailSubject, message, emailAddress, campaignName);
|
||||
return new EmailMessage(group, client, staff,emailCampaign, statusType, emailSubject, message, emailAddress, campaignName);
|
||||
}
|
||||
|
||||
protected EmailMessage() {
|
||||
@@ -91,7 +91,7 @@ public class EmailMessage extends AbstractPersistableCustom<Long> {
|
||||
|
||||
private EmailMessage(final Group group, final Client client, final Staff staff, final EmailCampaign emailCampaign, final EmailMessageStatusType statusType,
|
||||
final String emailSubject, final String message, final String emailAddress, final String campaignName) {
|
||||
this.group = group;
|
||||
this.group = group;
|
||||
this.client = client;
|
||||
this.staff = staff;
|
||||
this.emailCampaign = emailCampaign;
|
||||
@@ -118,19 +118,19 @@ public class EmailMessage extends AbstractPersistableCustom<Long> {
|
||||
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
return group;
|
||||
}
|
||||
|
||||
public Client getClient() {
|
||||
return client;
|
||||
return client;
|
||||
}
|
||||
|
||||
public Staff getStaff() {
|
||||
return staff;
|
||||
return staff;
|
||||
}
|
||||
|
||||
public Integer getStatusType() {
|
||||
return statusType;
|
||||
return statusType;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,12 +139,12 @@ public class EmailMessage extends AbstractPersistableCustom<Long> {
|
||||
public String getEmailSubject() {return emailSubject; }
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
public void setStatusType(final Integer statusType) {
|
||||
this.statusType = statusType;
|
||||
this.statusType = statusType;
|
||||
}
|
||||
|
||||
public String getCampaignName() {
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourc
|
||||
*/
|
||||
public class EmailConfigurationNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public EmailConfigurationNotFoundException(final String name) {
|
||||
super("error.msg.email.configuration.name.not.found", "Email configuration with name " + name + " does not exist", name);
|
||||
}
|
||||
public EmailConfigurationNotFoundException(final String name) {
|
||||
super("error.msg.email.configuration.name.not.found", "Email configuration with name " + name + " does not exist", name);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,8 +23,8 @@ import org.apache.fineract.infrastructure.campaigns.email.data.EmailConfiguratio
|
||||
import java.util.Collection;
|
||||
|
||||
public interface EmailConfigurationReadPlatformService {
|
||||
|
||||
Collection<EmailConfigurationData> retrieveAll();
|
||||
|
||||
Collection<EmailConfigurationData> retrieveAll();
|
||||
|
||||
EmailConfigurationData retrieveOne(String name);
|
||||
EmailConfigurationData retrieveOne(String name);
|
||||
}
|
||||
|
||||
+48
-48
@@ -34,66 +34,66 @@ import java.util.Collection;
|
||||
|
||||
@Service
|
||||
public class EmailConfigurationReadPlatformServiceImpl implements EmailConfigurationReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final EmailConfigurationRowMapper emailConfigurationRowMapper;
|
||||
|
||||
@Autowired
|
||||
public EmailConfigurationReadPlatformServiceImpl(final RoutingDataSource dataSource) {
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.emailConfigurationRowMapper = new EmailConfigurationRowMapper();
|
||||
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.emailConfigurationRowMapper = new EmailConfigurationRowMapper();
|
||||
|
||||
}
|
||||
|
||||
private static final class EmailConfigurationRowMapper implements RowMapper<EmailConfigurationData> {
|
||||
|
||||
final String schema;
|
||||
|
||||
public EmailConfigurationRowMapper() {
|
||||
final StringBuilder sql = new StringBuilder(300);
|
||||
sql.append("cnf.id as id, ");
|
||||
sql.append("cnf.name as name, ");
|
||||
sql.append("cnf.value as value ");
|
||||
sql.append("from scheduled_email_configuration cnf");
|
||||
|
||||
this.schema = sql.toString();
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
|
||||
private static final class EmailConfigurationRowMapper implements RowMapper<EmailConfigurationData> {
|
||||
|
||||
final String schema;
|
||||
|
||||
public EmailConfigurationRowMapper() {
|
||||
final StringBuilder sql = new StringBuilder(300);
|
||||
sql.append("cnf.id as id, ");
|
||||
sql.append("cnf.name as name, ");
|
||||
sql.append("cnf.value as value ");
|
||||
sql.append("from scheduled_email_configuration cnf");
|
||||
|
||||
this.schema = sql.toString();
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
return this.schema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmailConfigurationData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
|
||||
|
||||
final Long id = JdbcSupport.getLong(rs, "id");
|
||||
final String name = rs.getString("name");
|
||||
final String value = rs.getString("value");
|
||||
|
||||
return EmailConfigurationData.instance(id, name, value);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public EmailConfigurationData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
|
||||
|
||||
final Long id = JdbcSupport.getLong(rs, "id");
|
||||
final String name = rs.getString("name");
|
||||
final String value = rs.getString("value");
|
||||
|
||||
return EmailConfigurationData.instance(id, name, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EmailConfigurationData> retrieveAll() {
|
||||
final String sql = "select " + this.emailConfigurationRowMapper.schema();
|
||||
@Override
|
||||
public Collection<EmailConfigurationData> retrieveAll() {
|
||||
final String sql = "select " + this.emailConfigurationRowMapper.schema();
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.emailConfigurationRowMapper, new Object[] {});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmailConfigurationData retrieveOne(String name) {
|
||||
try {
|
||||
final String sql = "select " + this.emailConfigurationRowMapper.schema() + " where cnf.name = ?";
|
||||
@Override
|
||||
public EmailConfigurationData retrieveOne(String name) {
|
||||
try {
|
||||
final String sql = "select " + this.emailConfigurationRowMapper.schema() + " where cnf.name = ?";
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, this.emailConfigurationRowMapper, name);
|
||||
}
|
||||
|
||||
catch(final EmptyResultDataAccessException e) {
|
||||
|
||||
throw new EmailConfigurationNotFoundException(name);
|
||||
}
|
||||
}
|
||||
return this.jdbcTemplate.queryForObject(sql, this.emailConfigurationRowMapper, name);
|
||||
}
|
||||
|
||||
catch(final EmptyResultDataAccessException e) {
|
||||
|
||||
throw new EmailConfigurationNotFoundException(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+23
-23
@@ -83,7 +83,7 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
|
||||
}
|
||||
|
||||
public String tableName() {
|
||||
return "scheduled_email_messages_outbound";
|
||||
return "scheduled_email_messages_outbound";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,31 +130,31 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllPending(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = "
|
||||
+ EmailMessageStatusType.PENDING.getValue() + sqlPlusLimit;
|
||||
public Collection<EmailData> retrieveAllPending(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = "
|
||||
+ EmailMessageStatusType.PENDING.getValue() + sqlPlusLimit;
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.emailRowMapper, new Object[] {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllSent(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = "
|
||||
+ EmailMessageStatusType.SENT.getValue() + sqlPlusLimit;
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllSent(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = "
|
||||
+ EmailMessageStatusType.SENT.getValue() + sqlPlusLimit;
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.emailRowMapper, new Object[] {});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> retrieveExternalIdsOfAllSent(final Integer limit) {
|
||||
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : "";
|
||||
final String sql = "select external_id from " + this.emailRowMapper.tableName() + " where status_enum = "
|
||||
+ EmailMessageStatusType.SENT.getValue() + sqlPlusLimit;
|
||||
|
||||
return this.jdbcTemplate.queryForList(sql, Long.class);
|
||||
}
|
||||
@Override
|
||||
public List<Long> retrieveExternalIdsOfAllSent(final Integer limit) {
|
||||
final String sqlPlusLimit = (limit > 0) ? " limit 0, " + limit : "";
|
||||
final String sql = "select external_id from " + this.emailRowMapper.tableName() + " where status_enum = "
|
||||
+ EmailMessageStatusType.SENT.getValue() + sqlPlusLimit;
|
||||
|
||||
return this.jdbcTemplate.queryForList(sql, Long.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllDelivered(final Integer limit) {
|
||||
@@ -165,14 +165,14 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
|
||||
return this.jdbcTemplate.query(sql, this.emailRowMapper, new Object[] {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllFailed(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
@Override
|
||||
public Collection<EmailData> retrieveAllFailed(final SearchParameters searchParameters) {
|
||||
final String sqlPlusLimit = (searchParameters.getLimit() > 0) ? " limit 0, " + searchParameters.getLimit() : "";
|
||||
final String sql = "select " + this.emailRowMapper.schema() + " where emo.status_enum = "
|
||||
+ EmailMessageStatusType.FAILED.getValue() + sqlPlusLimit;
|
||||
|
||||
return this.jdbcTemplate.query(sql, this.emailRowMapper, new Object[] {});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EmailData> retrieveEmailByStatus(final Integer limit, final Integer status,final Date dateFrom, final Date dateTo) {
|
||||
|
||||
+5
-5
@@ -38,10 +38,10 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class SmsConfigUtils {
|
||||
|
||||
@Autowired
|
||||
private ExternalServicesPropertiesReadPlatformService propertiesReadPlatformService;
|
||||
|
||||
//This method will return uri and HttpEntry objects with keys as uri and entity
|
||||
@Autowired
|
||||
private ExternalServicesPropertiesReadPlatformService propertiesReadPlatformService;
|
||||
|
||||
//This method will return uri and HttpEntry objects with keys as uri and entity
|
||||
public Map<String, Object> getMessageGateWayRequestURI(final String apiEndPoint, String apiQueueResourceDatas) {
|
||||
Map<String, Object> httpRequestdetails = new HashMap<>();
|
||||
MessageGatewayConfigurationData messageGatewayConfigurationData = this.propertiesReadPlatformService.getSMSGateway();
|
||||
@@ -72,5 +72,5 @@ public class SmsConfigUtils {
|
||||
|
||||
return httpRequestdetails;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -86,11 +86,11 @@ public class SmsCampaignEnumerations {
|
||||
public static List<EnumOptionData> calendarPeriodFrequencyTypes(final PeriodFrequencyType[] periodFrequencyTypes) {
|
||||
final List<EnumOptionData> optionDatas = new ArrayList<>();
|
||||
for (final PeriodFrequencyType periodFrequencyType : periodFrequencyTypes) {
|
||||
if(!periodFrequencyType.getValue().equals(PeriodFrequencyType.INVALID.getValue())) {
|
||||
final EnumOptionData optionData = new EnumOptionData(periodFrequencyType.getValue().longValue(), periodFrequencyType.getCode(),
|
||||
if(!periodFrequencyType.getValue().equals(PeriodFrequencyType.INVALID.getValue())) {
|
||||
final EnumOptionData optionData = new EnumOptionData(periodFrequencyType.getValue().longValue(), periodFrequencyType.getCode(),
|
||||
periodFrequencyType.toString());
|
||||
optionDatas.add(optionData);
|
||||
}
|
||||
optionDatas.add(optionData);
|
||||
}
|
||||
}
|
||||
return optionDatas;
|
||||
}
|
||||
|
||||
+3
-3
@@ -207,8 +207,8 @@ public class SmsCampaignData {
|
||||
return this.providerId;
|
||||
}
|
||||
|
||||
public boolean isNotification() {
|
||||
return this.isNotification;
|
||||
}
|
||||
public boolean isNotification() {
|
||||
return this.isNotification;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-8
@@ -162,11 +162,11 @@ public class SmsCampaign extends AbstractPersistableCustom<Long> {
|
||||
final Long triggerType = command.longValueOfParameterNamed(SmsCampaignValidator.triggerType);
|
||||
boolean isNotification = false;
|
||||
if(command.parameterExists(SmsCampaignValidator.isNotificationParamName)){
|
||||
isNotification = command.booleanPrimitiveValueOfParameterNamed(SmsCampaignValidator.isNotificationParamName);
|
||||
isNotification = command.booleanPrimitiveValueOfParameterNamed(SmsCampaignValidator.isNotificationParamName);
|
||||
}
|
||||
Long providerId = null;
|
||||
if(!isNotification){
|
||||
providerId = command.longValueOfParameterNamed(SmsCampaignValidator.providerId);
|
||||
providerId = command.longValueOfParameterNamed(SmsCampaignValidator.providerId);
|
||||
}
|
||||
|
||||
final String paramValue = command.jsonFragment(SmsCampaignValidator.paramValue);
|
||||
@@ -577,13 +577,13 @@ public class SmsCampaign extends AbstractPersistableCustom<Long> {
|
||||
return recurrenceBuilder.toString();
|
||||
}
|
||||
|
||||
public boolean isNotification() {
|
||||
return this.isNotification;
|
||||
}
|
||||
public boolean isNotification() {
|
||||
return this.isNotification;
|
||||
}
|
||||
|
||||
public void setNotification(boolean isNotification) {
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
public void setNotification(boolean isNotification) {
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+11
-11
@@ -321,16 +321,16 @@ public class SmsCampaignValidator {
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||
}
|
||||
|
||||
public boolean isValidNotificationOrSms(Client client, SmsCampaign smsCampaign, Object mobileNo) {
|
||||
if (smsCampaign.isNotification()) {
|
||||
if (client != null) {
|
||||
DeviceRegistration deviceRegistration = this.deviceRegistrationRepository
|
||||
.findDeviceRegistrationByClientId(client.getId());
|
||||
return (deviceRegistration != null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return (mobileNo != null);
|
||||
}
|
||||
public boolean isValidNotificationOrSms(Client client, SmsCampaign smsCampaign, Object mobileNo) {
|
||||
if (smsCampaign.isNotification()) {
|
||||
if (client != null) {
|
||||
DeviceRegistration deviceRegistration = this.deviceRegistrationRepository
|
||||
.findDeviceRegistrationByClientId(client.getId());
|
||||
return (deviceRegistration != null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return (mobileNo != null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+236
-236
@@ -66,10 +66,10 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SmsCampaignDomainServiceImpl.class);
|
||||
|
||||
//private final static int POOL_SIZE = 5 ;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SmsCampaignDomainServiceImpl.class);
|
||||
|
||||
//private final static int POOL_SIZE = 5 ;
|
||||
|
||||
private final SmsCampaignRepository smsCampaignRepository;
|
||||
private final SmsMessageRepository smsMessageRepository;
|
||||
private final OfficeRepository officeRepository;
|
||||
@@ -110,198 +110,198 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
this.businessEventNotifierService.addBusinessEventPostListners(BUSINESS_EVENTS.SAVINGS_WITHDRAWAL, new SavingsAccountTransactionListener(false));
|
||||
}
|
||||
|
||||
private void notifyRejectedLoanOwner(Loan loan) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Loan Rejected");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
if (campaign.isActive()) {
|
||||
SmsCampaignDomainServiceImpl.this.smsCampaignWritePlatformCommandHandler
|
||||
.insertDirectCampaignIntoSmsOutboundTable(loan, campaign);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void notifyRejectedLoanOwner(Loan loan) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Loan Rejected");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
if (campaign.isActive()) {
|
||||
SmsCampaignDomainServiceImpl.this.smsCampaignWritePlatformCommandHandler
|
||||
.insertDirectCampaignIntoSmsOutboundTable(loan, campaign);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyAcceptedLoanOwner(Loan loan) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Loan Approved");
|
||||
if(smsCampaigns.size()>0){
|
||||
for (SmsCampaign campaign:smsCampaigns){
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(loan, campaign);
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(loan, campaign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyClientActivated(final Client client) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Client Activated");
|
||||
if(smsCampaigns.size()>0){
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Client Activated");
|
||||
if(smsCampaigns.size()>0){
|
||||
for (SmsCampaign campaign:smsCampaigns){
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(client, campaign);
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(client, campaign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void notifyClientRejected(final Client client) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Client Rejected");
|
||||
if(smsCampaigns.size()>0){
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Client Rejected");
|
||||
if(smsCampaigns.size()>0){
|
||||
for (SmsCampaign campaign:smsCampaigns){
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(client, campaign);
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(client, campaign);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void notifySavingsAccountActivated(final SavingsAccount savingsAccount) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Savings Activated");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(savingsAccount,
|
||||
campaign);
|
||||
}
|
||||
}
|
||||
private void notifySavingsAccountActivated(final SavingsAccount savingsAccount) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Savings Activated");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(savingsAccount,
|
||||
campaign);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySavingsAccountRejected(final SavingsAccount savingsAccount) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Savings Rejected");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(savingsAccount,
|
||||
campaign);
|
||||
}
|
||||
}
|
||||
private void notifySavingsAccountRejected(final SavingsAccount savingsAccount) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Savings Rejected");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign campaign : smsCampaigns) {
|
||||
this.smsCampaignWritePlatformCommandHandler.insertDirectCampaignIntoSmsOutboundTable(savingsAccount,
|
||||
campaign);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void sendSmsForLoanRepayment(LoanTransaction loanTransaction) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Loan Repayment");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign smsCampaign : smsCampaigns) {
|
||||
try {
|
||||
Loan loan = loanTransaction.getLoan();
|
||||
final Set<Client> groupClients = new HashSet<>();
|
||||
if (loan.hasInvalidLoanType()) {
|
||||
throw new InvalidLoanTypeException(
|
||||
"Loan Type cannot be Invalid for the Triggered Sms Campaign");
|
||||
}
|
||||
if (loan.isGroupLoan()) {
|
||||
Group group = this.groupRepository.findById(loan.getGroupId()).orElse(null);
|
||||
groupClients.addAll(group.getClientMembers());
|
||||
} else {
|
||||
groupClients.add(loan.client());
|
||||
}
|
||||
HashMap<String, String> campaignParams = new ObjectMapper().readValue(smsCampaign.getParamValue(),
|
||||
new TypeReference<HashMap<String, String>>() {
|
||||
});
|
||||
}
|
||||
|
||||
private void sendSmsForLoanRepayment(LoanTransaction loanTransaction) {
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns("Loan Repayment");
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign smsCampaign : smsCampaigns) {
|
||||
try {
|
||||
Loan loan = loanTransaction.getLoan();
|
||||
final Set<Client> groupClients = new HashSet<>();
|
||||
if (loan.hasInvalidLoanType()) {
|
||||
throw new InvalidLoanTypeException(
|
||||
"Loan Type cannot be Invalid for the Triggered Sms Campaign");
|
||||
}
|
||||
if (loan.isGroupLoan()) {
|
||||
Group group = this.groupRepository.findById(loan.getGroupId()).orElse(null);
|
||||
groupClients.addAll(group.getClientMembers());
|
||||
} else {
|
||||
groupClients.add(loan.client());
|
||||
}
|
||||
HashMap<String, String> campaignParams = new ObjectMapper().readValue(smsCampaign.getParamValue(),
|
||||
new TypeReference<HashMap<String, String>>() {
|
||||
});
|
||||
|
||||
if (groupClients.size() > 0) {
|
||||
for (Client client : groupClients) {
|
||||
HashMap<String, Object> smsParams = processRepaymentDataForSms(loanTransaction, client);
|
||||
for (String key : campaignParams.keySet()) {
|
||||
String value = campaignParams.get(key);
|
||||
String spvalue = null;
|
||||
boolean spkeycheck = smsParams.containsKey(key);
|
||||
if (spkeycheck) {
|
||||
spvalue = smsParams.get(key).toString();
|
||||
}
|
||||
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
|
||||
if (key.equals("officeId")) {
|
||||
Office campaignOffice = this.officeRepository.findById(Long.valueOf(value)).orElse(null);
|
||||
if (campaignOffice
|
||||
.doesNotHaveAnOfficeInHierarchyWithId(client.getOffice().getId())) {
|
||||
throw new SmsRuntimeException("error.msg.no.office",
|
||||
"Office not found for the id");
|
||||
}
|
||||
} else {
|
||||
throw new SmsRuntimeException("error.msg.no.id.attribute",
|
||||
"Office Id attribute is notfound");
|
||||
}
|
||||
}
|
||||
}
|
||||
String message = this.smsCampaignWritePlatformCommandHandler.compileSmsTemplate(
|
||||
smsCampaign.getMessage(), smsCampaign.getCampaignName(), smsParams);
|
||||
Object mobileNo = smsParams.get("mobileNo");
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, message,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error("smsParams does not contain the key: " + e.getMessage());
|
||||
} catch (final RuntimeException e) {
|
||||
logger.debug("Client Office Id and SMS Campaign Office id doesn't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (groupClients.size() > 0) {
|
||||
for (Client client : groupClients) {
|
||||
HashMap<String, Object> smsParams = processRepaymentDataForSms(loanTransaction, client);
|
||||
for (String key : campaignParams.keySet()) {
|
||||
String value = campaignParams.get(key);
|
||||
String spvalue = null;
|
||||
boolean spkeycheck = smsParams.containsKey(key);
|
||||
if (spkeycheck) {
|
||||
spvalue = smsParams.get(key).toString();
|
||||
}
|
||||
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
|
||||
if (key.equals("officeId")) {
|
||||
Office campaignOffice = this.officeRepository.findById(Long.valueOf(value)).orElse(null);
|
||||
if (campaignOffice
|
||||
.doesNotHaveAnOfficeInHierarchyWithId(client.getOffice().getId())) {
|
||||
throw new SmsRuntimeException("error.msg.no.office",
|
||||
"Office not found for the id");
|
||||
}
|
||||
} else {
|
||||
throw new SmsRuntimeException("error.msg.no.id.attribute",
|
||||
"Office Id attribute is notfound");
|
||||
}
|
||||
}
|
||||
}
|
||||
String message = this.smsCampaignWritePlatformCommandHandler.compileSmsTemplate(
|
||||
smsCampaign.getMessage(), smsCampaign.getCampaignName(), smsParams);
|
||||
Object mobileNo = smsParams.get("mobileNo");
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, message,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error("smsParams does not contain the key: " + e.getMessage());
|
||||
} catch (final RuntimeException e) {
|
||||
logger.debug("Client Office Id and SMS Campaign Office id doesn't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendSmsForSavingsTransaction(final SavingsAccountTransaction savingsTransaction, boolean isDeposit) {
|
||||
String campaignName = isDeposit ? "Savings Deposit" : "Savings Withdrawal";
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns(campaignName);
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign smsCampaign : smsCampaigns) {
|
||||
try {
|
||||
final SavingsAccount savingsAccount = savingsTransaction.getSavingsAccount();
|
||||
final Client client = savingsAccount.getClient();
|
||||
HashMap<String, String> campaignParams = new ObjectMapper().readValue(smsCampaign.getParamValue(),
|
||||
new TypeReference<HashMap<String, String>>() {
|
||||
});
|
||||
HashMap<String, Object> smsParams = processSavingsTransactionDataForSms(savingsTransaction, client);
|
||||
for (String key : campaignParams.keySet()) {
|
||||
String value = campaignParams.get(key);
|
||||
String spvalue = null;
|
||||
boolean spkeycheck = smsParams.containsKey(key);
|
||||
if (spkeycheck) {
|
||||
spvalue = smsParams.get(key).toString();
|
||||
}
|
||||
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
|
||||
if (key.equals("officeId")) {
|
||||
Office campaignOffice = this.officeRepository.findById(Long.valueOf(value)).orElse(null);
|
||||
if (campaignOffice.doesNotHaveAnOfficeInHierarchyWithId(client.getOffice().getId())) {
|
||||
throw new SmsRuntimeException("error.msg.no.office",
|
||||
"Office not found for the id");
|
||||
}
|
||||
} else {
|
||||
throw new SmsRuntimeException("error.msg.no.id.attribute",
|
||||
"Office Id attribute is notfound");
|
||||
}
|
||||
}
|
||||
}
|
||||
String message = this.smsCampaignWritePlatformCommandHandler
|
||||
.compileSmsTemplate(smsCampaign.getMessage(), smsCampaign.getCampaignName(), smsParams);
|
||||
Object mobileNo = smsParams.get("mobileNo");
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, message,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error("smsParams does not contain the key: " + e.getMessage());
|
||||
} catch (final RuntimeException e) {
|
||||
logger.debug("Client Office Id and SMS Campaign Office id doesn't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void sendSmsForSavingsTransaction(final SavingsAccountTransaction savingsTransaction, boolean isDeposit) {
|
||||
String campaignName = isDeposit ? "Savings Deposit" : "Savings Withdrawal";
|
||||
List<SmsCampaign> smsCampaigns = retrieveSmsCampaigns(campaignName);
|
||||
if (smsCampaigns.size() > 0) {
|
||||
for (SmsCampaign smsCampaign : smsCampaigns) {
|
||||
try {
|
||||
final SavingsAccount savingsAccount = savingsTransaction.getSavingsAccount();
|
||||
final Client client = savingsAccount.getClient();
|
||||
HashMap<String, String> campaignParams = new ObjectMapper().readValue(smsCampaign.getParamValue(),
|
||||
new TypeReference<HashMap<String, String>>() {
|
||||
});
|
||||
HashMap<String, Object> smsParams = processSavingsTransactionDataForSms(savingsTransaction, client);
|
||||
for (String key : campaignParams.keySet()) {
|
||||
String value = campaignParams.get(key);
|
||||
String spvalue = null;
|
||||
boolean spkeycheck = smsParams.containsKey(key);
|
||||
if (spkeycheck) {
|
||||
spvalue = smsParams.get(key).toString();
|
||||
}
|
||||
if (spkeycheck && !(value.equals("-1") || spvalue.equals(value))) {
|
||||
if (key.equals("officeId")) {
|
||||
Office campaignOffice = this.officeRepository.findById(Long.valueOf(value)).orElse(null);
|
||||
if (campaignOffice.doesNotHaveAnOfficeInHierarchyWithId(client.getOffice().getId())) {
|
||||
throw new SmsRuntimeException("error.msg.no.office",
|
||||
"Office not found for the id");
|
||||
}
|
||||
} else {
|
||||
throw new SmsRuntimeException("error.msg.no.id.attribute",
|
||||
"Office Id attribute is notfound");
|
||||
}
|
||||
}
|
||||
}
|
||||
String message = this.smsCampaignWritePlatformCommandHandler
|
||||
.compileSmsTemplate(smsCampaign.getMessage(), smsCampaign.getCampaignName(), smsParams);
|
||||
Object mobileNo = smsParams.get("mobileNo");
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, message,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error("smsParams does not contain the key: " + e.getMessage());
|
||||
} catch (final RuntimeException e) {
|
||||
logger.debug("Client Office Id and SMS Campaign Office id doesn't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SmsCampaign> retrieveSmsCampaigns(String paramValue){
|
||||
List<SmsCampaign> smsCampaigns = smsCampaignRepository.findActiveSmsCampaigns("%"+paramValue+"%", SmsCampaignTriggerType.TRIGGERED.getValue());
|
||||
@@ -337,9 +337,9 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
smsParams.put("officeId", client.getOffice().getId());
|
||||
|
||||
if(client.getStaff() != null) {
|
||||
smsParams.put("loanOfficerId", client.getStaff().getId());
|
||||
smsParams.put("loanOfficerId", client.getStaff().getId());
|
||||
}else {
|
||||
smsParams.put("loanOfficerId", -1);
|
||||
smsParams.put("loanOfficerId", -1);
|
||||
}
|
||||
|
||||
smsParams.put("repaymentAmount", loanTransaction.getAmount(loan.getCurrency()));
|
||||
@@ -347,18 +347,18 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
smsParams.put("RepaymentTime", loanTransaction.getCreatedDateTime().toLocalTime().toString(timeFormatter));
|
||||
|
||||
if(loanTransaction.getPaymentDetail() != null) {
|
||||
smsParams.put("receiptNumber", loanTransaction.getPaymentDetail().getReceiptNumber());
|
||||
smsParams.put("receiptNumber", loanTransaction.getPaymentDetail().getReceiptNumber());
|
||||
}else {
|
||||
smsParams.put("receiptNumber", -1);
|
||||
smsParams.put("receiptNumber", -1);
|
||||
}
|
||||
return smsParams;
|
||||
}
|
||||
|
||||
private HashMap<String, Object> processSavingsTransactionDataForSms(final SavingsAccountTransaction savingsAccountTransaction, Client client){
|
||||
|
||||
// {{savingsId}} {{id}} {{firstname}} {{middlename}} {{lastname}} {{FullName}} {{mobileNo}} {{savingsAccountId}} {{depositAmount}} {{balance}}
|
||||
|
||||
//transactionDate
|
||||
// {{savingsId}} {{id}} {{firstname}} {{middlename}} {{lastname}} {{FullName}} {{mobileNo}} {{savingsAccountId}} {{depositAmount}} {{balance}}
|
||||
|
||||
//transactionDate
|
||||
HashMap<String, Object> smsParams = new HashMap<String, Object>();
|
||||
SavingsAccount savingsAccount = savingsAccountTransaction.getSavingsAccount() ;
|
||||
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("MMM:d:yyyy");
|
||||
@@ -378,25 +378,25 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
smsParams.put("savingsTransactionId", savingsAccountTransaction.getId()) ;
|
||||
|
||||
if(client.getStaff() != null) {
|
||||
smsParams.put("loanOfficerId", client.getStaff().getId());
|
||||
smsParams.put("loanOfficerId", client.getStaff().getId());
|
||||
}else {
|
||||
smsParams.put("loanOfficerId", -1);
|
||||
smsParams.put("loanOfficerId", -1);
|
||||
}
|
||||
|
||||
if(savingsAccountTransaction.getPaymentDetail() != null) {
|
||||
smsParams.put("receiptNumber", savingsAccountTransaction.getPaymentDetail().getReceiptNumber());
|
||||
smsParams.put("receiptNumber", savingsAccountTransaction.getPaymentDetail().getReceiptNumber());
|
||||
}else {
|
||||
smsParams.put("receiptNumber", -1);
|
||||
smsParams.put("receiptNumber", -1);
|
||||
}
|
||||
return smsParams;
|
||||
}
|
||||
|
||||
private abstract class SmsBusinessEventAdapter implements BusinessEventListner {
|
||||
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
//Nothing to do
|
||||
}
|
||||
@Override
|
||||
public void businessEventToBeExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
//Nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
private class SendSmsOnLoanApproved extends SmsBusinessEventAdapter{
|
||||
@@ -437,79 +437,79 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
|
||||
private class ClientActivatedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientActivated((Client)entity);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientActivated((Client)entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ClientRejectedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientRejected((Client)entity);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.CLIENT);
|
||||
if(entity instanceof Client) {
|
||||
notifyClientRejected((Client)entity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class SavingsAccountActivatedListener extends SmsBusinessEventAdapter{
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountActivated((SavingsAccount)entity);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountActivated((SavingsAccount)entity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class SavingsAccountRejectedListener extends SmsBusinessEventAdapter {
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountRejected((SavingsAccount)entity);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVING);
|
||||
if(entity instanceof SavingsAccount) {
|
||||
notifySavingsAccountRejected((SavingsAccount)entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SavingsAccountTransactionListener extends SmsBusinessEventAdapter {
|
||||
|
||||
final boolean isDeposit ;
|
||||
|
||||
public SavingsAccountTransactionListener(final boolean isDeposit) {
|
||||
this.isDeposit = isDeposit ;
|
||||
}
|
||||
final boolean isDeposit ;
|
||||
|
||||
public SavingsAccountTransactionListener(final boolean isDeposit) {
|
||||
this.isDeposit = isDeposit ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVINGS_TRANSACTION);
|
||||
if(entity instanceof SavingsAccountTransaction) {
|
||||
sendSmsForSavingsTransaction((SavingsAccountTransaction)entity, this.isDeposit);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void businessEventWasExecuted(Map<BUSINESS_ENTITY, Object> businessEventEntity) {
|
||||
Object entity = businessEventEntity.get(BusinessEventNotificationConstants.BUSINESS_ENTITY.SAVINGS_TRANSACTION);
|
||||
if(entity instanceof SavingsAccountTransaction) {
|
||||
sendSmsForSavingsTransaction((SavingsAccountTransaction)entity, this.isDeposit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*private abstract class Task implements Runnable {
|
||||
|
||||
protected final FineractPlatformTenant tenant;
|
||||
|
||||
protected final String reportName ;
|
||||
|
||||
private final Object entity ;
|
||||
|
||||
public Task(final FineractPlatformTenant tenant, final String reportName, final Object entity) {
|
||||
|
||||
protected final FineractPlatformTenant tenant;
|
||||
|
||||
protected final String reportName ;
|
||||
|
||||
private final Object entity ;
|
||||
|
||||
public Task(final FineractPlatformTenant tenant, final String reportName, final Object entity) {
|
||||
this.tenant = tenant;
|
||||
this.reportName = reportName ;
|
||||
this.entity = entity ;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
+66
-66
@@ -232,10 +232,10 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId.longValue());
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
// String countryCode = this.smsReadPlatformService.retrieveCountryCode(client.getOffice().getId()).getCountryCode();
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage, mobileNumber,
|
||||
smsCampaign, smsCampaign.isNotification());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
@@ -243,7 +243,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error(e.getMessage());
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,10 +287,10 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
Object mobileNo = entry.get("mobileNo");
|
||||
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage, mobileNumber,
|
||||
smsCampaign, smsCampaign.isNotification());
|
||||
smsMessage.setStatusType(SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue());
|
||||
@@ -305,9 +305,9 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
} catch (final RuntimeException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,39 +320,39 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
HashMap<String, String> queryParamForRunReport = new ObjectMapper().readValue(smsCampaign.getParamValue(),
|
||||
new TypeReference<HashMap<String, String>>() {});
|
||||
|
||||
campaignParams.put("clientId", client.getId().toString());
|
||||
queryParamForRunReport.put("clientId", client.getId().toString());
|
||||
|
||||
List<HashMap<String, Object>> runReportObject = this
|
||||
.getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);
|
||||
campaignParams.put("clientId", client.getId().toString());
|
||||
queryParamForRunReport.put("clientId", client.getId().toString());
|
||||
|
||||
List<HashMap<String, Object>> runReportObject = this
|
||||
.getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);
|
||||
|
||||
if (runReportObject != null && runReportObject.size() > 0) {
|
||||
for (HashMap<String, Object> entry : runReportObject) {
|
||||
String textMessage = this.compileSmsTemplate(smsCampaign.getMessage(),
|
||||
smsCampaign.getCampaignName(), entry);
|
||||
Object mobileNo = entry.get("mobileNo");
|
||||
if (runReportObject != null && runReportObject.size() > 0) {
|
||||
for (HashMap<String, Object> entry : runReportObject) {
|
||||
String textMessage = this.compileSmsTemplate(smsCampaign.getMessage(),
|
||||
smsCampaign.getCampaignName(), entry);
|
||||
Object mobileNo = entry.get("mobileNo");
|
||||
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
smsMessage.setStatusType(SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
smsMessage.setStatusType(SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
} catch (final RuntimeException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,36 +367,36 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
queryParamForRunReport.put("savingsId", savingsAccount.getId().toString());
|
||||
|
||||
Client client = savingsAccount.getClient() ;
|
||||
List<HashMap<String, Object>> runReportObject = this
|
||||
.getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);
|
||||
List<HashMap<String, Object>> runReportObject = this
|
||||
.getRunReportByServiceImpl(campaignParams.get("reportName"), queryParamForRunReport);
|
||||
|
||||
if (runReportObject != null && runReportObject.size() > 0) {
|
||||
for (HashMap<String, Object> entry : runReportObject) {
|
||||
String textMessage = this.compileSmsTemplate(smsCampaign.getMessage(),
|
||||
smsCampaign.getCampaignName(), entry);
|
||||
Object mobileNo = entry.get("mobileNo");
|
||||
if (runReportObject != null && runReportObject.size() > 0) {
|
||||
for (HashMap<String, Object> entry : runReportObject) {
|
||||
String textMessage = this.compileSmsTemplate(smsCampaign.getMessage(),
|
||||
smsCampaign.getCampaignName(), entry);
|
||||
Object mobileNo = entry.get("mobileNo");
|
||||
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
smsMessage.setStatusType(SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.smsCampaignValidator.isValidNotificationOrSms(client, smsCampaign, mobileNo)) {
|
||||
String mobileNumber = null;
|
||||
if(mobileNo != null){
|
||||
mobileNumber = mobileNo.toString();
|
||||
}
|
||||
SmsMessage smsMessage = SmsMessage.pendingSms(null, null, client, null, textMessage,
|
||||
mobileNumber, smsCampaign, smsCampaign.isNotification());
|
||||
smsMessage.setStatusType(SmsMessageStatusType.WAITING_FOR_DELIVERY_REPORT.getValue());
|
||||
this.smsMessageRepository.save(smsMessage);
|
||||
Collection<SmsMessage> messages = new ArrayList<>();
|
||||
messages.add(smsMessage);
|
||||
Map<SmsCampaign, Collection<SmsMessage>> smsDataMap = new HashMap<>();
|
||||
smsDataMap.put(smsCampaign, messages);
|
||||
this.smsMessageScheduledJobService.sendTriggeredMessages(smsDataMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
} catch (final RuntimeException e) {
|
||||
logger.error(e.getMessage()) ;
|
||||
logger.error(e.getMessage()) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -76,9 +76,9 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
|
||||
handleCodeDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
|
||||
return CommandProcessingResult.empty();
|
||||
}catch (final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleCodeDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleCodeDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +108,9 @@ public class CodeWritePlatformServiceJpaRepositoryImpl implements CodeWritePlatf
|
||||
handleCodeDataIntegrityIssues(command, dve.getMostSpecificCause(), dve);
|
||||
return CommandProcessingResult.empty();
|
||||
}catch (final PersistenceException ee) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleCodeDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
Throwable throwable = ExceptionUtils.getRootCause(ee.getCause()) ;
|
||||
handleCodeDataIntegrityIssues(command, throwable, ee);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
-23
@@ -45,10 +45,10 @@ import com.google.gson.reflect.TypeToken;
|
||||
public class GlobalConfigurationDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(GlobalConfigurationApiConstant.localeParamName,
|
||||
GlobalConfigurationApiConstant.dateFormatParamName, GlobalConfigurationApiConstant.ENABLED,
|
||||
GlobalConfigurationApiConstant.VALUE, GlobalConfigurationApiConstant.DATE_VALUE));
|
||||
private static final Set<String> UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(GlobalConfigurationApiConstant.localeParamName,
|
||||
GlobalConfigurationApiConstant.dateFormatParamName, GlobalConfigurationApiConstant.ENABLED,
|
||||
GlobalConfigurationApiConstant.VALUE, GlobalConfigurationApiConstant.DATE_VALUE));
|
||||
|
||||
@Autowired
|
||||
public GlobalConfigurationDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
@@ -63,29 +63,29 @@ public class GlobalConfigurationDataValidator {
|
||||
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS);
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(GlobalConfigurationApiConstant.CONFIGURATION_RESOURCE_NAME);
|
||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
|
||||
.resource(GlobalConfigurationApiConstant.CONFIGURATION_RESOURCE_NAME);
|
||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.ENABLED, element)) {
|
||||
final boolean enabledBool = this.fromApiJsonHelper
|
||||
.extractBooleanNamed(GlobalConfigurationApiConstant.ENABLED, element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(enabledBool)
|
||||
.validateForBooleanValue();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.ENABLED, element)) {
|
||||
final boolean enabledBool = this.fromApiJsonHelper
|
||||
.extractBooleanNamed(GlobalConfigurationApiConstant.ENABLED, element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(enabledBool)
|
||||
.validateForBooleanValue();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.VALUE, element)) {
|
||||
final Long valueStr = this.fromApiJsonHelper.extractLongNamed(GlobalConfigurationApiConstant.VALUE,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(valueStr)
|
||||
.zeroOrPositiveAmount();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.VALUE, element)) {
|
||||
final Long valueStr = this.fromApiJsonHelper.extractLongNamed(GlobalConfigurationApiConstant.VALUE,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.ENABLED).value(valueStr)
|
||||
.zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.DATE_VALUE, element)) {
|
||||
final LocalDate dateValue = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(GlobalConfigurationApiConstant.DATE_VALUE, element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull();
|
||||
}
|
||||
if (this.fromApiJsonHelper.parameterExists(GlobalConfigurationApiConstant.DATE_VALUE, element)) {
|
||||
final LocalDate dateValue = this.fromApiJsonHelper
|
||||
.extractLocalDateNamed(GlobalConfigurationApiConstant.DATE_VALUE, element);
|
||||
baseDataValidator.reset().parameter(GlobalConfigurationApiConstant.DATE_VALUE).value(dateValue).notNull();
|
||||
}
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
|
||||
|
||||
|
||||
+21
-21
@@ -61,33 +61,33 @@ public class GlobalConfigurationPropertyData {
|
||||
this.trapDoor = isTrapDoor;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public Long getValue() {
|
||||
return this.value;
|
||||
}
|
||||
public Long getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public Date getDateValue() {
|
||||
return this.dateValue;
|
||||
}
|
||||
public Date getDateValue() {
|
||||
return this.dateValue;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public boolean isTrapDoor() {
|
||||
return this.trapDoor;
|
||||
}
|
||||
public boolean isTrapDoor() {
|
||||
return this.trapDoor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+11
-11
@@ -232,13 +232,13 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
||||
return property.getDateValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaymnetypeApplicableforDisbursementCharge() {
|
||||
final String propertyName = "paymenttype-applicable-for-disbursement-charges";
|
||||
@Override
|
||||
public boolean isPaymnetypeApplicableforDisbursementCharge() {
|
||||
final String propertyName = "paymenttype-applicable-for-disbursement-charges";
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
return property.isEnabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkippingMeetingOnFirstDayOfMonthEnabled() {
|
||||
return getGlobalConfigurationPropertyData("skip-repayment-on-first-day-of-month").isEnabled();
|
||||
@@ -266,19 +266,19 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
||||
return property.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDailyTPTLimitEnabled() {
|
||||
@Override
|
||||
public boolean isDailyTPTLimitEnabled() {
|
||||
final String propertyName = "daily-tpt-limit";
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
return property.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDailyTPTLimit() {
|
||||
@Override
|
||||
public Long getDailyTPTLimit() {
|
||||
final String propertyName = "daily-tpt-limit";
|
||||
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(propertyName);
|
||||
return property.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGlobalConfigurationPropertyDataFromCache(final String propertyName) {
|
||||
|
||||
+16
-16
@@ -53,22 +53,22 @@ public class ExternalServicePropertiesPK implements Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ExternalServicePropertiesPK rhs = (ExternalServicePropertiesPK) obj;
|
||||
return new EqualsBuilder() //
|
||||
.append(this.externalServiceId, rhs.externalServiceId) //
|
||||
.append(this.name, rhs.name) //
|
||||
.isEquals();
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj.getClass() != getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ExternalServicePropertiesPK rhs = (ExternalServicePropertiesPK) obj;
|
||||
return new EqualsBuilder() //
|
||||
.append(this.externalServiceId, rhs.externalServiceId) //
|
||||
.append(this.name, rhs.name) //
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
+1
-1
@@ -26,6 +26,6 @@ import org.springframework.data.repository.query.Param;
|
||||
public interface ExternalServicesPropertiesRepository extends JpaRepository<ExternalServicesProperties, ExternalServicePropertiesPK>,
|
||||
JpaSpecificationExecutor<ExternalServicesProperties> {
|
||||
|
||||
@Query("SELECT ep from ExternalServicesProperties ep where ep.externalServicePropertiesPK.name=:name and ep.externalServicePropertiesPK.externalServiceId=:externalServiceId")
|
||||
@Query("SELECT ep from ExternalServicesProperties ep where ep.externalServicePropertiesPK.name=:name and ep.externalServicePropertiesPK.externalServiceId=:externalServiceId")
|
||||
ExternalServicesProperties findOneByExternalServicePropertiesPK(@Param("name") String name, @Param("externalServiceId") Long externalServiceId);
|
||||
}
|
||||
+7
-7
@@ -209,11 +209,11 @@ public class ExternalServicesPropertiesReadPlatformServiceImpl implements Extern
|
||||
String fcmEndPoint = null;
|
||||
while (rs.next()) {
|
||||
if (rs.getString("name").equalsIgnoreCase(ExternalServicesConstants.NOTIFICATION_SERVER_KEY )) {
|
||||
serverKey = rs.getString("value");
|
||||
serverKey = rs.getString("value");
|
||||
} else if (rs.getString("name").equalsIgnoreCase(ExternalServicesConstants.NOTIFICATION_GCM_END_POINT )) {
|
||||
gcmEndPoint = rs.getString("value");
|
||||
gcmEndPoint = rs.getString("value");
|
||||
} else if (rs.getString("name").equalsIgnoreCase(ExternalServicesConstants.NOTIFICATION_FCM_END_POINT )) {
|
||||
fcmEndPoint = rs.getString("value");
|
||||
fcmEndPoint = rs.getString("value");
|
||||
}
|
||||
}
|
||||
return new NotificationConfigurationData(null, serverKey, gcmEndPoint, fcmEndPoint);
|
||||
@@ -221,13 +221,13 @@ public class ExternalServicesPropertiesReadPlatformServiceImpl implements Extern
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NotificationConfigurationData getNotificationConfiguration() {
|
||||
final ResultSetExtractor<NotificationConfigurationData> resultSetExtractor = new NotificationDataExtractor();
|
||||
@Override
|
||||
public NotificationConfigurationData getNotificationConfiguration() {
|
||||
final ResultSetExtractor<NotificationConfigurationData> resultSetExtractor = new NotificationDataExtractor();
|
||||
final String sql = "SELECT esp.name, esp.value FROM c_external_service_properties esp inner join c_external_service es on esp.external_service_id = es.id where es.name = '"
|
||||
+ ExternalServicesConstants.NOTIFICATION_SERVICE_NAME + "'";
|
||||
final NotificationConfigurationData notificationConfigurationData = this.jdbcTemplate.query(sql, resultSetExtractor, new Object[] {});
|
||||
return notificationConfigurationData;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -46,15 +46,15 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
*/
|
||||
@Configuration
|
||||
@Import({ WebXmlConfiguration.class, WebXmlOauthConfiguration.class, WebFrontEndConfiguration.class,
|
||||
MessagingConfiguration.class, WebTwoFactorXmlConfiguration.class })
|
||||
MessagingConfiguration.class, WebTwoFactorXmlConfiguration.class })
|
||||
@ImportResource({ "classpath*:META-INF/spring/appContext.xml" })
|
||||
@PropertySource(value="classpath:META-INF/spring/jdbc.properties")
|
||||
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
|
||||
HibernateJpaAutoConfiguration.class,
|
||||
DataSourceTransactionManagerAutoConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
GsonAutoConfiguration.class,
|
||||
JdbcTemplateAutoConfiguration.class})
|
||||
HibernateJpaAutoConfiguration.class,
|
||||
DataSourceTransactionManagerAutoConfiguration.class,
|
||||
FlywayAutoConfiguration.class,
|
||||
GsonAutoConfiguration.class,
|
||||
JdbcTemplateAutoConfiguration.class})
|
||||
@EnableWebSecurity
|
||||
@EnableTransactionManagement
|
||||
public abstract class AbstractApplicationConfiguration {
|
||||
|
||||
+26
-26
@@ -28,45 +28,45 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class JDBCDriverConfig {
|
||||
|
||||
private final static String DRIVER_CLASS_PROPERTYNAME = "DRIVERCLASS_NAME" ;
|
||||
private final static String PROTOCOL_PROPERTYNAME = "PROTOCOL" ;
|
||||
private final static String SUBPROTOCOL_PROPERTYNAME = "SUB_PROTOCOL" ;
|
||||
private final static String PORT_PROPERTYNAME = "PORT" ;
|
||||
|
||||
private String driverClassName ;
|
||||
private String protocol ;
|
||||
private String subProtocol ;
|
||||
private Integer port ;
|
||||
|
||||
@Autowired ApplicationContext context ;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
Environment environment = context.getEnvironment() ;
|
||||
driverClassName = (String)environment.getProperty(DRIVER_CLASS_PROPERTYNAME) ;
|
||||
protocol = (String) environment.getProperty(PROTOCOL_PROPERTYNAME) ;
|
||||
subProtocol = (String) environment.getProperty(SUBPROTOCOL_PROPERTYNAME) ;
|
||||
port = Integer.parseInt((String) environment.getProperty(PORT_PROPERTYNAME)) ;
|
||||
}
|
||||
|
||||
private final static String DRIVER_CLASS_PROPERTYNAME = "DRIVERCLASS_NAME" ;
|
||||
private final static String PROTOCOL_PROPERTYNAME = "PROTOCOL" ;
|
||||
private final static String SUBPROTOCOL_PROPERTYNAME = "SUB_PROTOCOL" ;
|
||||
private final static String PORT_PROPERTYNAME = "PORT" ;
|
||||
|
||||
private String driverClassName ;
|
||||
private String protocol ;
|
||||
private String subProtocol ;
|
||||
private Integer port ;
|
||||
|
||||
@Autowired ApplicationContext context ;
|
||||
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
Environment environment = context.getEnvironment() ;
|
||||
driverClassName = (String)environment.getProperty(DRIVER_CLASS_PROPERTYNAME) ;
|
||||
protocol = (String) environment.getProperty(PROTOCOL_PROPERTYNAME) ;
|
||||
subProtocol = (String) environment.getProperty(SUBPROTOCOL_PROPERTYNAME) ;
|
||||
port = Integer.parseInt((String) environment.getProperty(PORT_PROPERTYNAME)) ;
|
||||
}
|
||||
|
||||
public String getDriverClassName() {
|
||||
return this.driverClassName ;
|
||||
return this.driverClassName ;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return this.protocol ;
|
||||
return this.protocol ;
|
||||
}
|
||||
|
||||
public String getSubProtocol() {
|
||||
return this.subProtocol ;
|
||||
return this.subProtocol ;
|
||||
}
|
||||
|
||||
public Integer getPort() {
|
||||
return this.port ;
|
||||
return this.port ;
|
||||
}
|
||||
|
||||
public String constructProtocol(String schemaServer, String schemaServerPort, String schemaName) {
|
||||
final String url = new StringBuilder(protocol).append(":").append(subProtocol).append("://").append(schemaServer).append(':').append(schemaServerPort)
|
||||
final String url = new StringBuilder(protocol).append(":").append(subProtocol).append("://").append(schemaServer).append(':').append(schemaServerPort)
|
||||
.append('/').append(schemaName).toString();
|
||||
return url;
|
||||
}
|
||||
|
||||
+9
-9
@@ -39,15 +39,15 @@ import org.springframework.context.annotation.ImportResource;
|
||||
*/
|
||||
public class WarWebApplicationInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@ImportResource({ "classpath*:META-INF/spring/jndi.xml" })
|
||||
private static class Configuration extends AbstractApplicationConfiguration {
|
||||
}
|
||||
@ImportResource({ "classpath*:META-INF/spring/jndi.xml" })
|
||||
private static class Configuration extends AbstractApplicationConfiguration {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(
|
||||
SpringApplicationBuilder application) {
|
||||
// let's share Spring Boot Love, so no showBanner(false)
|
||||
return application.sources(Configuration.class);
|
||||
}
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(
|
||||
SpringApplicationBuilder application) {
|
||||
// let's share Spring Boot Love, so no showBanner(false)
|
||||
return application.sources(Configuration.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -34,18 +34,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
*/
|
||||
@Configuration
|
||||
public class DataSourceConfiguration {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataSourceConfiguration.class);
|
||||
|
||||
@Autowired JDBCDriverConfig config ;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataSourceConfiguration.class);
|
||||
|
||||
@Autowired JDBCDriverConfig config ;
|
||||
|
||||
@Bean
|
||||
public DataSourceProperties dataSourceProperties() {
|
||||
return new DataSourceProperties(config.getDriverClassName(), config.getProtocol(), config.getSubProtocol(), config.getPort());
|
||||
return new DataSourceProperties(config.getDriverClassName(), config.getProtocol(), config.getSubProtocol(), config.getPort());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource tenantDataSourceJndi() {
|
||||
PoolConfiguration p = getProperties();
|
||||
PoolConfiguration p = getProperties();
|
||||
org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(p);
|
||||
logger.info("Created new DataSource; url=" + p.getUrl());
|
||||
return ds;
|
||||
|
||||
+43
-43
@@ -98,60 +98,60 @@ public class DataSourceProperties extends PoolProperties {
|
||||
|
||||
@Override
|
||||
public void setUrl(@SuppressWarnings("unused") String url) {
|
||||
throw new UnsupportedOperationException("Use setHost/Port/DB() instead of setURL()");
|
||||
throw new UnsupportedOperationException("Use setHost/Port/DB() instead of setURL()");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrl() {
|
||||
String url = super.getUrl();
|
||||
if (StringUtils.hasText(url)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return jdbcProtocol + ":" + jdbcSubprotocol + "://" + getHost() + ":" + getPort() + "/" + getDBName();
|
||||
}
|
||||
@Override
|
||||
public String getUrl() {
|
||||
String url = super.getUrl();
|
||||
if (StringUtils.hasText(url)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return jdbcProtocol + ":" + jdbcSubprotocol + "://" + getHost() + ":" + getPort() + "/" + getDBName();
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return hostname;
|
||||
}
|
||||
public String getHost() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public String getDBName() {
|
||||
return dbName;
|
||||
}
|
||||
public String getDBName() {
|
||||
return dbName;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void setHost(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
public void setHost(String hostname) {
|
||||
this.hostname = hostname;
|
||||
}
|
||||
|
||||
public void setDBName(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
public void setDBName(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
@Override
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
@Override
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
||||
+29
-29
@@ -26,37 +26,37 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
|
||||
@Configuration
|
||||
public class MariaDB4jDataSourceConfiguration extends DataSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
public MariaDB4jSetupService mariaDB4jSetUp() {
|
||||
return new MariaDB4jSetupService(mariaDB4j().getDB());
|
||||
}
|
||||
@Bean
|
||||
public MariaDB4jSetupService mariaDB4jSetUp() {
|
||||
return new MariaDB4jSetupService(mariaDB4j().getDB());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MariaDB4jSpringService mariaDB4j() {
|
||||
MariaDB4jSpringService mariaDB4jSpringService = new MariaDB4jSpringService();
|
||||
mariaDB4jSpringService.setDefaultBaseDir("build/db/bin");
|
||||
mariaDB4jSpringService.setDefaultDataDir("build/db/data");
|
||||
return mariaDB4jSpringService;
|
||||
}
|
||||
@Bean
|
||||
public MariaDB4jSpringService mariaDB4j() {
|
||||
MariaDB4jSpringService mariaDB4jSpringService = new MariaDB4jSpringService();
|
||||
mariaDB4jSpringService.setDefaultBaseDir("build/db/bin");
|
||||
mariaDB4jSpringService.setDefaultDataDir("build/db/data");
|
||||
return mariaDB4jSpringService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
// NOT @Bean @Override dataSourceProperties() - doesn't work :(
|
||||
protected DataSourceProperties getProperties() {
|
||||
DataSourceProperties p = super.getProperties();
|
||||
String dbName = mariaDB4jSetUp().getTenantDBName();
|
||||
// Do not use p.setUrl(mariaDB4j().getConfiguration().getURL(dbName));
|
||||
// Because TenantDataSourcePortFixService needs separate
|
||||
// host/port/db/uid/pwd:
|
||||
// (DataSourceProperties getUrl() creates the correct JDBC URL from it)
|
||||
// This intentionally overrides any fineract.datasource.* settings, because
|
||||
// in this configuration, logically the mariaDB4j settings take
|
||||
// precedence:
|
||||
p.setHost("localhost");
|
||||
p.setPort(mariaDB4j().getConfiguration().getPort());
|
||||
p.setDBName(dbName);
|
||||
// TODO p.setUsername(mariaDB4j().getConfiguration().getUsername());
|
||||
// TODO p.setPassword(mariaDB4j().getConfiguration().getPassword());
|
||||
return p;
|
||||
}
|
||||
protected DataSourceProperties getProperties() {
|
||||
DataSourceProperties p = super.getProperties();
|
||||
String dbName = mariaDB4jSetUp().getTenantDBName();
|
||||
// Do not use p.setUrl(mariaDB4j().getConfiguration().getURL(dbName));
|
||||
// Because TenantDataSourcePortFixService needs separate
|
||||
// host/port/db/uid/pwd:
|
||||
// (DataSourceProperties getUrl() creates the correct JDBC URL from it)
|
||||
// This intentionally overrides any fineract.datasource.* settings, because
|
||||
// in this configuration, logically the mariaDB4j settings take
|
||||
// precedence:
|
||||
p.setHost("localhost");
|
||||
p.setPort(mariaDB4j().getConfiguration().getPort());
|
||||
p.setDBName(dbName);
|
||||
// TODO p.setUsername(mariaDB4j().getConfiguration().getUsername());
|
||||
// TODO p.setPassword(mariaDB4j().getConfiguration().getPassword());
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
+32
-32
@@ -46,25 +46,25 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class TenantDataSourcePortFixService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TenantDataSourcePortFixService.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(TenantDataSourcePortFixService.class);
|
||||
|
||||
/**
|
||||
* While what this class does is convenient in 96% you may would like to
|
||||
* completely disable it if you've hand tuned your tenants table for an
|
||||
* advanced configuration and use e.g. different databases maybe on
|
||||
* different hosts for different tenants.
|
||||
*/
|
||||
/**
|
||||
* While what this class does is convenient in 96% you may would like to
|
||||
* completely disable it if you've hand tuned your tenants table for an
|
||||
* advanced configuration and use e.g. different databases maybe on
|
||||
* different hosts for different tenants.
|
||||
*/
|
||||
public final static String ENABLED = "fineract.tenantdb.fixup";
|
||||
@Value("${" + ENABLED + ":true}")
|
||||
private boolean enabled;
|
||||
|
||||
// required=false is important here, because in
|
||||
// WebApplicationInitializerConfiguration for classic WAR there
|
||||
// is (intentionally) no MariaDB4j nor a DataSourceProperties
|
||||
// bean (because in the WAR we're using a DS from JNDI)
|
||||
private @Autowired(required = false) DataSourceProperties dsp;
|
||||
// required=false is important here, because in
|
||||
// WebApplicationInitializerConfiguration for classic WAR there
|
||||
// is (intentionally) no MariaDB4j nor a DataSourceProperties
|
||||
// bean (because in the WAR we're using a DS from JNDI)
|
||||
private @Autowired(required = false) DataSourceProperties dsp;
|
||||
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public TenantDataSourcePortFixService(@Qualifier("tenantDataSourceJndi") final DataSource dataSource) {
|
||||
@@ -72,25 +72,25 @@ public class TenantDataSourcePortFixService {
|
||||
}
|
||||
|
||||
public void fixUpTenantsSchemaServerPort() {
|
||||
if (!enabled) {
|
||||
logger.info("No schema_server_port UPDATE made to tenant_server_connections table of the mifosplatform-tenants schema, because " + ENABLED + " = false");
|
||||
return;
|
||||
}
|
||||
if (dsp == null) {
|
||||
// we don't have any generic mechanism to know the DB port, given just a tenant DataSource
|
||||
logger.debug("No schema_server_port UPDATE made to tenant_server_connections table of the mifosplatform-tenants schema (because neither MariaDB4j nor our own Spring Boot DataSourceConfiguration is used in a traditional WAR)");
|
||||
return;
|
||||
}
|
||||
int r = jdbcTemplate
|
||||
.update("UPDATE tenant_server_connections SET schema_server = ?, schema_server_port = ?, schema_username = ?, schema_password = ?",
|
||||
dsp.getHost(), dsp.getPort(), dsp.getUsername(), dsp.getPassword());
|
||||
if ( r == 0 )
|
||||
logger.warn("UPDATE tenant_server_connections SET ... did not update ANY rows - something is probably wrong");
|
||||
else
|
||||
logger.info("Upated "
|
||||
+ r
|
||||
+ " rows in the tenant_server_connections table of the mifosplatform-tenants schema to the real current host: "
|
||||
+ dsp.getHost() + ", port: " + dsp.getPort());
|
||||
if (!enabled) {
|
||||
logger.info("No schema_server_port UPDATE made to tenant_server_connections table of the mifosplatform-tenants schema, because " + ENABLED + " = false");
|
||||
return;
|
||||
}
|
||||
if (dsp == null) {
|
||||
// we don't have any generic mechanism to know the DB port, given just a tenant DataSource
|
||||
logger.debug("No schema_server_port UPDATE made to tenant_server_connections table of the mifosplatform-tenants schema (because neither MariaDB4j nor our own Spring Boot DataSourceConfiguration is used in a traditional WAR)");
|
||||
return;
|
||||
}
|
||||
int r = jdbcTemplate
|
||||
.update("UPDATE tenant_server_connections SET schema_server = ?, schema_server_port = ?, schema_username = ?, schema_password = ?",
|
||||
dsp.getHost(), dsp.getPort(), dsp.getUsername(), dsp.getPassword());
|
||||
if ( r == 0 )
|
||||
logger.warn("UPDATE tenant_server_connections SET ... did not update ANY rows - something is probably wrong");
|
||||
else
|
||||
logger.info("Upated "
|
||||
+ r
|
||||
+ " rows in the tenant_server_connections table of the mifosplatform-tenants schema to the real current host: "
|
||||
+ dsp.getHost() + ", port: " + dsp.getPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-16
@@ -173,22 +173,22 @@ public class DataValidatorBuilder {
|
||||
|
||||
public DataValidatorBuilder trueOrFalseRequired(final Object trueOfFalseField)
|
||||
{
|
||||
|
||||
if(trueOfFalseField!=null)
|
||||
{
|
||||
if((!trueOfFalseField.toString().equalsIgnoreCase("true")) && (!trueOfFalseField.toString().equalsIgnoreCase("false")) )
|
||||
{
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".must.be.true.or.false");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
|
||||
" must be set as true or false.");
|
||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
||||
defaultEnglishMessage.toString(), this.parameter);
|
||||
this.dataValidationErrors.add(error);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
if(trueOfFalseField!=null)
|
||||
{
|
||||
if((!trueOfFalseField.toString().equalsIgnoreCase("true")) && (!trueOfFalseField.toString().equalsIgnoreCase("false")) )
|
||||
{
|
||||
final StringBuilder validationErrorCode = new StringBuilder("validation.msg.").append(this.resource).append(".")
|
||||
.append(this.parameter).append(".must.be.true.or.false");
|
||||
final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter ").append(this.parameter).append(
|
||||
" must be set as true or false.");
|
||||
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode.toString(),
|
||||
defaultEnglishMessage.toString(), this.parameter);
|
||||
this.dataValidationErrors.add(error);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DataValidatorBuilder notNull() {
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ public class AbandonedConnectionCleanupShutdownListener implements ApplicationLi
|
||||
|
||||
private void shutDowncleanUpThreadAndDeregisterJDBCDriver() {
|
||||
/*try {
|
||||
|
||||
|
||||
AbandonedConnectionCleanupThread.shutdown(); tomcat memoroy leak with mysql connector. With Drizzle not required
|
||||
logger.info("Shut-down of AbandonedConnectionCleanupThread successful");
|
||||
} catch (Throwable t) {
|
||||
@@ -67,7 +67,7 @@ public class AbandonedConnectionCleanupShutdownListener implements ApplicationLi
|
||||
try {
|
||||
Thread.sleep(2000L);
|
||||
} catch (Exception e) {
|
||||
logger.error("Exception Occcured while trying to sleep.", e);
|
||||
logger.error("Exception Occcured while trying to sleep.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -30,20 +30,20 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GmailBackedPlatformEmailService implements PlatformEmailService {
|
||||
|
||||
private final ExternalServicesPropertiesReadPlatformService externalServicesReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public GmailBackedPlatformEmailService(final ExternalServicesPropertiesReadPlatformService externalServicesReadPlatformService){
|
||||
this.externalServicesReadPlatformService = externalServicesReadPlatformService;
|
||||
}
|
||||
|
||||
private final ExternalServicesPropertiesReadPlatformService externalServicesReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public GmailBackedPlatformEmailService(final ExternalServicesPropertiesReadPlatformService externalServicesReadPlatformService){
|
||||
this.externalServicesReadPlatformService = externalServicesReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToUserAccount(String organisationName, String contactName,
|
||||
String address, String username, String unencodedPassword) {
|
||||
|
||||
final String subject = "Welcome " + contactName + " to " + organisationName;
|
||||
final String body = "You are receiving this email as your email account: " +
|
||||
final String subject = "Welcome " + contactName + " to " + organisationName;
|
||||
final String body = "You are receiving this email as your email account: " +
|
||||
address + " has being used to create a user account for an organisation named [" +
|
||||
organisationName + "] on Mifos.\n" +
|
||||
"You can login using the following credentials:\nusername: " + username + "\n" +
|
||||
@@ -51,8 +51,8 @@ public class GmailBackedPlatformEmailService implements PlatformEmailService {
|
||||
"You must change this password upon first log in using Uppercase, Lowercase, number and character.\n" +
|
||||
"Thank you and welcome to the organisation.";
|
||||
|
||||
final EmailDetail emailDetail = new EmailDetail(subject, body, address, contactName);
|
||||
sendDefinedEmail(emailDetail);
|
||||
final EmailDetail emailDetail = new EmailDetail(subject, body, address, contactName);
|
||||
sendDefinedEmail(emailDetail);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ public final class SearchParameters {
|
||||
return new SearchParameters(sqlSearch, null, externalId, null, null, null, null, offset, maxLimitAllowed, orderBy, sortOrder,
|
||||
staffId, accountNo, loanId, savingsId, orphansOnly, isSelfUser);
|
||||
}
|
||||
|
||||
|
||||
private SearchParameters(final String sqlSearch, final Long officeId, final String externalId, final String name,
|
||||
final String hierarchy, final String firstname, final String lastname, final Integer offset, final Integer limit,
|
||||
final String orderBy, final String sortOrder, final Long staffId, final String accountNo, final Long loanId,
|
||||
|
||||
+11
-11
@@ -47,7 +47,7 @@ import com.googlecode.flyway.core.util.jdbc.DriverDataSource;
|
||||
@Service
|
||||
public class TenantDatabaseUpgradeService {
|
||||
|
||||
private final static Logger LOG = LoggerFactory.getLogger(TenantDatabaseUpgradeService.class);
|
||||
private final static Logger LOG = LoggerFactory.getLogger(TenantDatabaseUpgradeService.class);
|
||||
|
||||
private final TenantDetailsService tenantDetailsService;
|
||||
protected final DataSource tenantDataSource;
|
||||
@@ -92,9 +92,9 @@ public class TenantDatabaseUpgradeService {
|
||||
* itself.
|
||||
*/
|
||||
private void upgradeTenantDB() {
|
||||
String dbHostname = getEnvVar("FINERACT_DEFAULT_TENANTDB_HOSTNAME", "localhost");
|
||||
String dbPort = getEnvVar("FINERACT_DEFAULT_TENANTDB_PORT", "3306");
|
||||
LOG.info("upgradeTenantDB: FINERACT_DEFAULT_TENANTDB_HOSTNAME = {}, FINERACT_DEFAULT_TENANTDB_PORT = {}", dbHostname, dbPort);
|
||||
String dbHostname = getEnvVar("FINERACT_DEFAULT_TENANTDB_HOSTNAME", "localhost");
|
||||
String dbPort = getEnvVar("FINERACT_DEFAULT_TENANTDB_PORT", "3306");
|
||||
LOG.info("upgradeTenantDB: FINERACT_DEFAULT_TENANTDB_HOSTNAME = {}, FINERACT_DEFAULT_TENANTDB_PORT = {}", dbHostname, dbPort);
|
||||
|
||||
final Flyway flyway = new Flyway();
|
||||
flyway.setDataSource(tenantDataSource);
|
||||
@@ -108,11 +108,11 @@ public class TenantDatabaseUpgradeService {
|
||||
tenantDataSourcePortFixService.fixUpTenantsSchemaServerPort();
|
||||
}
|
||||
|
||||
private String getEnvVar(String name, String defaultValue) {
|
||||
String value = System.getenv(name);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
private String getEnvVar(String name, String defaultValue) {
|
||||
String value = System.getenv(name);
|
||||
if (value == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class ThreadLocalContextUtil {
|
||||
}
|
||||
|
||||
public static void setAuthToken(final String authToken) {
|
||||
authTokenContext.set(authToken);
|
||||
authTokenContext.set(authToken);
|
||||
}
|
||||
|
||||
public static String getAuthToken() {
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceSe
|
||||
// http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency
|
||||
|
||||
// see also org.apache.fineract.DataSourceProperties.setDefaults()
|
||||
String jdbcUrl = this.driverConfig.constructProtocol(tenantConnectionObj.getSchemaServer(), tenantConnectionObj.getSchemaServerPort(), tenantConnectionObj.getSchemaName()) ;
|
||||
String jdbcUrl = this.driverConfig.constructProtocol(tenantConnectionObj.getSchemaServer(), tenantConnectionObj.getSchemaServerPort(), tenantConnectionObj.getSchemaName()) ;
|
||||
//final String jdbcUrl = tenantConnectionObj.databaseURL();
|
||||
final PoolConfiguration poolConfiguration = new PoolProperties();
|
||||
poolConfiguration.setDriverClassName(this.driverConfig.getDriverClassName());
|
||||
|
||||
+138
-138
@@ -61,180 +61,180 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
@Api(value = "CreditBureau Configuration")
|
||||
public class CreditBureauConfigurationAPI {
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
|
||||
private final String resourceNameForPermissions = "CreditBureau";
|
||||
private final PlatformSecurityContext context;
|
||||
private final CreditBureauReadPlatformService readPlatformService;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer;
|
||||
private final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct;
|
||||
private final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct;
|
||||
private final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final CreditBureauReadConfigurationService creditBureauConfiguration;
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
|
||||
private final String resourceNameForPermissions = "CreditBureau";
|
||||
private final PlatformSecurityContext context;
|
||||
private final CreditBureauReadPlatformService readPlatformService;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer;
|
||||
private final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct;
|
||||
private final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct;
|
||||
private final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau;
|
||||
private final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final CreditBureauReadConfigurationService creditBureauConfiguration;
|
||||
|
||||
@Autowired
|
||||
public CreditBureauConfigurationAPI(final PlatformSecurityContext context,
|
||||
final CreditBureauReadPlatformService readPlatformService,
|
||||
final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
|
||||
final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
|
||||
final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
|
||||
final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
|
||||
final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
|
||||
final CreditBureauReadConfigurationService creditBureauConfiguration) {
|
||||
this.context = context;
|
||||
this.readPlatformService = readPlatformService;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
|
||||
this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
|
||||
this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
|
||||
this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
|
||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.toApiJsonSerializerReport = toApiJsonSerializerReport;
|
||||
this.creditBureauConfiguration = creditBureauConfiguration;
|
||||
@Autowired
|
||||
public CreditBureauConfigurationAPI(final PlatformSecurityContext context,
|
||||
final CreditBureauReadPlatformService readPlatformService,
|
||||
final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
|
||||
final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
|
||||
final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
|
||||
final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
|
||||
final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
|
||||
final CreditBureauReadConfigurationService creditBureauConfiguration) {
|
||||
this.context = context;
|
||||
this.readPlatformService = readPlatformService;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
|
||||
this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
|
||||
this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
|
||||
this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
|
||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.toApiJsonSerializerReport = toApiJsonSerializerReport;
|
||||
this.creditBureauConfiguration = creditBureauConfiguration;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getCreditBureau(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getCreditBureau(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau();
|
||||
final Collection<CreditBureauData> creditBureau = this.readPlatformService.retrieveCreditBureau();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, creditBureau, this.RESPONSE_DATA_PARAMETERS);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, creditBureau, this.RESPONSE_DATA_PARAMETERS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/mappings")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getCreditBureauLoanProductMapping(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@GET
|
||||
@Path("/mappings")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getCreditBureauLoanProductMapping(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
|
||||
.readCreditBureauLoanProductMapping();
|
||||
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
|
||||
.readCreditBureauLoanProductMapping();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/organisationCreditBureau")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getOrganisationCreditBureau(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
@GET
|
||||
@Path("/organisationCreditBureau")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getOrganisationCreditBureau(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
final Collection<OrganisationCreditBureauData> organisationCreditBureau = this.readPlatformServiceOrganisationCreditBureau
|
||||
.retrieveOrgCreditBureau();
|
||||
final Collection<OrganisationCreditBureauData> organisationCreditBureau = this.readPlatformServiceOrganisationCreditBureau
|
||||
.retrieveOrgCreditBureau();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau,
|
||||
this.RESPONSE_DATA_PARAMETERS);
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerOrganisationCreditBureau.serialize(settings, organisationCreditBureau,
|
||||
this.RESPONSE_DATA_PARAMETERS);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/config/{organisationCreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getConfiguration(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, @Context final UriInfo uriInfo) {
|
||||
@GET
|
||||
@Path("/config/{organisationCreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String getConfiguration(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
final Collection<CreditBureauConfigurationData> configurationData = this.creditBureauConfiguration
|
||||
.readConfigurationByOrganisationCreditBureauId(organisationCreditBureauId);
|
||||
final Collection<CreditBureauConfigurationData> configurationData = this.creditBureauConfiguration
|
||||
.readConfigurationByOrganisationCreditBureauId(organisationCreditBureauId);
|
||||
|
||||
return this.toApiJsonSerializerReport.serialize(configurationData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/loanProduct")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String fetchLoanProducts(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
return this.toApiJsonSerializerReport.serialize(configurationData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/loanProduct")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String fetchLoanProducts(@Context final UriInfo uriInfo) {
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
|
||||
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
|
||||
.fetchLoanProducts();
|
||||
final Collection<CreditBureauLoanProductMappingData> creditBureauLoanProductMapping = this.readPlatformServiceCreditBureauLoanProduct
|
||||
.fetchLoanProducts();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper
|
||||
.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializerCreditBureauLoanProduct.serialize(settings, creditBureauLoanProductMapping, this.RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/organisationCreditBureau")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCreditBureau(final String apiRequestBodyAsJson) {
|
||||
@PUT
|
||||
@Path("/organisationCreditBureau")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCreditBureau(final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureau()
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureau()
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/mappings")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCreditBureauLoanProductMapping(final String apiRequestBodyAsJson) {
|
||||
@PUT
|
||||
@Path("/mappings")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String updateCreditBureauLoanProductMapping(final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureauLoanProductMapping()
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCreditBureauLoanProductMapping()
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/organisationCreditBureau/{organisationCreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String addOrganisationCreditBureau(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) {
|
||||
@POST
|
||||
@Path("/organisationCreditBureau/{organisationCreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String addOrganisationCreditBureau(@PathParam("organisationCreditBureauId") final Long organisationCreditBureauId, final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().addOrganisationCreditBureau(organisationCreditBureauId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().addOrganisationCreditBureau(organisationCreditBureauId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/mappings/{CreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createCreditBureauLoanProductMapping(@PathParam("CreditBureauId") final Long CreditBureauId, final String apiRequestBodyAsJson) {
|
||||
@POST
|
||||
@Path("/mappings/{CreditBureauId}")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public String createCreditBureauLoanProductMapping(@PathParam("CreditBureauId") final Long CreditBureauId, final String apiRequestBodyAsJson) {
|
||||
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(CreditBureauId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createCreditBureauLoanProductMapping(CreditBureauId)
|
||||
.withJson(apiRequestBodyAsJson).build();
|
||||
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
return this.toApiJsonSerializer.serialize(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+33
-33
@@ -19,50 +19,50 @@
|
||||
package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class CreditBureauConfigurationData {
|
||||
private final long creditBureauConfigurationId;
|
||||
private final long creditBureauConfigurationId;
|
||||
|
||||
private final String configurationKey;
|
||||
private final String configurationKey;
|
||||
|
||||
private final String value;
|
||||
private final String value;
|
||||
|
||||
private final long organizationCreditBureauId;
|
||||
private final long organizationCreditBureauId;
|
||||
|
||||
private final String description;
|
||||
private final String description;
|
||||
|
||||
private CreditBureauConfigurationData(final long creditBureauConfigurationId, final String configurationKey,
|
||||
final String value, final long organizationCreditBureauId, final String description) {
|
||||
this.creditBureauConfigurationId = creditBureauConfigurationId;
|
||||
this.configurationKey = configurationKey;
|
||||
this.value = value;
|
||||
this.organizationCreditBureauId = organizationCreditBureauId;
|
||||
this.description = description;
|
||||
private CreditBureauConfigurationData(final long creditBureauConfigurationId, final String configurationKey,
|
||||
final String value, final long organizationCreditBureauId, final String description) {
|
||||
this.creditBureauConfigurationId = creditBureauConfigurationId;
|
||||
this.configurationKey = configurationKey;
|
||||
this.value = value;
|
||||
this.organizationCreditBureauId = organizationCreditBureauId;
|
||||
this.description = description;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static CreditBureauConfigurationData instance(final long creditBureauConfigurationId, final String configurationKey,
|
||||
final String value, final long organizationCreditBureauId, final String description) {
|
||||
return new CreditBureauConfigurationData(creditBureauConfigurationId, configurationKey, value,
|
||||
organizationCreditBureauId, description);
|
||||
}
|
||||
public static CreditBureauConfigurationData instance(final long creditBureauConfigurationId, final String configurationKey,
|
||||
final String value, final long organizationCreditBureauId, final String description) {
|
||||
return new CreditBureauConfigurationData(creditBureauConfigurationId, configurationKey, value,
|
||||
organizationCreditBureauId, description);
|
||||
}
|
||||
|
||||
public long getCreditBureauConfigurationId() {
|
||||
return this.creditBureauConfigurationId;
|
||||
}
|
||||
public long getCreditBureauConfigurationId() {
|
||||
return this.creditBureauConfigurationId;
|
||||
}
|
||||
|
||||
public String getConfigurationKey() {
|
||||
return this.configurationKey;
|
||||
}
|
||||
public String getConfigurationKey() {
|
||||
return this.configurationKey;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public long getOrganizationCreditBureauId() {
|
||||
return this.organizationCreditBureauId;
|
||||
}
|
||||
public long getOrganizationCreditBureauId() {
|
||||
return this.organizationCreditBureauId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+38
-38
@@ -20,58 +20,58 @@ package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class CreditBureauData {
|
||||
|
||||
private final long creditBureauId;
|
||||
private final long creditBureauId;
|
||||
|
||||
private final String creditBureauName;
|
||||
private final String creditBureauName;
|
||||
|
||||
private final String country;
|
||||
private final String country;
|
||||
|
||||
private final String productName;
|
||||
private final String productName;
|
||||
|
||||
private final String creditBureauSummary;
|
||||
private final String creditBureauSummary;
|
||||
|
||||
private final long implementationKey;
|
||||
private final long implementationKey;
|
||||
|
||||
private CreditBureauData(final long creditBureauId, final String creditBureauName, final String country,
|
||||
final String productName, final String creditBureauSummary, final long implementationKey) {
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.country = country;
|
||||
this.productName = productName;
|
||||
this.creditBureauSummary = creditBureauSummary;
|
||||
this.implementationKey = implementationKey;
|
||||
private CreditBureauData(final long creditBureauId, final String creditBureauName, final String country,
|
||||
final String productName, final String creditBureauSummary, final long implementationKey) {
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.country = country;
|
||||
this.productName = productName;
|
||||
this.creditBureauSummary = creditBureauSummary;
|
||||
this.implementationKey = implementationKey;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static CreditBureauData instance(final long creditBureauId, final String creditBureauName,
|
||||
final String country, final String productName, final String creditBureauSummary, final long implementationKey) {
|
||||
public static CreditBureauData instance(final long creditBureauId, final String creditBureauName,
|
||||
final String country, final String productName, final String creditBureauSummary, final long implementationKey) {
|
||||
|
||||
return new CreditBureauData(creditBureauId, creditBureauName, country, productName, creditBureauSummary,
|
||||
implementationKey);
|
||||
}
|
||||
return new CreditBureauData(creditBureauId, creditBureauName, country, productName, creditBureauSummary,
|
||||
implementationKey);
|
||||
}
|
||||
|
||||
public String getCreditBureauSummary() {
|
||||
return this.creditBureauSummary;
|
||||
}
|
||||
public String getCreditBureauSummary() {
|
||||
return this.creditBureauSummary;
|
||||
}
|
||||
|
||||
public long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
public long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return this.productName;
|
||||
}
|
||||
public String getProductName() {
|
||||
return this.productName;
|
||||
}
|
||||
|
||||
public long getImplementationKey() {
|
||||
return this.implementationKey;
|
||||
}
|
||||
public long getImplementationKey() {
|
||||
return this.implementationKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+66
-66
@@ -20,93 +20,93 @@ package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class CreditBureauLoanProductMappingData {
|
||||
|
||||
private final long creditbureauLoanProductMappingId;
|
||||
private final long creditbureauLoanProductMappingId;
|
||||
|
||||
private final long organisationCreditBureauId;
|
||||
private final long organisationCreditBureauId;
|
||||
|
||||
private final String alias;
|
||||
private final String alias;
|
||||
|
||||
private final String creditbureauSummary;
|
||||
private final String creditbureauSummary;
|
||||
|
||||
private final String loanProductName;
|
||||
private final String loanProductName;
|
||||
|
||||
private final long loanProductId;
|
||||
private final long loanProductId;
|
||||
|
||||
private final boolean isCreditCheckMandatory;
|
||||
private final boolean isCreditCheckMandatory;
|
||||
|
||||
private final boolean skipCrediCheckInFailure;
|
||||
private final boolean skipCrediCheckInFailure;
|
||||
|
||||
private final long stalePeriod;
|
||||
private final long stalePeriod;
|
||||
|
||||
private final boolean is_active;
|
||||
private final boolean is_active;
|
||||
|
||||
private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId,
|
||||
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
|
||||
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
|
||||
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
|
||||
this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId;
|
||||
this.organisationCreditBureauId = organisationCreditBureauId;
|
||||
this.alias = alias;
|
||||
this.creditbureauSummary = creditbureauSummary;
|
||||
this.loanProductName = loanProductName;
|
||||
this.loanProductId = loanProductId;
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
this.skipCrediCheckInFailure = skipCrediCheckInFailure;
|
||||
this.stalePeriod = stalePeriod;
|
||||
this.is_active = is_active;
|
||||
}
|
||||
private CreditBureauLoanProductMappingData(final long creditbureauLoanProductMappingId,
|
||||
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
|
||||
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
|
||||
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
|
||||
this.creditbureauLoanProductMappingId = creditbureauLoanProductMappingId;
|
||||
this.organisationCreditBureauId = organisationCreditBureauId;
|
||||
this.alias = alias;
|
||||
this.creditbureauSummary = creditbureauSummary;
|
||||
this.loanProductName = loanProductName;
|
||||
this.loanProductId = loanProductId;
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
this.skipCrediCheckInFailure = skipCrediCheckInFailure;
|
||||
this.stalePeriod = stalePeriod;
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId,
|
||||
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
|
||||
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
|
||||
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
|
||||
return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias,
|
||||
creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure,
|
||||
stalePeriod, is_active);
|
||||
}
|
||||
public static CreditBureauLoanProductMappingData instance(final long creditbureauLoanProductMappingId,
|
||||
final long organisationCreditBureauId, final String alias, final String creditbureauSummary,
|
||||
final String loanProductName, final long loanProductId, final boolean isCreditCheckMandatory,
|
||||
final boolean skipCrediCheckInFailure, final long stalePeriod, final boolean is_active) {
|
||||
return new CreditBureauLoanProductMappingData(creditbureauLoanProductMappingId, organisationCreditBureauId, alias,
|
||||
creditbureauSummary, loanProductName, loanProductId, isCreditCheckMandatory, skipCrediCheckInFailure,
|
||||
stalePeriod, is_active);
|
||||
}
|
||||
|
||||
public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) {
|
||||
return new CreditBureauLoanProductMappingData(0, 0, "", "", loanProductName, loanProductId, false, false, 0, false);
|
||||
}
|
||||
public static CreditBureauLoanProductMappingData instance1(final String loanProductName, final long loanProductId) {
|
||||
return new CreditBureauLoanProductMappingData(0, 0, "", "", loanProductName, loanProductId, false, false, 0, false);
|
||||
}
|
||||
|
||||
public long getCreditbureauLoanProductMappingId() {
|
||||
return this.creditbureauLoanProductMappingId;
|
||||
}
|
||||
public long getCreditbureauLoanProductMappingId() {
|
||||
return this.creditbureauLoanProductMappingId;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
public String getCreditbureauSummary() {
|
||||
return this.creditbureauSummary;
|
||||
}
|
||||
public String getCreditbureauSummary() {
|
||||
return this.creditbureauSummary;
|
||||
}
|
||||
|
||||
public String getLoanProductName() {
|
||||
return this.loanProductName;
|
||||
}
|
||||
public String getLoanProductName() {
|
||||
return this.loanProductName;
|
||||
}
|
||||
|
||||
public long getOrganisationCreditBureauId() {
|
||||
return this.organisationCreditBureauId;
|
||||
}
|
||||
public long getOrganisationCreditBureauId() {
|
||||
return this.organisationCreditBureauId;
|
||||
}
|
||||
|
||||
public long getLoanProductId() {
|
||||
return this.loanProductId;
|
||||
}
|
||||
public long getLoanProductId() {
|
||||
return this.loanProductId;
|
||||
}
|
||||
|
||||
public boolean isCreditCheckMandatory() {
|
||||
return this.isCreditCheckMandatory;
|
||||
}
|
||||
public boolean isCreditCheckMandatory() {
|
||||
return this.isCreditCheckMandatory;
|
||||
}
|
||||
|
||||
public boolean isSkipCrediCheckInFailure() {
|
||||
return this.skipCrediCheckInFailure;
|
||||
}
|
||||
public boolean isSkipCrediCheckInFailure() {
|
||||
return this.skipCrediCheckInFailure;
|
||||
}
|
||||
|
||||
public long getStalePeriod() {
|
||||
return this.stalePeriod;
|
||||
}
|
||||
public long getStalePeriod() {
|
||||
return this.stalePeriod;
|
||||
}
|
||||
|
||||
public boolean isIs_active() {
|
||||
return this.is_active;
|
||||
}
|
||||
public boolean isIs_active() {
|
||||
return this.is_active;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+20
-20
@@ -20,33 +20,33 @@ package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class CreditBureauMasterData {
|
||||
|
||||
private final long creditBureauId;
|
||||
private final long creditBureauId;
|
||||
|
||||
private final String creditBureauName;
|
||||
private final String creditBureauName;
|
||||
|
||||
private final String country;
|
||||
private final String country;
|
||||
|
||||
public static CreditBureauMasterData instance(final Long creditBureauId, final String creditBureauName, final String country) {
|
||||
return new CreditBureauMasterData(creditBureauId, creditBureauName, country);
|
||||
}
|
||||
public static CreditBureauMasterData instance(final Long creditBureauId, final String creditBureauName, final String country) {
|
||||
return new CreditBureauMasterData(creditBureauId, creditBureauName, country);
|
||||
}
|
||||
|
||||
private CreditBureauMasterData(final Long creditBureauId, final String creditBureauName, final String country) {
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.country = country;
|
||||
private CreditBureauMasterData(final Long creditBureauId, final String creditBureauName, final String country) {
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.country = country;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public Long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
public Long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+22
-22
@@ -20,34 +20,34 @@ package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class CreditBureauProduct {
|
||||
|
||||
private final long creditBureauProductId;
|
||||
private final long creditBureauProductId;
|
||||
|
||||
private final String creditBureauProductName;
|
||||
private final String creditBureauProductName;
|
||||
|
||||
private final long creditBureauMasterId;
|
||||
private final long creditBureauMasterId;
|
||||
|
||||
private CreditBureauProduct(final long creditBureauProductId, final String creditBureauProductName,
|
||||
final long creditBureauMasterId) {
|
||||
this.creditBureauProductId = creditBureauProductId;
|
||||
this.creditBureauProductName = creditBureauProductName;
|
||||
this.creditBureauMasterId = creditBureauMasterId;
|
||||
}
|
||||
private CreditBureauProduct(final long creditBureauProductId, final String creditBureauProductName,
|
||||
final long creditBureauMasterId) {
|
||||
this.creditBureauProductId = creditBureauProductId;
|
||||
this.creditBureauProductName = creditBureauProductName;
|
||||
this.creditBureauMasterId = creditBureauMasterId;
|
||||
}
|
||||
|
||||
public static CreditBureauProduct instance(final long creditBureauProductId, final String creditBureauProductName,
|
||||
final long creditBureauMasterId) {
|
||||
return new CreditBureauProduct(creditBureauProductId, creditBureauProductName, creditBureauMasterId);
|
||||
}
|
||||
public static CreditBureauProduct instance(final long creditBureauProductId, final String creditBureauProductName,
|
||||
final long creditBureauMasterId) {
|
||||
return new CreditBureauProduct(creditBureauProductId, creditBureauProductName, creditBureauMasterId);
|
||||
}
|
||||
|
||||
public long getCreditBureauProductId() {
|
||||
return this.creditBureauProductId;
|
||||
}
|
||||
public long getCreditBureauProductId() {
|
||||
return this.creditBureauProductId;
|
||||
}
|
||||
|
||||
public String getCreditBureauProductName() {
|
||||
return this.creditBureauProductName;
|
||||
}
|
||||
public String getCreditBureauProductName() {
|
||||
return this.creditBureauProductName;
|
||||
}
|
||||
|
||||
public long getCreditBureauMasterId() {
|
||||
return this.creditBureauMasterId;
|
||||
}
|
||||
public long getCreditBureauMasterId() {
|
||||
return this.creditBureauMasterId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+50
-50
@@ -20,72 +20,72 @@ package org.apache.fineract.infrastructure.creditbureau.data;
|
||||
|
||||
public class OrganisationCreditBureauData {
|
||||
|
||||
private final long organisationCreditBureauId;
|
||||
private final long organisationCreditBureauId;
|
||||
|
||||
private final String alias;
|
||||
private final String alias;
|
||||
|
||||
private final long creditBureauId;
|
||||
private final long creditBureauId;
|
||||
|
||||
private final String creditBureauName;
|
||||
private final String creditBureauName;
|
||||
|
||||
private final String creditBureauProduct;
|
||||
private final String creditBureauProduct;
|
||||
|
||||
private final String creditBureauCountry;
|
||||
private final String creditBureauCountry;
|
||||
|
||||
private final String creditBureauSummary;
|
||||
private final String creditBureauSummary;
|
||||
|
||||
private final boolean is_active;
|
||||
private final boolean is_active;
|
||||
|
||||
private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias,
|
||||
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
|
||||
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
|
||||
this.organisationCreditBureauId = organisationCreditBureauId;
|
||||
this.alias = alias;
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.creditBureauProduct = creditBureauProduct;
|
||||
this.creditBureauCountry = creditBureauCountry;
|
||||
this.creditBureauSummary = creditBureauSummary;
|
||||
this.is_active = is_active;
|
||||
}
|
||||
private OrganisationCreditBureauData(final long organisationCreditBureauId, final String alias,
|
||||
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
|
||||
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
|
||||
this.organisationCreditBureauId = organisationCreditBureauId;
|
||||
this.alias = alias;
|
||||
this.creditBureauId = creditBureauId;
|
||||
this.creditBureauName = creditBureauName;
|
||||
this.creditBureauProduct = creditBureauProduct;
|
||||
this.creditBureauCountry = creditBureauCountry;
|
||||
this.creditBureauSummary = creditBureauSummary;
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias,
|
||||
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
|
||||
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
|
||||
return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName,
|
||||
creditBureauProduct, creditBureauCountry, creditBureauSummary, is_active);
|
||||
}
|
||||
public static OrganisationCreditBureauData instance(final long organisationCreditBureauId, final String alias,
|
||||
final long creditBureauId, final String creditBureauName, final String creditBureauProduct,
|
||||
final String creditBureauCountry, final String creditBureauSummary, final boolean is_active) {
|
||||
return new OrganisationCreditBureauData(organisationCreditBureauId, alias, creditBureauId, creditBureauName,
|
||||
creditBureauProduct, creditBureauCountry, creditBureauSummary, is_active);
|
||||
}
|
||||
|
||||
public long getOrganisationCreditBureauId() {
|
||||
return this.organisationCreditBureauId;
|
||||
}
|
||||
public long getOrganisationCreditBureauId() {
|
||||
return this.organisationCreditBureauId;
|
||||
}
|
||||
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
public String getCreditBureauName() {
|
||||
return this.creditBureauName;
|
||||
}
|
||||
|
||||
public String getCreditBureauProduct() {
|
||||
return this.creditBureauProduct;
|
||||
}
|
||||
public String getCreditBureauProduct() {
|
||||
return this.creditBureauProduct;
|
||||
}
|
||||
|
||||
public String getCreditBureauCountry() {
|
||||
return this.creditBureauCountry;
|
||||
}
|
||||
public String getCreditBureauCountry() {
|
||||
return this.creditBureauCountry;
|
||||
}
|
||||
|
||||
public String getCreditBureauSummary() {
|
||||
return this.creditBureauSummary;
|
||||
}
|
||||
public String getCreditBureauSummary() {
|
||||
return this.creditBureauSummary;
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
public long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
public long getCreditBureauId() {
|
||||
return this.creditBureauId;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.is_active;
|
||||
}
|
||||
public boolean isActive() {
|
||||
return this.is_active;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+53
-53
@@ -34,79 +34,79 @@ import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
public class CreditBureau extends AbstractPersistableCustom<Long> {
|
||||
|
||||
|
||||
private String name;
|
||||
private String name;
|
||||
|
||||
private String product;
|
||||
private String product;
|
||||
|
||||
private String country;
|
||||
private String country;
|
||||
|
||||
private String implementationKey;
|
||||
private String implementationKey;
|
||||
|
||||
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
|
||||
private List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping = new ArrayList<>();
|
||||
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
|
||||
private List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping = new ArrayList<>();
|
||||
|
||||
public CreditBureau(String name, String product, String country, String implementationKey,
|
||||
List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
|
||||
this.name = name;
|
||||
this.product = product;
|
||||
this.country = country;
|
||||
this.implementationKey = implementationKey;
|
||||
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
|
||||
}
|
||||
public CreditBureau(String name, String product, String country, String implementationKey,
|
||||
List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
|
||||
this.name = name;
|
||||
this.product = product;
|
||||
this.country = country;
|
||||
this.implementationKey = implementationKey;
|
||||
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
public CreditBureau() {
|
||||
public CreditBureau() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static CreditBureau fromJson(final JsonCommand command) {
|
||||
public static CreditBureau fromJson(final JsonCommand command) {
|
||||
|
||||
final String tname = command.stringValueOfParameterNamed("name");
|
||||
final String tproduct = command.stringValueOfParameterNamed("product");
|
||||
final String tcountry = command.stringValueOfParameterNamed("country");
|
||||
final String timplementationKey = command.stringValueOfParameterNamed("implementationKey");
|
||||
final String tname = command.stringValueOfParameterNamed("name");
|
||||
final String tproduct = command.stringValueOfParameterNamed("product");
|
||||
final String tcountry = command.stringValueOfParameterNamed("country");
|
||||
final String timplementationKey = command.stringValueOfParameterNamed("implementationKey");
|
||||
|
||||
return new CreditBureau(tname, tproduct, tcountry, timplementationKey, null);
|
||||
return new CreditBureau(tname, tproduct, tcountry, timplementationKey, null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProduct() {
|
||||
return this.product;
|
||||
}
|
||||
public String getProduct() {
|
||||
return this.product;
|
||||
}
|
||||
|
||||
public void setProduct(String product) {
|
||||
this.product = product;
|
||||
}
|
||||
public void setProduct(String product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getImplementationKey() {
|
||||
return this.implementationKey;
|
||||
}
|
||||
public String getImplementationKey() {
|
||||
return this.implementationKey;
|
||||
}
|
||||
|
||||
public void setImplementationKey(String implementationKey) {
|
||||
this.implementationKey = implementationKey;
|
||||
}
|
||||
public void setImplementationKey(String implementationKey) {
|
||||
this.implementationKey = implementationKey;
|
||||
}
|
||||
|
||||
public List<CreditBureauLoanProductMapping> getCreditBureauLpMapping() {
|
||||
return this.CreditBureauLoanProductMapping;
|
||||
}
|
||||
public List<CreditBureauLoanProductMapping> getCreditBureauLpMapping() {
|
||||
return this.CreditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
public void setCreditBureauLpMapping(List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
|
||||
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
|
||||
}
|
||||
public void setCreditBureauLpMapping(List<CreditBureauLoanProductMapping> CreditBureauLoanProductMapping) {
|
||||
this.CreditBureauLoanProductMapping = CreditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+48
-48
@@ -31,71 +31,71 @@ import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@Entity
|
||||
@Table(name = "m_creditbureau_configuration")
|
||||
public class CreditBureauConfiguration extends AbstractPersistableCustom<Long> {
|
||||
@Column(name = "configkey")
|
||||
private String configurationKey;
|
||||
@Column(name = "configkey")
|
||||
private String configurationKey;
|
||||
|
||||
@Column(name = "value")
|
||||
private String value;
|
||||
@Column(name = "value")
|
||||
private String value;
|
||||
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "organisation_creditbureau_id")
|
||||
private OrganisationCreditBureau organisationCreditbureau;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "organisation_creditbureau_id")
|
||||
private OrganisationCreditBureau organisationCreditbureau;
|
||||
|
||||
public CreditBureauConfiguration() {
|
||||
public CreditBureauConfiguration() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public CreditBureauConfiguration(String configkey, String value, String description,
|
||||
OrganisationCreditBureau organisationCreditbureau) {
|
||||
this.configurationKey = configkey;
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
this.organisationCreditbureau = organisationCreditbureau;
|
||||
public CreditBureauConfiguration(String configkey, String value, String description,
|
||||
OrganisationCreditBureau organisationCreditbureau) {
|
||||
this.configurationKey = configkey;
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
this.organisationCreditbureau = organisationCreditbureau;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public CreditBureauConfiguration fromJson(JsonCommand command, OrganisationCreditBureau organisation_creditbureau) {
|
||||
final String configkey = command.stringValueOfParameterNamed("configkey");
|
||||
final String value = command.stringValueOfParameterNamed("value");
|
||||
final String description = command.stringValueOfParameterNamed("description");
|
||||
public CreditBureauConfiguration fromJson(JsonCommand command, OrganisationCreditBureau organisation_creditbureau) {
|
||||
final String configkey = command.stringValueOfParameterNamed("configkey");
|
||||
final String value = command.stringValueOfParameterNamed("value");
|
||||
final String description = command.stringValueOfParameterNamed("description");
|
||||
|
||||
return new CreditBureauConfiguration(configkey, value, description, organisation_creditbureau);
|
||||
return new CreditBureauConfiguration(configkey, value, description, organisation_creditbureau);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String getConfigkey() {
|
||||
return this.configurationKey;
|
||||
}
|
||||
public String getConfigkey() {
|
||||
return this.configurationKey;
|
||||
}
|
||||
|
||||
public void setConfigkey(String configkey) {
|
||||
this.configurationKey = configkey;
|
||||
}
|
||||
public void setConfigkey(String configkey) {
|
||||
this.configurationKey = configkey;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public OrganisationCreditBureau getOrganisation_creditbureau() {
|
||||
return this.organisationCreditbureau;
|
||||
}
|
||||
public OrganisationCreditBureau getOrganisation_creditbureau() {
|
||||
return this.organisationCreditbureau;
|
||||
}
|
||||
|
||||
public void setOrganisation_creditbureau(OrganisationCreditBureau organisation_creditbureau) {
|
||||
this.organisationCreditbureau = organisation_creditbureau;
|
||||
}
|
||||
public void setOrganisation_creditbureau(OrganisationCreditBureau organisation_creditbureau) {
|
||||
this.organisationCreditbureau = organisation_creditbureau;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+93
-93
@@ -32,119 +32,119 @@ import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@Entity
|
||||
@Table(name = "m_creditbureau_loanproduct_mapping")
|
||||
public class CreditBureauLoanProductMapping extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@Column(name = "is_CreditCheck_Mandatory")
|
||||
private boolean isCreditCheckMandatory;
|
||||
|
||||
@Column(name = "skip_CreditCheck_in_Failure")
|
||||
private boolean skipCreditCheckInFailure;
|
||||
|
||||
@Column(name = "stale_Period")
|
||||
private int stalePeriod;
|
||||
|
||||
@Column(name = "is_CreditCheck_Mandatory")
|
||||
private boolean isCreditCheckMandatory;
|
||||
|
||||
@Column(name = "skip_CreditCheck_in_Failure")
|
||||
private boolean skipCreditCheckInFailure;
|
||||
|
||||
@Column(name = "stale_Period")
|
||||
private int stalePeriod;
|
||||
|
||||
private boolean is_active;
|
||||
private boolean is_active;
|
||||
|
||||
@ManyToOne
|
||||
private OrganisationCreditBureau organisation_creditbureau;
|
||||
@ManyToOne
|
||||
private OrganisationCreditBureau organisation_creditbureau;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name="loan_product_id")
|
||||
private LoanProduct loanProduct;
|
||||
|
||||
public CreditBureauLoanProductMapping() {
|
||||
@OneToOne
|
||||
@JoinColumn(name="loan_product_id")
|
||||
private LoanProduct loanProduct;
|
||||
|
||||
public CreditBureauLoanProductMapping() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public CreditBureauLoanProductMapping(boolean isCreditCheckMandatory, boolean skipCreditCheckInFailure, int stalePeriod,
|
||||
boolean is_active, OrganisationCreditBureau organisationCreditbureau, LoanProduct loanProduct) {
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
|
||||
this.stalePeriod = stalePeriod;
|
||||
this.is_active = is_active;
|
||||
this.organisation_creditbureau = organisationCreditbureau;
|
||||
this.loanProduct = loanProduct;
|
||||
}
|
||||
public CreditBureauLoanProductMapping(boolean isCreditCheckMandatory, boolean skipCreditCheckInFailure, int stalePeriod,
|
||||
boolean is_active, OrganisationCreditBureau organisationCreditbureau, LoanProduct loanProduct) {
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
|
||||
this.stalePeriod = stalePeriod;
|
||||
this.is_active = is_active;
|
||||
this.organisation_creditbureau = organisationCreditbureau;
|
||||
this.loanProduct = loanProduct;
|
||||
}
|
||||
|
||||
public static CreditBureauLoanProductMapping fromJson(final JsonCommand command,
|
||||
OrganisationCreditBureau organisation_creditbureau, LoanProduct loanProduct) {
|
||||
Boolean isCreditCheckMandatory=false;
|
||||
Boolean skipCreditCheckInFailure=false;
|
||||
Integer stalePeriod=-1;
|
||||
Boolean is_active=false;
|
||||
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory")!=null)
|
||||
{
|
||||
isCreditCheckMandatory = command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory");
|
||||
}
|
||||
|
||||
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure")!=null)
|
||||
{
|
||||
skipCreditCheckInFailure = command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure");
|
||||
}
|
||||
|
||||
if((Integer)command.integerValueOfParameterNamed("stalePeriod")!=null)
|
||||
{
|
||||
stalePeriod = command.integerValueOfParameterNamed("stalePeriod");
|
||||
}
|
||||
|
||||
if((Boolean) command.booleanPrimitiveValueOfParameterNamed("is_active"))
|
||||
{
|
||||
is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
|
||||
}
|
||||
|
||||
public static CreditBureauLoanProductMapping fromJson(final JsonCommand command,
|
||||
OrganisationCreditBureau organisation_creditbureau, LoanProduct loanProduct) {
|
||||
Boolean isCreditCheckMandatory=false;
|
||||
Boolean skipCreditCheckInFailure=false;
|
||||
Integer stalePeriod=-1;
|
||||
Boolean is_active=false;
|
||||
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory")!=null)
|
||||
{
|
||||
isCreditCheckMandatory = command.booleanPrimitiveValueOfParameterNamed("isCreditcheckMandatory");
|
||||
}
|
||||
|
||||
if((Boolean)command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure")!=null)
|
||||
{
|
||||
skipCreditCheckInFailure = command.booleanPrimitiveValueOfParameterNamed("skipCreditcheckInFailure");
|
||||
}
|
||||
|
||||
if((Integer)command.integerValueOfParameterNamed("stalePeriod")!=null)
|
||||
{
|
||||
stalePeriod = command.integerValueOfParameterNamed("stalePeriod");
|
||||
}
|
||||
|
||||
if((Boolean) command.booleanPrimitiveValueOfParameterNamed("is_active"))
|
||||
{
|
||||
is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
|
||||
}
|
||||
|
||||
|
||||
return new CreditBureauLoanProductMapping(isCreditCheckMandatory, skipCreditCheckInFailure, stalePeriod, is_active,
|
||||
organisation_creditbureau, loanProduct);
|
||||
return new CreditBureauLoanProductMapping(isCreditCheckMandatory, skipCreditCheckInFailure, stalePeriod, is_active,
|
||||
organisation_creditbureau, loanProduct);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCreditCheckMandatory() {
|
||||
return this.isCreditCheckMandatory;
|
||||
}
|
||||
public boolean isCreditCheckMandatory() {
|
||||
return this.isCreditCheckMandatory;
|
||||
}
|
||||
|
||||
public void setCreditCheckMandatory(boolean isCreditCheckMandatory) {
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
}
|
||||
public void setCreditCheckMandatory(boolean isCreditCheckMandatory) {
|
||||
this.isCreditCheckMandatory = isCreditCheckMandatory;
|
||||
}
|
||||
|
||||
public boolean isSkipCreditCheckInFailure() {
|
||||
return this.skipCreditCheckInFailure;
|
||||
}
|
||||
public boolean isSkipCreditCheckInFailure() {
|
||||
return this.skipCreditCheckInFailure;
|
||||
}
|
||||
|
||||
public void setSkipCreditCheckInFailure(boolean skipCreditCheckInFailure) {
|
||||
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
|
||||
}
|
||||
public void setSkipCreditCheckInFailure(boolean skipCreditCheckInFailure) {
|
||||
this.skipCreditCheckInFailure = skipCreditCheckInFailure;
|
||||
}
|
||||
|
||||
public int getStalePeriod() {
|
||||
return this.stalePeriod;
|
||||
}
|
||||
public int getStalePeriod() {
|
||||
return this.stalePeriod;
|
||||
}
|
||||
|
||||
public void setStalePeriod(int stalePeriod) {
|
||||
this.stalePeriod = stalePeriod;
|
||||
}
|
||||
public void setStalePeriod(int stalePeriod) {
|
||||
this.stalePeriod = stalePeriod;
|
||||
}
|
||||
|
||||
public boolean isIs_active() {
|
||||
return this.is_active;
|
||||
}
|
||||
public boolean isIs_active() {
|
||||
return this.is_active;
|
||||
}
|
||||
|
||||
public void setIs_active(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
public void setIs_active(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public OrganisationCreditBureau getOrganisationCreditbureau() {
|
||||
return this.organisation_creditbureau;
|
||||
}
|
||||
public OrganisationCreditBureau getOrganisationCreditbureau() {
|
||||
return this.organisation_creditbureau;
|
||||
}
|
||||
|
||||
public void setOrganisationCreditbureau(OrganisationCreditBureau organisationCreditbureau) {
|
||||
this.organisation_creditbureau = organisationCreditbureau;
|
||||
}
|
||||
public void setOrganisationCreditbureau(OrganisationCreditBureau organisationCreditbureau) {
|
||||
this.organisation_creditbureau = organisationCreditbureau;
|
||||
}
|
||||
|
||||
public LoanProduct getLoanProduct() {
|
||||
return this.loanProduct;
|
||||
}
|
||||
public LoanProduct getLoanProduct() {
|
||||
return this.loanProduct;
|
||||
}
|
||||
|
||||
public void setLoanProduct(LoanProduct loanProduct) {
|
||||
this.loanProduct = loanProduct;
|
||||
}
|
||||
public void setLoanProduct(LoanProduct loanProduct) {
|
||||
this.loanProduct = loanProduct;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface CreditBureauLoanProductMappingRepository
|
||||
extends JpaRepository<CreditBureauLoanProductMapping, Long>, JpaSpecificationExecutor<CreditBureauLoanProductMapping> {
|
||||
extends JpaRepository<CreditBureauLoanProductMapping, Long>, JpaSpecificationExecutor<CreditBureauLoanProductMapping> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
public interface CreditBureauRepository
|
||||
extends JpaRepository<CreditBureau, Long>, JpaSpecificationExecutor<CreditBureau> {
|
||||
extends JpaRepository<CreditBureau, Long>, JpaSpecificationExecutor<CreditBureau> {
|
||||
|
||||
// CreditBureau findOne(long id);
|
||||
// CreditBureau findOne(long id);
|
||||
|
||||
}
|
||||
|
||||
+45
-45
@@ -34,67 +34,67 @@ import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@Table(name = "m_organisation_creditbureau")
|
||||
public class OrganisationCreditBureau extends AbstractPersistableCustom<Long> {
|
||||
|
||||
private String alias;
|
||||
private String alias;
|
||||
|
||||
@OneToOne
|
||||
private CreditBureau creditbureau;
|
||||
@OneToOne
|
||||
private CreditBureau creditbureau;
|
||||
|
||||
private boolean is_active;
|
||||
private boolean is_active;
|
||||
|
||||
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
|
||||
private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>();
|
||||
@OneToMany(mappedBy = "organisation_creditbureau", cascade = CascadeType.ALL)
|
||||
private List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping = new ArrayList<>();
|
||||
|
||||
public OrganisationCreditBureau(String alias, CreditBureau creditBureau, boolean is_active,
|
||||
List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
|
||||
this.alias = alias;
|
||||
this.creditbureau = creditBureau;
|
||||
this.is_active = is_active;
|
||||
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
|
||||
}
|
||||
public OrganisationCreditBureau(String alias, CreditBureau creditBureau, boolean is_active,
|
||||
List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
|
||||
this.alias = alias;
|
||||
this.creditbureau = creditBureau;
|
||||
this.is_active = is_active;
|
||||
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
public OrganisationCreditBureau() {
|
||||
public OrganisationCreditBureau() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditBureau) {
|
||||
final String alias = command.stringValueOfParameterNamed("alias");
|
||||
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
|
||||
public static OrganisationCreditBureau fromJson(final JsonCommand command, CreditBureau creditBureau) {
|
||||
final String alias = command.stringValueOfParameterNamed("alias");
|
||||
final boolean is_active = command.booleanPrimitiveValueOfParameterNamed("is_active");
|
||||
|
||||
return new OrganisationCreditBureau(alias, creditBureau, is_active, null);
|
||||
}
|
||||
return new OrganisationCreditBureau(alias, creditBureau, is_active, null);
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
public String getAlias() {
|
||||
return this.alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public CreditBureau getCreditBureau() {
|
||||
return this.creditbureau;
|
||||
}
|
||||
public CreditBureau getCreditBureau() {
|
||||
return this.creditbureau;
|
||||
}
|
||||
|
||||
public void setCreditBureau(CreditBureau creditBureau) {
|
||||
this.creditbureau = creditBureau;
|
||||
}
|
||||
public void setCreditBureau(CreditBureau creditBureau) {
|
||||
this.creditbureau = creditBureau;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.is_active;
|
||||
}
|
||||
public boolean isActive() {
|
||||
return this.is_active;
|
||||
}
|
||||
|
||||
public void setIsActive(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
public void setIsActive(boolean is_active) {
|
||||
this.is_active = is_active;
|
||||
}
|
||||
|
||||
public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() {
|
||||
return this.creditBureauLoanProductMapping;
|
||||
}
|
||||
public List<CreditBureauLoanProductMapping> getCreditBureauLoanProductMapping() {
|
||||
return this.creditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
public void setCreditBureauLoanProductMapping(List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
|
||||
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
|
||||
}
|
||||
public void setCreditBureauLoanProductMapping(List<CreditBureauLoanProductMapping> creditBureauLoanProductMapping) {
|
||||
this.creditBureauLoanProductMapping = creditBureauLoanProductMapping;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user