use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CenterPersistence method findBySystemId.
@SuppressWarnings("unchecked")
public CenterBO findBySystemId(String globalCustNum) throws PersistenceException {
Map<String, String> queryParameters = new HashMap<String, String>();
CenterBO center = null;
queryParameters.put("globalCustNum", globalCustNum);
List<CenterBO> queryResult = executeNamedQuery(NamedQueryConstants.GET_CENTER_BY_SYSTEMID, queryParameters);
if (null != queryResult && queryResult.size() > 0) {
center = queryResult.get(0);
}
return center;
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CenterCustAction method update.
// NOTE - manage->preview->update
@CloseSession
@TransactionDemarcate(validateAndResetToken = true)
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CenterBO centerFromSession = (CenterBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CenterCustActionForm actionForm = (CenterCustActionForm) form;
AddressDto dto = null;
if (actionForm.getAddress() != null) {
dto = Address.toDto(actionForm.getAddress());
}
CenterUpdate centerUpdate = new CenterUpdate(centerFromSession.getCustomerId(), actionForm.getDisplayName(), centerFromSession.getVersionNo(), actionForm.getLoanOfficerIdValue(), actionForm.getExternalId(), actionForm.getMfiJoiningDate(), dto, actionForm.getCustomFields(), actionForm.getCustomerPositions());
try {
this.centerServiceFacade.updateCenter(centerUpdate);
} catch (BusinessRuleException e) {
throw new ApplicationException(e.getMessageKey(), e);
}
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CenterCustAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CenterInformationDto centerInformationDto;
try {
centerInformationDto = this.centerServiceFacade.getCenterInformationDto(((CenterCustActionForm) form).getGlobalCustNum());
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
SessionUtils.removeThenSetAttribute("centerInformationDto", centerInformationDto, request);
// John W - 'BusinessKey' attribute used by breadcrumb but is not in associated jsp
CenterBO centerBO = (CenterBO) this.customerDao.findCustomerById(centerInformationDto.getCenterDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, centerBO, request);
setCurrentPageUrl(request, centerBO);
setQuestionGroupInstances(request, centerBO);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class CustomerServiceImpl method updateCustomerStatus.
@Override
public final void updateCustomerStatus(UserContext userContext, CustomerStatusUpdate customerStatusUpdate) throws CustomerException {
CustomerBO customer = this.customerDao.findCustomerById(customerStatusUpdate.getCustomerId());
customer.validateVersion(customerStatusUpdate.getVersionNum());
customer.updateDetails(userContext);
checkPermission(customer, userContext, customerStatusUpdate.getNewStatus(), customerStatusUpdate.getCustomerStatusFlag());
Short oldStatusId = customer.getCustomerStatus().getId();
CustomerStatus oldStatus = CustomerStatus.fromInt(oldStatusId);
PersonnelBO loggedInUser = this.personnelDao.findPersonnelById(userContext.getId());
CustomerNoteEntity customerNote = new CustomerNoteEntity(customerStatusUpdate.getNotes(), new Date(), loggedInUser, customer);
if (customer.isGroup()) {
GroupBO group = (GroupBO) customer;
updateGroupStatus(group, oldStatus, customerStatusUpdate.getNewStatus(), customerStatusUpdate.getCustomerStatusFlag(), customerNote);
} else if (customer.isClient()) {
ClientBO client = (ClientBO) customer;
updateClientStatus(client, oldStatus, customerStatusUpdate.getNewStatus(), customerStatusUpdate.getCustomerStatusFlag(), customerNote);
} else {
CenterBO center = (CenterBO) customer;
updateCenterStatus(center, customerStatusUpdate.getNewStatus(), customerStatusUpdate.getCustomerStatusFlag(), customerNote);
}
}
use of org.mifos.customers.center.business.CenterBO in project head by mifos.
the class AccountBOIntegrationTest method testGetPastInstallments.
@Test
public void testGetPastInstallments() {
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
CenterBO centerBO = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
StaticHibernateUtil.flushAndClearSession();
centerBO = TestObjectFactory.getCenter(centerBO.getCustomerId());
for (AccountActionDateEntity actionDate : centerBO.getCustomerAccount().getAccountActionDates()) {
actionDate.setActionDate(offSetCurrentDate(4));
break;
}
List<AccountActionDateEntity> pastInstallments = centerBO.getCustomerAccount().getPastInstallments();
Assert.assertNotNull(pastInstallments);
Assert.assertEquals(1, pastInstallments.size());
centerBO = null;
}
Aggregations