1 /** 2 * Copyright 2005-2014 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.inquiry; 17 18 import org.kuali.rice.krad.uif.widget.Inquiry; 19 20 import java.util.Map; 21 22 /** 23 * Provides the contract for implementing an inquiry within the 24 * inquiry framework 25 * 26 * @author Kuali Rice Team (rice.collab@kuali.org) 27 */ 28 public interface Inquirable { 29 30 /** 31 * Class for the data object the inquirable should retrieve 32 * 33 * <p> 34 * Must be set before invoking any other operations on the <code>Inquirable</code>, 35 * including the retrieveDataObject method 36 * </p> 37 * 38 * @return inquiry data object class 39 */ 40 Class<?> getDataObjectClass(); 41 42 /** 43 * @see Inquirable#getDataObjectClass() 44 */ 45 void setDataObjectClass(Class<?> dataObjectClass); 46 47 /** 48 * Responsible for retrieving the data object from its data source 49 * (database, service call, etc) based on the given map of field 50 * name/value pairs 51 * 52 * <p> 53 * Given map can contain more than fields (primary key or other) necessary 54 * for retrieving the data object. Method will use the fields necessary 55 * based on the metadata for the data object class configured on the inquirable 56 * </p> 57 * 58 * @param fieldValues - a map of string field names and values 59 * @return the data object or null if not found 60 */ 61 Object retrieveDataObject(Map<String, String> fieldValues); 62 63 /** 64 * Invoked by the <code>ViewHelperService</code> to build a link to the 65 * inquiry 66 * 67 * <p> 68 * Note this is used primarily for custom <code>Inquirable</code> 69 * implementations to customize the inquiry class or parameters for an 70 * inquiry. Instead of building the full inquiry link, implementations can 71 * make a callback to 72 * org.kuali.rice.krad.uif.widget.Inquiry.buildInquiryLink(Object, String, 73 * Class<?>, Map<String, String>) given an inquiry class and parameters to 74 * build the link field. 75 * </p> 76 * 77 * @param dataObject - parent object for the inquiry property 78 * @param propertyName - name of the property the inquiry is being built for 79 * @param inquiry - instance of the inquiry widget being built for the property 80 */ 81 void buildInquirableLink(Object dataObject, String propertyName, Inquiry inquiry); 82 }