| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ParameterService | 
 | 
 | 1.0;1 | 
| 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; | |
| 17 | ||
| 18 |  import java.util.List; | |
| 19 |  import java.util.Map; | |
| 20 | ||
| 21 |  import org.kuali.rice.kns.bo.Parameter; | |
| 22 | ||
| 23 |  /** | |
| 24 |   * This class provides methods to verify the existence of Parameters, get the value(s), and get ParameterEvaluators. For the most | |
| 25 |   * part, your code should be asking for a ParameterEvaluator and interacting with that. For optional parameters (ones that may not | |
| 26 |   * exist but should be processed if they do), you will want to use the parameterExists method before using other methods, since an | |
| 27 |   * exception will be thrown by the other methods if the referenced parameter does not exist. In some cases you may need to just pull | |
| 28 |   * the value(s) of a parameter via the getParameterValue(s) or getIndicatorParameter methods. All of the methods that you will want | |
| 29 |   * to use take a Class componentClass and String parameterName argument. Implementations of this class know how to translate these | |
| 30 |   * appropriately to retrieve Parameters and construct ParameterEvaluators. | |
| 31 |   */ | |
| 32 | public interface ParameterService { | |
| 33 |      /** | |
| 34 |       * This method provides an exception free way to ensure that a parameter exists. | |
| 35 |       *  | |
| 36 |       * @param componentClass | |
| 37 |       * @param parameterName | |
| 38 |       * @return boolean indicating whether or not the parameter exists | |
| 39 |       */ | |
| 40 | public boolean parameterExists(Class<? extends Object> componentClass, String parameterName); | |
| 41 | ||
| 42 |      /** | |
| 43 |       * This method provides a convenient way to access the a parameter that signifies true or false. | |
| 44 |       *  | |
| 45 |       * @param componentClass | |
| 46 |       * @param parameterName | |
| 47 |       * @return boolean value of indicator parameter | |
| 48 |       */ | |
| 49 | public boolean getIndicatorParameter(Class<? extends Object> componentClass, String parameterName); | |
| 50 | ||
| 51 |      /** | |
| 52 |       * This method provides a convenient way to access the a parameter that signifies true or false. | |
| 53 |       *  | |
| 54 |       * @param namespaceCode | |
| 55 |       * @param detailTypeCode | |
| 56 |       * @param parameterName | |
| 57 |       * @return boolean value of indicator parameter | |
| 58 |       */ | |
| 59 | public boolean getIndicatorParameter(String namespaceCode, String detailTypeCode, String parameterName); | |
| 60 | ||
| 61 |      /** | |
| 62 |       * This method returns the actual BusinessObject instance of a parameter. | |
| 63 |       *  | |
| 64 |       * @param namespaceCode | |
| 65 |       * @param detailTypeCode | |
| 66 |       * @param parameterName | |
| 67 |       * @return The Parameter instance | |
| 68 |       */ | |
| 69 |      public Parameter retrieveParameter(String namespaceCode,  | |
| 70 | String detailTypeCode, String parameterName); | |
| 71 | ||
| 72 |      /** | |
| 73 |       * This method returns the unprocessed text value of a parameter. | |
| 74 |       *  | |
| 75 |       * @param componentClass | |
| 76 |       * @param parameterName | |
| 77 |       * @return unprocessed string value as a parameter | |
| 78 |       */ | |
| 79 | public String getParameterValue(Class<? extends Object> componentClass, String parameterName); | |
| 80 | ||
| 81 |      /** | |
| 82 |       * This method can be used to derive a value based on another value. | |
| 83 |       *  | |
| 84 |       * @param componentClass | |
| 85 |       * @param parameterName | |
| 86 |       * @param constrainingValue | |
| 87 |       * @return derived value | |
| 88 |       */ | |
| 89 | public String getParameterValue(Class<? extends Object> componentClass, String parameterName, String constrainingValue); | |
| 90 | ||
| 91 |      /** | |
| 92 |       * This method returns the value of the specified parameter | |
| 93 |       * @param namespaceCode | |
| 94 |       * @param detailTypeCode  | |
| 95 |       * @param parameterName | |
| 96 |       */ | |
| 97 |      public String getParameterValue(String namespaceCode, String detailTypeCode, String parameterName); | |
| 98 | ||
| 99 |      /** | |
| 100 |       * This method can be used to parse the value of a parameter. | |
| 101 |       *  | |
| 102 |       * @param componentClass | |
| 103 |       * @param parameterName | |
| 104 |       * @return parsed List of String parameter values | |
| 105 |       */ | |
| 106 | public List<String> getParameterValues(Class<? extends Object> componentClass, String parameterName); | |
| 107 | ||
| 108 |      /** | |
| 109 |       * This method can be used to derive a set of values based on another value. | |
| 110 |       *  | |
| 111 |       * @param componentClass | |
| 112 |       * @param parameterName | |
| 113 |       * @param constrainingValue | |
| 114 |       * @return derived values List<String> | |
| 115 |       */ | |
| 116 | public List<String> getParameterValues(Class<? extends Object> componentClass, String parameterName, String constrainingValue); | |
| 117 | ||
| 118 |      /** | |
| 119 |       * This method returns a list of the parameter values split on implementation specific criteria. | |
| 120 |       * For the default KualiConfigurationServiceImpl, the split is on a semi-colon. | |
| 121 |       * @param namespaceCode | |
| 122 |       * @param detailTypeCode  | |
| 123 |       * @param parameterName | |
| 124 |       */ | |
| 125 |      public List<String> getParameterValues(String namespaceCode, String detailTypeCode, String parameterName); | |
| 126 | ||
| 127 |      /** | |
| 128 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and provide convenient | |
| 129 |       * evaluation methods. | |
| 130 |       *  | |
| 131 |       * @param componentClass | |
| 132 |       * @param parameterName | |
| 133 |       * @return ParameterEvaluator | |
| 134 |       */ | |
| 135 | public ParameterEvaluator getParameterEvaluator(Class<? extends Object> componentClass, String parameterName); | |
| 136 | ||
| 137 |      /** | |
| 138 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and provide convenient | |
| 139 |       * evaluation methods. | |
| 140 |       *  | |
| 141 |       * @param namespaceCode | |
| 142 |       * @param detailTypeCode  | |
| 143 |       * @param parameterName | |
| 144 |       * @return ParameterEvaluator | |
| 145 |       */ | |
| 146 |      public ParameterEvaluator getParameterEvaluator(String namespaceCode, String detailTypeCode, String parameterName); | |
| 147 | ||
| 148 |      /** | |
| 149 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and constrainedValue | |
| 150 |       * and provide convenient evaluation methods. | |
| 151 |       *  | |
| 152 |       * @param componentClass | |
| 153 |       * @param parameterName | |
| 154 |       * @return ParameterEvaluator | |
| 155 |       */ | |
| 156 | public ParameterEvaluator getParameterEvaluator(Class<? extends Object> componentClass, String parameterName, String constrainedValue); | |
| 157 | ||
| 158 |      /** | |
| 159 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter and constrainedValue | |
| 160 |       * and provide convenient evaluation methods. | |
| 161 |       *  | |
| 162 |       * @param namespaceCode | |
| 163 |       * @param detailTypeCode  | |
| 164 |       * @param parameterName | |
| 165 |       * @return ParameterEvaluator | |
| 166 |       */ | |
| 167 |      public ParameterEvaluator getParameterEvaluator(String namespaceCode, String detailTypeCode, String parameterName, String constrainedValue); | |
| 168 | ||
| 169 |      /** | |
| 170 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap a Parameter, constrainingValue, and | |
| 171 |       * constrainedValue and provide convenient evaluation methods. | |
| 172 |       *  | |
| 173 |       * @param componentClass | |
| 174 |       * @param parameterName | |
| 175 |       * @return ParameterEvaluator | |
| 176 |       */ | |
| 177 | public ParameterEvaluator getParameterEvaluator(Class<? extends Object> componentClass, String parameterName, String constrainingValue, String constrainedValue); | |
| 178 | ||
| 179 |      /** | |
| 180 |       * This method will return an instance of a ParameterEvaluator implementation that will wrap an allow Parameter, a deny | |
| 181 |       * Parameter, constrainingValue, and constrainedValue and provide convenient evaluation methods. | |
| 182 |       *  | |
| 183 |       * @param componentClass | |
| 184 |       * @param parameterName | |
| 185 |       * @return ParameterEvaluator | |
| 186 |       */ | |
| 187 | public ParameterEvaluator getParameterEvaluator(Class<? extends Object> componentClass, String allowParameterName, String denyParameterName, String constrainingValue, String constrainedValue); | |
| 188 | ||
| 189 |      /** | |
| 190 |       * This method can be used to change the value of a Parameter for unit testing purposes. | |
| 191 |       *  | |
| 192 |       * @param componentClass | |
| 193 |       * @param parameterName | |
| 194 |       * @param parameterText | |
| 195 |       */ | |
| 196 | public void setParameterForTesting(Class<? extends Object> componentClass, String parameterName, String parameterText); | |
| 197 | ||
| 198 |      /** | |
| 199 |       * This method can be used to clear the parameter cache during unit testing. | |
| 200 |       */ | |
| 201 | public void clearCache(); | |
| 202 | ||
| 203 |      /** | |
| 204 |       * This method can be used to set a namespace. | |
| 205 |       *  | |
| 206 |       * @param documentOrStepClass | |
| 207 |       *  | |
| 208 |       */ | |
| 209 | public String getNamespace(Class<? extends Object> documentOrStepClass); | |
| 210 | ||
| 211 |      /** | |
| 212 |       * This method can be used to change the value of a Parameter for unit testing purposes. | |
| 213 |       *  | |
| 214 |       * @param documentOrStepClass | |
| 215 |       */ | |
| 216 | public String getDetailType(Class<? extends Object> documentOrStepClass); | |
| 217 | ||
| 218 |      /** | |
| 219 |       * This method can be used to retrieve a list of parameters that | |
| 220 |       * match the given fieldValues criteria. You could also specify the "like" | |
| 221 |       * criteria in the Map. | |
| 222 |       *  | |
| 223 |       * @param   fieldValues The Map containing the key value pairs to be used  | |
| 224 |       *                      to build the criteria. | |
| 225 |       * @return  List of Parameters that match the criteria. | |
| 226 |       */ | |
| 227 |           public List<Parameter> retrieveParametersGivenLookupCriteria(Map<String, String> fieldValues); | |
| 228 | ||
| 229 | } |