1 /** 2 * Copyright 2005-2015 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.service; 17 18 import org.kuali.rice.krad.bo.DataObjectRelationship; 19 import org.kuali.rice.krad.datadictionary.RelationshipDefinition; 20 21 import java.util.List; 22 import java.util.Map; 23 24 /** 25 * Provides metadata such as relationships and key fields for data objects 26 * 27 * <p> 28 * Service provides a facade to the various services for retrieving metadata 29 * within the framework, such as the <code>DataDictionaryService</code> and 30 * the <code>PersistenceService</code> 31 * </p> 32 * 33 * @author Kuali Rice Team (rice.collab@kuali.org) 34 * 35 * @deprecated use {@link org.kuali.rice.krad.data.metadata.MetadataRepository} instead 36 */ 37 @Deprecated 38 public interface DataObjectMetaDataService { 39 40 /** 41 * Checks the DataDictionary and OJB Repository File to determine the primary 42 * fields names for a given class. 43 * 44 * @param clazz - the Class to check for primary keys 45 * @return a list of the primary key field names or an empty list if none are found 46 * 47 * @deprecated use {@link org.kuali.rice.krad.data.metadata.DataObjectMetadata#getPrimaryKeyAttributeNames()} 48 */ 49 @Deprecated 50 public List<String> listPrimaryKeyFieldNames(Class<?> clazz); 51 52 /** 53 * Determines the primary keys for the class of the given object, then for each 54 * key field retrieves the value from the object instance and populates the return 55 * map with the primary key name as the map key and the object value as the map value 56 * 57 * @param dataObject - object whose primary key field name,value pairs you want 58 * @return a Map containing the names and values of fields for the given class which 59 * are designated as key fields in the OJB repository file or DataDictionary 60 * @throws IllegalArgumentException if the given Object is null 61 * 62 * @deprecated use {@link org.kuali.rice.krad.data.DataObjectWrapper#getPrimaryKeyValues()} instead 63 */ 64 @Deprecated 65 public Map<String, ?> getPrimaryKeyFieldValues(Object dataObject); 66 67 /** 68 * Determines the primary keys for the class of the given object, then for each 69 * key field retrieves the value from the object instance and populates the return 70 * map with the primary key name as the map key and the object value as the map value 71 * 72 * @param dataObject - object whose primary key field name,value pairs you want 73 * @param sortFieldNames - if true, the returned Map will iterate through its entries sorted by fieldName 74 * @return a Map containing the names and values of fields for the given class which 75 * are designated as key fields in the OJB repository file or DataDictionary 76 * @throws IllegalArgumentException if the given Object is null 77 78 * @deprecated use {@link org.kuali.rice.krad.data.DataObjectWrapper#getPrimaryKeyValues()} instead, and sort manually if needed 79 */ 80 @Deprecated 81 public Map<String, ?> getPrimaryKeyFieldValues(Object dataObject, boolean sortFieldNames); 82 83 /** 84 * Compares two dataObject instances for equality of type and key values using toString() 85 * of each value for comparison purposes. 86 * 87 * @param do1 88 * @param do2 89 * @return boolean indicating whether the two objects are equal. 90 * 91 * @deprecated use {@link org.kuali.rice.krad.data.DataObjectWrapper#equalsByPrimaryKey(Object)} 92 */ 93 @Deprecated 94 public boolean equalsByPrimaryKeys(Object do1, Object do2); 95 96 /** 97 * Attempts to find a relationship for the given attribute within the given 98 * data object 99 * 100 * <p> 101 * First the data dictionary is queried to find any relationship definitions 102 * setup that include the attribute, if found the 103 * <code>BusinessObjectRetationship</code> is build from that. If not and 104 * the data object class is persistent, relationships are retrieved from the 105 * persistence service. Nested attributes are handled in addition to 106 * external business objects. If multiple relationships are found, the one 107 * that contains the least amount of joining keys is returned 108 * </p> 109 * 110 * @param dataObject - data object instance that contains the attribute 111 * @param dataObjectClass - class for the data object that contains the attribute 112 * @param attributeName - property name for the attribute 113 * @param attributePrefix - property prefix for the attribute 114 * @param keysOnly - indicates whether only primary key fields should be returned 115 * in the relationship 116 * @param supportsLookup - indicates whether the relationship should support lookup 117 * @param supportsInquiry - indicates whether the relationship should support inquiry 118 * @return BusinessObjectRelationship for the attribute, or null if not 119 * found 120 */ 121 @Deprecated 122 public DataObjectRelationship getDataObjectRelationship(Object dataObject, Class<?> dataObjectClass, 123 String attributeName, String attributePrefix, boolean keysOnly, boolean supportsLookup, 124 boolean supportsInquiry); 125 126 /** 127 * Attempts to find relationships for the given data object class 128 * 129 * <p> 130 * First the data dictionary is queried to find any relationship definitions 131 * <code>BusinessObjectRetationship</code> is build from that. If not and 132 * the data object class is persistent, relationships are retrieved from the 133 * persistence service. Nested attributes are handled in addition to 134 * external business objects. If multiple relationships are found, the one 135 * that contains the least amount of joining keys is returned 136 * </p> 137 * 138 * @param dataObjectClass - class for the data object that contains the attribute 139 * @return List of DataObjectRelationship for the class 140 */ 141 @Deprecated 142 public List<DataObjectRelationship> getDataObjectRelationships(Class<?> dataObjectClass); 143 144 /** 145 * Fetches the RelationshipDefinition for the attribute with the given name within 146 * the given class 147 * 148 * @param dataObjectClass - data object class that contains the attribute 149 * @param attributeName - property name for the attribute 150 * @return RelationshipDefinition for the attribute, or null if not found 151 */ 152 @Deprecated 153 public RelationshipDefinition getDictionaryRelationship(Class<?> dataObjectClass, String attributeName); 154 155 /** 156 * Returns the attribute to be associated with for object level markings. This would 157 * be the field chosen for inquiry links etc. 158 * 159 * @param dataObjectClass - data object class to obtain title attribute of 160 * @return property name of title attribute or null if data object entry not found 161 * @throws IllegalArgumentException if the given Class is null 162 */ 163 @Deprecated 164 public String getTitleAttribute(Class<?> dataObjectClass); 165 166 /** 167 * Indicates whether notes are supported by the given data object class, currently this 168 * can only be true for business objects 169 * 170 * @param dataObjectClass - class for data object to check 171 * @return boolean true if notes are supported for data object, false if notes are not supported 172 */ 173 @Deprecated 174 public boolean areNotesSupported(Class<?> dataObjectClass); 175 176 /** 177 * Builds a string that uniquely identifiers the data object instance 178 * 179 * <p> 180 * Based on the metadata available for the class of the data object, the values for fields that uniquely 181 * identify an instance are concatenated together into one string. For general data objects these fields 182 * will be the primary key fields defined in the data dictionary. For the case of objects with type 183 * <code>PersistableBusinessObject</code>, the object id field will be used. 184 * </p> 185 * 186 * @param dataObject - data object instance to build identifier string for 187 * @return String identifier string for data object 188 */ 189 @Deprecated 190 public String getDataObjectIdentifierString(Object dataObject); 191 192 /** 193 * Determines whether the given data object class has an associated lookup in the local 194 * running application 195 * 196 * @param dataObjectClass data object class to find lookup for 197 * @return boolean true if a lookup exists for the data object class, false if not 198 */ 199 @Deprecated 200 public boolean hasLocalLookup(Class<?> dataObjectClass); 201 202 /** 203 * Determines whether the given data object class has an associated inquiry in the local 204 * running application 205 * 206 * @param dataObjectClass data object class to find inquiry for 207 * @return boolean true if a inquiry exists for the data object class, false if not 208 */ 209 @Deprecated 210 public boolean hasLocalInquiry(Class<?> dataObjectClass); 211 212 }