Java Code Examples for org.apache.struts.action.ActionForward#setModule()

The following examples show how to use org.apache.struts.action.ActionForward#setModule() . 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: KualiInquiryAction.java    From rice with Educational Community License v2.0 6 votes vote down vote up
/**
   * Gets an inquirable impl from the impl service name parameter. Then calls lookup service to retrieve the record from the
   * key/value parameters. Finally gets a list of Rows from the inquirable
   */
  public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
      InquiryForm inquiryForm = (InquiryForm) form;
      if (inquiryForm.getBusinessObjectClassName() == null) {
          LOG.error("Business object name not given.");
          throw new RuntimeException("Business object name not given.");
      }
      
      Class boClass = Class.forName(inquiryForm.getBusinessObjectClassName());
      ModuleService responsibleModuleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(boClass);
if(responsibleModuleService!=null && responsibleModuleService.isExternalizable(boClass)){
	String redirectUrl = responsibleModuleService.getExternalizableBusinessObjectInquiryUrl(boClass, (Map<String, String[]>) request.getParameterMap());
	ActionForward redirectingActionForward = new RedirectingActionForward(redirectUrl);
	redirectingActionForward.setModule("/");
	return redirectingActionForward;
}

return continueWithInquiry(mapping, form, request, response);
  }
 
Example 2
Source File: ForwardWithQueryParametersAction.java    From rice with Educational Community License v2.0 6 votes vote down vote up
public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {

    String path = mapping.getParameter();
    if (request.getQueryString() != null) {
    	path = path + "?" + request.getQueryString();
    }
    ActionForward retVal = new ActionForward(path);
    retVal.setModule("");

    return retVal;
}
 
Example 3
Source File: FenixDispatchAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ActionForward forwardForDestination(ViewDestination destination) {
    ActionForward forward = new ActionForward();
    forward.setModule(destination.getModule());
    forward.setPath(destination.getPath());
    forward.setRedirect(destination.getRedirect());
    return forward;
}
 
Example 4
Source File: EditMissingCandidacyInformationDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {

        final PersonalInformationBean personalInformationBean = getRenderedObject("personalInformationBean");

        final Set<String> messages = personalInformationBean.validate();

        if (!messages.isEmpty()) {
            for (final String each : messages) {
                addActionMessage(request, each);
            }
            return prepareEditInvalid(mapping, form, request, response);
        }

        try {
            personalInformationBean.updatePersonalInformation(true);
        } catch (DomainException e) {
            addActionMessage(request, e.getKey(), e.getArgs());
            return prepareEditInvalid(mapping, form, request, response);
        }

        if (personalInformationBean.getStudent().hasAnyMissingPersonalInformation()) {
            RenderUtils.invalidateViewState();
            return prepareEdit(mapping, form, request, response);
        }

        final ActionForward forward = new ActionForward();
        forward.setPath("/home.do");
        forward.setRedirect(true);
        forward.setModule("/");

        return forward;

    }
 
Example 5
Source File: StudentEnrolmentsDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ActionForward editEnrolment(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                          final HttpServletResponse response) {

    final EditEnrolmentBean enrolmentBean = getRenderedObject();
    final Enrolment enrolment = enrolmentBean.getEnrolment();

    final Double newWeight = enrolmentBean.getWeight();
    final EctsConversionTable newEctsConversionTable = enrolmentBean.getEctsConversionTable();
    final Grade newNormalizedGrade = enrolmentBean.getNormalizedGrade();

    Double oldWeight = enrolment.getWeigth();

    RenderUtils.invalidateViewState();
    
    FenixFramework.atomic(() -> {
        if (newEctsConversionTable instanceof EmptyConversionTable) {
            if (newNormalizedGrade.isEmpty()) {
                // use default table
                enrolment.setEctsConversionTable(null);
                enrolment.setEctsGrade(null);
            } else {
                enrolment.setEctsGrade(newNormalizedGrade);
                enrolment.setEctsConversionTable(newEctsConversionTable);
            }
        } else {
            // default to the selected table
            enrolment.setEctsGrade(null);
            enrolment.setEctsConversionTable(newEctsConversionTable);
        }

        enrolment.setWeigth(newWeight);
    });

    LOGGER.info("Changed enrolment {} of student {} by user {}", enrolmentBean.getEnrolment().getExternalId(),
                enrolmentBean.getEnrolment().getStudent().getPerson().getUsername(), Authenticate.getUser().getUsername());
    LOGGER.info("\t newEctsConversionTable: {}", newEctsConversionTable == null ? "-" : newEctsConversionTable
                                                                                            .getPresentationName().getContent());
    LOGGER.info("\t newEctsGrade: {}", newNormalizedGrade == null ? "-" : newNormalizedGrade.getValue());
    if (!oldWeight.equals(newWeight)) {
        LOGGER.info("\t oldWeight: {} newWeight: {}", oldWeight.toString(), newWeight.toString());
    }


    final UriBuilder builder = UriBuilder.fromPath("/academicAdministration/studentEnrolments.do");
    builder.queryParam("method", "prepare");
    final String scpID = request.getParameter("scpID");
    final String executionPeriodId = request.getParameter("executionPeriodId");

    if (!Strings.isNullOrEmpty(scpID)) {
        builder.queryParam("scpID", scpID);
    }

    if (!Strings.isNullOrEmpty(executionPeriodId)) {
        builder.queryParam("executionPeriodId", executionPeriodId);
    }

    final String redirectTo = GenericChecksumRewriter.injectChecksumInUrl(request.getContextPath(), builder.toString(), request.getSession(false));
    
    final ActionForward actionForward = new ActionForward();
    actionForward.setModule("/");
    actionForward.setPath(redirectTo);
    actionForward.setRedirect(true);

    return actionForward;
}