use of org.mifos.customers.api.CustomerLevel in project head by mifos.
the class CheckListServiceFacadeWebTier method createCustomerChecklist.
@Override
public void createCustomerChecklist(Short levelId, Short stateId, String checklistName, List<String> checklistDetails) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
CustomerLevel level = CustomerLevel.getLevel(levelId);
CustomerLevelEntity customerLevelEntity = new CustomerLevelEntity(level);
CustomerStatusEntity customerStatusEntity = new CustomerStatusEntity(stateId);
try {
hibernateTransactionHelper.startTransaction();
CustomerCheckListBO customerCheckListBO = new CustomerCheckListBO(customerLevelEntity, customerStatusEntity, checklistName, CheckListConstants.STATUS_ACTIVE, checklistDetails, userContext.getLocaleId(), userContext.getId());
customerDao.save(customerCheckListBO);
hibernateTransactionHelper.commitTransaction();
} catch (CheckListException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
use of org.mifos.customers.api.CustomerLevel in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveCustomerStatusDetails.
@Override
public CustomerStatusDetailDto retrieveCustomerStatusDetails(Short newStatusId, Short flagIdValue, Short customerLevelId) {
CustomerLevel customerLevel = CustomerLevel.getLevel(customerLevelId);
CustomerStatus customerStatus = CustomerStatus.fromInt(newStatusId);
CustomerStatusFlag statusFlag = null;
if (customerStatus.isCustomerCancelledOrClosed()) {
statusFlag = CustomerStatusFlag.getStatusFlag(flagIdValue);
}
String statusName = AccountStateMachines.getInstance().getCustomerStatusName(customerStatus, customerLevel);
String flagName = AccountStateMachines.getInstance().getCustomerFlagName(statusFlag, customerLevel);
return new CustomerStatusDetailDto(statusName, flagName);
}
use of org.mifos.customers.api.CustomerLevel in project head by mifos.
the class CustomerSearchServiceFacadeWebTier method getAvailibleCustomerStates.
@Override
public Map<String, ArrayList<CustomerStatusDetailDto>> getAvailibleCustomerStates() throws PersistenceException {
HashMap<String, ArrayList<CustomerStatusDetailDto>> customerStates = new HashMap<String, ArrayList<CustomerStatusDetailDto>>();
for (CustomerLevel customerLevel : CustomerLevel.values()) {
List<CustomerStatusEntity> states = new CustomerPersistence().retrieveAllCustomerStatusList(customerLevel.getValue());
ArrayList<CustomerStatusDetailDto> statesDtos = new ArrayList<CustomerStatusDetailDto>();
for (CustomerStatusEntity customerStatusEntity : states) {
CustomerStatusDetailDto customerStatusDetailDto = new CustomerStatusDetailDto(customerStatusEntity.getId().toString(), customerStatusEntity.getName(), null);
statesDtos.add(customerStatusDetailDto);
}
customerStates.put(customerLevel.toString(), statesDtos);
}
return customerStates;
}
use of org.mifos.customers.api.CustomerLevel in project head by mifos.
the class AccountStateMachines method initializeLoanStates.
public void initializeLoanStates() throws StatesInitializationException {
AccountTypes accountType = AccountTypes.LOAN_ACCOUNT;
CustomerLevel level = null;
String configName = getConfigurationName(accountType, level);
try {
statesMapForLoan = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_LOAN, configName);
accountStateEntityListForLoan = retrieveAllAccountStateList(accountType);
removeLoanReversalFlagForCancelState();
populateLoanStatesViewMap();
} catch (Exception e) {
throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
}
}
use of org.mifos.customers.api.CustomerLevel in project head by mifos.
the class AccountStateMachines method initializeSavingsStates.
public void initializeSavingsStates() throws StatesInitializationException {
AccountTypes accountType = AccountTypes.SAVINGS_ACCOUNT;
CustomerLevel level = null;
String configName = getConfigurationName(accountType, level);
try {
statesMapForSavings = loadMap(AccountStates.TRANSITION_CONFIG_FILE_PATH_SAVINGS, configName);
accountStateEntityListForSavings = retrieveAllAccountStateList(accountType);
populateSavingsStatesViewMap();
} catch (Exception e) {
throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
}
}
Aggregations