| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| InquiryForm |
|
| 1.1428571428571428;1.143 |
| 1 | /* | |
| 2 | * Copyright 2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 1.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/ecl1.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.container.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 | 0 | private static final Logger LOG = Logger.getLogger(InquiryForm.class); |
| 35 | ||
| 36 | private String dataObjectClassName; | |
| 37 | private Object dataObject; | |
| 38 | ||
| 39 | 0 | public InquiryForm() { |
| 40 | 0 | setViewTypeName(ViewType.INQUIRY); |
| 41 | 0 | } |
| 42 | ||
| 43 | /** | |
| 44 | * Picks out business object name from the request to get retrieve a | |
| 45 | * lookupable and set properties | |
| 46 | */ | |
| 47 | @Override | |
| 48 | public void postBind(HttpServletRequest request) { | |
| 49 | 0 | super.postBind(request); |
| 50 | ||
| 51 | 0 | if (StringUtils.isBlank(getDataObjectClassName())) { |
| 52 | 0 | setDataObjectClassName(((InquiryView) getView()).getDataObjectClassName().getName()); |
| 53 | } | |
| 54 | 0 | } |
| 55 | ||
| 56 | /** | |
| 57 | * Class name of the data object the inquiry will display | |
| 58 | * | |
| 59 | * <p> | |
| 60 | * Used to set the data object class for the <code>Inquirable</code> which | |
| 61 | * is then used to perform the inquiry query | |
| 62 | * </p> | |
| 63 | * | |
| 64 | * @return String class name | |
| 65 | */ | |
| 66 | public String getDataObjectClassName() { | |
| 67 | 0 | return this.dataObjectClassName; |
| 68 | } | |
| 69 | ||
| 70 | /** | |
| 71 | * Setter for the inquiry data object class name | |
| 72 | * | |
| 73 | * @param dataObjectClassName | |
| 74 | */ | |
| 75 | public void setDataObjectClassName(String dataObjectClassName) { | |
| 76 | 0 | this.dataObjectClassName = dataObjectClassName; |
| 77 | 0 | } |
| 78 | ||
| 79 | /** | |
| 80 | * Result data object for inquiry that will be display with the view | |
| 81 | * | |
| 82 | * @return Object object instance containing the inquiry data | |
| 83 | */ | |
| 84 | public Object getDataObject() { | |
| 85 | 0 | return this.dataObject; |
| 86 | } | |
| 87 | ||
| 88 | /** | |
| 89 | * Setter for the inquiry data object | |
| 90 | * | |
| 91 | * @param dataObject | |
| 92 | */ | |
| 93 | public void setDataObject(Object dataObject) { | |
| 94 | 0 | this.dataObject = dataObject; |
| 95 | 0 | } |
| 96 | ||
| 97 | /** | |
| 98 | * <code>Inquirable</code> instance that will be used to perform | |
| 99 | * the inquiry | |
| 100 | * | |
| 101 | * @return Inquirable instance | |
| 102 | */ | |
| 103 | public Inquirable getInquirable() { | |
| 104 | 0 | return (Inquirable) getView().getViewHelperService(); |
| 105 | } | |
| 106 | ||
| 107 | } |