コード例 #1
0
 @Atomic
 private CareerWorkshopApplication retrieveThisWorkshopApplication(
     Student student, CareerWorkshopApplicationEvent event) {
   for (CareerWorkshopApplication application : student.getCareerWorkshopApplicationsSet()) {
     if (application.getCareerWorkshopApplicationEvent() == event) {
       return application;
     }
   }
   return new CareerWorkshopApplication(student, event);
 }
コード例 #2
0
  public ActionForward submitApplication(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    CareerWorkshopApplication application = getDomainObject(request, "applicationExternalId");

    if (isApplicationPeriodExpired(application)) {
      addActionMessage("error", request, "error.careerWorkshops.applicationPeriodExpired");
      return prepare(actionMapping, actionForm, request, response);
    }

    boolean comingFromSubmission = true;
    String[] sessionPreferences = new String[CareerWorkshopSessions.values().length];
    for (CareerWorkshopSessions careerWorkshopSessions : CareerWorkshopSessions.values()) {
      sessionPreferences[careerWorkshopSessions.ordinal()] =
          (String) getFromRequest(request, careerWorkshopSessions.name());
    }
    application.setSessionPreferences(sessionPreferences);

    String[] themePreferences = new String[CareerWorkshopThemes.values().length];
    for (CareerWorkshopThemes careerWorkshopThemes : CareerWorkshopThemes.values()) {
      themePreferences[careerWorkshopThemes.ordinal()] =
          (String) getFromRequest(request, careerWorkshopThemes.name());
    }
    application.setThemePreferences(themePreferences);

    application.sealApplication();

    request.setAttribute("comingFromSubmission", comingFromSubmission);

    request.setAttribute("application", application);
    return actionMapping.findForward("careerWorkshopApplicationForm");
  }
コード例 #3
0
 private boolean isApplicationPeriodExpired(CareerWorkshopApplication application) {
   DateTime thisInstant = new DateTime();
   return thisInstant.isAfter(application.getCareerWorkshopApplicationEvent().getEndDate());
 }