1 /** 2 * Copyright 2005-2011 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 28 29 /** 30 * This interface defines service methods for modules. 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, Map<String, Object> fieldValues); 97 98 /** 99 * This method gets the list of externalizable business objects, given its type and a map of primary keys and values. 100 * 101 * @param businessObjectClass 102 * @param fieldValues 103 * @return 104 */ 105 public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsList( 106 Class<T> businessObjectClass, Map<String, Object> fieldValues); 107 108 /** 109 * This method gets the list of externalizable business objects for lookup, given its type and a map of primary keys and values. 110 * 111 * @param <T> 112 * @param businessObjectClass 113 * @param fieldValues 114 * @param unbounded 115 * @return 116 */ 117 public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsListForLookup( 118 Class<T> businessObjectClass, Map<String, Object> fieldValues, boolean unbounded); 119 120 /** 121 * This method returns a URL so that the inquiry framework may redirect a user to the appropriate (possibly external) website 122 * at which to view inquiry information. 123 * 124 * @param inquiryBusinessObjectClass a {@link ExternalizableBusinessObject} managed by this module 125 * @param parameters any inquiry parameters, and the primary key values of the inquiryBusinessObjectClass would be in here 126 * @return a URL where externalizable business object information may be viewed. 127 */ 128 public String getExternalizableBusinessObjectInquiryUrl(Class inquiryBusinessObjectClass, Map<String, String[]> parameters); 129 130 /** 131 * This method gets the lookup url for the given externalizable business object properties. 132 * 133 * @param parameters 134 * @return 135 */ 136 public String getExternalizableBusinessObjectLookupUrl(Class inquiryBusinessObjectClass, Map<String, String> parameters); 137 138 /** 139 * This method retrieves the externalizable business object, if it is not already populated 140 * with the matching primary key values. 141 * 142 * @param businessObject 143 * @param currentInstanceExternalizableBO 144 * 145 * @param externalizableRelationshipName 146 * @return 147 */ 148 public <T extends ExternalizableBusinessObject> T retrieveExternalizableBusinessObjectIfNecessary( 149 BusinessObject businessObject, T currentInstanceExternalizableBO, String externalizableRelationshipName); 150 151 /** 152 * This method retrieves a list of externalizable business objects given a business object, 153 * name of the relationship between the business object and the externalizable business object, and 154 * the externalizable business object class. 155 * 156 * @param businessObject 157 * @param externalizableRelationshipName 158 * @param externalizableClazz 159 * @return 160 */ 161 public <T extends ExternalizableBusinessObject> List<T> retrieveExternalizableBusinessObjectsList( 162 BusinessObject businessObject, String externalizableRelationshipName, Class<T> externalizableClazz); 163 164 /** 165 * This method determines whether or not a bo class is externalizable. 166 * 167 * @param boClass 168 * @return 169 */ 170 public boolean isExternalizable(Class boClass); 171 172 /** 173 * @param boClass 174 * @return 175 */ 176 public boolean isExternalizableBusinessObjectLookupable(Class boClass); 177 178 /** 179 * @param boClass 180 * @return 181 */ 182 public boolean isExternalizableBusinessObjectInquirable(Class boClass); 183 184 /** 185 * @param <T> 186 * @param boClass 187 * @return 188 */ 189 public <T extends ExternalizableBusinessObject> T createNewObjectFromExternalizableClass(Class<T> boClass); 190 191 /** 192 * For a given ExternalizableBusinessObject interface, return the implementation class provided by this module. 193 */ 194 public <E extends ExternalizableBusinessObject> Class<E> getExternalizableBusinessObjectImplementation(Class<E> externalizableBusinessObjectInterface); 195 196 /** 197 * This method determines whether or not this module is currently locked 198 */ 199 public boolean isLocked(); 200 } 201