Java Code Examples for org.apache.struts.action.ActionMapping#getAttribute()

The following examples show how to use org.apache.struts.action.ActionMapping#getAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SalarySettingBaseAction.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping,
 *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    SalarySettingBaseForm salarySettingForm = (SalarySettingBaseForm) form;

    // if org sal setting we need to initialize authorization
    if (!salarySettingForm.isBudgetByAccountMode() && salarySettingForm.getMethodToCall() != null && salarySettingForm.getMethodToCall().equals(BCConstants.LOAD_EXPANSION_SCREEN_METHOD)) {
        initAuthorization(salarySettingForm);
    }

    populateAuthorizationFields(salarySettingForm);

    ActionForward forward = super.execute(mapping, form, request, response);
    salarySettingForm.postProcessBCAFLines();

    // re-init the session form if session scoped
    if (salarySettingForm.getMethodToCall().equals("refresh")) {
        if (BCConstants.MAPPING_SCOPE_SESSION.equals(mapping.getScope())) {
            HttpSession sess = request.getSession(Boolean.FALSE);
            String formName = mapping.getAttribute();
            sess.setAttribute(formName, salarySettingForm);
        }
    }
    return forward;
}
 
Example 2
Source File: BudgetExpansionAction.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * remove any session form attribute
 *
 * @param mapping
 * @param request
 */
public void cleanupAnySessionForm(ActionMapping mapping, HttpServletRequest request) {
    if (BCConstants.MAPPING_SCOPE_SESSION.equals(mapping.getScope())) {
        HttpSession sess = request.getSession(Boolean.FALSE);
        String formName = mapping.getAttribute();
        sess.removeAttribute(formName);
    }
}
 
Example 3
Source File: ActionBase.java    From iaf with Apache License 2.0 5 votes vote down vote up
/**
 * removes formbean <br/>
 * removes what is defined under the Attribute of a mapping from either the
 * request or the session
 */
public void removeFormBean(ActionMapping mapping, HttpServletRequest request) {
    HttpSession session = request.getSession();

    if (mapping.getAttribute() != null) {
        if ("request".equals(mapping.getScope()))
            request.removeAttribute(mapping.getAttribute());
        else
            session.removeAttribute(mapping.getAttribute());
    }
}
 
Example 4
Source File: OrganizationSelectionTreeAction.java    From kfs with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * @see org.kuali.kfs.module.bc.document.web.struts.BudgetExpansionAction#execute(org.apache.struts.action.ActionMapping,
 *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

    ActionForward actionForward = super.execute(mapping, form, request, response);

    OrganizationSelectionTreeForm orgSelTreeForm = (OrganizationSelectionTreeForm) form;

    // re-init the session form if session scoped
    if (orgSelTreeForm.getMethodToCall().equals("refresh")) {
        if (BCConstants.MAPPING_SCOPE_SESSION.equals(mapping.getScope())) {
            HttpSession sess = request.getSession(Boolean.FALSE);
            String formName = mapping.getAttribute();
            sess.setAttribute(formName, orgSelTreeForm);
        }
    }

    if (orgSelTreeForm.getPullFlagKeyLabels().isEmpty() && orgSelTreeForm.getOperatingMode() != null) {
        OrgSelOpMode opMode = OrgSelOpMode.valueOf(orgSelTreeForm.getOperatingMode());
        switch (opMode) {
            case SALSET:
                orgSelTreeForm.setOperatingModeTitle("Budget Salary Setting Organization Selection");
                orgSelTreeForm.setOperatingModePullFlagLabel("Selected");
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.NO.getKey().toString(), OrgSelControlOption.NO.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.YES.getKey().toString(), OrgSelControlOption.YES.getLabel()));
                break;
            case REPORTS:
                orgSelTreeForm.setOperatingModeTitle("BC Reports Organization Selection");
                orgSelTreeForm.setOperatingModePullFlagLabel("Selected");
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.NO.getKey().toString(), OrgSelControlOption.NO.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.YES.getKey().toString(), OrgSelControlOption.YES.getLabel()));
                break;
            case PULLUP:
                orgSelTreeForm.setOperatingModeTitle("BC Pull Up Organization Selection");
                orgSelTreeForm.setOperatingModePullFlagLabel("Pull Up Type");
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.NOTSEL.getKey().toString(), OrgSelControlOption.NOTSEL.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.BOTH.getKey().toString(), OrgSelControlOption.BOTH.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.ORG.getKey().toString(), OrgSelControlOption.ORG.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.SUBORG.getKey().toString(), OrgSelControlOption.SUBORG.getLabel()));
                break;
            case PUSHDOWN:
                orgSelTreeForm.setOperatingModeTitle("BC Push Down Organization Selection");
                orgSelTreeForm.setOperatingModePullFlagLabel("Push Down Type");
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.NOTSEL.getKey().toString(), OrgSelControlOption.NOTSEL.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.ORGLEV.getKey().toString(), OrgSelControlOption.ORGLEV.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.MGRLEV.getKey().toString(), OrgSelControlOption.MGRLEV.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.ORGMGRLEV.getKey().toString(), OrgSelControlOption.ORGMGRLEV.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.LEVONE.getKey().toString(), OrgSelControlOption.LEVONE.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.LEVZERO.getKey().toString(), OrgSelControlOption.LEVZERO.getLabel()));
                break;
            default:
                // default to ACCOUNT operating mode
                orgSelTreeForm.setOperatingModeTitle("Budgeted Account List Search Organization Selection");
                orgSelTreeForm.setOperatingModePullFlagLabel("Selected");
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.NO.getKey().toString(), OrgSelControlOption.NO.getLabel()));
                orgSelTreeForm.getPullFlagKeyLabels().add(new ConcreteKeyValue(OrgSelControlOption.YES.getKey().toString(), OrgSelControlOption.YES.getLabel()));
                break;
        }
    }

    return actionForward;
}