001/** 002 * Copyright 2005-2016 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.krad.service; 017 018import org.kuali.rice.krad.bo.BusinessObject; 019import org.kuali.rice.krad.bo.ExternalizableBusinessObject; 020import org.kuali.rice.krad.bo.ModuleConfiguration; 021import org.kuali.rice.krad.datadictionary.BusinessObjectEntry; 022import org.springframework.beans.factory.InitializingBean; 023import org.springframework.context.ApplicationContextAware; 024 025import java.util.List; 026import java.util.Map; 027import java.util.Properties; 028 029/** 030 * Defines service methods for module services 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034public interface ModuleService extends InitializingBean, ApplicationContextAware { 035 036 /** 037 * This method returns the module configuration. 038 * 039 * @return 040 */ 041 public ModuleConfiguration getModuleConfiguration(); 042 043 /** 044 * This method determines whether this service is responsible for the business object class passed in, or not. 045 * 046 * @param businessObjectClass 047 * @return 048 */ 049 public boolean isResponsibleFor(Class businessObjectClass); 050 051 /** 052 * This method determines whether this service is responsible for the given jobname, or not. 053 * 054 * @param jobName 055 * @return 056 */ 057 public boolean isResponsibleForJob(String jobName); 058 059 /** 060 * This method returns the list of primary keys for the EBO. 061 * 062 * @param businessObjectInterfaceClass 063 * @return 064 */ 065 public List listPrimaryKeyFieldNames(Class businessObjectInterfaceClass); 066 067 /** 068 * This method returns a list of alternate primary keys. This is used when the "real" primary 069 * key is not the only one that can be used. For example, documentType has "documentTypeId" 070 * as its primary key, but the "name" could also be used. 071 * A List of Lists is returned because because there can be component keys: 072 * Ex: 073 * {name, date} 074 * {department, personId} 075 * 076 * @param businessObjectInterfaceClass 077 * @return List of List of Strings. 078 */ 079 public List<List<String>> listAlternatePrimaryKeyFieldNames(Class businessObjectInterfaceClass); 080 081 /** 082 * This method gets the business object dictionary entry for the passed in externalizable business object class. 083 * 084 * @param businessObjectInterfaceClass 085 * @return 086 */ 087 public BusinessObjectEntry getExternalizableBusinessObjectDictionaryEntry(Class businessObjectInterfaceClass); 088 089 /** 090 * This method gets the externalizable business object, given its type and a map of primary keys and values 091 * 092 * @param businessObjectClass 093 * @param fieldValues 094 * @return 095 */ 096 public <T extends ExternalizableBusinessObject> T getExternalizableBusinessObject(Class<T> businessObjectClass, 097 Map<String, Object> fieldValues); 098 099 /** 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