use of org.mifos.customers.persistence.CustomerDao in project head by mifos.
the class CenterPersistence method createCenter.
/**
* @deprecated use {@link CustomerDao#save(org.mifos.customers.business.CustomerBO)} with {@link CustomerBO} static
* factory methods.
*/
@Deprecated
public CenterBO createCenter(UserContext userContext, CenterTemplate template) throws Exception {
OfficeBO centerOffice = officePersistence.getOffice(template.getOfficeId());
PersonnelBO loanOfficer = legacyPersonnelDao.getPersonnel(template.getLoanOfficerId());
MeetingBO meeting = template.getMeeting();
CenterBO center = CenterBO.createNew(userContext, template.getDisplayName(), new DateTime(template.getMfiJoiningDate()), meeting, loanOfficer, centerOffice, template.getAddress(), template.getExternalId(), new DateMidnight().toDateTime());
CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
try {
StaticHibernateUtil.startTransaction();
customerDao.save(center);
center.generateGlobalCustomerNumber();
customerDao.save(center);
StaticHibernateUtil.commitTransaction();
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
} finally {
StaticHibernateUtil.closeSession();
}
return center;
}
use of org.mifos.customers.persistence.CustomerDao in project head by mifos.
the class ProcessFlowRules method initFromDB.
public static void initFromDB() {
MifosConfigurationManager cm = MifosConfigurationManager.getInstance();
CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
LegacyAccountDao ap = ApplicationContextProvider.getBean(LegacyAccountDao.class);
CustomerStatusEntity cse = customerDao.findClientPendingStatus();
cm.setProperty(CLIENT_PENDING_APPROVAL, isClientPendingApprovalStateEnabledOnDatabaseConfiguration(cse));
cse = customerDao.findGroupPendingStatus();
cm.setProperty(GROUP_PENDING_APPROVAL, isGroupPendingApprovalStateEnabledOnDatabaseConfiguration(cse));
AccountStateEntity ase = ap.loadPersistentObject(AccountStateEntity.class, AccountState.LOAN_PENDING_APPROVAL.getValue());
cm.setProperty(LOAN_PENDING_APPROVAL, isLoanPendingApprovalStateEnabledOnDatabaseConfig(ase));
ase = ap.loadPersistentObject(AccountStateEntity.class, AccountState.SAVINGS_PENDING_APPROVAL.getValue());
cm.setProperty(SAVINGS_PENDING_APPROVAL, isSavingPendingApprovalStateEnabledOnDatabaseConfig(ase));
}
use of org.mifos.customers.persistence.CustomerDao in project head by mifos.
the class ProcessFlowRules method initGroupPendingApprovalState.
private static void initGroupPendingApprovalState() throws ConfigurationException {
CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
CustomerStatusEntity cse = customerDao.findGroupPendingStatus();
boolean fromDb = isGroupPendingApprovalStateEnabledOnDatabaseConfiguration(cse);
boolean fromCfg = isGroupPendingApprovalStateEnabled();
if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
int count = customerDao.countOfGroups();
if (count > 0) {
final String errMsg = getBadOverrideMsg(GROUP_PENDING_APPROVAL, "Records for groups in the 'pending approval' state" + " may already exist.");
throw new ConfigurationException(errMsg);
}
makeDatabaseConfigurationMatchPropertiesFileConfiguration(customerDao, cse, fromCfg);
}
}
use of org.mifos.customers.persistence.CustomerDao in project head by mifos.
the class ProcessFlowRules method initClientPendingApprovalState.
private static void initClientPendingApprovalState() throws ConfigurationException {
CustomerDao customerDao = ApplicationContextProvider.getBean(CustomerDao.class);
CustomerStatusEntity cse = customerDao.findClientPendingStatus();
boolean fromDb = isClientPendingApprovalStateEnabledOnDatabaseConfiguration(cse);
boolean fromCfg = isClientPendingApprovalStateEnabled();
if (databaseAndCustomConfigurationAreNotTheSame(fromDb, fromCfg)) {
int count = customerDao.countOfClients();
if (count > 0) {
final String errMsg = getBadOverrideMsg(CLIENT_PENDING_APPROVAL, "Records for clients in the 'pending approval' state" + " may already exist.");
throw new ConfigurationException(errMsg);
}
makeDatabaseConfigurationMatchPropertiesFileConfiguration(customerDao, cse, fromCfg);
}
}
Aggregations