use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.
the class PasswordRules method getPasswordHistoryCountFromConfig.
private static int getPasswordHistoryCountFromConfig() throws ConfigurationException {
int passwordHistoryCount = 6;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(PASSWORD_HISTORY_COUNT)) {
passwordHistoryCount = Integer.parseInt(configMgr.getString(PASSWORD_HISTORY_COUNT));
}
if (passwordHistoryCount < 1 || passwordHistoryCount > 20) {
throw new ConfigurationException("The PasswordRules.PasswordHistoryCount defined in the " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME + " must be a number between 0 and 20.");
}
return passwordHistoryCount;
}
use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.
the class PasswordRules method getMinPasswordLengthFromConfig.
private static int getMinPasswordLengthFromConfig() throws ConfigurationException {
int minPasswordLength = 6;
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (configMgr.containsKey(MIN_PASSWORD_LENGTH)) {
minPasswordLength = Integer.parseInt(configMgr.getString(MIN_PASSWORD_LENGTH));
}
if (minPasswordLength < 3 || minPasswordLength > 20) {
throw new ConfigurationException("The PasswordRules.MinPasswordLength defined in the " + MifosConfigurationManager.DEFAULT_CONFIG_PROPS_FILENAME + " must be a number between 3 and 20.");
}
return minPasswordLength;
}
use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.
the class ProcessFlowRules method initLoanPendingApprovalState.
private static void initLoanPendingApprovalState() throws ConfigurationException {
LegacyAccountDao ap = ApplicationContextProvider.getBean(LegacyAccountDao.class);
AccountStateEntity ase = ap.loadPersistentObject(AccountStateEntity.class, AccountState.LOAN_PENDING_APPROVAL.getValue());
boolean fromDb = isLoanPendingApprovalStateEnabledOnDatabaseConfig(ase);
boolean fromCfg = isLoanPendingApprovalStateEnabled();
if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
int count = ApplicationContextProvider.getBean(LegacyLoanDao.class).countOfLoanAccounts();
if (count > 0) {
String errMsg = getBadOverrideMsg(LOAN_PENDING_APPROVAL, "Records for loans in the 'pending approval' state" + " may already exist.");
throw new ConfigurationException(errMsg);
}
makeDatabaseConfigurationMatchPropertiesFileConfiguration(ap, ase, fromCfg);
}
}
use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrievePossibleGuarantors.
public List<CustomerSearchResultDto> retrievePossibleGuarantors(CustomerSearchDto customerSearchDto, boolean isNewGLIMCreation, Integer clientId, Integer loanId) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
try {
List<CustomerSearchResultDto> pagedDetails = new ArrayList<CustomerSearchResultDto>();
QueryResult customerForSavings = customerPersistence.searchGroupClient(customerSearchDto.getSearchTerm(), userContext.getId(), isNewGLIMCreation);
int position = (customerSearchDto.getPage() - 1) * customerSearchDto.getPageSize();
List<AccountSearchResultsDto> pagedResults = customerForSavings.get(position, customerSearchDto.getPageSize());
int i = 1;
for (AccountSearchResultsDto customerBO : pagedResults) {
if (CustomerLevel.getLevel(customerBO.getLevelId()) == CustomerLevel.CLIENT && customerBO.getClientId() != clientId && isApplicableForGuaranty(customerBO, loanId)) {
CustomerSearchResultDto customer = new CustomerSearchResultDto();
customer.setCustomerId(customerBO.getClientId());
customer.setBranchName(customerBO.getOfficeName());
customer.setGlobalId(customerBO.getGlobelNo());
customer.setSearchIndex(i);
customer.setCenterName(StringUtils.defaultIfEmpty(customerBO.getCenterName(), "--"));
customer.setGroupName(StringUtils.defaultIfEmpty(customerBO.getGroupName(), "--"));
customer.setClientName(customerBO.getClientName());
pagedDetails.add(customer);
}
i++;
}
return pagedDetails;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
} catch (HibernateSearchException e) {
throw new MifosRuntimeException(e);
} catch (ConfigurationException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.config.exceptions.ConfigurationException in project head by mifos.
the class MessageLookup method lookup.
public String lookup(String lookupKey) {
String msg;
try {
String textMessage = getLabel(lookupKey);
// we should return the default message from the properties file
if (StringUtils.isEmpty(textMessage)) {
Locale locale = personnelServiceFacade.getUserPreferredLocale();
msg = replaceSubstitutions(messageSource.getMessage(lookupKey, null, lookupKey, locale));
} else {
msg = replaceSubstitutions(textMessage);
}
} catch (ConfigurationException e) {
throw new RuntimeException(e);
}
return msg;
}
Aggregations