use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class CenterServiceFacadeWebTier method retrieveChangeLogs.
@Override
public List<AuditLogDto> retrieveChangeLogs(Integer centerId) {
try {
List<AuditLogDto> auditLogs = new ArrayList<AuditLogDto>();
Short entityType = EntityType.CENTER.getValue();
AuditBusinessService auditBusinessService = new AuditBusinessService();
List<AuditLogView> centerAuditLogs = auditBusinessService.getAuditLogRecords(entityType, centerId);
for (AuditLogView auditLogView : centerAuditLogs) {
auditLogs.add(auditLogView.toDto());
}
return auditLogs;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class CheckListServiceFacadeWebTier method updateCustomerChecklist.
@Override
public void updateCustomerChecklist(Short checklistId, Short levelId, Short stateId, Short checklistStatus, String checklistName, List<String> details) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
CustomerLevelEntity customerLevelEntity = new CustomerLevelEntity(CustomerLevel.getLevel(levelId));
CustomerStatusEntity customerStatusEntity = new CustomerStatusEntity(stateId);
try {
hibernateTransactionHelper.startTransaction();
CustomerCheckListBO customerCheckList = (CustomerCheckListBO) new CheckListPersistence().getCheckList(checklistId);
customerCheckList.update(customerLevelEntity, customerStatusEntity, checklistName, checklistStatus, details, userContext.getLocaleId(), userContext.getId());
customerDao.save(customerCheckList);
hibernateTransactionHelper.commitTransaction();
} catch (CheckListException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} catch (PersistenceException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class CheckListServiceFacadeWebTier method retreiveAllCustomerCheckLists.
@Override
public List<CustomerCheckBoxItemDto> retreiveAllCustomerCheckLists() {
try {
List<CustomerCheckListBO> customerCheckLists = new CheckListBusinessService().retreiveAllCustomerCheckLists();
List<CustomerCheckBoxItemDto> dtoList = new ArrayList<CustomerCheckBoxItemDto>();
for (CustomerCheckListBO bo : customerCheckLists) {
String lookUpName = bo.getCustomerStatus().getLookUpValue() != null ? bo.getCustomerStatus().getLookUpValue().getLookUpName() : null;
CustomerCheckBoxItemDto dto = new CustomerCheckBoxItemDto(bo.getChecklistId(), bo.getChecklistName(), bo.getChecklistStatus(), null, lookUpName, bo.getCustomerStatus().getId(), bo.getCustomerLevel().getId());
if (dto.getLookUpName() != null) {
dto.setName(ApplicationContextProvider.getBean(MessageLookup.class).lookup(dto.getLookUpName()));
}
dtoList.add(dto);
}
return dtoList;
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class CheckListServiceFacadeWebTier method createAccountChecklist.
@Override
public void createAccountChecklist(Short productId, Short stateId, String checklistName, List<String> checklistDetails) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = new UserContextFactory().create(user);
try {
ProductTypeEntity productTypeEntity = null;
for (ProductTypeEntity prdTypeEntity : new ProductCategoryBusinessService().getProductTypes()) {
if (productId.equals(prdTypeEntity.getProductTypeID())) {
productTypeEntity = prdTypeEntity;
break;
}
}
hibernateTransactionHelper.startTransaction();
AccountStateEntity accountStateEntity = new AccountStateEntity(AccountState.fromShort(stateId));
AccountCheckListBO accountCheckListBO = new AccountCheckListBO(productTypeEntity, accountStateEntity, checklistName, CheckListConstants.STATUS_ACTIVE, checklistDetails, userContext.getLocaleId(), userContext.getId());
customerDao.save(accountCheckListBO);
hibernateTransactionHelper.commitTransaction();
} catch (ServiceException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new MifosRuntimeException(e);
} catch (CheckListException e) {
hibernateTransactionHelper.rollbackTransaction();
throw new BusinessRuleException(e.getKey(), e);
} finally {
hibernateTransactionHelper.closeSession();
}
}
use of org.mifos.core.MifosRuntimeException in project head by mifos.
the class CheckListServiceFacadeWebTier method retrieveChecklistMasterData.
@Override
public List<CheckListMasterDto> retrieveChecklistMasterData() {
try {
Short localeIdNotUsed = null;
List<CheckListMasterDto> masterData = new CheckListPersistence().getCheckListMasterData(localeIdNotUsed);
for (CheckListMasterDto checkListMasterDto : masterData) {
if (checkListMasterDto.isCustomer()) {
checkListMasterDto.setMasterTypeName(ApplicationContextProvider.getBean(MessageLookup.class).lookupLabel(checkListMasterDto.getLookupKey()));
} else {
checkListMasterDto.setMasterTypeName(ApplicationContextProvider.getBean(MessageLookup.class).lookup(checkListMasterDto.getLookupKey()));
}
}
return masterData;
} catch (PersistenceException e) {
throw new MifosRuntimeException(e);
}
}
Aggregations