001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krad.data.metadata; 017 018import com.google.common.annotations.Beta; 019import org.kuali.rice.core.api.data.DataType; 020import org.kuali.rice.krad.data.DataObjectService; 021import org.kuali.rice.krad.data.provider.PersistenceProvider; 022import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint; 023import org.kuali.rice.krad.keyvalues.KeyValuesFinder; 024 025import java.beans.PropertyEditor; 026import java.util.Set; 027 028/** 029* Attribute metadata 030* 031* <p> 032* Represents attribute metadata (persistent or non-persistent) for a data object. 033* </p> 034* 035* @author Kuali Rice Team (rice.collab@kuali.org) 036*/ 037public interface DataObjectAttribute extends MetadataCommon { 038 039 /** 040 * Gets the data object type 041 * 042 * <p> 043 * Gets the data object type to which this attribute belongs. 044 * </p> 045 * 046 * @return class type 047 */ 048 Class<?> getOwningType(); 049 050 /** 051 * Gets the display attribute name. 052 * 053 * <p> 054 * To be used on attributes which have an associated business key that is shown to users rather than the "internal" 055 * key which is likely a meaningless (to the users) sequence number. 056 * </p> 057 * 058 * @return user friendly business key 059 */ 060 String getDisplayAttributeName(); 061 062 /** 063 * Gets the maximum length. 064 * 065 * <p> 066 * The maximum length value which will be accepted into this field. 067 * </p> 068 * 069 * @return maximum length 070 */ 071 Long getMaxLength(); 072 073 /** 074 * Gets the minimum length. 075 * 076 * <p> 077 * The minimum length value which will be accepted into this field. 078 * </p> 079 * 080 * @return minimum length 081 */ 082 Long getMinLength(); 083 084 /** 085 * Determines if attribute is case insensitive. 086 * 087 * <p> 088 * Whether this attribute should be treated as case insensitive when performing lookups and searches. 089 * </p> 090 * 091 * @return attribute case insensitive 092 */ 093 boolean isCaseInsensitive(); 094 095 /** 096 * Determines if attribute should be forced to upper case. 097 * 098 * <p> 099 * 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}