| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ParameterRepositoryService |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2006-2011 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 | ||
| 17 | package org.kuali.rice.core.api.parameter; | |
| 18 | ||
| 19 | import java.util.Collection; | |
| 20 | ||
| 21 | import javax.jws.WebMethod; | |
| 22 | import javax.jws.WebParam; | |
| 23 | import javax.jws.WebResult; | |
| 24 | import javax.jws.WebService; | |
| 25 | import javax.jws.soap.SOAPBinding; | |
| 26 | ||
| 27 | import org.kuali.rice.core.api.CoreConstants; | |
| 28 | import org.kuali.rice.core.api.criteria.QueryByCriteria; | |
| 29 | ||
| 30 | /** | |
| 31 | * Service for interacting with {@link Parameter Parameters}. | |
| 32 | */ | |
| 33 | @WebService(name = "parameterServiceSoap", targetNamespace = CoreConstants.Namespaces.CORE_NAMESPACE_2_0) | |
| 34 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
| 35 | public interface ParameterRepositoryService { | |
| 36 | ||
| 37 | /** | |
| 38 | * This will create a {@link Parameter} exactly like the parameter passed in. | |
| 39 | * | |
| 40 | * @param parameter the parameter to create | |
| 41 | * @throws IllegalArgumentException if the parameter is null | |
| 42 | * @throws IllegalStateException if the parameter is already existing in the system | |
| 43 | */ | |
| 44 | @WebMethod(operationName="createParameter") | |
| 45 | void createParameter(@WebParam(name = "parameter") Parameter parameter); | |
| 46 | ||
| 47 | /** | |
| 48 | * This will update a {@link Parameter}. | |
| 49 | * | |
| 50 | * <p> | |
| 51 | * If the parameter does not exist under the application | |
| 52 | * code passed, then this method will check if the parameter | |
| 53 | * exists under the default rice application code and | |
| 54 | * will update that parameter. | |
| 55 | * </p> | |
| 56 | * | |
| 57 | * @param parameter the parameter to update | |
| 58 | * @throws IllegalArgumentException if the parameter is null | |
| 59 | * @throws IllegalStateException if the parameter does not exist in the system under the | |
| 60 | * specific application code or default rice application code | |
| 61 | */ | |
| 62 | @WebMethod(operationName="updateParameter") | |
| 63 | void updateParameter(@WebParam(name = "parameter") Parameter parameter); | |
| 64 | ||
| 65 | /** | |
| 66 | * Gets a {@link Parameter} from a {@link ParameterKey}. | |
| 67 | * | |
| 68 | * <p> | |
| 69 | * If the parameter does not exist under the application | |
| 70 | * code passed, then this method will check if the parameter | |
| 71 | * exists under the default rice application code and | |
| 72 | * will return that parameter. | |
| 73 | * </p> | |
| 74 | * | |
| 75 | * <p> | |
| 76 | * This method will return null if the parameter does not exist. | |
| 77 | * </p> | |
| 78 | * | |
| 79 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 80 | * @return a {@link Parameter} or null | |
| 81 | * @throws IllegalArgumentException if the key is null | |
| 82 | */ | |
| 83 | @WebMethod(operationName="getParameter") | |
| 84 | @WebResult(name = "parameter") | |
| 85 | Parameter getParameter(@WebParam(name = "key") ParameterKey key); | |
| 86 | ||
| 87 | /** | |
| 88 | * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey}. | |
| 89 | * | |
| 90 | * <p> | |
| 91 | * If the parameter does not exist under the application | |
| 92 | * code passed, then this method will check if the parameter | |
| 93 | * exists under the default rice application code and | |
| 94 | * will return that parameter. | |
| 95 | * </p> | |
| 96 | * | |
| 97 | * <p> | |
| 98 | * This method will return null if the parameter does not exist. | |
| 99 | * </p> | |
| 100 | * | |
| 101 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 102 | * @return a string value or null | |
| 103 | * @throws IllegalArgumentException if the key is null | |
| 104 | */ | |
| 105 | @WebMethod(operationName="getParameterValueAsString") | |
| 106 | @WebResult(name = "value") | |
| 107 | String getParameterValueAsString(@WebParam(name = "key") ParameterKey key); | |
| 108 | ||
| 109 | /** | |
| 110 | * Gets a {@link ParameterContract#getValue()} as a Boolean from a {@link ParameterKey}. | |
| 111 | * | |
| 112 | * <p> | |
| 113 | * If the parameter does not exist under the application | |
| 114 | * code passed, then this method will check if the parameter | |
| 115 | * exists under the default rice application code and | |
| 116 | * will return that parameter. | |
| 117 | * </p> | |
| 118 | * | |
| 119 | * <p> | |
| 120 | * This method will return null if the parameter does not exist or is not a valid truth value. | |
| 121 | * </p> | |
| 122 | * | |
| 123 | * valid truth values (case insensitive): | |
| 124 | * <ul> | |
| 125 | * <li>Y</li> | |
| 126 | * <li>true</li> | |
| 127 | * <li>N</li> | |
| 128 | * <li>false</li> | |
| 129 | * </ul> | |
| 130 | * | |
| 131 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 132 | * @return a boolean value or null | |
| 133 | * @throws IllegalArgumentException if the key is null | |
| 134 | */ | |
| 135 | @WebMethod(operationName="getParameterValueAsBoolean") | |
| 136 | @WebResult(name = "value") | |
| 137 | Boolean getParameterValueAsBoolean(@WebParam(name = "key") ParameterKey key); | |
| 138 | ||
| 139 | /** | |
| 140 | * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey} | |
| 141 | * where the value is split on a semi-colon delimeter and each token is trimmed | |
| 142 | * of white space. | |
| 143 | * | |
| 144 | * for example: param_name=foo; bar; baz | |
| 145 | * | |
| 146 | * will yield a collection containing foo, bar, baz | |
| 147 | * | |
| 148 | * <p> | |
| 149 | * If the parameter does not exist under the application | |
| 150 | * code passed, then this method will check if the parameter | |
| 151 | * exists under the default rice application code and | |
| 152 | * will return that parameter. | |
| 153 | * </p> | |
| 154 | * | |
| 155 | * <p> | |
| 156 | * This method will always return an <b>immutable</b> Collection | |
| 157 | * even when no values exist. | |
| 158 | * </p> | |
| 159 | * | |
| 160 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 161 | * @return an immutable collection of strings | |
| 162 | * @throws IllegalArgumentException if the key is null | |
| 163 | */ | |
| 164 | @WebMethod(operationName="getParameterValuesAsString") | |
| 165 | @WebResult(name = "values") | |
| 166 | Collection<String> getParameterValuesAsString(@WebParam(name = "key") ParameterKey key); | |
| 167 | ||
| 168 | /** | |
| 169 | * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey} | |
| 170 | * where the value is split on a semi-colon delimeter and each token is trimmed | |
| 171 | * of white space. Those values are themselves keyvalue pairs which are searched | |
| 172 | * for the sub parameter name. | |
| 173 | * | |
| 174 | * for example: | |
| 175 | * | |
| 176 | * param_name=foo=f1; bar=b1; baz=z1 | |
| 177 | * subParameterName=bar | |
| 178 | * | |
| 179 | * will yield b1 | |
| 180 | * | |
| 181 | * <p>if multiple subparameters are contained in the parameter value the first one is returned</p> | |
| 182 | * | |
| 183 | * <p> | |
| 184 | * If the parameter does not exist under the application | |
| 185 | * code passed, then this method will check if the parameter | |
| 186 | * exists under the default rice application code and | |
| 187 | * will return that parameter. | |
| 188 | * </p> | |
| 189 | * | |
| 190 | * <p> | |
| 191 | * This method will always return null when the subparameter does not | |
| 192 | * exist or if the parameter value does not conform to the following format(s): | |
| 193 | * <ol> | |
| 194 | * <li>subparameter_name=subparameter_value;</li> | |
| 195 | * </ol> | |
| 196 | * </p> | |
| 197 | * | |
| 198 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 199 | * @param subParameterName the sub parameter to search for | |
| 200 | * @return a string value or null | |
| 201 | * @throws IllegalArgumentException if the key is null or if the subParameterName is blank | |
| 202 | */ | |
| 203 | @WebMethod(operationName="getSubParameterValueAsString") | |
| 204 | @WebResult(name = "value") | |
| 205 | String getSubParameterValueAsString(@WebParam(name = "key") ParameterKey key, @WebParam(name = "subParameterName") String subParameterName); | |
| 206 | ||
| 207 | /** | |
| 208 | * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey} | |
| 209 | * where the value is split on a semi-colon delimeter and each token is trimmed | |
| 210 | * of white space. Those values are themselves keyvalue pairs which are searched | |
| 211 | * for the sub parameter name. After the sub parameter is found it is split on a comma | |
| 212 | * and trimmed or whitespace before adding it to the final collection for return. | |
| 213 | * | |
| 214 | * for example: | |
| 215 | * | |
| 216 | * param_name=foo=f1,f2,f3; bar=b1,b2; baz=z1 | |
| 217 | * subParameterName=bar | |
| 218 | * | |
| 219 | * will yield a collection containing b1, b2 | |
| 220 | * | |
| 221 | * <p>if multiple subparameters are contained in the parameter value the first one is returned</p> | |
| 222 | * | |
| 223 | * <p> | |
| 224 | * If the parameter does not exist under the application | |
| 225 | * code passed, then this method will check if the parameter | |
| 226 | * exists under the default rice application code and | |
| 227 | * will return that parameter. | |
| 228 | * </p> | |
| 229 | * | |
| 230 | * <p> | |
| 231 | * This method will always return an <b>immutable</b> Collection | |
| 232 | * even when no values exist. | |
| 233 | * </p> | |
| 234 | * | |
| 235 | * <p> | |
| 236 | * This method will always return an empty <b>immutable</b> Collection when | |
| 237 | * the subparameter does not exist or if the parameter value does not | |
| 238 | * conform to the following format(s): | |
| 239 | * <ol> | |
| 240 | * <li>subparameter_name=subparameter_value;</li> | |
| 241 | * <li>subparameter_name=subparameter_value1, subparameter_value2;</li> | |
| 242 | * <li>subparameter_name=subparameter_value1, subparameter_value2,;</li> | |
| 243 | * </ol> | |
| 244 | * </p> | |
| 245 | * | |
| 246 | * @param key the key to retrieve the parameter by. cannot be null. | |
| 247 | * @param subParameterName the sub parameter to search for | |
| 248 | * @return an immutable collection of strings | |
| 249 | * @throws IllegalArgumentException if the key is null or if the subParameterName is blank | |
| 250 | */ | |
| 251 | @WebMethod(operationName="getSubParameterValuesAsString") | |
| 252 | @WebResult(name = "values") | |
| 253 | Collection<String> getSubParameterValuesAsString(@WebParam(name = "key") ParameterKey key, @WebParam(name = "subParameterName") String subParameterName); | |
| 254 | ||
| 255 | @WebMethod(operationName="findParameters") | |
| 256 | @WebResult(name = "results") | |
| 257 | ParameterQueryResults findParameters(@WebParam(name = "query") QueryByCriteria<Parameter> queryByCriteria); | |
| 258 | } |