View Javadoc

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.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       * Sets the 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       * @param dataObjectClass the class of the dataObject that this inquirable should
39       * retrieve
40       */
41      public void setDataObjectClass(Class<?> dataObjectClass);
42  
43      /**
44       * Responsible for retrieving the data object from its data source
45       * (database, service call, etc) based on the given map of field
46       * name/value pairs
47       *
48       * <p>
49       * Given map can contain more than fields (primary key or other) necessary
50       * for retrieving the data object. Method will use the fields necessary
51       * based on the metadata for the data object class configured on the inquirable
52       * </p>
53       *
54       * @param fieldValues - a map of string field names and values
55       * @return the data object or null if not found
56       */
57      public Object retrieveDataObject(Map<String, String> fieldValues);
58  
59      /**
60       * Invoked by the <code>ViewHelperService</code> to build a link to the
61       * inquiry
62       *
63       * <p>
64       * Note this is used primarily for custom <code>Inquirable</code>
65       * implementations to customize the inquiry class or parameters for an
66       * inquiry. Instead of building the full inquiry link, implementations can
67       * make a callback to
68       * org.kuali.rice.krad.uif.widget.Inquiry.buildInquiryLink(Object, String,
69       * Class<?>, Map<String, String>) given an inquiry class and parameters to
70       * build the link field.
71       * </p>
72       *
73       * @param dataObject - parent object for the inquiry property
74       * @param propertyName - name of the property the inquiry is being built for
75       * @param inquiry - instance of the inquiry widget being built for the property
76       */
77      public void buildInquirableLink(Object dataObject, String propertyName, Inquiry inquiry);
78  }