| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.krad.service.impl; |
| 17 | |
|
| 18 | |
import java.lang.reflect.Modifier; |
| 19 | |
import java.util.HashMap; |
| 20 | |
import java.util.List; |
| 21 | |
import java.util.Map; |
| 22 | |
import java.util.Map.Entry; |
| 23 | |
import java.util.Properties; |
| 24 | |
|
| 25 | |
import org.apache.commons.beanutils.PropertyUtils; |
| 26 | |
import org.apache.commons.lang.StringUtils; |
| 27 | |
import org.apache.log4j.Logger; |
| 28 | |
import org.kuali.rice.core.framework.parameter.ParameterService; |
| 29 | |
import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator; |
| 30 | |
import org.kuali.rice.krad.bo.BusinessObject; |
| 31 | |
import org.kuali.rice.krad.bo.DataObjectRelationship; |
| 32 | |
import org.kuali.rice.krad.bo.ExternalizableBusinessObject; |
| 33 | |
import org.kuali.rice.krad.bo.ModuleConfiguration; |
| 34 | |
import org.kuali.rice.krad.datadictionary.BusinessObjectEntry; |
| 35 | |
import org.kuali.rice.krad.datadictionary.PrimitiveAttributeDefinition; |
| 36 | |
import org.kuali.rice.krad.datadictionary.RelationshipDefinition; |
| 37 | |
import org.kuali.rice.krad.service.BusinessObjectDictionaryService; |
| 38 | |
import org.kuali.rice.krad.service.BusinessObjectNotLookupableException; |
| 39 | |
import org.kuali.rice.krad.service.BusinessObjectService; |
| 40 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
| 41 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
| 42 | |
import org.kuali.rice.krad.service.KualiModuleService; |
| 43 | |
import org.kuali.rice.krad.service.LookupService; |
| 44 | |
import org.kuali.rice.krad.service.ModuleService; |
| 45 | |
import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils; |
| 46 | |
import org.kuali.rice.krad.util.KRADConstants; |
| 47 | |
import org.kuali.rice.krad.util.ObjectUtils; |
| 48 | |
import org.kuali.rice.krad.util.UrlFactory; |
| 49 | |
import org.springframework.beans.BeansException; |
| 50 | |
import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
| 51 | |
import org.springframework.context.ApplicationContext; |
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | 0 | public class ModuleServiceBase implements ModuleService { |
| 59 | |
|
| 60 | 0 | protected static final Logger LOG = Logger.getLogger(ModuleServiceBase.class); |
| 61 | |
|
| 62 | |
protected ModuleConfiguration moduleConfiguration; |
| 63 | |
protected BusinessObjectService businessObjectService; |
| 64 | |
protected LookupService lookupService; |
| 65 | |
protected BusinessObjectDictionaryService businessObjectDictionaryService; |
| 66 | |
protected KualiModuleService kualiModuleService; |
| 67 | |
protected ApplicationContext applicationContext; |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
public boolean isResponsibleFor(Class businessObjectClass) { |
| 73 | 0 | if(getModuleConfiguration() == null) |
| 74 | 0 | throw new IllegalStateException("Module configuration has not been initialized for the module service."); |
| 75 | |
|
| 76 | 0 | if (getModuleConfiguration().getPackagePrefixes() == null || businessObjectClass == null) { |
| 77 | 0 | return false; |
| 78 | |
} |
| 79 | 0 | for (String prefix : getModuleConfiguration().getPackagePrefixes()) { |
| 80 | 0 | if (businessObjectClass.getPackage().getName().startsWith(prefix)) { |
| 81 | 0 | return true; |
| 82 | |
} |
| 83 | |
} |
| 84 | 0 | if (ExternalizableBusinessObject.class.isAssignableFrom(businessObjectClass)) { |
| 85 | 0 | Class externalizableBusinessObjectInterface = ExternalizableBusinessObjectUtils.determineExternalizableBusinessObjectSubInterface(businessObjectClass); |
| 86 | 0 | if (externalizableBusinessObjectInterface != null) { |
| 87 | 0 | for (String prefix : getModuleConfiguration().getPackagePrefixes()) { |
| 88 | 0 | if (externalizableBusinessObjectInterface.getPackage().getName().startsWith(prefix)) { |
| 89 | 0 | return true; |
| 90 | |
} |
| 91 | |
} |
| 92 | |
} |
| 93 | |
} |
| 94 | 0 | return false; |
| 95 | |
} |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
public boolean isResponsibleForJob(String jobName) { |
| 103 | 0 | if(getModuleConfiguration() == null) |
| 104 | 0 | throw new IllegalStateException("Module configuration has not been initialized for the module service."); |
| 105 | |
|
| 106 | 0 | if (getModuleConfiguration().getJobNames() == null || StringUtils.isEmpty(jobName)) |
| 107 | 0 | return false; |
| 108 | |
|
| 109 | 0 | return getModuleConfiguration().getJobNames().contains(jobName); |
| 110 | |
} |
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
public <T extends ExternalizableBusinessObject> T getExternalizableBusinessObject(Class<T> businessObjectClass, Map<String, Object> fieldValues) { |
| 116 | 0 | Class<? extends ExternalizableBusinessObject> implementationClass = getExternalizableBusinessObjectImplementation(businessObjectClass); |
| 117 | 0 | ExternalizableBusinessObject businessObject = (ExternalizableBusinessObject) |
| 118 | |
getBusinessObjectService().findByPrimaryKey(implementationClass, fieldValues); |
| 119 | 0 | return (T) businessObject; |
| 120 | |
} |
| 121 | |
|
| 122 | |
|
| 123 | |
|
| 124 | |
|
| 125 | |
public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsList( |
| 126 | |
Class<T> externalizableBusinessObjectClass, Map<String, Object> fieldValues) { |
| 127 | 0 | Class<? extends ExternalizableBusinessObject> implementationClass = getExternalizableBusinessObjectImplementation(externalizableBusinessObjectClass); |
| 128 | 0 | return (List<T>) getBusinessObjectService().findMatching(implementationClass, fieldValues); |
| 129 | |
} |
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | |
public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsListForLookup( |
| 135 | |
Class<T> externalizableBusinessObjectClass, Map<String, Object> fieldValues, boolean unbounded) { |
| 136 | 0 | Class<? extends ExternalizableBusinessObject> implementationClass = getExternalizableBusinessObjectImplementation(externalizableBusinessObjectClass); |
| 137 | 0 | if (isExternalizableBusinessObjectLookupable(implementationClass)) { |
| 138 | 0 | Map<String, String> searchCriteria = new HashMap<String, String>(); |
| 139 | 0 | for (Entry<String, Object> fieldValue : fieldValues.entrySet()) { |
| 140 | 0 | if (fieldValue.getValue() != null) { |
| 141 | 0 | searchCriteria.put(fieldValue.getKey(), fieldValue.getValue().toString()); |
| 142 | |
} |
| 143 | |
else { |
| 144 | 0 | searchCriteria.put(fieldValue.getKey(), null); |
| 145 | |
} |
| 146 | |
} |
| 147 | 0 | return (List<T>) getLookupService().findCollectionBySearchHelper(implementationClass, searchCriteria, unbounded); |
| 148 | |
} else { |
| 149 | 0 | throw new BusinessObjectNotLookupableException("External business object is not a Lookupable: " + implementationClass); |
| 150 | |
} |
| 151 | |
} |
| 152 | |
|
| 153 | |
public List listPrimaryKeyFieldNames(Class businessObjectInterfaceClass){ |
| 154 | 0 | Class clazz = getExternalizableBusinessObjectImplementation(businessObjectInterfaceClass); |
| 155 | 0 | return KRADServiceLocator.getPersistenceStructureService().listPrimaryKeyFieldNames(clazz); |
| 156 | |
} |
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
public BusinessObjectEntry getExternalizableBusinessObjectDictionaryEntry( |
| 162 | |
Class businessObjectInterfaceClass) { |
| 163 | 0 | Class boClass = getExternalizableBusinessObjectImplementation(businessObjectInterfaceClass); |
| 164 | |
|
| 165 | 0 | return boClass==null?null: |
| 166 | |
KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntryForConcreteClass(boClass.getName()); |
| 167 | |
} |
| 168 | |
|
| 169 | |
public String getExternalizableBusinessObjectInquiryUrl(Class inquiryBusinessObjectClass, Map<String, String[]> parameters) { |
| 170 | 0 | if(!ExternalizableBusinessObject.class.isAssignableFrom(inquiryBusinessObjectClass)) { |
| 171 | 0 | return KRADConstants.EMPTY_STRING; |
| 172 | |
} |
| 173 | |
String businessObjectClassAttribute; |
| 174 | |
|
| 175 | 0 | Class implementationClass = getExternalizableBusinessObjectImplementation(inquiryBusinessObjectClass); |
| 176 | 0 | if (implementationClass == null) { |
| 177 | 0 | LOG.error("Can't find ExternalizableBusinessObject implementation class for " + inquiryBusinessObjectClass.getName()); |
| 178 | 0 | throw new RuntimeException("Can't find ExternalizableBusinessObject implementation class for interface " + inquiryBusinessObjectClass.getName()); |
| 179 | |
} |
| 180 | 0 | businessObjectClassAttribute = implementationClass.getName(); |
| 181 | 0 | return UrlFactory.parameterizeUrl( |
| 182 | |
getInquiryUrl(inquiryBusinessObjectClass), |
| 183 | |
getUrlParameters(businessObjectClassAttribute, parameters)); |
| 184 | |
} |
| 185 | |
|
| 186 | |
protected Properties getUrlParameters(String businessObjectClassAttribute, Map<String, String[]> parameters){ |
| 187 | 0 | Properties urlParameters = new Properties(); |
| 188 | 0 | for (String paramName : parameters.keySet()) { |
| 189 | 0 | String[] parameterValues = parameters.get(paramName); |
| 190 | 0 | if (parameterValues.length > 0) { |
| 191 | 0 | urlParameters.put(paramName, parameterValues[0]); |
| 192 | |
} |
| 193 | 0 | } |
| 194 | 0 | urlParameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, businessObjectClassAttribute); |
| 195 | 0 | urlParameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.CONTINUE_WITH_INQUIRY_METHOD_TO_CALL); |
| 196 | 0 | return urlParameters; |
| 197 | |
} |
| 198 | |
|
| 199 | |
protected String getInquiryUrl(Class inquiryBusinessObjectClass){ |
| 200 | 0 | String riceBaseUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString( |
| 201 | |
KRADConstants.APPLICATION_URL_KEY); |
| 202 | 0 | String inquiryUrl = riceBaseUrl; |
| 203 | 0 | if (!inquiryUrl.endsWith("/")) { |
| 204 | 0 | inquiryUrl = inquiryUrl + "/"; |
| 205 | |
} |
| 206 | 0 | return inquiryUrl + "kr/" + KRADConstants.INQUIRY_ACTION; |
| 207 | |
} |
| 208 | |
|
| 209 | |
|
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
public String getExternalizableBusinessObjectLookupUrl(Class inquiryBusinessObjectClass, Map<String, String> parameters) { |
| 215 | 0 | Properties urlParameters = new Properties(); |
| 216 | |
|
| 217 | 0 | String riceBaseUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString( |
| 218 | |
KRADConstants.APPLICATION_URL_KEY); |
| 219 | 0 | String lookupUrl = riceBaseUrl; |
| 220 | 0 | if (!lookupUrl.endsWith("/")) { |
| 221 | 0 | lookupUrl = lookupUrl + "/"; |
| 222 | |
} |
| 223 | 0 | if (parameters.containsKey(KRADConstants.MULTIPLE_VALUE)) { |
| 224 | 0 | lookupUrl = lookupUrl + "kr/" + KRADConstants.MULTIPLE_VALUE_LOOKUP_ACTION; |
| 225 | |
} |
| 226 | |
else { |
| 227 | 0 | lookupUrl = lookupUrl + "kr/" + KRADConstants.LOOKUP_ACTION; |
| 228 | |
} |
| 229 | 0 | for (String paramName : parameters.keySet()) { |
| 230 | 0 | urlParameters.put(paramName, parameters.get(paramName)); |
| 231 | |
} |
| 232 | |
|
| 233 | 0 | Class clazz = getExternalizableBusinessObjectImplementation(inquiryBusinessObjectClass); |
| 234 | 0 | urlParameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, clazz==null?"":clazz.getName()); |
| 235 | |
|
| 236 | 0 | return UrlFactory.parameterizeUrl(lookupUrl, urlParameters); |
| 237 | |
} |
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
|
| 243 | |
|
| 244 | |
|
| 245 | |
|
| 246 | |
public <T extends ExternalizableBusinessObject> T retrieveExternalizableBusinessObjectIfNecessary( |
| 247 | |
BusinessObject businessObject, T currentInstanceExternalizableBO, String externalizableRelationshipName) { |
| 248 | |
|
| 249 | 0 | if(businessObject==null) return null; |
| 250 | |
Class clazz; |
| 251 | |
try{ |
| 252 | 0 | clazz = getExternalizableBusinessObjectImplementation( |
| 253 | |
PropertyUtils.getPropertyType(businessObject, externalizableRelationshipName)); |
| 254 | 0 | } catch(Exception iex){ |
| 255 | 0 | LOG.warn("Exception:"+iex+" thrown while trying to get property type for property:"+externalizableRelationshipName+ |
| 256 | |
" from business object:"+businessObject); |
| 257 | 0 | return null; |
| 258 | 0 | } |
| 259 | |
|
| 260 | |
|
| 261 | |
|
| 262 | 0 | BusinessObjectEntry entry = |
| 263 | |
KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntries().get( |
| 264 | |
businessObject.getClass().getSimpleName()); |
| 265 | 0 | RelationshipDefinition relationshipDefinition = entry.getRelationshipDefinition(externalizableRelationshipName); |
| 266 | 0 | List<PrimitiveAttributeDefinition> primitiveAttributeDefinitions = relationshipDefinition.getPrimitiveAttributes(); |
| 267 | |
|
| 268 | 0 | Map<String, Object> fieldValuesInEBO = new HashMap<String, Object>(); |
| 269 | |
Object sourcePropertyValue; |
| 270 | 0 | Object targetPropertyValue = null; |
| 271 | 0 | boolean sourceTargetPropertyValuesSame = true; |
| 272 | 0 | for(PrimitiveAttributeDefinition primitiveAttributeDefinition: primitiveAttributeDefinitions){ |
| 273 | 0 | sourcePropertyValue = ObjectUtils.getPropertyValue( |
| 274 | |
businessObject, primitiveAttributeDefinition.getSourceName()); |
| 275 | 0 | if(currentInstanceExternalizableBO!=null) |
| 276 | 0 | targetPropertyValue = ObjectUtils.getPropertyValue(currentInstanceExternalizableBO, primitiveAttributeDefinition.getTargetName()); |
| 277 | 0 | if(sourcePropertyValue==null){ |
| 278 | 0 | return null; |
| 279 | 0 | } else if(targetPropertyValue==null || (targetPropertyValue!=null && !targetPropertyValue.equals(sourcePropertyValue))){ |
| 280 | 0 | sourceTargetPropertyValuesSame = false; |
| 281 | |
} |
| 282 | 0 | fieldValuesInEBO.put(primitiveAttributeDefinition.getTargetName(), sourcePropertyValue); |
| 283 | |
} |
| 284 | |
|
| 285 | 0 | if(!sourceTargetPropertyValuesSame) |
| 286 | 0 | return (T) getExternalizableBusinessObject(clazz, fieldValuesInEBO); |
| 287 | 0 | return currentInstanceExternalizableBO; |
| 288 | |
} |
| 289 | |
|
| 290 | |
|
| 291 | |
|
| 292 | |
|
| 293 | |
|
| 294 | |
|
| 295 | |
|
| 296 | |
|
| 297 | |
public List<? extends ExternalizableBusinessObject> retrieveExternalizableBusinessObjectsList( |
| 298 | |
BusinessObject businessObject, String externalizableRelationshipName, Class externalizableClazz) { |
| 299 | |
|
| 300 | 0 | if(businessObject==null) return null; |
| 301 | |
|
| 302 | |
|
| 303 | 0 | String className = businessObject.getClass().getName(); |
| 304 | 0 | String key = className.substring(className.lastIndexOf(".")+1); |
| 305 | 0 | BusinessObjectEntry entry = |
| 306 | |
KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntries().get(key); |
| 307 | 0 | RelationshipDefinition relationshipDefinition = entry.getRelationshipDefinition(externalizableRelationshipName); |
| 308 | 0 | List<PrimitiveAttributeDefinition> primitiveAttributeDefinitions = relationshipDefinition.getPrimitiveAttributes(); |
| 309 | 0 | Map<String, Object> fieldValuesInEBO = new HashMap<String, Object>(); |
| 310 | |
Object sourcePropertyValue; |
| 311 | 0 | for(PrimitiveAttributeDefinition primitiveAttributeDefinition: primitiveAttributeDefinitions){ |
| 312 | 0 | sourcePropertyValue = ObjectUtils.getPropertyValue( |
| 313 | |
businessObject, primitiveAttributeDefinition.getSourceName()); |
| 314 | 0 | if(sourcePropertyValue==null){ |
| 315 | 0 | return null; |
| 316 | |
} |
| 317 | 0 | fieldValuesInEBO.put(primitiveAttributeDefinition.getTargetName(), sourcePropertyValue); |
| 318 | |
} |
| 319 | 0 | return getExternalizableBusinessObjectsList( |
| 320 | |
getExternalizableBusinessObjectImplementation(externalizableClazz), fieldValuesInEBO); |
| 321 | |
} |
| 322 | |
|
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
public <E extends ExternalizableBusinessObject> Class<E> getExternalizableBusinessObjectImplementation(Class<E> externalizableBusinessObjectInterface) { |
| 327 | 0 | if (getModuleConfiguration() == null) { |
| 328 | 0 | throw new IllegalStateException("Module configuration has not been initialized for the module service."); |
| 329 | |
} |
| 330 | 0 | int classModifiers = externalizableBusinessObjectInterface.getModifiers(); |
| 331 | 0 | Map<Class, Class> ebos = getModuleConfiguration().getExternalizableBusinessObjectImplementations(); |
| 332 | |
|
| 333 | 0 | if (ebos.containsValue(externalizableBusinessObjectInterface)) { |
| 334 | 0 | return externalizableBusinessObjectInterface; |
| 335 | |
} |
| 336 | 0 | if (getModuleConfiguration().getExternalizableBusinessObjectImplementations() == null) { |
| 337 | 0 | return null; |
| 338 | |
} |
| 339 | |
else { |
| 340 | 0 | Class<E> implementationClass = ebos.get(externalizableBusinessObjectInterface); |
| 341 | 0 | int implClassModifiers = implementationClass.getModifiers(); |
| 342 | 0 | if (Modifier.isInterface(implClassModifiers) || Modifier.isAbstract(implClassModifiers)) { |
| 343 | 0 | throw new RuntimeException("Implementation class must be non-abstract class: ebo interface: " + externalizableBusinessObjectInterface.getName() + " impl class: " |
| 344 | |
+ implementationClass.getName() + " module: " + getModuleConfiguration().getNamespaceCode()); |
| 345 | |
} |
| 346 | 0 | return implementationClass; |
| 347 | |
} |
| 348 | |
|
| 349 | |
} |
| 350 | |
|
| 351 | |
|
| 352 | |
|
| 353 | |
|
| 354 | |
public void afterPropertiesSet() throws Exception { |
| 355 | 0 | KualiModuleService kualiModuleService = null; |
| 356 | |
try { |
| 357 | 0 | kualiModuleService = KRADServiceLocatorWeb.getKualiModuleService(); |
| 358 | 0 | if ( kualiModuleService == null ) { |
| 359 | 0 | kualiModuleService = ((KualiModuleService)applicationContext.getBean( KRADServiceLocatorWeb.KUALI_MODULE_SERVICE )); |
| 360 | |
} |
| 361 | 0 | } catch ( NoSuchBeanDefinitionException ex ) { |
| 362 | 0 | kualiModuleService = ((KualiModuleService)applicationContext.getBean( KRADServiceLocatorWeb.KUALI_MODULE_SERVICE )); |
| 363 | 0 | } |
| 364 | 0 | kualiModuleService.getInstalledModuleServices().add( this ); |
| 365 | 0 | } |
| 366 | |
|
| 367 | |
|
| 368 | |
|
| 369 | |
|
| 370 | |
public ModuleConfiguration getModuleConfiguration() { |
| 371 | 0 | return this.moduleConfiguration; |
| 372 | |
} |
| 373 | |
|
| 374 | |
|
| 375 | |
|
| 376 | |
|
| 377 | |
public void setModuleConfiguration(ModuleConfiguration moduleConfiguration) { |
| 378 | 0 | this.moduleConfiguration = moduleConfiguration; |
| 379 | 0 | } |
| 380 | |
|
| 381 | |
|
| 382 | |
|
| 383 | |
|
| 384 | |
public boolean isExternalizable(Class boClazz){ |
| 385 | 0 | if(boClazz==null) return false; |
| 386 | 0 | return ExternalizableBusinessObject.class.isAssignableFrom(boClazz); |
| 387 | |
} |
| 388 | |
|
| 389 | |
public boolean isExternalizableBusinessObjectLookupable(Class boClass) { |
| 390 | 0 | return getBusinessObjectDictionaryService().isLookupable(boClass); |
| 391 | |
} |
| 392 | |
|
| 393 | |
public boolean isExternalizableBusinessObjectInquirable(Class boClass) { |
| 394 | 0 | return getBusinessObjectDictionaryService().isInquirable(boClass); |
| 395 | |
} |
| 396 | |
|
| 397 | |
public <T extends ExternalizableBusinessObject> T createNewObjectFromExternalizableClass(Class<T> boClass) { |
| 398 | |
try { |
| 399 | 0 | return (T) getExternalizableBusinessObjectImplementation(boClass).newInstance(); |
| 400 | 0 | } catch (Exception e) { |
| 401 | 0 | throw new RuntimeException("Unable to create externalizable business object class", e); |
| 402 | |
} |
| 403 | |
} |
| 404 | |
|
| 405 | |
public DataObjectRelationship getBusinessObjectRelationship(Class boClass, String attributeName, String attributePrefix){ |
| 406 | 0 | return null; |
| 407 | |
} |
| 408 | |
|
| 409 | |
|
| 410 | |
|
| 411 | |
public BusinessObjectDictionaryService getBusinessObjectDictionaryService () { |
| 412 | 0 | if ( businessObjectDictionaryService == null ) { |
| 413 | 0 | businessObjectDictionaryService = KRADServiceLocatorWeb.getBusinessObjectDictionaryService(); |
| 414 | |
} |
| 415 | 0 | return businessObjectDictionaryService; |
| 416 | |
} |
| 417 | |
|
| 418 | |
|
| 419 | |
|
| 420 | |
|
| 421 | |
public BusinessObjectService getBusinessObjectService() { |
| 422 | 0 | if ( businessObjectService == null ) { |
| 423 | 0 | businessObjectService = KRADServiceLocator.getBusinessObjectService(); |
| 424 | |
} |
| 425 | 0 | return businessObjectService; |
| 426 | |
} |
| 427 | |
|
| 428 | |
|
| 429 | |
|
| 430 | |
|
| 431 | |
|
| 432 | |
protected LookupService getLookupService() { |
| 433 | 0 | return lookupService != null ? lookupService : KRADServiceLocatorWeb.getLookupService(); |
| 434 | |
} |
| 435 | |
|
| 436 | |
|
| 437 | |
|
| 438 | |
|
| 439 | |
public KualiModuleService getKualiModuleService() { |
| 440 | 0 | return this.kualiModuleService; |
| 441 | |
} |
| 442 | |
|
| 443 | |
|
| 444 | |
|
| 445 | |
|
| 446 | |
public void setKualiModuleService(KualiModuleService kualiModuleService) { |
| 447 | 0 | this.kualiModuleService = kualiModuleService; |
| 448 | 0 | } |
| 449 | |
|
| 450 | |
|
| 451 | |
|
| 452 | |
|
| 453 | |
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| 454 | 0 | this.applicationContext = applicationContext; |
| 455 | 0 | } |
| 456 | |
|
| 457 | |
|
| 458 | |
|
| 459 | |
|
| 460 | |
|
| 461 | |
|
| 462 | |
|
| 463 | |
|
| 464 | |
public List<List<String>> listAlternatePrimaryKeyFieldNames( |
| 465 | |
Class businessObjectInterfaceClass) { |
| 466 | 0 | return null; |
| 467 | |
} |
| 468 | |
|
| 469 | |
|
| 470 | |
|
| 471 | |
|
| 472 | |
|
| 473 | |
|
| 474 | |
|
| 475 | |
|
| 476 | |
@Override |
| 477 | |
public boolean isLocked() { |
| 478 | 0 | ModuleConfiguration configuration = this.getModuleConfiguration(); |
| 479 | 0 | if(configuration != null) { |
| 480 | 0 | String namespaceCode = configuration.getNamespaceCode(); |
| 481 | 0 | String componentCode = KRADConstants.DetailTypes.OLTP_LOCKOUT_DETAIL_TYPE; |
| 482 | 0 | String parameterName = KRADConstants.SystemGroupParameterNames.OLTP_LOCKOUT_ACTIVE_IND; |
| 483 | 0 | ParameterService parameterService = CoreFrameworkServiceLocator.getParameterService(); |
| 484 | 0 | String shouldLockout = parameterService.getParameterValueAsString(namespaceCode, componentCode, parameterName); |
| 485 | 0 | if(StringUtils.isNotBlank(shouldLockout)) { |
| 486 | 0 | return parameterService.getParameterValueAsBoolean(namespaceCode, componentCode, parameterName); |
| 487 | |
} |
| 488 | |
} |
| 489 | 0 | return false; |
| 490 | |
} |
| 491 | |
} |
| 492 | |
|