use of org.mifos.customers.business.CustomerStatusEntity 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.business.CustomerStatusEntity in project head by mifos.
the class ApplicationConfigurationDaoHibernate method findAllCustomerStatuses.
@SuppressWarnings("unchecked")
@Override
public List<CustomerStatusEntity> findAllCustomerStatuses() {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("LEVEL_ID", CustomerLevel.CLIENT.getValue());
List<CustomerStatusEntity> queryResult = (List<CustomerStatusEntity>) this.genericDao.executeNamedQuery(NamedQueryConstants.GET_CUSTOMER_STATUS_LIST, queryParameters);
for (CustomerStatusEntity customerStatus : queryResult) {
for (CustomerStatusFlagEntity customerStatusFlagEntity : customerStatus.getFlagSet()) {
Hibernate.initialize(customerStatusFlagEntity);
Hibernate.initialize(customerStatusFlagEntity.getNames());
}
Hibernate.initialize(customerStatus.getLookUpValue());
}
return queryResult;
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class AccountStateMachines method retrieveNextPossibleCustomerStateForCenter.
private List<CustomerStatusEntity> retrieveNextPossibleCustomerStateForCenter(StateEntity customerStateEntityObj) throws ApplicationException {
logger.debug("In AccountStateMachines::retrieveNextPossibleCustomerStateForCenter()");
List<CustomerStatusEntity> stateEntityList = new ArrayList<CustomerStatusEntity>();
try {
List<StateEntity> stateList = statesMapForCenter.get(customerStateEntityObj);
if (null != stateList) {
for (StateEntity customerStateEntity : stateList) {
for (CustomerStatusEntity customerStatusEntry : customerStatusListForCenter) {
if (customerStatusEntry.sameId(customerStateEntity)) {
stateEntityList.add(customerStatusEntry);
break;
}
}
}
}
return stateEntityList;
} catch (Exception e) {
throw new StatesInitializationException(SavingsConstants.STATEINITIALIZATION_EXCEPTION, e);
}
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CustomerServiceImpl method transferGroupTo.
@Override
public final String transferGroupTo(GroupBO group, OfficeBO transferToOffice) throws CustomerException {
group.validateNewOffice(transferToOffice);
group.validateNoActiveAccountsExist();
customerDao.validateGroupNameIsNotTakenForOffice(group.getDisplayName(), transferToOffice.getOfficeId());
try {
hibernateTransactionHelper.startTransaction();
hibernateTransactionHelper.beginAuditLoggingFor(group);
group.makeCustomerMovementEntries(transferToOffice);
group.setPersonnel(null);
if (group.isActive()) {
group.setCustomerStatus(new CustomerStatusEntity(CustomerStatus.GROUP_HOLD));
}
CustomerBO oldParentOfGroup = group.getParentCustomer();
if (oldParentOfGroup != null) {
oldParentOfGroup.incrementChildCount();
customerDao.save(oldParentOfGroup);
}
this.hibernateTransactionHelper.flushSession();
group.generateSearchId();
group.setUpdateDetails();
customerDao.save(group);
Set<CustomerBO> clients = group.getChildren();
if (clients != null) {
for (CustomerBO client : clients) {
client.setUserContext(group.getUserContext());
((ClientBO) client).handleGroupTransfer();
client.setUpdateDetails();
customerDao.save(client);
}
}
hibernateTransactionHelper.commitTransaction();
return group.getGlobalCustNum();
} catch (Exception e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CheckListPersistence method retrieveAllCustomerStatusList.
@SuppressWarnings("unchecked")
public List<CheckListStatesView> retrieveAllCustomerStatusList(Short levelId, Short localeId) throws PersistenceException {
List<CheckListStatesView> checkListStatesView = new ArrayList<CheckListStatesView>();
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("LEVEL_ID", levelId);
List<CustomerStatusEntity> queryResult = executeNamedQuery(NamedQueryConstants.CHECKLIST_GET_VALID_CUSTOMER_STATES, queryParameters);
for (CustomerStatusEntity customerStatus : queryResult) {
checkListStatesView.add(new CheckListStatesView(customerStatus.getId(), customerStatus.getName(), customerStatus.getCustomerLevel().getId()));
}
return checkListStatesView;
}
Aggregations