1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.form;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.codehaus.jackson.map.ObjectMapper;
20 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
21 import org.kuali.rice.krad.uif.UifConstants;
22 import org.kuali.rice.krad.uif.UifConstants.ViewType;
23 import org.kuali.rice.krad.uif.UifParameters;
24 import org.kuali.rice.krad.uif.UifPropertyPaths;
25 import org.kuali.rice.krad.uif.component.Component;
26 import org.kuali.rice.krad.uif.lifecycle.ViewPostMetadata;
27 import org.kuali.rice.krad.uif.service.ViewHelperService;
28 import org.kuali.rice.krad.uif.service.ViewService;
29 import org.kuali.rice.krad.uif.util.SessionTransient;
30 import org.kuali.rice.krad.uif.view.View;
31 import org.kuali.rice.krad.uif.view.ViewModel;
32 import org.kuali.rice.krad.util.KRADUtils;
33 import org.kuali.rice.krad.web.bind.RequestAccessible;
34 import org.springframework.web.multipart.MultipartFile;
35
36 import javax.servlet.http.HttpServletRequest;
37 import java.io.IOException;
38 import java.util.ArrayList;
39 import java.util.Enumeration;
40 import java.util.HashMap;
41 import java.util.HashSet;
42 import java.util.List;
43 import java.util.Map;
44 import java.util.Properties;
45 import java.util.Set;
46 import java.util.UUID;
47
48
49
50
51
52
53
54
55
56 public class UifFormBase implements ViewModel {
57
58 private static final long serialVersionUID = 8432543267099454434L;
59
60 @RequestAccessible
61 protected String viewId;
62
63 @RequestAccessible
64 protected String viewName;
65
66 @RequestAccessible
67 protected ViewType viewTypeName;
68
69 @RequestAccessible
70 protected String pageId;
71
72 @RequestAccessible
73 protected String methodToCall;
74
75 @RequestAccessible
76 protected String formKey;
77
78 @RequestAccessible
79 @SessionTransient
80 protected String requestedFormKey;
81
82 @RequestAccessible
83 protected String flowKey;
84
85 protected String sessionId;
86 protected int sessionTimeoutInterval;
87
88 @SessionTransient
89 protected HistoryFlow historyFlow;
90 @SessionTransient
91 protected HistoryManager historyManager;
92
93 @RequestAccessible
94 @SessionTransient
95 protected String jumpToId;
96
97 @SessionTransient
98 protected String jumpToName;
99
100 @RequestAccessible
101 @SessionTransient
102 protected String focusId;
103
104 @RequestAccessible
105 @SessionTransient
106 protected boolean dirtyForm;
107
108 protected String formPostUrl;
109 protected String controllerMapping;
110
111 @SessionTransient
112 private String requestUrl;
113 private Map<String, String[]> initialRequestParameters;
114
115 protected String state;
116
117 @RequestAccessible
118 protected boolean renderedInDialog;
119
120 @RequestAccessible
121 protected boolean renderedInIframe;
122
123 @SessionTransient
124 protected String growlScript;
125
126 @SessionTransient
127 protected View view;
128 protected ViewPostMetadata viewPostMetadata;
129
130 protected Map<String, String> viewRequestParameters;
131 protected List<String> readOnlyFieldsList;
132
133 protected Map<String, Object> newCollectionLines;
134
135 @RequestAccessible
136 @SessionTransient
137 protected String triggerActionId;
138
139 @RequestAccessible
140 @SessionTransient
141 protected Map<String, String> actionParameters;
142
143 protected Map<String, Object> clientStateForSyncing;
144
145 @SessionTransient
146 protected Map<String, Set<String>> selectedCollectionLines;
147
148 protected Set<String> selectedLookupResultsCache;
149
150 protected List<Object> addedCollectionItems;
151
152 @SessionTransient
153 protected MultipartFile attachmentFile;
154
155
156 @RequestAccessible
157 protected String returnLocation;
158
159 @RequestAccessible
160 protected String returnFormKey;
161
162 @RequestAccessible
163 @SessionTransient
164 protected boolean ajaxRequest;
165
166 @RequestAccessible
167 @SessionTransient
168 protected String ajaxReturnType;
169
170 @SessionTransient
171 private String requestJsonTemplate;
172 @SessionTransient
173 private boolean collectionPagingRequest;
174
175
176 @RequestAccessible
177 @SessionTransient
178 protected String showDialogId;
179
180 @RequestAccessible
181 @SessionTransient
182 protected String returnDialogId;
183
184 @RequestAccessible
185 @SessionTransient
186 protected String returnDialogResponse;
187
188 @RequestAccessible
189 protected Map<String, String> dialogExplanations;
190 protected Map<String, DialogResponse> dialogResponses;
191
192 @SessionTransient
193 protected boolean requestRedirected;
194
195 @RequestAccessible
196 @SessionTransient
197 protected String updateComponentId;
198 @SessionTransient
199 private Component updateComponent;
200
201 @RequestAccessible
202 protected Map<String, Object> extensionData;
203
204 protected boolean applyDefaultValues;
205
206 protected boolean evaluateFlagsAndModes;
207 protected Boolean canEditView;
208 protected Map<String, Boolean> actionFlags;
209 protected Map<String, Boolean> editModes;
210
211 protected HttpServletRequest request;
212
213 private Object dialogDataObject;
214
215 public UifFormBase() {
216 renderedInDialog = false;
217 renderedInIframe = false;
218 requestRedirected = false;
219
220 readOnlyFieldsList = new ArrayList<String>();
221 viewRequestParameters = new HashMap<String, String>();
222 newCollectionLines = new HashMap<String, Object>();
223 actionParameters = new HashMap<String, String>();
224 clientStateForSyncing = new HashMap<String, Object>();
225 selectedCollectionLines = new HashMap<String, Set<String>>();
226 selectedLookupResultsCache = new HashSet<String>();
227 addedCollectionItems = new ArrayList<Object>();
228 dialogExplanations = new HashMap<String, String>();
229 dialogResponses = new HashMap<String, DialogResponse>();
230 extensionData = new HashMap<String, Object>();
231
232 applyDefaultValues = true;
233 evaluateFlagsAndModes = true;
234 }
235
236
237
238
239 @Override
240 public void preBind(HttpServletRequest request) {
241 String formKeyParam = request.getParameter(UifParameters.FORM_KEY);
242 if (StringUtils.isNotBlank(formKeyParam)) {
243 UifFormManager uifFormManager = (UifFormManager) request.getSession().getAttribute(
244 UifParameters.FORM_MANAGER);
245
246
247 uifFormManager.updateFormWithSession(this, formKeyParam);
248 }
249
250 String requestedFormKey = request.getParameter(UifParameters.REQUESTED_FORM_KEY);
251 if (StringUtils.isNotBlank(requestedFormKey)) {
252 setRequestedFormKey(requestedFormKey);
253 } else {
254 setRequestedFormKey(formKeyParam);
255 }
256
257 this.request = request;
258 }
259
260
261
262
263 @Override
264 public void postBind(HttpServletRequest request) {
265
266 UifFormManager uifFormManager = (UifFormManager) request.getSession().getAttribute(UifParameters.FORM_MANAGER);
267 if (StringUtils.isBlank(formKey) || !uifFormManager.hasSessionForm(formKey)) {
268 formKey = generateFormKey();
269 }
270
271
272 formPostUrl = request.getRequestURL().toString();
273
274 controllerMapping = request.getPathInfo();
275
276 if (request.getSession() != null) {
277 sessionId = request.getSession().getId();
278 sessionTimeoutInterval = request.getSession().getMaxInactiveInterval();
279 }
280
281
282 if (request.getParameterMap().containsKey(UifParameters.CLIENT_VIEW_STATE)) {
283 String clientStateJSON = request.getParameter(UifParameters.CLIENT_VIEW_STATE);
284 if (StringUtils.isNotBlank(clientStateJSON)) {
285
286 clientStateJSON = StringUtils.replace(clientStateJSON, "\\'", "\"");
287 clientStateJSON = StringUtils.replace(clientStateJSON, "\\[", "[");
288 clientStateJSON = StringUtils.replace(clientStateJSON, "\\]", "]");
289 clientStateJSON = StringUtils.replace(clientStateJSON, "'", "\"");
290
291 ObjectMapper mapper = new ObjectMapper();
292 try {
293 clientStateForSyncing = mapper.readValue(clientStateJSON, Map.class);
294 } catch (IOException e) {
295 throw new RuntimeException("Unable to decode client side state JSON: " + clientStateJSON, e);
296 }
297 }
298 }
299
300 String requestUrl = KRADUtils.stripXSSPatterns(KRADUtils.getFullURL(request));
301 setRequestUrl(requestUrl);
302
303 String referer = request.getHeader(UifConstants.REFERER);
304 if (StringUtils.isBlank(referer) && StringUtils.isBlank(getReturnLocation())) {
305 setReturnLocation(UifConstants.NO_RETURN);
306 } else if (StringUtils.isBlank(getReturnLocation())) {
307 setReturnLocation(referer);
308 }
309
310 if (getInitialRequestParameters() == null) {
311 Map<String, String[]> requestParams = new HashMap<String, String[]>();
312 Enumeration<String> names = request.getParameterNames();
313
314 while (names != null && names.hasMoreElements()) {
315 String name = KRADUtils.stripXSSPatterns(names.nextElement());
316 String[] values = KRADUtils.stripXSSPatterns(request.getParameterValues(name));
317
318 requestParams.put(name, values);
319 }
320
321 requestParams.remove(UifConstants.UrlParams.LOGIN_USER);
322 setInitialRequestParameters(requestParams);
323 }
324
325
326 if (request.getParameter(UifParameters.READ_ONLY_FIELDS) != null) {
327 String readOnlyFields = request.getParameter(UifParameters.READ_ONLY_FIELDS);
328 setReadOnlyFieldsList(KRADUtils.convertStringParameterToList(readOnlyFields));
329 }
330
331
332 if (request.getParameter(UifParameters.RETURN_FROM_DIALOG) != null) {
333 String dialogExplanation = null;
334 if ((dialogExplanations != null) && dialogExplanations.containsKey(returnDialogId)) {
335 dialogExplanation = dialogExplanations.get(returnDialogId);
336 }
337
338 DialogResponse response = new DialogResponse(returnDialogId, returnDialogResponse, dialogExplanation);
339 this.dialogResponses.put(this.returnDialogId, response);
340 } else {
341 this.dialogResponses = new HashMap<String, DialogResponse>();
342 }
343
344 Object historyManager = request.getSession().getAttribute(UifConstants.HistoryFlow.HISTORY_MANAGER);
345 if (historyManager != null && historyManager instanceof HistoryManager) {
346 setHistoryManager((HistoryManager) historyManager);
347
348 String flowKey = request.getParameter(UifConstants.HistoryFlow.FLOW);
349 setFlowKey(flowKey);
350 }
351
352
353 this.pageId = KRADUtils.stripXSSPatterns(this.pageId);
354 this.methodToCall = KRADUtils.stripXSSPatterns(this.methodToCall);
355 this.formKey = KRADUtils.stripXSSPatterns(this.formKey);
356 this.requestedFormKey = KRADUtils.stripXSSPatterns(this.requestedFormKey);
357 this.flowKey = KRADUtils.stripXSSPatterns(this.flowKey);
358 this.sessionId = KRADUtils.stripXSSPatterns(this.sessionId);
359 this.formPostUrl = KRADUtils.stripXSSPatterns(this.formPostUrl);
360 this.returnLocation = KRADUtils.stripXSSPatterns(this.returnLocation);
361 this.returnFormKey = KRADUtils.stripXSSPatterns(this.returnFormKey);
362 this.requestUrl = KRADUtils.stripXSSPatterns(this.requestUrl);
363 }
364
365
366
367
368 @Override
369 public void preRender(HttpServletRequest request) {
370
371 this.returnDialogId = null;
372 this.returnDialogResponse = null;
373 this.dialogExplanations = new HashMap<String, String>();
374 }
375
376
377
378
379
380
381
382 protected String generateFormKey() {
383 return UUID.randomUUID().toString();
384 }
385
386
387
388
389 @Override
390 public String getViewId() {
391 return this.viewId;
392 }
393
394
395
396
397 @Override
398 public void setViewId(String viewId) {
399 this.viewId = viewId;
400 }
401
402
403
404
405 @Override
406 public String getViewName() {
407 return this.viewName;
408 }
409
410
411
412
413 @Override
414 public void setViewName(String viewName) {
415 this.viewName = viewName;
416 }
417
418
419
420
421 @Override
422 public ViewType getViewTypeName() {
423 return this.viewTypeName;
424 }
425
426
427
428
429 @Override
430 public void setViewTypeName(ViewType viewTypeName) {
431 this.viewTypeName = viewTypeName;
432 }
433
434
435
436
437 @Override
438 public String getPageId() {
439 return this.pageId;
440 }
441
442
443
444
445 @Override
446 public void setPageId(String pageId) {
447 this.pageId = pageId;
448 }
449
450
451
452
453 @Override
454 public String getFormPostUrl() {
455 return this.formPostUrl;
456 }
457
458
459
460
461 @Override
462 public void setFormPostUrl(String formPostUrl) {
463 this.formPostUrl = formPostUrl;
464 }
465
466
467
468
469
470
471 public String getControllerMapping() {
472 return controllerMapping;
473 }
474
475
476
477
478
479
480
481 public HistoryFlow getHistoryFlow() {
482 return historyFlow;
483 }
484
485
486
487
488 public void setHistoryFlow(HistoryFlow historyFlow) {
489 this.historyFlow = historyFlow;
490 }
491
492
493
494
495
496
497
498
499 public HistoryManager getHistoryManager() {
500 return historyManager;
501 }
502
503
504
505
506 public void setHistoryManager(HistoryManager historyManager) {
507 this.historyManager = historyManager;
508 }
509
510
511
512
513
514
515
516
517
518
519 public String getFlowKey() {
520 return flowKey;
521 }
522
523
524
525
526 public void setFlowKey(String flowKey) {
527 this.flowKey = flowKey;
528 }
529
530
531
532
533
534
535
536 public String getRequestUrl() {
537 return requestUrl;
538 }
539
540
541
542
543 public void setRequestUrl(String requestUrl) {
544 this.requestUrl = requestUrl;
545 }
546
547
548
549
550
551
552
553 public Map<String, String[]> getInitialRequestParameters() {
554 return initialRequestParameters;
555 }
556
557
558
559
560 public void setInitialRequestParameters(Map<String, String[]> requestParameters) {
561 this.initialRequestParameters = requestParameters;
562 }
563
564 public String getReturnLocation() {
565 return this.returnLocation;
566 }
567
568 public void setReturnLocation(String returnLocation) {
569 this.returnLocation = returnLocation;
570 }
571
572 public String getReturnFormKey() {
573 return this.returnFormKey;
574 }
575
576 public void setReturnFormKey(String returnFormKey) {
577 this.returnFormKey = returnFormKey;
578 }
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594 public String getSessionId() {
595 return sessionId;
596 }
597
598
599
600
601
602
603
604
605
606
607
608
609 public int getSessionTimeoutInterval() {
610 return sessionTimeoutInterval;
611 }
612
613
614
615
616
617
618
619
620 public String getMethodToCall() {
621 return this.methodToCall;
622 }
623
624
625
626
627 public void setMethodToCall(String methodToCall) {
628 this.methodToCall = methodToCall;
629 }
630
631
632
633
634 @Override
635 public Map<String, String> getViewRequestParameters() {
636 return this.viewRequestParameters;
637 }
638
639
640
641
642 @Override
643 public void setViewRequestParameters(Map<String, String> viewRequestParameters) {
644 this.viewRequestParameters = viewRequestParameters;
645 }
646
647
648
649
650 @Override
651 public List<String> getReadOnlyFieldsList() {
652 return readOnlyFieldsList;
653 }
654
655
656
657
658 @Override
659 public void setReadOnlyFieldsList(List<String> readOnlyFieldsList) {
660 this.readOnlyFieldsList = readOnlyFieldsList;
661 }
662
663
664
665
666 @Override
667 public Map<String, Object> getNewCollectionLines() {
668 return this.newCollectionLines;
669 }
670
671
672
673
674 @Override
675 public void setNewCollectionLines(Map<String, Object> newCollectionLines) {
676 this.newCollectionLines = newCollectionLines;
677 }
678
679
680
681
682 @Override
683 public String getTriggerActionId() {
684 return triggerActionId;
685 }
686
687
688
689
690 @Override
691 public void setTriggerActionId(String triggerActionId) {
692 this.triggerActionId = triggerActionId;
693 }
694
695
696
697
698 @Override
699 public Map<String, String> getActionParameters() {
700 return this.actionParameters;
701 }
702
703
704
705
706
707
708 public Properties getActionParametersAsProperties() {
709 return KRADUtils.convertMapToProperties(actionParameters);
710 }
711
712
713
714
715 @Override
716 public void setActionParameters(Map<String, String> actionParameters) {
717 this.actionParameters = actionParameters;
718 }
719
720
721
722
723
724
725
726
727 public String getActionParamaterValue(String actionParameterName) {
728 if ((actionParameters != null) && actionParameters.containsKey(actionParameterName)) {
729 return actionParameters.get(actionParameterName);
730 }
731
732 return "";
733 }
734
735
736
737
738
739
740
741
742
743
744
745
746
747 public String getActionEvent() {
748 if ((actionParameters != null) && actionParameters.containsKey(UifConstants.UrlParams.ACTION_EVENT)) {
749 return actionParameters.get(UifConstants.UrlParams.ACTION_EVENT);
750 }
751
752 return "";
753 }
754
755
756
757
758 @Override
759 public Map<String, Object> getClientStateForSyncing() {
760 return clientStateForSyncing;
761 }
762
763
764
765
766 public void setClientStateForSyncing(Map<String, Object> clientStateForSyncing) {
767 this.clientStateForSyncing = clientStateForSyncing;
768 }
769
770
771
772
773 @Override
774 public Map<String, Set<String>> getSelectedCollectionLines() {
775 return selectedCollectionLines;
776 }
777
778
779
780
781 @Override
782 public void setSelectedCollectionLines(Map<String, Set<String>> selectedCollectionLines) {
783 this.selectedCollectionLines = selectedCollectionLines;
784 }
785
786
787
788
789
790
791
792
793
794 public Set<String> getSelectedLookupResultsCache() {
795 return selectedLookupResultsCache;
796 }
797
798
799
800
801 public void setSelectedLookupResultsCache(Set<String> selectedLookupResultsCache) {
802 this.selectedLookupResultsCache = selectedLookupResultsCache;
803 }
804
805
806
807
808
809
810
811
812
813
814
815
816 public String getFormKey() {
817 return this.formKey;
818 }
819
820
821
822
823 public void setFormKey(String formKey) {
824 this.formKey = formKey;
825 }
826
827
828
829
830
831
832
833 public String getRequestedFormKey() {
834 return requestedFormKey;
835 }
836
837
838
839
840 public void setRequestedFormKey(String requestedFormKey) {
841 this.requestedFormKey = requestedFormKey;
842 }
843
844
845
846
847
848
849 public boolean isRequestRedirected() {
850 return requestRedirected;
851 }
852
853
854
855
856 public void setRequestRedirected(boolean requestRedirected) {
857 this.requestRedirected = requestRedirected;
858 }
859
860
861
862
863
864
865 public MultipartFile getAttachmentFile() {
866 return this.attachmentFile;
867 }
868
869
870
871
872 public void setAttachmentFile(MultipartFile attachmentFile) {
873 this.attachmentFile = attachmentFile;
874 }
875
876
877
878
879 @Override
880 public String getUpdateComponentId() {
881 return updateComponentId;
882 }
883
884
885
886
887 @Override
888 public void setUpdateComponentId(String updateComponentId) {
889 this.updateComponentId = updateComponentId;
890 }
891
892
893
894
895 public Component getUpdateComponent() {
896 return updateComponent;
897 }
898
899
900
901
902 public void setUpdateComponent(Component updateComponent) {
903 this.updateComponent = updateComponent;
904 }
905
906
907
908
909 @Override
910 public View getView() {
911 return this.view;
912 }
913
914
915
916
917 @Override
918 public void setView(View view) {
919 this.view = view;
920 }
921
922
923
924
925
926
927
928
929
930 @Override
931 public ViewHelperService getViewHelperService() {
932 if ((getView() != null) && (getView().getViewHelperService() != null)) {
933 return getView().getViewHelperService();
934 }
935
936 String viewId = getViewId();
937 if (StringUtils.isBlank(viewId) && (getView() != null)) {
938 viewId = getView().getId();
939 }
940
941 if (StringUtils.isBlank(viewId)) {
942 return null;
943 }
944
945 ViewHelperService viewHelperService =
946 (ViewHelperService) KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryBeanProperty(viewId,
947 UifPropertyPaths.VIEW_HELPER_SERVICE);
948 if (viewHelperService == null) {
949 Class<?> viewHelperServiceClass =
950 (Class<?>) KRADServiceLocatorWeb.getDataDictionaryService().getDictionaryBeanProperty(viewId,
951 UifPropertyPaths.VIEW_HELPER_SERVICE_CLASS);
952
953 if (viewHelperServiceClass != null) {
954 try {
955 viewHelperService = (ViewHelperService) viewHelperServiceClass.newInstance();
956 } catch (Exception e) {
957 throw new RuntimeException("Unable to instantiate view helper class: " + viewHelperServiceClass, e);
958 }
959 }
960 }
961
962 return viewHelperService;
963 }
964
965
966
967
968 @Override
969 public ViewPostMetadata getViewPostMetadata() {
970 return viewPostMetadata;
971 }
972
973
974
975
976 @Override
977 public void setViewPostMetadata(ViewPostMetadata viewPostMetadata) {
978 this.viewPostMetadata = viewPostMetadata;
979 }
980
981
982
983
984
985
986
987 protected ViewService getViewService() {
988 return KRADServiceLocatorWeb.getViewService();
989 }
990
991
992
993
994
995
996
997
998
999 public String getJumpToId() {
1000 return this.jumpToId;
1001 }
1002
1003
1004
1005
1006 public void setJumpToId(String jumpToId) {
1007 this.jumpToId = jumpToId;
1008 }
1009
1010
1011
1012
1013
1014
1015
1016
1017 public String getJumpToName() {
1018 return this.jumpToName;
1019 }
1020
1021
1022
1023
1024 public void setJumpToName(String jumpToName) {
1025 this.jumpToName = jumpToName;
1026 }
1027
1028
1029
1030
1031
1032
1033
1034 public String getFocusId() {
1035 return this.focusId;
1036 }
1037
1038
1039
1040
1041 public void setFocusId(String focusId) {
1042 this.focusId = focusId;
1043 }
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056 public boolean isDirtyForm() {
1057 return dirtyForm;
1058 }
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069 public void setDirtyForm(boolean dirtyForm) {
1070 this.dirtyForm = dirtyForm;
1071 }
1072
1073
1074
1075
1076 public void setDirtyForm(String dirtyForm) {
1077 if (dirtyForm != null) {
1078 this.dirtyForm = Boolean.parseBoolean(dirtyForm);
1079 }
1080 }
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093 public boolean isRenderedInDialog() {
1094 return this.renderedInDialog;
1095 }
1096
1097
1098
1099
1100 public void setRenderedInDialog(boolean renderedInDialog) {
1101 this.renderedInDialog = renderedInDialog;
1102 }
1103
1104
1105
1106
1107
1108
1109 public boolean isRenderedInIframe() {
1110 return renderedInIframe;
1111 }
1112
1113
1114
1115
1116 public void setRenderedInIframe(boolean renderedInIframe) {
1117 this.renderedInIframe = renderedInIframe;
1118 }
1119
1120
1121
1122
1123 @Override
1124 public boolean isApplyDefaultValues() {
1125 return applyDefaultValues;
1126 }
1127
1128
1129
1130
1131 @Override
1132 public void setApplyDefaultValues(boolean applyDefaultValues) {
1133 this.applyDefaultValues = applyDefaultValues;
1134 }
1135
1136
1137
1138
1139 public boolean isEvaluateFlagsAndModes() {
1140 return evaluateFlagsAndModes;
1141 }
1142
1143
1144
1145
1146 public void setEvaluateFlagsAndModes(boolean evaluateFlagsAndModes) {
1147 this.evaluateFlagsAndModes = evaluateFlagsAndModes;
1148 }
1149
1150
1151
1152
1153 public Boolean isCanEditView() {
1154 return canEditView;
1155 }
1156
1157
1158
1159
1160 public void setCanEditView(Boolean canEditView) {
1161 this.canEditView = canEditView;
1162 }
1163
1164
1165
1166
1167 public Map<String, Boolean> getActionFlags() {
1168 return actionFlags;
1169 }
1170
1171
1172
1173
1174 public void setActionFlags(Map<String, Boolean> actionFlags) {
1175 this.actionFlags = actionFlags;
1176 }
1177
1178
1179
1180
1181 public Map<String, Boolean> getEditModes() {
1182 return editModes;
1183 }
1184
1185
1186
1187
1188 public void setEditModes(Map<String, Boolean> editModes) {
1189 this.editModes = editModes;
1190 }
1191
1192
1193
1194
1195 @Override
1196 public String getGrowlScript() {
1197 return growlScript;
1198 }
1199
1200
1201
1202
1203 @Override
1204 public void setGrowlScript(String growlScript) {
1205 this.growlScript = growlScript;
1206 }
1207
1208
1209
1210
1211 @Override
1212 public String getState() {
1213 return state;
1214 }
1215
1216
1217
1218
1219 @Override
1220 public void setState(String state) {
1221 this.state = state;
1222 }
1223
1224
1225
1226
1227 @Override
1228 public boolean isAjaxRequest() {
1229 return ajaxRequest;
1230 }
1231
1232
1233
1234
1235 @Override
1236 public void setAjaxRequest(boolean ajaxRequest) {
1237 this.ajaxRequest = ajaxRequest;
1238 }
1239
1240
1241
1242
1243 @Override
1244 public String getAjaxReturnType() {
1245 return ajaxReturnType;
1246 }
1247
1248
1249
1250
1251 @Override
1252 public void setAjaxReturnType(String ajaxReturnType) {
1253 this.ajaxReturnType = ajaxReturnType;
1254 }
1255
1256
1257
1258
1259 @Override
1260 public boolean isUpdateComponentRequest() {
1261 return isAjaxRequest() && StringUtils.isNotBlank(getAjaxReturnType()) && getAjaxReturnType().equals(
1262 UifConstants.AjaxReturnTypes.UPDATECOMPONENT.getKey());
1263 }
1264
1265
1266
1267
1268 @Override
1269 public boolean isUpdateDialogRequest() {
1270 return isAjaxRequest() && StringUtils.isNotBlank(getAjaxReturnType()) && getAjaxReturnType().equals(
1271 UifConstants.AjaxReturnTypes.UPDATEDIALOG.getKey());
1272 }
1273
1274
1275
1276
1277 @Override
1278 public boolean isUpdatePageRequest() {
1279 return StringUtils.isNotBlank(getAjaxReturnType()) && getAjaxReturnType().equals(
1280 UifConstants.AjaxReturnTypes.UPDATEPAGE.getKey());
1281 }
1282
1283
1284
1285
1286 @Override
1287 public boolean isUpdateNoneRequest() {
1288 return StringUtils.isNotBlank(getAjaxReturnType()) && getAjaxReturnType().equals(
1289 UifConstants.AjaxReturnTypes.UPDATENONE.getKey());
1290 }
1291
1292
1293
1294
1295 @Override
1296 public boolean isJsonRequest() {
1297 return StringUtils.isNotBlank(getRequestJsonTemplate());
1298 }
1299
1300
1301
1302
1303 @Override
1304 public String getRequestJsonTemplate() {
1305 return requestJsonTemplate;
1306 }
1307
1308
1309
1310
1311 @Override
1312 public void setRequestJsonTemplate(String requestJsonTemplate) {
1313 this.requestJsonTemplate = requestJsonTemplate;
1314 }
1315
1316
1317
1318
1319 @Override
1320 public boolean isCollectionPagingRequest() {
1321 return collectionPagingRequest;
1322 }
1323
1324
1325
1326
1327 @Override
1328 public void setCollectionPagingRequest(boolean collectionPagingRequest) {
1329 this.collectionPagingRequest = collectionPagingRequest;
1330 }
1331
1332
1333
1334
1335
1336 public String getShowDialogId() {
1337 return showDialogId;
1338 }
1339
1340
1341
1342
1343 public void setShowDialogId(String dialogId) {
1344 this.showDialogId = dialogId;
1345 }
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356 public String getReturnDialogId() {
1357 return returnDialogId;
1358 }
1359
1360
1361
1362
1363 public void setReturnDialogId(String returnDialogId) {
1364 this.returnDialogId = returnDialogId;
1365 }
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376 public String getReturnDialogResponse() {
1377 return returnDialogResponse;
1378 }
1379
1380
1381
1382
1383 public void setReturnDialogResponse(String returnDialogResponse) {
1384 this.returnDialogResponse = returnDialogResponse;
1385 }
1386
1387
1388
1389
1390 @Override
1391 public Map<String, String> getDialogExplanations() {
1392 return dialogExplanations;
1393 }
1394
1395
1396
1397
1398 @Override
1399 public void setDialogExplanations(Map<String, String> dialogExplanations) {
1400 this.dialogExplanations = dialogExplanations;
1401 }
1402
1403
1404
1405
1406 @Override
1407 public Map<String, DialogResponse> getDialogResponses() {
1408 return dialogResponses;
1409 }
1410
1411
1412
1413
1414 @Override
1415 public DialogResponse getDialogResponse(String dialogId) {
1416 if ((dialogResponses != null) && dialogResponses.containsKey(dialogId)) {
1417 return dialogResponses.get(dialogId);
1418 }
1419
1420 return null;
1421 }
1422
1423
1424
1425
1426 @Override
1427 public void setDialogResponses(Map<String, DialogResponse> dialogResponses) {
1428 this.dialogResponses = dialogResponses;
1429 }
1430
1431
1432
1433
1434 @Override
1435 public Map<String, Object> getExtensionData() {
1436 return extensionData;
1437 }
1438
1439
1440
1441
1442 @Override
1443 public void setExtensionData(Map<String, Object> extensionData) {
1444 this.extensionData = extensionData;
1445 }
1446
1447
1448
1449
1450
1451
1452 public HttpServletRequest getRequest() {
1453 return request;
1454 }
1455
1456
1457
1458
1459 public void setRequest(HttpServletRequest request) {
1460 this.request = request;
1461 }
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472 public List getAddedCollectionItems() {
1473 return addedCollectionItems;
1474 }
1475
1476
1477
1478
1479 public void setAddedCollectionItems(List addedCollectionItems) {
1480 this.addedCollectionItems = addedCollectionItems;
1481 }
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494 public boolean isAddedCollectionItem(Object item) {
1495 return addedCollectionItems.contains(item);
1496 }
1497
1498
1499
1500
1501
1502
1503
1504
1505 public Object getDialogDataObject() {
1506 return dialogDataObject;
1507 }
1508
1509
1510
1511
1512 public void setDialogDataObject(Object dataObject) {
1513 this.dialogDataObject = dataObject;
1514 }
1515
1516 @Override
1517 public String toString() {
1518 StringBuilder builder = new StringBuilder();
1519 builder.append(getClass().getSimpleName()).append(" [viewId=").append(this.viewId).append(", viewName=").append(
1520 this.viewName).append(", viewTypeName=").append(this.viewTypeName).append(", pageId=").append(
1521 this.pageId).append(", methodToCall=").append(this.methodToCall).append(", formKey=").append(
1522 this.formKey).append(", requestedFormKey=").append(this.requestedFormKey).append("]");
1523 return builder.toString();
1524 }
1525 }