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.kns.service; 17 18 import org.kuali.rice.krad.bo.BusinessObject; 19 import org.kuali.rice.krad.bo.DataObjectRelationship; 20 import org.kuali.rice.krad.datadictionary.RelationshipDefinition; 21 import org.kuali.rice.krad.valuefinder.ValueFinder; 22 import org.kuali.rice.krad.service.DataObjectMetaDataService; 23 24 import java.util.Collection; 25 import java.util.List; 26 import java.util.Map; 27 28 /** 29 * Provides Metadata about a specific BusinessObject. Depending on the circumstance or type 30 * of BO it will retrieve the data it needs from either the DataDictionary or through the 31 * PersistenceStructureService 32 * 33 * @author Kuali Rice Team (rice.collab@kuali.org) 34 */ 35 public interface BusinessObjectMetaDataService extends DataObjectMetaDataService { 36 37 public DataObjectRelationship getBusinessObjectRelationship(RelationshipDefinition ddReference, 38 BusinessObject bo, Class boClass, String attributeName, String attributePrefix, boolean keysOnly); 39 40 public RelationshipDefinition getBusinessObjectRelationshipDefinition(Class c, String attributeName); 41 42 public RelationshipDefinition getBusinessObjectRelationshipDefinition(BusinessObject bo, String attributeName); 43 44 /** 45 * 46 * This method returns a list of inquirable field names 47 * 48 * @param bo 49 * @return a collection of inquirable field names 50 */ 51 public Collection<String> getInquirableFieldNames(Class boClass, String sectionTitle); 52 53 /** 54 * 55 * This method returns a list of lookupable fields 56 * 57 * @param bo 58 * @return a collection of lookupable fields 59 */ 60 public List<String> getLookupableFieldNames(Class boClass); 61 62 /** 63 * 64 * This method looks up the default value for a given attribute and returns 65 * it 66 * 67 * @param businessObjectClass 68 * @param attributeName 69 * @return default value for an attribute 70 */ 71 public String getLookupFieldDefaultValue(Class businessObjectClass, String attributeName); 72 73 /** 74 * 75 * This method returns the value finder class for a given attribute 76 * 77 * @param businessObjectClass 78 * @param attributeName 79 * @return value finder class 80 */ 81 public Class getLookupFieldDefaultValueFinderClass(Class businessObjectClass, String attributeName); 82 83 /** 84 * 85 * This method looks up the quickfinder parameter string for a given 86 * attribute and returns it. See 87 * {@link org.kuali.rice.kns.datadictionary.FieldDefinition#getQuickfinderParameterString()}. 88 * 89 * @param businessObjectClass 90 * @param attributeName 91 * @return default values for attributes 92 */ 93 public String getLookupFieldQuickfinderParameterString(Class businessObjectClass, String attributeName); 94 95 /** 96 * This method returns the quickfinder parameter string builder class for a 97 * given attribute. See 98 * {@link org.kuali.rice.kns.datadictionary.FieldDefinition#getQuickfinderParameterStringBuilderClass()}. 99 * 100 * @param businessObjectClass 101 * @param attributeName 102 * @return value finder class 103 */ 104 public Class<? extends ValueFinder> getLookupFieldQuickfinderParameterStringBuilderClass(Class businessObjectClass, 105 String attributeName); 106 107 /** 108 * 109 * This method returns a list of collection names a business object contains 110 * 111 * @param bo 112 * @return 113 */ 114 public Collection<String> getCollectionNames(BusinessObject bo); 115 116 /** 117 * 118 * This method determines if a given field(attribute) is inquirable or not 119 * This handles both nested and non-nested attributes 120 * 121 * @param bo 122 * @param attributeName 123 * @param sectionTitle 124 * @return true if field is inquirable 125 */ 126 public boolean isAttributeInquirable(Class boClass, String attributeName, String sectionTitle); 127 128 /** 129 * 130 * This method determines if a given business object is inquirable 131 * 132 * @param bo 133 * @return true if bo is inquirable 134 */ 135 public boolean isInquirable(Class boClass); 136 137 /** 138 * 139 * This method determines if a given field(attribute) is lookupable or not 140 * This handles both nested and non-nested attributes 141 * 142 * @param bo 143 * @param attributeName 144 * @return true if field is lookupable 145 */ 146 public boolean isAttributeLookupable(Class boClass, String attributeName); 147 148 /** 149 * 150 * This method determines if a given business object is lookupable 151 * 152 * @param bo 153 * @return true if bo is lookupable 154 */ 155 public boolean isLookupable(Class boClass); 156 157 /** 158 * 159 * This method will return a class that is related to the parent BO (either 160 * through the DataDictionary or through the PersistenceStructureService) 161 * 162 * @param bo 163 * @param attributes 164 * @return related class 165 */ 166 @Deprecated 167 public DataObjectRelationship getBusinessObjectRelationship(BusinessObject bo, String attributeName); 168 169 @Deprecated 170 public DataObjectRelationship getBusinessObjectRelationship(BusinessObject bo, Class boClass, 171 String attributeName, String attributePrefix, boolean keysOnly); 172 173 174 175 /** 176 * Get all the business object relationships for the given business object. 177 * These relationships may be defined at the ORM-layer or within the data 178 * dictionary. 179 */ 180 @Deprecated 181 public List<DataObjectRelationship> getBusinessObjectRelationships(BusinessObject bo); 182 183 /** 184 * Get all the business object relationships for the given class. These 185 * relationships may be defined at the ORM-layer or within the data 186 * dictionary. 187 */ 188 @Deprecated 189 public List<DataObjectRelationship> getBusinessObjectRelationships(Class<? extends BusinessObject> boClass); 190 191 /** 192 * This method accepts a business object and one of its foreign key 193 * attribute names. It returns a map that has a foreign key attribute name 194 * as a key and its respective related class as value. If the passed in 195 * attributeName is not a foreign key, this method will return an empty map. 196 * 197 * @param BusinessObject 198 * businessObject 199 * @param String 200 * attributeName 201 * @return Map<String, Class> 202 */ 203 @Deprecated 204 public Map<String, Class> getReferencesForForeignKey(BusinessObject businessObject, String attributeName); 205 206 /** 207 * 208 * This method ... 209 * 210 * @param businessObjectClass 211 * @param attributeName 212 * @param targetName 213 * @return 214 */ 215 @Deprecated 216 public String getForeignKeyFieldName(Class businessObjectClass, String attributeName, String targetName); 217 }