use of org.apache.struts.action.ActionForward in project head by mifos.
the class PersonAction method search.
@Override
@TransactionDemarcate(saveToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward actionForward = null;
UserContext userContext = getUserContext(request);
PersonnelBO personnel = this.personnelDao.findPersonnelById(userContext.getId());
String searchString = ((PersonActionForm) form).getSearchString();
addSeachValues(searchString, personnel.getOffice().getOfficeId().toString(), personnel.getOffice().getOfficeName(), request);
searchString = org.mifos.framework.util.helpers.SearchUtils.normalizeSearchString(searchString);
actionForward = super.search(mapping, form, request, response);
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, legacyPersonnelDao.search(searchString, userContext.getId()), request);
return actionForward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class CustSearchAction method search.
/**
* FIXME: KEITHW - When replacing search functionality for customers with spring/ftl implementation,
* find cleaner way of implementing search that returns a non domain related class (data only object)
*/
@Override
@TransactionDemarcate(joinToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
if (request.getParameter("perspective") != null) {
request.setAttribute("perspective", request.getParameter("perspective"));
}
ActionForward actionForward = super.search(mapping, form, request, response);
CustSearchActionForm actionForm = (CustSearchActionForm) form;
UserContext userContext = getUserContext(request);
String searchString = actionForm.getSearchString();
if (searchString == null) {
throw new CustomerException(CenterConstants.NO_SEARCH_STRING);
}
String officeName = this.centerServiceFacade.retrieveOfficeName(userContext.getBranchId());
addSeachValues(searchString, userContext.getBranchId().toString(), officeName, request);
searchString = SearchUtils.normalizeSearchString(searchString);
if (StringUtils.isBlank(searchString)) {
throw new CustomerException(CenterConstants.NO_SEARCH_STRING);
}
if (actionForm.getInput() != null && actionForm.getInput().equals("loan")) {
QueryResult groupClients = new CustomerPersistence().searchGroupClient(searchString, userContext.getId(), false);
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, groupClients, request);
} else if (actionForm.getInput() != null && actionForm.getInput().equals("savings")) {
QueryResult customerForSavings = new CustomerPersistence().searchCustForSavings(searchString, userContext.getId());
SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, customerForSavings, request);
}
return actionForward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class OffAction method update.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OffActionForm offActionForm = (OffActionForm) form;
ActionForward forward = null;
OfficeDto sessionOffice = (OfficeDto) SessionUtils.getAttribute(OfficeConstants.OFFICE_DTO, request);
Short officeId = sessionOffice.getOfficeId();
Integer versionNum = sessionOffice.getVersionNum();
OfficeUpdateRequest officeUpdateRequest = officeUpdateRequestFrom(offActionForm);
boolean isParentOfficeChanged = this.officeServiceFacade.updateOffice(officeId, versionNum, officeUpdateRequest);
if (isParentOfficeChanged) {
forward = mapping.findForward(ActionForwards.update_cache_success.toString());
} else {
forward = mapping.findForward(ActionForwards.update_success.toString());
}
return forward;
}
use of org.apache.struts.action.ActionForward in project head by mifos.
the class QuestionnaireFlowAdapterTest method testShouldFetchQuestions.
@Test
public void testShouldFetchQuestions() {
QuestionnaireFlowAdapter createLoanQuestionnaire = new QuestionnaireFlowAdapter("Create", "Loan", ActionForwards.schedulePreview_success, "clientsAndAccounts.ftl", serviceLocator);
List<QuestionGroupDetail> applicableGroups = getQuestionGroups();
when(mapping.findForward("captureQuestionResponses")).thenReturn(captureResponseActFwd);
when(mapping.findForward("schedulePreview_success")).thenReturn(schedulePreview_successFwd);
when(serviceLocator.getService(request)).thenReturn(questionnaireServiceFacade);
when(request.getRequestURI()).thenReturn("/mifos/loanAccountAction.do");
when(request.getContextPath()).thenReturn("/mifos");
when(questionnaireServiceFacade.getQuestionGroups("Create", "Loan")).thenReturn(applicableGroups);
ActionForward fwdTo = createLoanQuestionnaire.fetchAppliedQuestions(mapping, questionForm, request, ActionForwards.schedulePreview_success);
Assert.assertEquals(captureResponseActFwd, fwdTo);
//Assert.assertEquals(applicableGroups, questionForm.getQuestionGroups());
verify(questionForm).setQuestionGroups(applicableGroups);
verify(request).setAttribute("questionsHostForm", questionForm);
verify(request).setAttribute("origFlowRequestURI", "/loanAccountAction.do");
verify(request).setAttribute("cancelToURL", "clientsAndAccounts.ftl");
}
use of org.apache.struts.action.ActionForward in project sonarqube by SonarSource.
the class ConfigHelper method getLink.
/**
* <p> Return the path for the specified forward, otherwise return
* <code>null</code>. </p>
*
* @param name Name given to local or global forward.
*/
public String getLink(String name) {
ActionForward forward = getActionForward(name);
if (forward == null) {
return null;
}
StringBuffer path = new StringBuffer(this.request.getContextPath());
path.append(forward.getPath());
// :TODO: What about runtime parameters?
return getEncodeURL(path.toString());
}
Aggregations