Search in sources :

Example 6 with ActionForward

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;
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext) ActionForward(org.apache.struts.action.ActionForward) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 7 with 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;
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) QueryResult(org.mifos.framework.hibernate.helper.QueryResult) CustSearchActionForm(org.mifos.customers.struts.actionforms.CustSearchActionForm) UserContext(org.mifos.security.util.UserContext) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence) ActionForward(org.apache.struts.action.ActionForward) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 8 with 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;
}
Also used : OfficeDto(org.mifos.dto.domain.OfficeDto) OffActionForm(org.mifos.customers.office.struts.actionforms.OffActionForm) ActionForward(org.apache.struts.action.ActionForward) OfficeUpdateRequest(org.mifos.dto.domain.OfficeUpdateRequest) CloseSession(org.mifos.framework.util.helpers.CloseSession) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 9 with ActionForward

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");
}
Also used : QuestionGroupDetail(org.mifos.platform.questionnaire.service.QuestionGroupDetail) ActionForward(org.apache.struts.action.ActionForward) Test(org.junit.Test)

Example 10 with ActionForward

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());
}
Also used : ActionForward(org.apache.struts.action.ActionForward)

Aggregations

ActionForward (org.apache.struts.action.ActionForward)117 AbstractContest (cn.edu.zju.acm.onlinejudge.bean.AbstractContest)16 ActionMessages (org.apache.struts.action.ActionMessages)14 Problem (cn.edu.zju.acm.onlinejudge.bean.Problem)11 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 UserProfile (cn.edu.zju.acm.onlinejudge.bean.UserProfile)9 ActionMessage (org.apache.struts.action.ActionMessage)9 KualiDocumentFormBase (org.kuali.kfs.kns.web.struts.form.KualiDocumentFormBase)8 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)7 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)7 UserContext (org.mifos.security.util.UserContext)7 IOException (java.io.IOException)6 Date (java.util.Date)6 AuthorizationPersistence (cn.edu.zju.acm.onlinejudge.persistence.AuthorizationPersistence)5 ArrayList (java.util.ArrayList)5 Cookie (javax.servlet.http.Cookie)5 ActionMapping (org.apache.struts.action.ActionMapping)5 CloseSession (org.mifos.framework.util.helpers.CloseSession)5 Submission (cn.edu.zju.acm.onlinejudge.bean.Submission)4 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)4