1 /**
2 * Copyright 2005-2013 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.krad.web.form;
17
18
19 import javax.servlet.http.HttpServletRequest;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.apache.log4j.Logger;
23 import org.kuali.rice.krad.inquiry.Inquirable;
24 import org.kuali.rice.krad.uif.UifConstants.ViewType;
25 import org.kuali.rice.krad.uif.view.InquiryView;
26
27 /**
28 * Form class for <code>InquiryView</code> screens
29 *
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 */
32 public class InquiryForm extends UifFormBase {
33 private static final long serialVersionUID = 4733144086378429410L;
34
35 private String dataObjectClassName;
36 private Object dataObject;
37
38 private boolean redirectedInquiry;
39
40 public InquiryForm() {
41 setViewTypeName(ViewType.INQUIRY);
42
43 redirectedInquiry = false;
44 }
45
46 /**
47 * Picks out business object name from the request to get retrieve a
48 * lookupable and set properties
49 */
50 @Override
51 public void postBind(HttpServletRequest request) {
52 super.postBind(request);
53
54 if (StringUtils.isBlank(getDataObjectClassName())) {
55 setDataObjectClassName(((InquiryView) getView()).getDataObjectClassName().getName());
56 }
57 }
58
59 /**
60 * Class name of the data object the inquiry will display
61 *
62 * <p>
63 * Used to set the data object class for the <code>Inquirable</code> which
64 * is then used to perform the inquiry query
65 * </p>
66 *
67 * @return String class name
68 */
69 public String getDataObjectClassName() {
70 return this.dataObjectClassName;
71 }
72
73 /**
74 * Setter for the inquiry data object class name
75 *
76 * @param dataObjectClassName
77 */
78 public void setDataObjectClassName(String dataObjectClassName) {
79 this.dataObjectClassName = dataObjectClassName;
80 }
81
82 /**
83 * Result data object for inquiry that will be display with the view
84 *
85 * @return Object object instance containing the inquiry data
86 */
87 public Object getDataObject() {
88 return this.dataObject;
89 }
90
91 /**
92 * Setter for the inquiry data object
93 *
94 * @param dataObject
95 */
96 public void setDataObject(Object dataObject) {
97 this.dataObject = dataObject;
98 }
99
100 /**
101 * Indicates whether the requested was redirected from the inquiry framework due to an external object
102 * request. This prevents the framework from performing another redirect check
103 *
104 * @return boolean true if request was a redirect, false if not
105 */
106 public boolean isRedirectedInquiry() {
107 return redirectedInquiry;
108 }
109
110 /**
111 * Setter for the redirected request indicator
112 *
113 * @param redirectedInquiry
114 */
115 public void setRedirectedInquiry(boolean redirectedInquiry) {
116 this.redirectedInquiry = redirectedInquiry;
117 }
118
119 /**
120 * <code>Inquirable</code> instance that will be used to perform
121 * the inquiry
122 *
123 * @return Inquirable instance
124 */
125 public Inquirable getInquirable() {
126 return (Inquirable) getView().getViewHelperService();
127 }
128
129 }