| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Lookupable |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 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.lookup; | |
| 17 | ||
| 18 | import org.kuali.rice.krad.uif.field.InputField; | |
| 19 | import org.kuali.rice.krad.uif.field.LinkField; | |
| 20 | import org.kuali.rice.krad.uif.service.ViewHelperService; | |
| 21 | import org.kuali.rice.krad.web.form.LookupForm; | |
| 22 | ||
| 23 | import java.util.Collection; | |
| 24 | import java.util.List; | |
| 25 | import java.util.Map; | |
| 26 | ||
| 27 | /** | |
| 28 | * Provides contract for implementing a lookup within the lookup framework | |
| 29 | * | |
| 30 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 31 | */ | |
| 32 | public interface Lookupable extends ViewHelperService, java.io.Serializable { | |
| 33 | ||
| 34 | /** | |
| 35 | * Invoked to carry out the lookup search based on the given map of key/value search | |
| 36 | * values | |
| 37 | * | |
| 38 | * @param form - lookup form instance containing the lookup data | |
| 39 | * @param searchCriteria - map of criteria currently set | |
| 40 | * @param bounded - indicates whether the results should be limited (if necessary) to the max search | |
| 41 | * result limit configured | |
| 42 | * @return the list of result objects, possibly bounded | |
| 43 | */ | |
| 44 | public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded); | |
| 45 | ||
| 46 | /** | |
| 47 | * Invoked when the clear action is requested to result the search fields to | |
| 48 | * their initial default values | |
| 49 | * | |
| 50 | * @param form - lookup form instance containing the lookup data | |
| 51 | * @param searchCriteria - map of criteria currently set | |
| 52 | * @return map of criteria with field values reset to defaults | |
| 53 | */ | |
| 54 | public Map<String, String> performClear(LookupForm form, Map<String, String> searchCriteria); | |
| 55 | ||
| 56 | /** | |
| 57 | * Invoked to perform validation on the search criteria before the search is performed | |
| 58 | * | |
| 59 | * @param form - lookup form instance containing the lookup data | |
| 60 | * @param searchCriteria - map of criteria where key is search property name and value is | |
| 61 | * search value (which can include wildcards) | |
| 62 | * @param boolean true if validation was successful, false if there were errors and the search | |
| 63 | * should not be performed | |
| 64 | */ | |
| 65 | public boolean validateSearchParameters(LookupForm form, Map<String, String> searchCriteria); | |
| 66 | ||
| 67 | /** | |
| 68 | * Sets the class for the data object the lookup will be provided on | |
| 69 | * | |
| 70 | * @param dataObjectClass - data object class for lookup | |
| 71 | */ | |
| 72 | public void setDataObjectClass(Class<?> dataObjectClass); | |
| 73 | ||
| 74 | /** | |
| 75 | * Returns the class for the data object the lookup is configured with | |
| 76 | * | |
| 77 | * @return Class<?> data object class | |
| 78 | */ | |
| 79 | public Class<?> getDataObjectClass(); | |
| 80 | ||
| 81 | /** | |
| 82 | * Sets the field conversion map on the lookupable | |
| 83 | * | |
| 84 | * <p> | |
| 85 | * The field conversions map specifies the mappings for return fields. When the | |
| 86 | * user selects a row to return, for each configured field conversion the corresponding value | |
| 87 | * from the result row will be sent back as the value for the field on the calling field. | |
| 88 | * </p> | |
| 89 | * | |
| 90 | * @param fieldConversions - map of field conversions where key is name of the property on result | |
| 91 | * data object to get value for, and map value is the name of the field to send the value back as (name | |
| 92 | * of the field on the calling view) | |
| 93 | */ | |
| 94 | public void setFieldConversions(Map<String, String> fieldConversions); | |
| 95 | ||
| 96 | /** | |
| 97 | * Sets List of fields on the lookupable that should be made read only in the search | |
| 98 | * criteria group | |
| 99 | * | |
| 100 | * @param readOnlyFieldsList - list of read only fields | |
| 101 | */ | |
| 102 | public void setReadOnlyFieldsList(List<String> readOnlyFieldsList); | |
| 103 | ||
| 104 | /** | |
| 105 | * Invoked to build the return URL for a result row | |
| 106 | * | |
| 107 | * <p> | |
| 108 | * Based on the line contained in the field context, the URL for returning the role is constructed and | |
| 109 | * set as the href for the link field. If a return link cannot be constructed the field should be set | |
| 110 | * to not render | |
| 111 | * </p> | |
| 112 | * | |
| 113 | * @param returnLinkField - link field that will be used to render the return URL | |
| 114 | * @param model - lookup form containing the data | |
| 115 | */ | |
| 116 | public void getReturnUrlForResults(LinkField returnLinkField, Object model); | |
| 117 | ||
| 118 | /** | |
| 119 | * Invoked to build a maintenance URL for a result row | |
| 120 | * | |
| 121 | * <p> | |
| 122 | * Based on the line contained in the field context and the given maintenance method that should be called a | |
| 123 | * URL is constructed and set as the href on the link field. If a maintenance link cannot be constructed the | |
| 124 | * field should be set to not render | |
| 125 | * </p> | |
| 126 | * | |
| 127 | * @param actionLinkField - link field that will be used to return the maintenance URL | |
| 128 | * @param model - lookup form containing the data | |
| 129 | * @param maintenanceMethodToCall - name of the method that should be invoked in the maintenance controller | |
| 130 | */ | |
| 131 | public void getMaintenanceActionLink(LinkField actionLinkField, Object model, String maintenanceMethodToCall); | |
| 132 | ||
| 133 | public void setMultiValueLookupSelect(InputField selectField, Object model); | |
| 134 | } |