001/**
002 * Copyright 2005-2018 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.kns.service;
017
018import org.kuali.rice.krad.bo.BusinessObject;
019import org.kuali.rice.krad.bo.DataObjectRelationship;
020import org.kuali.rice.krad.datadictionary.RelationshipDefinition;
021import org.kuali.rice.krad.valuefinder.ValueFinder;
022import org.kuali.rice.krad.service.DataObjectMetaDataService;
023
024import java.util.Collection;
025import java.util.List;
026import java.util.Map;
027
028/**
029 * Provides Metadata about a specific BusinessObject. Depending on the circumstance or type
030 * of BO it will retrieve the data it needs from either the DataDictionary or through the
031 * PersistenceStructureService
032 * 
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 *
035 * @deprecated use {@link org.kuali.rice.krad.data.metadata.MetadataRepository}
036 */
037@Deprecated
038public interface BusinessObjectMetaDataService extends DataObjectMetaDataService {
039
040        public DataObjectRelationship getBusinessObjectRelationship(RelationshipDefinition ddReference,
041            Object bo, Class boClass, String attributeName, String attributePrefix, boolean keysOnly);
042
043        public RelationshipDefinition getBusinessObjectRelationshipDefinition(Class c, String attributeName);
044
045        public RelationshipDefinition getBusinessObjectRelationshipDefinition(Object bo, String attributeName);
046
047        /**
048         * 
049         * This method returns a list of inquirable field names
050         * 
051         * @param bo
052         * @return a collection of inquirable field names
053         */
054        public Collection<String> getInquirableFieldNames(Class boClass, String sectionTitle);
055
056        /**
057         * 
058         * This method returns a list of lookupable fields
059         * 
060         * @param bo
061         * @return a collection of lookupable fields
062         */
063        public List<String> getLookupableFieldNames(Class boClass);
064
065        /**
066         * 
067         * This method looks up the default value for a given attribute and returns
068         * it
069         * 
070         * @param businessObjectClass
071         * @param attributeName
072         * @return default value for an attribute
073         */
074        public String getLookupFieldDefaultValue(Class businessObjectClass, String attributeName);
075
076        /**
077         * 
078         * This method returns the value finder class for a given attribute
079         * 
080         * @param businessObjectClass
081         * @param attributeName
082         * @return value finder class
083         */
084        public Class getLookupFieldDefaultValueFinderClass(Class businessObjectClass, String attributeName);
085
086        /**
087         * 
088         * This method looks up the quickfinder parameter string for a given
089         * attribute and returns it. See
090         * {@link org.kuali.rice.kns.datadictionary.FieldDefinition#getQuickfinderParameterString()}.
091         * 
092         * @param businessObjectClass
093         * @param attributeName
094         * @return default values for attributes
095         */
096        public String getLookupFieldQuickfinderParameterString(Class businessObjectClass, String attributeName);
097
098        /**
099         * This method returns the quickfinder parameter string builder class for a
100         * given attribute. See
101         * {@link org.kuali.rice.kns.datadictionary.FieldDefinition#getQuickfinderParameterStringBuilderClass()}.
102         * 
103         * @param businessObjectClass
104         * @param attributeName
105         * @return value finder class
106         */
107        public Class<? extends ValueFinder> getLookupFieldQuickfinderParameterStringBuilderClass(Class businessObjectClass,
108                        String attributeName);
109
110        /**
111         * 
112         * This method returns a list of collection names a business object contains
113         * 
114         * @param bo
115         * @return
116         */
117        public Collection<String> getCollectionNames(Object bo);
118
119        /**
120         * 
121         * This method determines if a given field(attribute) is inquirable or not
122         * This handles both nested and non-nested attributes
123         * 
124         * @param bo
125         * @param attributeName
126         * @param sectionTitle
127         * @return true if field is inquirable
128         */
129        public boolean isAttributeInquirable(Class boClass, String attributeName, String sectionTitle);
130
131        /**
132         * 
133         * This method determines if a given business object is inquirable
134         * 
135         * @param bo
136         * @return true if bo is inquirable
137         */
138        public boolean isInquirable(Class boClass);
139
140        /**
141         * 
142         * This method determines if a given field(attribute) is lookupable or not
143         * This handles both nested and non-nested attributes
144         * 
145         * @param bo
146         * @param attributeName
147         * @return true if field is lookupable
148         */
149        public boolean isAttributeLookupable(Class boClass, String attributeName);
150
151        /**
152         * 
153         * This method determines if a given business object is lookupable
154         * 
155         * @param bo
156         * @return true if bo is lookupable
157         */
158        public boolean isLookupable(Class boClass);
159
160        /**
161         * 
162         * This method will return a class that is related to the parent BO (either
163         * through the DataDictionary or through the PersistenceStructureService)
164         * 
165         * @param bo
166         * @param attributes
167         * @return related class
168         */
169        @Deprecated
170        public DataObjectRelationship getBusinessObjectRelationship(Object bo, String attributeName);
171
172        @Deprecated
173        public DataObjectRelationship getBusinessObjectRelationship(Object bo, Class boClass,
174                        String attributeName, String attributePrefix, boolean keysOnly);
175
176
177
178        /**
179         * Get all the business object relationships for the given business object.
180         * These relationships may be defined at the ORM-layer or within the data
181         * dictionary.
182         */
183        @Deprecated
184        public List<DataObjectRelationship> getBusinessObjectRelationships(Object bo);
185
186        /**
187         * Get all the business object relationships for the given class. These
188         * relationships may be defined at the ORM-layer or within the data
189         * dictionary.
190         */
191        @Deprecated
192        public List<DataObjectRelationship> getBusinessObjectRelationships(Class<? extends Object> boClass);
193
194        /**
195         * This method accepts a business object and one of its foreign key
196         * attribute names. It returns a map that has a foreign key attribute name
197         * as a key and its respective related class as value. If the passed in
198         * attributeName is not a foreign key, this method will return an empty map.
199         * 
200         * @param Object
201         *            businessObject
202         * @param String
203         *            attributeName
204         * @return Map<String, Class>
205         */
206        @Deprecated
207        public Map<String, Class> getReferencesForForeignKey(Object businessObject, String attributeName);
208
209        /**
210         * 
211         * This method ...
212         * 
213         * @param businessObjectClass
214         * @param attributeName
215         * @param targetName
216         * @return
217         */
218        @Deprecated
219        public String getForeignKeyFieldName(Class businessObjectClass, String attributeName, String targetName);
220}