View Javadoc

1   package org.kuali.student.enrollment.class2.courseoffering.controller;
2   
3   import org.kuali.rice.krad.web.form.DocumentFormBase;
4   import org.springframework.transaction.annotation.Propagation;
5   import org.springframework.transaction.annotation.Transactional;
6   import org.springframework.validation.BindingResult;
7   import org.springframework.web.servlet.ModelAndView;
8   
9   import javax.servlet.http.HttpServletRequest;
10  import javax.servlet.http.HttpServletResponse;
11  
12  /**
13   * Created with IntelliJ IDEA.
14   * User: Daniel
15   * Date: 7/23/13
16   * Time: 10:54 AM
17   * This method is a round-about way to provide a new transaction when calling MaintenanceDocumentController.route()
18   *
19   * In krad-base-servlet.xml lives this gem:
20   *   <aop:config>
21           <aop:pointcut id="controllerTransaction"
22              expression="execution(* org.kuali.rice.krad.web.controller.UifControllerBase+.*(..))"/>
23           <aop:advisor advice-ref="txAdvice" pointcut-ref="controllerTransaction"/>
24       </aop:config>
25   *
26   * Which was proxying all UifControllerBase in a transaction. This is bad if you want to handle exceptions and display
27   * messages to the user without a stacktrace. To get around this, we created this indirect class that can be
28   * transactionally proxied. (Note @Transactional annotation). The propagation is set to requires new, which means that
29   * it will be in a different transaction than the  Controller's transaction and any rollbacks will stop at the proxy.
30   * Then in the controller we can catch exceptions without having our initial transaction rolling back.
31   *
32   */
33  public class ActivityOfferingControllerTransactionHelperImpl implements ActivityOfferingControllerTransactionHelper {
34  
35      /* (non-Javadoc)
36  	 * @see org.kuali.student.enrollment.class2.courseoffering.controller.ActivityOfferingControllerTransactionHelper#routeSuper(org.kuali.rice.krad.web.form.DocumentFormBase, org.springframework.validation.BindingResult, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.kuali.student.enrollment.class2.courseoffering.controller.ActivityOfferingController)
37  	 */
38      @Override
39  	@Transactional(propagation = Propagation.REQUIRES_NEW)
40      public ModelAndView routeSuper(DocumentFormBase form, BindingResult result,
41                                HttpServletRequest request, HttpServletResponse response, ActivityOfferingController activityOfferingController) {
42          return activityOfferingController.routeSuper(form, result, request, response);
43      }
44  
45  }