use of org.mifos.customers.center.struts.actionforms.CenterCustActionForm in project head by mifos.
the class CenterActionStrutsTest method testLoad.
@Test
public void testLoad() throws Exception {
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "3");
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyNoActionErrors();
verifyNoActionMessages();
verifyForward(ActionForwards.load_success.toString());
Assert.assertNotNull(SessionUtils.getAttribute(CustomerConstants.LOAN_OFFICER_LIST, request));
// Assert.assertNotNull(SessionUtils.getAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, request));
CenterCustActionForm actionForm = (CenterCustActionForm) request.getSession().getAttribute("centerCustActionForm");
String currentDate = DateUtils.getCurrentDate(TestUtils.ukLocale());
SimpleDateFormat retrievedFormat = new SimpleDateFormat(dateFormat);
SimpleDateFormat localFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, TestUtils.ukLocale());
Date curDate = localFormat.parse(currentDate);
Date retrievedDate = retrievedFormat.parse(actionForm.getMfiJoiningDate());
Assert.assertEquals(curDate, retrievedDate);
}
use of org.mifos.customers.center.struts.actionforms.CenterCustActionForm in project head by mifos.
the class CenterActionStrutsTest method testSuccessfulCreate.
@Test
public void testSuccessfulCreate() throws Exception {
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
AmountFeeBO monthlyPeriodicFeeForFirstClients = new FeeBuilder().appliesToCenterOnly().withFeeAmount("200.0").withName("PeriodicAmountFee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
IntegrationTestObjectMother.saveFee(monthlyPeriodicFeeForFirstClients);
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "load");
addRequestParameter("officeId", "1");
actionPerform();
SessionUtils.setAttribute(CustomerConstants.CUSTOMER_MEETING, weeklyMeeting, request);
List<ApplicableAccountFeeDto> feeList = retrieveAdditionalFeesFromSession();
ApplicableAccountFeeDto fee = feeList.get(0);
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "preview");
addRequestParameter("displayName", "center");
addRequestParameter("loanOfficerId", "1");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
addRequestParameter("selectedFee[0].feeId", fee.getFeeId().toString());
addRequestParameter("selectedFee[0].amount", fee.getAmount());
actionPerform();
verifyForward(ActionForwards.preview_success.toString());
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "create");
addRequestParameter(Constants.CURRENTFLOWKEY, (String) request.getAttribute(Constants.CURRENTFLOWKEY));
actionPerform();
verifyNoActionErrors();
verifyForward(ActionForwards.create_success.toString());
CenterCustActionForm actionForm = (CenterCustActionForm) request.getSession().getAttribute("centerCustActionForm");
center = TestObjectFactory.getCenter(actionForm.getCustomerIdAsInt());
}
use of org.mifos.customers.center.struts.actionforms.CenterCustActionForm 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.struts.actionforms.CenterCustActionForm 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.struts.actionforms.CenterCustActionForm in project head by mifos.
the class CenterCustAction method searchTransfer.
@TransactionDemarcate(joinToken = true)
public ActionForward searchTransfer(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
cleanUpSearch(request);
CenterCustActionForm actionForm = (CenterCustActionForm) form;
String searchString = actionForm.getSearchString();
CustomerSearch searchResult = this.customerServiceFacade.search(searchString);
addSeachValues(searchString, searchResult.getOfficeId(), searchResult.getOfficeName(), request);
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, searchResult.getSearchResult(), request);
return mapping.findForward(ActionForwards.transferSearch_success.toString());
}
Aggregations