use of org.mifos.customers.exceptions.CustomerException in project head by mifos.
the class GroupBO method updatePerformanceHistoryOnReversal.
@Override
public void updatePerformanceHistoryOnReversal(final LoanBO loan, final Money lastLoanAmount) throws CustomerException {
try {
GroupPerformanceHistoryEntity groupPerformanceHistoryEntity = (GroupPerformanceHistoryEntity) getPerformanceHistory();
groupPerformanceHistoryEntity.updateOnReversal(loan, lastLoanAmount);
} catch (AccountException e) {
throw new CustomerException(e);
}
}
use of org.mifos.customers.exceptions.CustomerException in project head by mifos.
the class CenterServiceFacadeWebTier method updateCustomerStatus.
@Override
public void updateCustomerStatus(Integer customerId, Integer previousCustomerVersionNo, String flagIdAsString, String newStatusIdAsString, String notes) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
Short flagId = null;
Short newStatusId = null;
if (StringUtils.isNotBlank(flagIdAsString)) {
flagId = Short.valueOf(flagIdAsString);
}
if (StringUtils.isNotBlank(newStatusIdAsString)) {
newStatusId = Short.valueOf(newStatusIdAsString);
}
CustomerStatusFlag customerStatusFlag = null;
if (flagId != null) {
customerStatusFlag = CustomerStatusFlag.fromInt(flagId);
}
CustomerStatus newStatus = CustomerStatus.fromInt(newStatusId);
CustomerStatusUpdate customerStatusUpdate = new CustomerStatusUpdate(customerId, previousCustomerVersionNo, customerStatusFlag, newStatus, notes);
try {
this.customerService.updateCustomerStatus(userContext, customerStatusUpdate);
} catch (CustomerException e) {
throw new BusinessRuleException(e.getKey(), e);
}
}
use of org.mifos.customers.exceptions.CustomerException in project head by mifos.
the class CustomerPersistence method saveCustomer.
public void saveCustomer(final CustomerBO customer) throws CustomerException {
try {
createOrUpdate(customer);
customer.generateGlobalCustomerNumber();
createOrUpdate(customer);
} catch (PersistenceException e) {
throw new CustomerException(CustomerConstants.CREATE_FAILED_EXCEPTION, e);
}
}
use of org.mifos.customers.exceptions.CustomerException in project head by mifos.
the class CustSearchAction method mainSearch.
@TransactionDemarcate(joinToken = true)
public ActionForward mainSearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
CustSearchActionForm actionForm = (CustSearchActionForm) form;
Short officeId = getShortValue(actionForm.getOfficeId());
String searchString = actionForm.getSearchString();
UserContext userContext = (UserContext) SessionUtils.getAttribute(Constants.USERCONTEXT, request.getSession());
super.search(mapping, form, request, response);
if (searchString == null || searchString.equals("")) {
ActionErrors errors = new ActionErrors();
errors.add(CustomerSearchConstants.NAMEMANDATORYEXCEPTION, new ActionMessage(CustomerSearchConstants.NAMEMANDATORYEXCEPTION));
request.setAttribute(Globals.ERROR_KEY, errors);
return mapping.findForward(ActionForwards.mainSearch_success.toString());
}
if (officeId != null && officeId != 0) {
addSeachValues(searchString, officeId.toString(), new OfficePersistence().getOffice(officeId).getOfficeName(), request);
} else {
addSeachValues(searchString, officeId.toString(), new OfficePersistence().getOffice(userContext.getBranchId()).getOfficeName(), request);
}
searchString = SearchUtils.normalizeSearchString(searchString);
if (searchString.equals("")) {
throw new CustomerException(CustomerSearchConstants.NAMEMANDATORYEXCEPTION);
}
if (actionForm.getFilters() == null) {
actionForm.setFilters(new SearchFiltersDto());
}
QueryResult customerSearchResult = new CustomerPersistence().search(searchString, officeId, userContext.getId(), userContext.getBranchId(), actionForm.getFilters());
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, customerSearchResult, request);
return mapping.findForward(ActionForwards.mainSearch_success.toString());
}
use of org.mifos.customers.exceptions.CustomerException in project head by mifos.
the class PictureFormFile method updateMfiInfo.
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward updateMfiInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
ClientCustActionForm actionForm = (ClientCustActionForm) form;
ClientBO clientInSession = getClientFromSession(request);
Integer clientId = clientInSession.getCustomerId();
Integer oldVersionNumber = clientInSession.getVersionNo();
boolean trained = false;
if (trainedValue(actionForm) != null && trainedValue(actionForm).equals(YesNoFlag.YES.getValue())) {
trained = true;
}
DateTime trainedDate = null;
try {
java.sql.Date inputDate = trainedDate(actionForm);
if (inputDate != null) {
trainedDate = new DateTime(trainedDate(actionForm));
}
} catch (InvalidDateException e) {
throw new CustomerException(ClientConstants.TRAINED_DATE_MANDATORY);
}
Short personnelId = Short.valueOf("-1");
if (groupFlagValue(actionForm).equals(YesNoFlag.NO.getValue())) {
if (actionForm.getLoanOfficerIdValue() != null) {
personnelId = actionForm.getLoanOfficerIdValue();
}
} else if (groupFlagValue(actionForm).equals(YesNoFlag.YES.getValue())) {
// TODO for an urgent fix this reads client to get personnelId.
// Client is read again in updateClientMfiInfo. Refactor to only read in
// updateClientMfiInfo.
ClientBO client = (ClientBO) this.customerDao.findCustomerById(clientId);
personnelId = client.getPersonnel().getPersonnelId();
}
ClientMfiInfoUpdate clientMfiInfoUpdate = new ClientMfiInfoUpdate(clientId, oldVersionNumber, personnelId, externalId(actionForm), trained, trainedDate);
this.clientServiceFacade.updateClientMfiInfo(clientMfiInfoUpdate);
return mapping.findForward(ActionForwards.updateMfiInfo_success.toString());
}
Aggregations