use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class LoginServiceFacadeWebTier method login.
@Override
public LoginDto login(String username, String password) {
PersonnelBO user = this.personnelDao.findPersonnelByUsername(username);
if (user == null) {
throw new UsernameNotFoundException(LoginConstants.KEYINVALIDUSER);
}
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
List<ValueListElement> localeList = personnelServiceFacade.getDisplayLocaleList();
Locale preferredLocale = new Locale(configMgr.getString(LANGUAGE_CODE), configMgr.getString(COUNTRY_CODE));
String listElement = "[" + preferredLocale.toString() + "]";
Short localeId = user.getPreferredLocale();
for (ValueListElement element : localeList) {
if (element.getName().contains(listElement)) {
localeId = element.getId().shortValue();
break;
}
}
user.setPreferredLocale(localeId);
UserContext userContext = new UserContext();
userContext.setPreferredLocale(preferredLocale);
userContext.setLocaleId(localeId);
userContext.setId(user.getPersonnelId());
userContext.setName(user.getDisplayName());
userContext.setLevel(user.getLevelEnum());
userContext.setRoles(user.getRoles());
userContext.setLastLogin(user.getLastLogin());
userContext.setPasswordChanged(user.getPasswordChanged());
userContext.setBranchId(user.getOffice().getOfficeId());
userContext.setBranchGlobalNum(user.getOffice().getGlobalOfficeNum());
userContext.setOfficeLevelId(user.getOffice().getLevel().getId());
user.updateDetails(userContext);
try {
this.transactionHelper.startTransaction();
this.transactionHelper.beginAuditLoggingFor(user);
user.login(password);
this.personnelDao.save(user);
this.transactionHelper.commitTransaction();
boolean isPasswordExpired = new LocalDate(user.getPasswordExpirationDate()).isBefore(new LocalDate());
return new LoginDto(user.getPersonnelId(), user.getOffice().getOfficeId(), user.isPasswordChanged(), isPasswordExpired);
} catch (ApplicationException e) {
this.transactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} catch (Exception e) {
this.transactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
this.transactionHelper.closeSession();
}
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class StandardTestingService method setImport.
@Override
public void setImport(String importParamName, String importParamValue) throws MifosException {
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
if (importParamValue == null || importParamValue.equals("")) {
configMgr.clearProperty(importParamName);
return;
}
configMgr.setProperty(importParamName, importParamValue);
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ViewOrganizationSettingsServiceFacadeWebTier method getConfigurationContent.
private Properties getConfigurationContent() {
Properties configContent = new Properties();
MifosConfigurationManager configuration = MifosConfigurationManager.getInstance();
String branchMangerRoleName = configuration.getString("RolesAndPermissions.BranchManager.RoleName");
configContent.put("branchManagerRoleName", branchMangerRoleName);
return configContent;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class ViewOrganizationSettingsServiceFacadeWebTier method getMpesa.
private Properties getMpesa() {
Properties configContent = new Properties();
MifosConfigurationManager configuration = MifosConfigurationManager.getInstance();
String disbursalMax = configuration.getString("MPESA.DisbursalMax");
configContent.put("disbursalMax", disbursalMax);
return configContent;
}
use of org.mifos.config.business.MifosConfigurationManager in project head by mifos.
the class AccountingRules method getInitialRoundOffMultiple.
public static BigDecimal getInitialRoundOffMultiple() {
MifosConfigurationManager configMgr = MifosConfigurationManager.getInstance();
String modeStr = configMgr.getString(AccountingRulesConstants.INITIAL_ROUND_OFF_MULTIPLE);
return getRoundOffMultipleFromString(modeStr, DEFAULT_INITIAL_ROUNDOFF_MULTIPLE);
}
Aggregations