Coverage Report - org.kuali.rice.kns.service.impl.ParameterServiceBase
 
Classes in this File Line Coverage Branch Coverage Complexity
ParameterServiceBase
0%
0/123
0%
0/72
2.833
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.impl;
 17  
 
 18  
 import java.util.Arrays;
 19  
 import java.util.Collections;
 20  
 import java.util.List;
 21  
 
 22  
 import org.apache.commons.lang.StringUtils;
 23  
 import org.apache.log4j.Logger;
 24  
 import org.kuali.rice.core.util.ClassLoaderUtils;
 25  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 26  
 import org.kuali.rice.kns.bo.BusinessObject;
 27  
 import org.kuali.rice.kns.bo.Parameter;
 28  
 import org.kuali.rice.kns.bo.ParameterDetailType;
 29  
 import org.kuali.rice.kns.datadictionary.BusinessObjectEntry;
 30  
 import org.kuali.rice.kns.document.TransactionalDocument;
 31  
 import org.kuali.rice.kns.service.DataDictionaryService;
 32  
 import org.kuali.rice.kns.service.KualiModuleService;
 33  
 import org.kuali.rice.kns.service.ModuleService;
 34  
 import org.kuali.rice.kns.service.ParameterConstants;
 35  
 import org.kuali.rice.kns.service.ParameterEvaluator;
 36  
 import org.kuali.rice.kns.service.ParameterService;
 37  
 import org.kuali.rice.kns.service.ParameterConstants.COMPONENT;
 38  
 import org.kuali.rice.kns.service.ParameterConstants.NAMESPACE;
 39  
 import org.kuali.rice.kns.util.KNSConstants;
 40  
 import org.kuali.rice.kns.util.KNSUtils;
 41  
 
 42  
 /**
 43  
  * This is a description of what this class does - tom don't forget to fill this in. 
 44  
  * 
 45  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 46  
  *
 47  
  */
 48  
 public abstract class ParameterServiceBase implements ParameterService {
 49  
         protected DataDictionaryService dataDictionaryService;
 50  
         protected KualiModuleService kualiModuleService;
 51  
         protected static final String PARAMETER_CACHE_PREFIX = "Parameter:";
 52  
     protected static final String PARAMETER_CACHE_GROUP_NAME = "SystemParameter";
 53  
 
 54  
         /**
 55  
          * This constructs a ...
 56  
          * 
 57  
          */
 58  
         public ParameterServiceBase() {
 59  0
                 super();
 60  0
         }
 61  
 
 62  
         /**
 63  
          * @see org.kuali.kfs.sys.service.ParameterService#parameterExists(java.lang.Class componentClass, java.lang.String parameterName)
 64  
          */
 65  
         @SuppressWarnings("unchecked")
 66  
         public boolean parameterExists(Class componentClass, String parameterName) {
 67  0
             return retrieveParameter(getNamespace(componentClass), getDetailType(componentClass), parameterName) != null;
 68  
         }
 69  
 
 70  
         /**
 71  
          * This method provides a convenient way to access the value of indicator parameters with Y/N values. Y is translated to true
 72  
          * and N is translated to false.
 73  
          * 
 74  
          * @param componentClass
 75  
          * @param parameterName
 76  
          * @return boolean value of Yes/No indicator parameter
 77  
          */
 78  
         @SuppressWarnings("unchecked")
 79  
         public boolean getIndicatorParameter(Class componentClass, String parameterName) {
 80  0
             return "Y".equals(getParameter(componentClass, parameterName).getParameterValue());
 81  
         }
 82  
         
 83  
         /**
 84  
      * This method provides a convenient way to access the value of indicator parameters with Y/N values. Y is translated to true
 85  
      * and N is translated to false.
 86  
      * 
 87  
      * @param namespaceCode
 88  
      * @param detailTypeCode 
 89  
      * @param parameterName
 90  
      * @return boolean value of Yes/No indicator parameter
 91  
      */
 92  
     @SuppressWarnings("unchecked")
 93  
     public boolean getIndicatorParameter(String namespaceCode, String detailTypeCode, String parameterName) {
 94  0
         return "Y".equals(getParameter(namespaceCode, detailTypeCode, parameterName).getParameterValue());
 95  
     }
 96  
 
 97  
         /**
 98  
          * @see org.kuali.kfs.sys.service.ParameterService#getParameterValue(java.lang.Class componentClass, java.lang.String parameterName)
 99  
          */
 100  
         @SuppressWarnings("unchecked")
 101  
         public String getParameterValue(Class componentClass, String parameterName) {
 102  0
             return getParameter(componentClass, parameterName).getParameterValue();
 103  
         }
 104  
         
 105  
         /**
 106  
      * @see org.kuali.kfs.sys.service.ParameterService#getParameterValue(java.lang.Class componentClass, java.lang.String parameterName)
 107  
      */
 108  
     @SuppressWarnings("unchecked")
 109  
     public String getParameterValue(String namespaceCode, String detailTypeCode, String parameterName) {
 110  0
         return getParameter(namespaceCode, detailTypeCode, parameterName).getParameterValue();
 111  
     }
 112  
 
 113  
         /**
 114  
          * This will look for constrainingValue=<value to return> within the parameter text and return that if it is found. Otherwise,
 115  
          * it will return null. Note, that if constrainingValue=value1,value2... (commas specific to the ParameterServiceImpl
 116  
          * implementation) is found it will still return null, because calling this method states the assumption that there is only one
 117  
          * value within the parameter text that corresponds to the constraining value.
 118  
          * 
 119  
          * @param componentClass
 120  
          * @param parameterName
 121  
          * @param constrainingValue
 122  
          * @return derived value String or null
 123  
          */
 124  
         @SuppressWarnings("unchecked")
 125  
         public String getParameterValue(Class componentClass, String parameterName, String constrainingValue) {
 126  0
             List<String> parameterValues = getParameterValues(componentClass, parameterName, constrainingValue);
 127  0
             if (parameterValues.size() == 1) {
 128  0
                 return parameterValues.get(0);
 129  
             }
 130  0
             return null;
 131  
         }
 132  
 
 133  
         /**
 134  
          * This method can be used to parse the value of a parameter by splitting on a semi-colon.
 135  
          * 
 136  
          * @param componentClass
 137  
          * @param parameterName
 138  
          * @return parsed List of String parameter values
 139  
          */
 140  
         @SuppressWarnings("unchecked")
 141  
         public List<String> getParameterValues(Class componentClass, String parameterName) {
 142  0
             return Collections.unmodifiableList( getParameterValues(getParameter(componentClass, parameterName)) );
 143  
         }
 144  
         
 145  
         /**
 146  
      * This method can be used to parse the value of a parameter by splitting on a semi-colon.
 147  
      * 
 148  
      * @param namespaceCode
 149  
      * @param detailTypeCode 
 150  
      * @param parameterName
 151  
      * @return parsed List of String parameter values
 152  
      */
 153  
     @SuppressWarnings("unchecked")
 154  
     public List<String> getParameterValues(String namespaceCode, String detailTypeCode, String parameterName) {
 155  0
         return Collections.unmodifiableList( getParameterValues(getParameter(namespaceCode, detailTypeCode, parameterName)) );
 156  
     }
 157  
 
 158  
         /**
 159  
          * This method looks for constrainingValue=<some text> within the parameter text and splits that text on a comma to generate
 160  
          * the List to return.
 161  
          * 
 162  
          * @param componentClass
 163  
          * @param parameterName
 164  
          * @param constrainingValue
 165  
          * @return derived values List<String> or an empty list if no values are found
 166  
          */
 167  
         @SuppressWarnings("unchecked")
 168  
         public List<String> getParameterValues(Class componentClass, String parameterName, String constrainingValue) {
 169  0
             return Collections.unmodifiableList( getParameterValues(getParameter(componentClass, parameterName), constrainingValue) );
 170  
         }
 171  
 
 172  
         /**
 173  
          * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 174  
          * corresponding to the specified componentClass and parameterName and the values of the Parameter.
 175  
          * 
 176  
          * @param componentClass
 177  
          * @param parameterName
 178  
          * @return ParameterEvaluator instance initialized with the Parameter corresponding to the specified componentClass and
 179  
          *         parameterName and the values of the Parameter
 180  
          */
 181  
         @SuppressWarnings("unchecked")
 182  
         public ParameterEvaluator getParameterEvaluator(Class componentClass, String parameterName) {
 183  0
             return getParameterEvaluator(getParameter(componentClass, parameterName));
 184  
         }
 185  
         
 186  
         /**
 187  
      * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 188  
      * corresponding to the specified componentClass and parameterName and the values of the Parameter.
 189  
      * 
 190  
      * @param namespaceCode
 191  
      * @param detailTypeCode 
 192  
      * @param parameterName
 193  
      * @return ParameterEvaluator instance initialized with the Parameter corresponding to the specified componentClass and
 194  
      *         parameterName and the values of the Parameter
 195  
      */
 196  
     @SuppressWarnings("unchecked")
 197  
     public ParameterEvaluator getParameterEvaluator(String namespaceCode, String detailTypeCode, String parameterName) {
 198  0
         return getParameterEvaluator(getParameter(namespaceCode, detailTypeCode, parameterName));
 199  
     }
 200  
 
 201  
         /**
 202  
          * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 203  
          * corresponding to the specified componentClass and parameterName, the values of the Parameter, the knowledge of whether the
 204  
          * values are allowed or denied, and the constrainedValue.
 205  
          * 
 206  
          * @param componentClass
 207  
          * @param parameterName
 208  
          * @return ParameterEvaluator instance initialized with the Parameter corresponding to the specified componentClass and
 209  
          *         parameterName, the values of the Parameter, the knowledge of whether the values are allowed or denied, and the
 210  
          *         constrainedValue
 211  
          */
 212  
         @SuppressWarnings("unchecked")
 213  
         public ParameterEvaluator getParameterEvaluator(Class componentClass, String parameterName, String constrainedValue) {
 214  0
             return getParameterEvaluator(getParameter(componentClass, parameterName), constrainedValue);
 215  
         }
 216  
 
 217  
         /**
 218  
      * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 219  
      * corresponding to the specified componentClass and parameterName and the values of the Parameter.
 220  
      * 
 221  
      * @param namespaceCode
 222  
      * @param detailTypeCode 
 223  
      * @param parameterName
 224  
      * @return ParameterEvaluator instance initialized with the Parameter corresponding to the specified componentClass and
 225  
      *         parameterName and the values of the Parameter
 226  
      */
 227  
     @SuppressWarnings("unchecked")
 228  
     public ParameterEvaluator getParameterEvaluator(String namespaceCode, String detailTypeCode, String parameterName, String constrainedValue) {
 229  0
         return getParameterEvaluator(getParameter(namespaceCode, detailTypeCode, parameterName), constrainedValue);
 230  
     }
 231  
     
 232  
         /**
 233  
          * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 234  
          * corresponding to the specified componentClass and parameterName, the values of the Parameter that correspond to the specified
 235  
          * constrainingValue, the knowledge of whether the values are allowed or denied, and the constrainedValue.
 236  
          * 
 237  
          * @param componentClass
 238  
          * @param parameterName
 239  
          * @return ParameterEvaluator instance initialized with the Parameter corresponding to the specified componentClass and
 240  
          *         parameterName, the values of the Parameter that correspond to the specified constrainingValue, the knowledge of
 241  
          *         whether the values are allowed or denied, and the constrainedValue
 242  
          */
 243  
         @SuppressWarnings("unchecked")
 244  
         public ParameterEvaluator getParameterEvaluator(Class componentClass, String parameterName, String constrainingValue,
 245  
                         String constrainedValue) {
 246  0
                             return getParameterEvaluator(getParameter(componentClass, parameterName), constrainingValue, constrainedValue);
 247  
                         }
 248  
 
 249  
         /**
 250  
          * This method will return an instance of the parameterEvaluator bean defined in Spring, initialized with the Parameter
 251  
          * corresponding to the specified componentClass and allowParameterName or to the specified componentClass and denyParameterName
 252  
          * (depending on which restricts based on the constraining value) or an instance of AlwaysSucceedParameterEvaluatorImpl if
 253  
          * neither restricts, the values of the Parameter that correspond to the specified constrainingValue, the knowledge of whether
 254  
          * the values are allowed or denied, and the constrainedValue.
 255  
          * 
 256  
          * @param componentClass
 257  
          * @param allowParameterName
 258  
          * @param denyParameterName
 259  
          * @param constrainingValue
 260  
          * @param constrainedValue
 261  
          * @return AlwaysSucceedParameterEvaluatorImpl or ParameterEvaluator instance initialized with the Parameter that corresponds to
 262  
          *         the constrainingValue restriction, the values of the Parameter that correspond to the specified constrainingValue,
 263  
          *         the knowledge of whether the values are allowed or denied, and the constrainedValue
 264  
          */
 265  
         @SuppressWarnings("unchecked")
 266  
         public ParameterEvaluator getParameterEvaluator(Class componentClass, String allowParameterName, String denyParameterName,
 267  
                         String constrainingValue, String constrainedValue) {
 268  0
                             Parameter allowParameter = getParameter(componentClass, allowParameterName);
 269  0
                             Parameter denyParameter = getParameter(componentClass, denyParameterName);
 270  0
                             if (!getParameterValues(allowParameter, constrainingValue).isEmpty() && !getParameterValues(denyParameter, constrainingValue).isEmpty()) {
 271  0
                                 throw new IllegalArgumentException("The getParameterEvaluator(Class componentClass, String allowParameterName, String denyParameterName, String constrainingValue, String constrainedValue) method of ParameterServiceImpl does not facilitate evaluation of combination allow and deny parameters that both have values for the constraining value: " + allowParameterName + " / " + denyParameterName + " / " + constrainingValue);
 272  
                             }
 273  0
                             if (getParameterValues(allowParameter, constrainingValue).isEmpty() && getParameterValues(denyParameter, constrainingValue).isEmpty()) {
 274  0
                                 return AlwaysSucceedParameterEvaluatorImpl.getInstance();
 275  
                             }
 276  0
                             return getParameterEvaluator(getParameterValues(denyParameter, constrainingValue).isEmpty() ? allowParameter : denyParameter, constrainingValue, constrainedValue);
 277  
                         }
 278  
 
 279  
 
 280  
         @SuppressWarnings("unchecked")
 281  
         public String getNamespace(Class documentOrStepClass) {
 282  0
             if (documentOrStepClass == null) {
 283  0
                 throw new IllegalArgumentException("The getNamespace method of ParameterServiceImpl requires non-null documentOrStepClass");
 284  
             }
 285  0
             if (documentOrStepClass.isAnnotationPresent(NAMESPACE.class)) {
 286  0
                 return ((NAMESPACE) documentOrStepClass.getAnnotation(NAMESPACE.class)).namespace();
 287  
             }
 288  0
             ModuleService moduleService = kualiModuleService.getResponsibleModuleService(documentOrStepClass);
 289  0
             if (moduleService != null) {
 290  0
                 return moduleService.getModuleConfiguration().getNamespaceCode();
 291  
             }
 292  0
             if (documentOrStepClass.getName().startsWith("org.kuali.rice.kns")) {
 293  0
                 return ParameterConstants.NERVOUS_SYSTEM_NAMESPACE;
 294  
             }
 295  0
             if (documentOrStepClass.getName().startsWith("org.kuali.rice.kew")) {
 296  0
                 return "KR-WKFLW";
 297  
             }
 298  0
             if (documentOrStepClass.getName().startsWith("org.kuali.rice.kim")) {
 299  0
                 return "KR-IDM";
 300  
             }
 301  0
             throw new IllegalArgumentException("Unable to determine the namespace for documentOrStepClass " + documentOrStepClass.getName() );
 302  
         }
 303  
 
 304  
         @SuppressWarnings("unchecked")
 305  
         public String getDetailType(Class documentOrStepClass) {
 306  0
             if (documentOrStepClass == null) {
 307  0
                 throw new IllegalArgumentException("The getDetailType method of ParameterServiceImpl requires non-null documentOrStepClass");
 308  
             }
 309  0
             else if (documentOrStepClass.isAnnotationPresent(COMPONENT.class)) {
 310  0
                 return ((COMPONENT) documentOrStepClass.getAnnotation(COMPONENT.class)).component();
 311  
             }
 312  0
             else if (TransactionalDocument.class.isAssignableFrom(documentOrStepClass)) {
 313  0
                 return documentOrStepClass.getSimpleName().replace("Document", "");
 314  
             }
 315  0
             else if (BusinessObject.class.isAssignableFrom(documentOrStepClass) ) {
 316  0
                 return documentOrStepClass.getSimpleName();
 317  
             }
 318  
             else {
 319  
                     // TODO: Warning!  Kludge!  Hack!  Will be replaced!  KULRICE-2921
 320  0
                     Class c = getStepClass();
 321  0
                     if ( c != null && c.isAssignableFrom(documentOrStepClass) ) {
 322  0
                             return documentOrStepClass.getSimpleName();                            
 323  
                     }
 324  
             }
 325  0
             throw new IllegalArgumentException("The getDetailType method of ParameterServiceImpl requires a TransactionalDocument or BusinessObject class.  Was:" + documentOrStepClass.getName());
 326  
         }
 327  
 
 328  
         @SuppressWarnings("unchecked")
 329  
         private Class getStepClass() {
 330  
                 try {
 331  0
                         ClassLoader cl = ClassLoaderUtils.getDefaultClassLoader();
 332  0
                         return Class.forName("org.kuali.kfs.sys.batch.Step", true, cl);
 333  
                 }
 334  0
                 catch ( Exception e ) {
 335  0
                         e.printStackTrace();
 336  0
                         return null;
 337  
                 }
 338  
         }
 339  
         
 340  
         @SuppressWarnings("unchecked")
 341  
         protected String getDetailTypeName(Class documentOrStepClass) {
 342  0
             if (documentOrStepClass == null) {
 343  0
                 throw new IllegalArgumentException("The getDetailTypeName method of ParameterServiceImpl requires non-null documentOrStepClass");
 344  
             }
 345  0
             if (documentOrStepClass.isAnnotationPresent(COMPONENT.class)) {
 346  0
                 BusinessObjectEntry boe = dataDictionaryService.getDataDictionary().getBusinessObjectEntry(documentOrStepClass.getName());
 347  0
                 if (boe != null) {
 348  0
                     return boe.getObjectLabel();
 349  
                 }
 350  
                 else {
 351  0
                     return ((COMPONENT) documentOrStepClass.getAnnotation(COMPONENT.class)).component();
 352  
                 }
 353  
             }
 354  0
             if (TransactionalDocument.class.isAssignableFrom(documentOrStepClass)) {
 355  0
                 return dataDictionaryService.getDocumentLabelByClass(documentOrStepClass);
 356  
             }
 357  0
             else if (BusinessObject.class.isAssignableFrom(documentOrStepClass) ) {
 358  0
                 BusinessObjectEntry boe = dataDictionaryService.getDataDictionary().getBusinessObjectEntry(documentOrStepClass.getName());
 359  0
                 if (boe != null) {
 360  0
                     return boe.getObjectLabel();
 361  
                 }
 362  
                 else {
 363  0
                     return KNSUtils.getBusinessTitleForClass(documentOrStepClass);
 364  
                 }
 365  
             }
 366  0
             throw new IllegalArgumentException("The getDetailTypeName method of ParameterServiceImpl requires TransactionalDocument, BusinessObject, or Step class. Was: " + documentOrStepClass.getName() );
 367  
         }
 368  
 
 369  
         protected ParameterEvaluatorImpl getParameterEvaluator(Parameter parameter) {
 370  0
             ParameterEvaluatorImpl parameterEvaluator = new ParameterEvaluatorImpl();
 371  0
             parameterEvaluator.setParameter(parameter);
 372  0
             parameterEvaluator.setConstraintIsAllow(constraintIsAllow(parameter));
 373  0
             parameterEvaluator.setValues(getParameterValues(parameter));
 374  0
             return parameterEvaluator;
 375  
         }
 376  
 
 377  
         protected ParameterEvaluatorImpl getParameterEvaluator(Parameter parameter, String constrainedValue) {
 378  0
             ParameterEvaluatorImpl parameterEvaluator = getParameterEvaluator(parameter);
 379  0
             parameterEvaluator.setConstrainedValue(constrainedValue);
 380  0
             return parameterEvaluator;
 381  
         }
 382  
 
 383  
         protected ParameterEvaluatorImpl getParameterEvaluator(Parameter parameter, String constrainingValue,
 384  
                         String constrainedValue) {
 385  0
             ParameterEvaluatorImpl parameterEvaluator = getParameterEvaluator(parameter, constrainedValue);
 386  0
             parameterEvaluator.setValues(getParameterValues(parameter, constrainingValue));
 387  0
             return parameterEvaluator;
 388  
         }
 389  
 
 390  
         @SuppressWarnings("unchecked")
 391  
         protected ParameterDetailType getParameterDetailType(Class documentOrStepClass) {
 392  0
             String detailTypeString = getDetailType(documentOrStepClass);
 393  0
             String detailTypeName = getDetailTypeName(documentOrStepClass);
 394  0
             ParameterDetailType detailType = new ParameterDetailType(getNamespace(documentOrStepClass), detailTypeString, (detailTypeName == null) ? detailTypeString : detailTypeName);
 395  0
             detailType.refreshNonUpdateableReferences();
 396  0
             return detailType;
 397  
         }
 398  
 
 399  
         protected List<String> getParameterValues(Parameter parameter, String constrainingValue) {
 400  0
             List<String> constraintValuePairs = getParameterValues(parameter);
 401  0
             for (String pair : constraintValuePairs) {
 402  0
                 if (StringUtils.equals(constrainingValue, StringUtils.substringBefore(pair, "="))) {
 403  0
                     return Arrays.asList(StringUtils.substringAfter(pair, "=").split(","));
 404  
                 }
 405  
             }
 406  0
             return Collections.emptyList();
 407  
         }
 408  
 
 409  
         private List<String> getParameterValues(Parameter parameter) {
 410  0
             if (parameter == null || StringUtils.isBlank(parameter.getParameterValue())) {
 411  0
                 return Collections.emptyList();
 412  
             }
 413  0
             return Arrays.asList(parameter.getParameterValue().split(";"));
 414  
         }
 415  
 
 416  
     /**
 417  
      * @see org.kuali.kfs.sys.service.ParameterService#clearCache()
 418  
      */
 419  
     public void clearCache() {
 420  
         //parameterCache = new ThreadLocal<Map<String,Parameter>>();
 421  0
         KEWServiceLocator.getCacheAdministrator().flushGroup(PARAMETER_CACHE_GROUP_NAME);
 422  0
     }
 423  
  
 424  
     @SuppressWarnings("unchecked")
 425  
         protected Parameter getParameter(Class componentClass, String parameterName) {
 426  0
         String key = componentClass.toString() + ":" + parameterName;
 427  0
         Parameter parameter = null;
 428  
         //String namespaceCode = getNamespace(componentClass);
 429  
         //String detailTypeCode = getDetailType(componentClass);
 430  
         //parameter = fetchFromCache(namespaceCode, detailTypeCode, parameterName);
 431  
         //if (parameter != null) {
 432  
         //    return parameter;
 433  
         //}
 434  0
         parameter = getParameter(getNamespace(componentClass), getDetailType(componentClass), parameterName);
 435  0
         if (parameter == null) {
 436  0
             throw new IllegalArgumentException("The getParameter method of ParameterServiceImpl requires a componentClass and parameterName that correspond to an existing parameter.  Was passed: " + componentClass.getName() + "/" + parameterName);
 437  
         }
 438  
         //insertIntoCache(parameter);
 439  0
         return parameter;
 440  
     }
 441  
     
 442  
         protected Parameter getParameter(String namespaceCode, String detailTypeCode, String parameterName) {
 443  0
             if (StringUtils.isBlank(namespaceCode) || StringUtils.isBlank(detailTypeCode) || StringUtils.isBlank(parameterName)) {
 444  0
                 throw new IllegalArgumentException("The getParameter method of KualiConfigurationServiceImpl requires a non-blank namespaceCode, parameterDetailTypeCode, and parameterName: " + namespaceCode + " / " + detailTypeCode + " / " + parameterName);
 445  
             }
 446  0
             Parameter param = retrieveParameter(namespaceCode, detailTypeCode, parameterName);
 447  0
             if (param == null) {
 448  0
                 throw new IllegalArgumentException("The getParameter method of KualiConfigurationServiceImpl was unable to find parameter: " + namespaceCode + " / " + detailTypeCode + " / " + parameterName);
 449  
             }
 450  0
             return param;
 451  
         }
 452  
 
 453  
     /**
 454  
      * Fetches the Parameter from the cache with the given parameter namespace and name.  If there is no entry in the cache for the given
 455  
      * namespace and name, null is returned.
 456  
      */
 457  
     protected Parameter fetchFromCache(String namespaceCode, String detailTypeCode, String name) {
 458  0
         return (Parameter)KEWServiceLocator.getCacheAdministrator().getFromCache(getParameterCacheKey(namespaceCode, detailTypeCode, name));
 459  
     }
 460  
     
 461  
     /**
 462  
      * Inserts the given Parameter into the cache.  If the Parameter is already in the cache,
 463  
      * these entries should  be overwritten.
 464  
      */
 465  
     protected void insertIntoCache(Parameter parameter) {
 466  0
         if (parameter == null) {
 467  0
             return;
 468  
         }
 469  0
         KEWServiceLocator.getCacheAdministrator().putInCache(getParameterCacheKey(parameter.getParameterNamespaceCode(), parameter.getParameterDetailTypeCode(), parameter.getParameterName()), parameter, PARAMETER_CACHE_GROUP_NAME);
 470  0
     }
 471  
     
 472  
     /**
 473  
      * Inserts the given Parameter into the cache.  If the Parameter is already in the cache,
 474  
      * these entries should  be overwritten.
 475  
      */
 476  
     //protected void insertIntoCache(Parameter parameter, String applicationNamespaceCodeOverride) {
 477  
     //    if (parameter == null) {
 478  
     //        return;
 479  
     //    }
 480  
     //    KEWServiceLocator.getCacheAdministrator().putInCache(getParameterCacheKey(parameter.getParameterNamespaceCode(), parameter.getParameterDetailTypeCode(), parameter.getParameterName(), applicationNamespaceCodeOverride), parameter, PARAMETER_CACHE_GROUP_NAME);
 481  
     //}
 482  
     
 483  
     protected void flushParameterFromCache(String namespaceCode, String detailTypeCode, String name) {
 484  0
         KEWServiceLocator.getCacheAdministrator().flushEntry(getParameterCacheKey(namespaceCode, detailTypeCode, name));
 485  0
     }
 486  
     /**
 487  
      * Returns the cache key for the given parameter.
 488  
      */
 489  
     protected String getParameterCacheKey(String namespaceCode, String detailTypeCode, String name) {
 490  0
         return PARAMETER_CACHE_PREFIX + namespaceCode + "-" + detailTypeCode + "-" + name;
 491  
     }
 492  
     
 493  
         private boolean constraintIsAllow(Parameter parameter) {
 494  0
             return KNSConstants.APC_ALLOWED_OPERATOR.equals(parameter.getParameterConstraintCode());
 495  
         }
 496  
         
 497  
         public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
 498  0
             this.dataDictionaryService = dataDictionaryService;
 499  0
         }
 500  
 
 501  
         public void setKualiModuleService(KualiModuleService kualiModuleService) {
 502  0
             this.kualiModuleService = kualiModuleService;
 503  0
         }
 504  
 }