1 /** 2 * Copyright 2005-2013 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.BusinessObject; 19 import org.kuali.rice.krad.bo.ExternalizableBusinessObject; 20 import org.kuali.rice.krad.bo.ModuleConfiguration; 21 import org.kuali.rice.krad.datadictionary.BusinessObjectEntry; 22 import org.springframework.beans.factory.InitializingBean; 23 import org.springframework.context.ApplicationContextAware; 24 25 import java.util.List; 26 import java.util.Map; 27 import java.util.Properties; 28 29 /** 30 * Defines service methods for module services 31 * 32 * @author Kuali Rice Team (rice.collab@kuali.org) 33 */ 34 public interface ModuleService extends InitializingBean, ApplicationContextAware { 35 36 /** 37 * This method returns the module configuration. 38 * 39 * @return 40 */ 41 public ModuleConfiguration getModuleConfiguration(); 42 43 /** 44 * This method determines whether this service is responsible for the business object class passed in, or not. 45 * 46 * @param businessObjectClass 47 * @return 48 */ 49 public boolean isResponsibleFor(Class businessObjectClass); 50 51 /** 52 * This method determines whether this service is responsible for the given jobname, or not. 53 * 54 * @param jobName 55 * @return 56 */ 57 public boolean isResponsibleForJob(String jobName); 58 59 /** 60 * This method returns the list of primary keys for the EBO. 61 * 62 * @param businessObjectInterfaceClass 63 * @return 64 */ 65 public List listPrimaryKeyFieldNames(Class businessObjectInterfaceClass); 66 67 /** 68 * This method returns a list of alternate primary keys. This is used when the "real" primary 69 * key is not the only one that can be used. For example, documentType has "documentTypeId" 70 * as its primary key, but the "name" could also be used. 71 * A List of Lists is returned because because there can be component keys: 72 * Ex: 73 * {name, date} 74 * {department, personId} 75 * 76 * @param businessObjectInterfaceClass 77 * @return List of List of Strings. 78 */ 79 public List<List<String>> listAlternatePrimaryKeyFieldNames(Class businessObjectInterfaceClass); 80 81 /** 82 * This method gets the business object dictionary entry for the passed in externalizable business object class. 83 * 84 * @param businessObjectInterfaceClass 85 * @return 86 */ 87 public BusinessObjectEntry getExternalizableBusinessObjectDictionaryEntry(Class businessObjectInterfaceClass); 88 89 /** 90 * This method gets the externalizable business object, given its type and a map of primary keys and values 91 * 92 * @param businessObjectClass 93 * @param fieldValues 94 * @return 95 */ 96 public <T extends ExternalizableBusinessObject> T getExternalizableBusinessObject(Class<T> businessObjectClass, 97 Map<String, Object> fieldValues); 98 99 /** 100 * This method gets the list of externalizable business objects, given its type and a map of primary keys and 101 * values. 102 * 103 * @param businessObjectClass 104 * @param fieldValues 105 * @return 106 */ 107 public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsList( 108 Class<T> businessObjectClass, Map<String, Object> fieldValues); 109 110 /** 111 * This method gets the list of externalizable business objects for lookup, given its type and a map of primary keys 112 * and values. 113 * 114 * @param <T> 115 * @param businessObjectClass 116 * @param fieldValues 117 * @param unbounded 118 * @return 119 */ 120 public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsListForLookup( 121 Class<T> businessObjectClass, Map<String, Object> fieldValues, boolean unbounded); 122 123 /** 124 * Returns a URL so that the inquiry framework may redirect a user to the appropriate (possibly 125 * external) website at which to view inquiry information 126 * 127 * @param inquiryDataObjectClass - a {@link ExternalizableBusinessObject} managed by this module 128 * @param parameters - any inquiry parameters, and the primary key values of the inquiry class would be 129 * in here 130 * @return String URL where externalizable object information may be viewed 131 */ 132 public String getExternalizableDataObjectInquiryUrl(Class<?> inquiryDataObjectClass, Properties parameters); 133 134 /** 135 * Returns a URL so that the lookup framework may redirect a user to the appropriate (possibly 136 * external) website at which to the data for the object may be searched 137 * 138 * @param inquiryDataObjectClass - a {@link ExternalizableBusinessObject} managed by this module 139 * @param parameters - any parameters for the lookup call 140 * @return String URL where externalizable object information may be searched 141 */ 142 public String getExternalizableDataObjectLookupUrl(Class<?> inquiryDataObjectClass, Properties parameters); 143 144 /** 145 * This method returns a URL so that the inquiry framework may redirect a user to the appropriate (possibly 146 * external) website 147 * at which to view inquiry information. 148 * 149 * @param inquiryBusinessObjectClass a {@link ExternalizableBusinessObject} managed by this module 150 * @param parameters any inquiry parameters, and the primary key values of the inquiryBusinessObjectClass would be 151 * in here 152 * @return a URL where externalizable business object information may be viewed. 153 * @deprecated legacy KNS call, replaced by {@link #getExternalizableDataObjectInquiryUrl(Class, java.util.Properties)} 154 * in KRAD 155 */ 156 @Deprecated 157 public String getExternalizableBusinessObjectInquiryUrl(Class inquiryBusinessObjectClass, 158 Map<String, String[]> parameters); 159 160 /** 161 * This method gets the lookup url for the given externalizable business object properties. 162 * 163 * @param parameters 164 * @return 165 * @deprecated legacy KNS call, replaced by {@link #getExternalizableDataObjectLookupUrl(Class, java.util.Properties)} 166 * in KRAD 167 */ 168 @Deprecated 169 public String getExternalizableBusinessObjectLookupUrl(Class inquiryBusinessObjectClass, 170 Map<String, String> parameters); 171 172 /** 173 * This method retrieves the externalizable business object, if it is not already populated 174 * with the matching primary key values. 175 * 176 * @param businessObject 177 * @param currentInstanceExternalizableBO 178 * @param externalizableRelationshipName 179 * @return 180 */ 181 public <T extends ExternalizableBusinessObject> T retrieveExternalizableBusinessObjectIfNecessary( 182 BusinessObject businessObject, T currentInstanceExternalizableBO, String externalizableRelationshipName); 183 184 /** 185 * This method retrieves a list of externalizable business objects given a business object, 186 * name of the relationship between the business object and the externalizable business object, and 187 * the externalizable business object class. 188 * 189 * @param businessObject 190 * @param externalizableRelationshipName 191 * @param externalizableClazz 192 * @return 193 */ 194 public <T extends ExternalizableBusinessObject> List<T> retrieveExternalizableBusinessObjectsList( 195 BusinessObject businessObject, String externalizableRelationshipName, Class<T> externalizableClazz); 196 197 /** 198 * This method determines whether or not a bo class is externalizable. 199 * 200 * @param boClass 201 * @return 202 */ 203 public boolean isExternalizable(Class boClass); 204 205 /** 206 * @param boClass 207 * @return 208 */ 209 public boolean isExternalizableBusinessObjectLookupable(Class boClass); 210 211 /** 212 * @param boClass 213 * @return 214 */ 215 public boolean isExternalizableBusinessObjectInquirable(Class boClass); 216 217 /** 218 * @param <T> 219 * @param boClass 220 * @return 221 */ 222 public <T extends ExternalizableBusinessObject> T createNewObjectFromExternalizableClass(Class<T> boClass); 223 224 /** 225 * For a given ExternalizableBusinessObject interface, return the implementation class provided by this module. 226 */ 227 public <E extends ExternalizableBusinessObject> Class<E> getExternalizableBusinessObjectImplementation( 228 Class<E> externalizableBusinessObjectInterface); 229 230 /** 231 * This method determines whether or not this module is currently locked 232 */ 233 public boolean isLocked(); 234 235 /** 236 * This method determines whether or not the central rice server should be used for lookups. 237 * 238 * @return 239 */ 240 public boolean goToCentralRiceForInquiry(); 241 } 242