Ejemplo n.º 1
0
 void onPrepareFromReviewForm() {
   if (!StudentUtil.isPossibleUuid(courseUuid)) {
     LOG.info("Invalid CourseUUID");
     courseUuid = null;
     course = null;
   } else {
     try {
       course = courseFinderService.findCourseByUuid(courseUuid);
     } catch (ObjectNotFoundException e) {
       // Handle null course in the template.
       LOG.trace("course not found: " + courseUuid);
     }
   }
 }
Ejemplo n.º 2
0
 void onPrepareForSubmitFromUpdateForm() {
   // Get objects for the form fields to overlay.
   if (!StudentUtil.isPossibleUuid(courseUuid)) {
     LOG.info("Invalid CourseUUID");
     courseUuid = null;
     course = new Course();
   } else {
     try {
       course = courseFinderService.findCourseByUuid(courseUuid);
     } catch (ObjectNotFoundException e) {
       course = new Course();
       updateForm.recordError("Course has been deleted by another process.");
       LOG.trace("course not found: " + courseUuid);
     }
   }
 }
Ejemplo n.º 3
0
  void setupRender() {

    if (mode == Mode.REVIEW) {
      // this test includes valid 'null' case.
      if (!StudentUtil.isPossibleUuid(courseUuid)) {
        courseUuid = null;
        course = null;
        // Handle null course in the template.
      } else {
        if (course == null) {
          try {
            course = courseFinderService.findCourseByUuid(courseUuid);
          } catch (ObjectNotFoundException e) {
            // Handle null course in the template.
            LOG.trace("course not found: " + courseUuid);
          }
        }
      }
    }
  }
Ejemplo n.º 4
0
  void onPrepareForRenderFromUpdateForm() {
    if (!StudentUtil.isPossibleUuid(courseUuid)) {
      LOG.info("Invalid CourseUUID");
      courseUuid = null;
      course = null;
    } else {
      try {
        course = courseFinderService.findCourseByUuid(courseUuid);
      } catch (ObjectNotFoundException e) {
        // Handle null course in the template.
        LOG.trace("course not found: " + courseUuid);
      }
    }

    // If the form has errors then we're redisplaying after a redirect.
    // Form will restore your input values but it's up to us to restore
    // Hidden values.

    if (updateForm.getHasErrors()) {
      if (course != null) {
        course.setVersion(versionFlash);
      }
    }
  }