View Javadoc
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.uif.service;
17  
18  import java.util.Map;
19  
20  import org.kuali.rice.krad.uif.field.AttributeQueryResult;
21  import org.kuali.rice.krad.uif.lifecycle.ViewPostMetadata;
22  
23  /**
24   * Provides methods for executing <code>AttributeQuery</code> instances
25   * and preparing the <code>AttributeQueryResult</code> with the result of the query
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public interface AttributeQueryService {
30  
31      /**
32       * Executes the <code>AttributeQuery</code> associated with the <code>Suggest</code> widget within
33       * the field given by the Id. The given Map of key/value pairs are used to populate the criteria part of the
34       * attribute query or as arguments to the query method. The fieldTerm parameter gives the current value
35       * of the field that should be matched on. The query is expected to return a list of values to suggest
36       *
37       * @param viewPostMetadata - post metadata related to the field
38       * @param fieldId - id for the attribute field to perform the query for
39       * @param fieldTerm - the partial value of the query field to match
40       * @param queryParameters - map of key/value pairs that are parameters to the query
41       * @return AttributeQueryResult instance populated with the List<String> data field of result data
42       */
43      public AttributeQueryResult performFieldSuggestQuery(ViewPostMetadata viewPostMetadata,
44              String fieldId, String fieldTerm, Map<String, String> queryParameters);
45  
46      /**
47       * Executes the <code>AttributeQuery</code> associated with the field given by the id. The given Map of key/value
48       * pairs are used to populate the criteria part of the attribute query or as arguments to the query method.
49       * The query is expected to return a Map of field name/value pairs (unlike the suggest query which just returns
50       * values for one field)
51       *
52       * @param viewPostMetadata - post metadata related to the field
53       * @param fieldId - id for the attribute field to perform the query for
54       * @param queryParameters - map of key/value pairs that are parameters to the query
55       * @return AttributeQueryResult instance populated with the Map<String, String> of result field data
56       */
57      public AttributeQueryResult performFieldQuery(ViewPostMetadata viewPostMetadata,
58              String fieldId, Map<String, String> queryParameters);
59  
60  }