1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel;
17
18 import org.kuali.rice.krad.document.TransactionalDocumentControllerBase;
19 import org.kuali.rice.krad.web.form.DialogResponse;
20 import org.kuali.rice.krad.web.form.DocumentFormBase;
21 import org.springframework.stereotype.Controller;
22 import org.springframework.web.bind.annotation.RequestMapping;
23 import org.springframework.web.servlet.ModelAndView;
24
25
26
27
28 @Controller
29 @RequestMapping(value = "/approval")
30 public class TravelAuthorizationController extends TransactionalDocumentControllerBase {
31
32 @Override
33 protected TravelAuthorizationForm createInitialForm() {
34 return new TravelAuthorizationForm();
35 }
36
37
38
39
40 @Override
41 public ModelAndView route(DocumentFormBase form) {
42 String dialog = "TravelAuthorization-RouteConfirmationDialog";
43 DialogResponse routeConfirmDialog = form.getDialogResponse(dialog);
44 if (routeConfirmDialog == null) {
45 return showDialog(dialog, true, form);
46 }
47
48 boolean dialogAnswer = routeConfirmDialog.getResponseAsBoolean();
49 if (dialogAnswer) {
50 return super.route(form);
51 }
52
53 return getModelAndView(form);
54 }
55 }