use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class CustomerPersistence method retrieveAllCustomerStatusList.
public List<CustomerStatusEntity> retrieveAllCustomerStatusList(final Short levelId) throws PersistenceException {
Map<String, Object> queryParameters = new HashMap<String, Object>();
queryParameters.put("LEVEL_ID", levelId);
List<CustomerStatusEntity> queryResult = 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;
}
use of org.mifos.customers.business.CustomerStatusEntity in project head by mifos.
the class ClientBO method transferToBranch.
public void transferToBranch(final OfficeBO officeToTransfer) throws CustomerException {
validateBranchTransfer(officeToTransfer);
logger.debug("In ClientBO::transferToBranch(), transfering customerId: " + getCustomerId() + "to branch : " + officeToTransfer.getOfficeId());
if (isActive()) {
setCustomerStatus(new CustomerStatusEntity(CustomerStatus.CLIENT_HOLD));
}
makeCustomerMovementEntries(officeToTransfer);
this.setPersonnel(null);
logger.debug("In ClientBO::transferToBranch(), successfully transfered, customerId :" + getCustomerId());
}
Aggregations