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