001 /** 002 * Copyright 2005-2013 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 */ 016 package org.kuali.rice.krad.service.impl; 017 018 import org.apache.commons.beanutils.PropertyUtils; 019 import org.apache.commons.lang.StringUtils; 020 import org.apache.log4j.Logger; 021 import org.kuali.rice.core.api.config.property.ConfigurationService; 022 import org.kuali.rice.coreservice.framework.CoreFrameworkServiceLocator; 023 import org.kuali.rice.coreservice.framework.parameter.ParameterService; 024 import org.kuali.rice.krad.bo.BusinessObject; 025 import org.kuali.rice.krad.bo.DataObjectRelationship; 026 import org.kuali.rice.krad.bo.ExternalizableBusinessObject; 027 import org.kuali.rice.krad.bo.ModuleConfiguration; 028 import org.kuali.rice.krad.datadictionary.BusinessObjectEntry; 029 import org.kuali.rice.krad.datadictionary.PrimitiveAttributeDefinition; 030 import org.kuali.rice.krad.datadictionary.RelationshipDefinition; 031 import org.kuali.rice.krad.service.BusinessObjectNotLookupableException; 032 import org.kuali.rice.krad.service.KRADServiceLocator; 033 import org.kuali.rice.krad.service.KRADServiceLocatorWeb; 034 import org.kuali.rice.krad.service.KualiModuleService; 035 import org.kuali.rice.krad.service.LookupService; 036 import org.kuali.rice.krad.service.ModuleService; 037 import org.kuali.rice.krad.uif.UifParameters; 038 import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils; 039 import org.kuali.rice.krad.util.KRADConstants; 040 import org.kuali.rice.krad.util.ObjectUtils; 041 import org.kuali.rice.krad.util.UrlFactory; 042 import org.springframework.beans.BeansException; 043 import org.springframework.beans.factory.NoSuchBeanDefinitionException; 044 import org.springframework.context.ApplicationContext; 045 046 import java.lang.reflect.Modifier; 047 import java.util.HashMap; 048 import java.util.List; 049 import java.util.Map; 050 import java.util.Properties; 051 052 053 public abstract class RemoteModuleServiceBase implements ModuleService { 054 protected static final Logger LOG = Logger.getLogger(RemoteModuleServiceBase.class); 055 056 protected ModuleConfiguration moduleConfiguration; 057 protected KualiModuleService kualiModuleService; 058 protected ApplicationContext applicationContext; 059 protected ConfigurationService kualiConfigurationService; 060 protected LookupService lookupService; 061 062 /** 063 * @see org.kuali.rice.krad.service.ModuleService#isResponsibleFor(java.lang.Class) 064 */ 065 public boolean isResponsibleFor(Class businessObjectClass) { 066 if (getModuleConfiguration() == null) { 067 throw new IllegalStateException("Module configuration has not been initialized for the module service."); 068 } 069 070 if (getModuleConfiguration().getPackagePrefixes() == null || businessObjectClass == null) { 071 return false; 072 } 073 for (String prefix : getModuleConfiguration().getPackagePrefixes()) { 074 if (businessObjectClass.getPackage().getName().startsWith(prefix)) { 075 return true; 076 } 077 } 078 if (ExternalizableBusinessObject.class.isAssignableFrom(businessObjectClass)) { 079 Class externalizableBusinessObjectInterface = 080 ExternalizableBusinessObjectUtils.determineExternalizableBusinessObjectSubInterface( 081 businessObjectClass); 082 if (externalizableBusinessObjectInterface != null) { 083 for (String prefix : getModuleConfiguration().getPackagePrefixes()) { 084 if (externalizableBusinessObjectInterface.getPackage().getName().startsWith(prefix)) { 085 return true; 086 } 087 } 088 } 089 } 090 return false; 091 } 092 093 /** 094 * Utility method to check for the presence of a non blank value in the map for the given key 095 * Note: returns false if a null map is passed in. 096 * 097 * @param map the map to retrieve the value from 098 * @param key the key to use 099 * @return true if there is a non-blank value in the map for the given key. 100 */ 101 protected static boolean isNonBlankValueForKey(Map<String, Object> map, String key) { 102 if (map == null) return false; 103 104 Object result = map.get(key); 105 if (result instanceof String) { 106 return !StringUtils.isBlank((String)result); 107 } 108 return result != null; 109 } 110 111 /** 112 * @see org.kuali.rice.krad.service.ModuleService#isResponsibleFor(java.lang.Class) 113 */ 114 public boolean isResponsibleForJob(String jobName) { 115 if (getModuleConfiguration() == null) { 116 throw new IllegalStateException("Module configuration has not been initialized for the module service."); 117 } 118 119 if (getModuleConfiguration().getJobNames() == null || StringUtils.isEmpty(jobName)) { 120 return false; 121 } 122 123 return getModuleConfiguration().getJobNames().contains(jobName); 124 } 125 126 127 public List listPrimaryKeyFieldNames(Class businessObjectInterfaceClass) { 128 Class clazz = getExternalizableBusinessObjectImplementation(businessObjectInterfaceClass); 129 return KRADServiceLocator.getPersistenceStructureService().listPrimaryKeyFieldNames(clazz); 130 } 131 132 /** 133 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableBusinessObjectDictionaryEntry(java.lang.Class) 134 */ 135 public BusinessObjectEntry getExternalizableBusinessObjectDictionaryEntry(Class businessObjectInterfaceClass) { 136 Class boClass = getExternalizableBusinessObjectImplementation(businessObjectInterfaceClass); 137 138 return boClass == null ? null : KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary() 139 .getBusinessObjectEntryForConcreteClass(boClass.getName()); 140 } 141 142 /** 143 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableDataObjectInquiryUrl(java.lang.Class, 144 * java.util.Properties) 145 */ 146 public String getExternalizableDataObjectInquiryUrl(Class<?> inquiryDataObjectClass, Properties parameters) { 147 String baseUrl = getBaseInquiryUrl(); 148 149 // if external business object, replace data object in request with the actual impl object class 150 if (ExternalizableBusinessObject.class.isAssignableFrom(inquiryDataObjectClass)) { 151 Class implementationClass = getExternalizableBusinessObjectImplementation(inquiryDataObjectClass.asSubclass( 152 ExternalizableBusinessObject.class)); 153 if (implementationClass == null) { 154 throw new RuntimeException("Can't find ExternalizableBusinessObject implementation class for " 155 + inquiryDataObjectClass.getName()); 156 } 157 158 parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, implementationClass.getName()); 159 } 160 161 return UrlFactory.parameterizeUrl(baseUrl, parameters); 162 } 163 164 /** 165 * Returns the base URL to use for inquiry requests to objects within the module 166 * 167 * @return String base inquiry URL 168 */ 169 protected String getBaseInquiryUrl() { 170 return getKualiConfigurationService().getPropertyValueAsString(KRADConstants.KRAD_INQUIRY_URL_KEY); 171 } 172 173 /** 174 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableDataObjectLookupUrl(java.lang.Class, 175 * java.util.Properties) 176 */ 177 public String getExternalizableDataObjectLookupUrl(Class<?> lookupDataObjectClass, Properties parameters) { 178 String baseUrl = getBaseLookupUrl(); 179 180 // if external business object, replace data object in request with the actual impl object class 181 if (ExternalizableBusinessObject.class.isAssignableFrom(lookupDataObjectClass)) { 182 Class implementationClass = getExternalizableBusinessObjectImplementation(lookupDataObjectClass.asSubclass( 183 ExternalizableBusinessObject.class)); 184 if (implementationClass == null) { 185 throw new RuntimeException("Can't find ExternalizableBusinessObject implementation class for " 186 + lookupDataObjectClass.getName()); 187 } 188 189 parameters.put(UifParameters.DATA_OBJECT_CLASS_NAME, implementationClass.getName()); 190 } 191 192 return UrlFactory.parameterizeUrl(baseUrl, parameters); 193 } 194 195 /** 196 * Returns the base lookup URL for the Rice server 197 * 198 * @return String base lookup URL 199 */ 200 protected String getRiceBaseLookupUrl() { 201 return BaseLookupUrlsHolder.remoteKradBaseLookupUrl; 202 } 203 204 // Lazy initialization holder class idiom, see Effective Java item #71 205 protected static final class BaseLookupUrlsHolder { 206 207 public static final String localKradBaseLookupUrl; 208 public static final String remoteKradBaseLookupUrl; 209 210 static { 211 remoteKradBaseLookupUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString(KRADConstants.KRAD_SERVER_LOOKUP_URL_KEY); 212 localKradBaseLookupUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString(KRADConstants.KRAD_LOOKUP_URL_KEY); 213 } 214 } 215 216 /** 217 * Returns the base URL to use for lookup requests to objects within the module 218 * 219 * @return String base lookup URL 220 */ 221 protected String getBaseLookupUrl() { 222 return getRiceBaseLookupUrl(); 223 } 224 225 @Deprecated 226 public String getExternalizableBusinessObjectInquiryUrl(Class inquiryBusinessObjectClass, 227 Map<String, String[]> parameters) { 228 if (!isExternalizable(inquiryBusinessObjectClass)) { 229 return KRADConstants.EMPTY_STRING; 230 } 231 String businessObjectClassAttribute; 232 233 Class implementationClass = getExternalizableBusinessObjectImplementation(inquiryBusinessObjectClass); 234 if (implementationClass == null) { 235 LOG.error("Can't find ExternalizableBusinessObject implementation class for " + inquiryBusinessObjectClass 236 .getName()); 237 throw new RuntimeException("Can't find ExternalizableBusinessObject implementation class for interface " 238 + inquiryBusinessObjectClass.getName()); 239 } 240 businessObjectClassAttribute = implementationClass.getName(); 241 return UrlFactory.parameterizeUrl(getInquiryUrl(inquiryBusinessObjectClass), getUrlParameters( 242 businessObjectClassAttribute, parameters)); 243 } 244 245 /** 246 * This overridden method ... 247 * 248 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableBusinessObjectLookupUrl(java.lang.Class, 249 * java.util.Map) 250 */ 251 @Deprecated 252 @Override 253 public String getExternalizableBusinessObjectLookupUrl(Class inquiryBusinessObjectClass, 254 Map<String, String> parameters) { 255 Properties urlParameters = new Properties(); 256 257 String riceBaseUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString( 258 KRADConstants.KUALI_RICE_URL_KEY); 259 String lookupUrl = riceBaseUrl; 260 if (!lookupUrl.endsWith("/")) { 261 lookupUrl = lookupUrl + "/"; 262 } 263 if (parameters.containsKey(KRADConstants.MULTIPLE_VALUE)) { 264 lookupUrl = lookupUrl + KRADConstants.MULTIPLE_VALUE_LOOKUP_ACTION; 265 } else { 266 lookupUrl = lookupUrl + KRADConstants.LOOKUP_ACTION; 267 } 268 for (String paramName : parameters.keySet()) { 269 urlParameters.put(paramName, parameters.get(paramName)); 270 } 271 272 Class clazz = getExternalizableBusinessObjectImplementation(inquiryBusinessObjectClass); 273 urlParameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, clazz == null ? "" : clazz.getName()); 274 275 return UrlFactory.parameterizeUrl(lookupUrl, urlParameters); 276 } 277 278 /** 279 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableBusinessObjectsListForLookup(java.lang.Class, 280 * java.util.Map, boolean) 281 */ 282 public <T extends ExternalizableBusinessObject> List<T> getExternalizableBusinessObjectsListForLookup( 283 Class<T> externalizableBusinessObjectClass, Map<String, Object> fieldValues, boolean unbounded) { 284 Class<? extends ExternalizableBusinessObject> implementationClass = 285 getExternalizableBusinessObjectImplementation(externalizableBusinessObjectClass); 286 if (isExternalizableBusinessObjectLookupable(implementationClass)) { 287 Map<String, String> searchCriteria = new HashMap<String, String>(); 288 for (Map.Entry<String, Object> fieldValue : fieldValues.entrySet()) { 289 if (fieldValue.getValue() != null) { 290 searchCriteria.put(fieldValue.getKey(), fieldValue.getValue().toString()); 291 } else { 292 searchCriteria.put(fieldValue.getKey(), null); 293 } 294 } 295 return (List<T>) getLookupService().findCollectionBySearchHelper(implementationClass, searchCriteria, 296 unbounded); 297 } else { 298 throw new BusinessObjectNotLookupableException( 299 "External business object is not a Lookupable: " + implementationClass); 300 } 301 } 302 303 /** 304 * This method assumes that the property type for externalizable relationship in the business object is an interface 305 * and gets the concrete implementation for it 306 * 307 * @see org.kuali.rice.krad.service.ModuleService#retrieveExternalizableBusinessObjectIfNecessary(org.kuali.rice.krad.bo.BusinessObject, 308 * org.kuali.rice.krad.bo.BusinessObject, java.lang.String) 309 */ 310 public <T extends ExternalizableBusinessObject> T retrieveExternalizableBusinessObjectIfNecessary( 311 BusinessObject businessObject, T currentInstanceExternalizableBO, String externalizableRelationshipName) { 312 313 if (businessObject == null) { 314 return null; 315 } 316 Class clazz; 317 try { 318 clazz = getExternalizableBusinessObjectImplementation(PropertyUtils.getPropertyType(businessObject, 319 externalizableRelationshipName)); 320 } catch (Exception iex) { 321 LOG.warn("Exception:" 322 + iex 323 + " thrown while trying to get property type for property:" 324 + externalizableRelationshipName 325 + " from business object:" 326 + businessObject); 327 return null; 328 } 329 330 //Get the business object entry for this business object from data dictionary 331 //using the class name (without the package) as key 332 BusinessObjectEntry entry = 333 KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntries().get( 334 businessObject.getClass().getSimpleName()); 335 RelationshipDefinition relationshipDefinition = entry.getRelationshipDefinition(externalizableRelationshipName); 336 List<PrimitiveAttributeDefinition> primitiveAttributeDefinitions = 337 relationshipDefinition.getPrimitiveAttributes(); 338 339 Map<String, Object> fieldValuesInEBO = new HashMap<String, Object>(); 340 Object sourcePropertyValue; 341 Object targetPropertyValue = null; 342 boolean sourceTargetPropertyValuesSame = true; 343 for (PrimitiveAttributeDefinition primitiveAttributeDefinition : primitiveAttributeDefinitions) { 344 sourcePropertyValue = ObjectUtils.getPropertyValue(businessObject, 345 primitiveAttributeDefinition.getSourceName()); 346 if (currentInstanceExternalizableBO != null) { 347 targetPropertyValue = ObjectUtils.getPropertyValue(currentInstanceExternalizableBO, 348 primitiveAttributeDefinition.getTargetName()); 349 } 350 if (sourcePropertyValue == null) { 351 return null; 352 } else if (targetPropertyValue == null || (targetPropertyValue != null && !targetPropertyValue.equals( 353 sourcePropertyValue))) { 354 sourceTargetPropertyValuesSame = false; 355 } 356 fieldValuesInEBO.put(primitiveAttributeDefinition.getTargetName(), sourcePropertyValue); 357 } 358 359 if (!sourceTargetPropertyValuesSame) { 360 return (T) getExternalizableBusinessObject(clazz, fieldValuesInEBO); 361 } 362 return currentInstanceExternalizableBO; 363 } 364 365 /** 366 * This method assumes that the externalizableClazz is an interface 367 * and gets the concrete implementation for it 368 * 369 * @see org.kuali.rice.krad.service.ModuleService#retrieveExternalizableBusinessObjectIfNecessary(org.kuali.rice.krad.bo.BusinessObject, 370 * org.kuali.rice.krad.bo.BusinessObject, java.lang.String) 371 */ 372 @Override 373 public List<? extends ExternalizableBusinessObject> retrieveExternalizableBusinessObjectsList( 374 BusinessObject businessObject, String externalizableRelationshipName, Class externalizableClazz) { 375 376 if (businessObject == null) { 377 return null; 378 } 379 //Get the business object entry for this business object from data dictionary 380 //using the class name (without the package) as key 381 String className = businessObject.getClass().getName(); 382 String key = className.substring(className.lastIndexOf(".") + 1); 383 BusinessObjectEntry entry = 384 KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getBusinessObjectEntries().get( 385 key); 386 RelationshipDefinition relationshipDefinition = entry.getRelationshipDefinition(externalizableRelationshipName); 387 List<PrimitiveAttributeDefinition> primitiveAttributeDefinitions = 388 relationshipDefinition.getPrimitiveAttributes(); 389 Map<String, Object> fieldValuesInEBO = new HashMap<String, Object>(); 390 Object sourcePropertyValue; 391 for (PrimitiveAttributeDefinition primitiveAttributeDefinition : primitiveAttributeDefinitions) { 392 sourcePropertyValue = ObjectUtils.getPropertyValue(businessObject, 393 primitiveAttributeDefinition.getSourceName()); 394 if (sourcePropertyValue == null) { 395 return null; 396 } 397 fieldValuesInEBO.put(primitiveAttributeDefinition.getTargetName(), sourcePropertyValue); 398 } 399 return getExternalizableBusinessObjectsList(getExternalizableBusinessObjectImplementation(externalizableClazz), 400 fieldValuesInEBO); 401 } 402 403 /** 404 * @see org.kuali.rice.krad.service.ModuleService#getExternalizableBusinessObjectImplementation(java.lang.Class) 405 */ 406 @Override 407 public <E extends ExternalizableBusinessObject> Class<E> getExternalizableBusinessObjectImplementation( 408 Class<E> externalizableBusinessObjectInterface) { 409 if (getModuleConfiguration() == null) { 410 throw new IllegalStateException("Module configuration has not been initialized for the module service."); 411 } 412 Map<Class, Class> ebos = getModuleConfiguration().getExternalizableBusinessObjectImplementations(); 413 if (ebos == null) { 414 return null; 415 } 416 if (ebos.containsValue(externalizableBusinessObjectInterface)) { 417 return externalizableBusinessObjectInterface; 418 } else { 419 Class<E> implementationClass = ebos.get(externalizableBusinessObjectInterface); 420 int implClassModifiers = implementationClass.getModifiers(); 421 if (Modifier.isInterface(implClassModifiers) || Modifier.isAbstract(implClassModifiers)) { 422 throw new RuntimeException("Implementation class must be non-abstract class: ebo interface: " 423 + externalizableBusinessObjectInterface.getName() 424 + " impl class: " 425 + implementationClass.getName() 426 + " module: " 427 + getModuleConfiguration().getNamespaceCode()); 428 } 429 return implementationClass; 430 } 431 432 } 433 434 @Deprecated 435 protected Properties getUrlParameters(String businessObjectClassAttribute, Map<String, String[]> parameters) { 436 Properties urlParameters = new Properties(); 437 for (String paramName : parameters.keySet()) { 438 String[] parameterValues = parameters.get(paramName); 439 if (parameterValues.length > 0) { 440 urlParameters.put(paramName, parameterValues[0]); 441 } 442 } 443 urlParameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, businessObjectClassAttribute); 444 urlParameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.CONTINUE_WITH_INQUIRY_METHOD_TO_CALL); 445 return urlParameters; 446 } 447 448 @Deprecated 449 protected String getInquiryUrl(Class inquiryBusinessObjectClass) { 450 String riceBaseUrl = KRADServiceLocator.getKualiConfigurationService().getPropertyValueAsString( 451 KRADConstants.KUALI_RICE_URL_KEY); 452 String inquiryUrl = riceBaseUrl; 453 if (!inquiryUrl.endsWith("/")) { 454 inquiryUrl = inquiryUrl + "/"; 455 } 456 return inquiryUrl + KRADConstants.INQUIRY_ACTION; 457 } 458 459 /** 460 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() 461 */ 462 public void afterPropertiesSet() throws Exception { 463 KualiModuleService kualiModuleService = null; 464 try { 465 kualiModuleService = KRADServiceLocatorWeb.getKualiModuleService(); 466 if (kualiModuleService == null) { 467 kualiModuleService = ((KualiModuleService) applicationContext.getBean( 468 KRADServiceLocatorWeb.KUALI_MODULE_SERVICE)); 469 } 470 } catch (NoSuchBeanDefinitionException ex) { 471 kualiModuleService = ((KualiModuleService) applicationContext.getBean( 472 KRADServiceLocatorWeb.KUALI_MODULE_SERVICE)); 473 } 474 kualiModuleService.getInstalledModuleServices().add(this); 475 } 476 477 /** 478 * @return the moduleConfiguration 479 */ 480 public ModuleConfiguration getModuleConfiguration() { 481 return this.moduleConfiguration; 482 } 483 484 /** 485 * @param moduleConfiguration the moduleConfiguration to set 486 */ 487 public void setModuleConfiguration(ModuleConfiguration moduleConfiguration) { 488 this.moduleConfiguration = moduleConfiguration; 489 } 490 491 /** 492 * @see org.kuali.rice.krad.service.ModuleService#isExternalizable(java.lang.Class) 493 */ 494 @Override 495 public boolean isExternalizable(Class boClazz) { 496 if (boClazz == null) { 497 return false; 498 } 499 return ExternalizableBusinessObject.class.isAssignableFrom(boClazz); 500 } 501 502 public <T extends ExternalizableBusinessObject> T createNewObjectFromExternalizableClass(Class<T> boClass) { 503 try { 504 return (T) getExternalizableBusinessObjectImplementation(boClass).newInstance(); 505 } catch (Exception e) { 506 throw new RuntimeException("Unable to create externalizable business object class", e); 507 } 508 } 509 510 public DataObjectRelationship getBusinessObjectRelationship(Class boClass, String attributeName, 511 String attributePrefix) { 512 return null; 513 } 514 515 516 /** 517 * @return the kualiModuleService 518 */ 519 public KualiModuleService getKualiModuleService() { 520 return this.kualiModuleService; 521 } 522 523 /** 524 * @param kualiModuleService the kualiModuleService to set 525 */ 526 public void setKualiModuleService(KualiModuleService kualiModuleService) { 527 this.kualiModuleService = kualiModuleService; 528 } 529 530 protected ConfigurationService getKualiConfigurationService() { 531 if (this.kualiConfigurationService == null) { 532 this.kualiConfigurationService = KRADServiceLocator.getKualiConfigurationService(); 533 } 534 535 return this.kualiConfigurationService; 536 } 537 538 public void setKualiConfigurationService(ConfigurationService kualiConfigurationService) { 539 this.kualiConfigurationService = kualiConfigurationService; 540 } 541 542 /** 543 * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) 544 */ 545 @Override 546 public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 547 this.applicationContext = applicationContext; 548 } 549 550 /** 551 * This overridden method ... 552 * 553 * @see org.kuali.rice.krad.service.ModuleService#listAlternatePrimaryKeyFieldNames(java.lang.Class) 554 */ 555 @Override 556 public List<List<String>> listAlternatePrimaryKeyFieldNames(Class businessObjectInterfaceClass) { 557 return null; 558 } 559 560 /** 561 * This method determines whether or not this module is currently locked 562 * 563 * @see org.kuali.rice.krad.service.ModuleService#isLocked() 564 */ 565 @Override 566 public boolean isLocked() { 567 ModuleConfiguration configuration = this.getModuleConfiguration(); 568 if (configuration != null) { 569 String namespaceCode = configuration.getNamespaceCode(); 570 String componentCode = KRADConstants.DetailTypes.ALL_DETAIL_TYPE; 571 String parameterName = KRADConstants.SystemGroupParameterNames.OLTP_LOCKOUT_ACTIVE_IND; 572 ParameterService parameterService = CoreFrameworkServiceLocator.getParameterService(); 573 String shouldLockout = parameterService.getParameterValueAsString(namespaceCode, componentCode, 574 parameterName); 575 if (StringUtils.isNotBlank(shouldLockout)) { 576 return parameterService.getParameterValueAsBoolean(namespaceCode, componentCode, parameterName); 577 } 578 } 579 return false; 580 } 581 582 /** 583 * Gets the lookupService attribute. 584 * 585 * @return Returns the lookupService. 586 */ 587 protected LookupService getLookupService() { 588 return lookupService != null ? lookupService : KRADServiceLocatorWeb.getLookupService(); 589 } 590 591 @Override 592 public boolean goToCentralRiceForInquiry() { 593 return false; 594 } 595 }