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.data.metadata;
17  
18  import com.google.common.annotations.Beta;
19  import org.kuali.rice.core.api.data.DataType;
20  import org.kuali.rice.krad.data.DataObjectService;
21  import org.kuali.rice.krad.data.provider.PersistenceProvider;
22  import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint;
23  import org.kuali.rice.krad.keyvalues.KeyValuesFinder;
24  
25  import java.beans.PropertyEditor;
26  import java.util.Set;
27  
28  /**
29  * Attribute metadata
30  *
31  * <p>
32  * Represents attribute metadata (persistent or non-persistent) for a data object.
33  * </p>
34  *
35  * @author Kuali Rice Team (rice.collab@kuali.org)
36  */
37  public interface DataObjectAttribute extends MetadataCommon {
38  
39      /**
40      * Gets the data object type
41      *
42      * <p>
43      * Gets the data object type to which this attribute belongs.
44      * </p>
45      *
46      * @return class type
47      */
48  	Class<?> getOwningType();
49  
50      /**
51      * Gets the display attribute name.
52      *
53      * <p>
54      * To be used on attributes which have an associated business key that is shown to users rather than the "internal"
55      * key which is likely a meaningless (to the users) sequence number.
56      * </p>
57      *
58      * @return user friendly business key
59      */
60  	String getDisplayAttributeName();
61  
62      /**
63      * Gets the maximum length.
64      *
65      * <p>
66      * The maximum length value which will be accepted into this field.
67      * </p>
68      *
69      * @return maximum length
70      */
71  	Long getMaxLength();
72  
73      /**
74      * Gets the minimum length.
75      *
76      * <p>
77      * The minimum length value which will be accepted into this field.
78      * </p>
79      *
80      * @return minimum length
81      */
82  	Long getMinLength();
83  
84      /**
85      * Determines if attribute is case insensitive.
86      *
87      * <p>
88      * Whether this attribute should be treated as case insensitive when performing lookups and searches.
89      * </p>
90      *
91      * @return attribute case insensitive
92      */
93  	boolean isCaseInsensitive();
94  
95      /**
96      * Determines if attribute should be forced to upper case.
97      *
98      * <p>
99      * Whether this attribute should be forced to upper case before being sent to the {@link PersistenceProvider}.
100     * </p>
101     *
102     * @return attribute forced upper case
103     */
104 	boolean isForceUppercase();
105 
106     /**
107     * Determines if attribute is required.
108     *
109     * <p>
110     * Whether (at the data level) this attribute must have a non-null value.
111     * </p>
112     *
113     * @return attribute is required
114     */
115 	boolean isRequired();
116 
117     /**
118     * BETA: Gets the bean name.
119     *
120     * <p>
121     * The bean name (in the UIF data dictionary), which checks the entered value's characters for correctness.
122     * </p>
123     *
124     * @return bean name
125     */
126     @Beta
127 	String getValidCharactersConstraintBeanName();
128 
129     /**
130     * Gets the property editor.
131     *
132     * <p>
133     * To be used by the persistence layer when loading and persisting the data.
134     * (E.g., strip extra characters from phone numbers to leave only the digits for storage in the database.).
135     * </p>
136     *
137     * @return property editor
138     */
139 	PropertyEditor getPropertyEditor();
140 
141     /**
142     * Determines attribute case insensitivity.
143     *
144     * <p>
145     * Whether this attribute is protected at the persistence level and should be protected by default when included on
146     * user interfaces.
147     * </p>
148     *
149     * @return attribute case insensitivity
150     */
151 	boolean isSensitive();
152 
153     /**
154     * Gets the values if a drop-down.
155     *
156     * <p>
157     * If this field should be rendered using a drop-down list, specify the instance on this property.
158     * </p>
159     *
160     * @return drop-down values
161     */
162 	KeyValuesFinder getValidValues();
163 
164     /**
165     * Gets the derived krad data type.
166     *
167     * <p>
168     * The derived krad-data data type used by the UIF to help generate the appropriate control and perform default
169     * validation.
170     * </p>
171     *
172     * @return derived keard data type
173     */
174     DataType getDataType();
175 
176     /**
177     * Determines whether data object is persistent.
178     *
179     * <p>
180     * Whether or not this attribute of the data object is saved to persistent storage when saved via the
181     * {@link DataObjectService}.
182     * </p>
183     *
184     * @return whether data object is persistent
185     */
186 	boolean isPersisted();
187 
188     /**
189     * Gets class type object is inherited from.
190     *
191     * <p>
192     * If this attribute is inherited from a different data object, that object's type. Otherwise null.
193     * </p>
194     *
195     * @return class type inherited from
196     */
197 	Class<?> getInheritedFromType();
198 
199     /**
200     * Gets inherited attribute name.
201     *
202     * <p>
203     * If this attribute is inherited from a different data object, the source attribute name. Otherwise null.
204     * </p>
205     *
206     * @return inherited attribute name
207     */
208 	String getInheritedFromAttributeName();
209 
210     /**
211     * Gets inherited parent attribute name.
212     *
213     * <p>
214     * If this attribute is inherited from a different data object, the attribute name on the parent object. Otherwise
215     * null.
216     * </p>
217     *
218     * @return inherited parent attribute name
219     */
220 	String getInheritedFromParentAttributeName();
221 
222     /**
223     * Determines whether attribute is inherited.
224     *
225     * <p>
226     * Whether this attribute is inherited from a different data object.
227     * </p>
228     *
229     * @return whether attribute is inherited
230     */
231 	boolean isInherited();
232 
233     /**
234     * Gets original data object.
235     *
236     * <p>
237     * Obtains the "original" data object attribute in a chain of embedded attribute definitions.
238     * </p>
239     *
240     * @return original data object
241     */
242 	DataObjectAttribute getOriginalDataObjectAttribute();
243 
244     /**
245     * BETA: Gets the display hints.
246     *
247     * <p>
248     * Returns a set of display hints which can be used by the UIF layer when displaying these fields.
249     * </p>
250     *
251     * @return display hints
252     */
253     @Beta
254 	Set<UifDisplayHint> getDisplayHints();
255 }