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