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="getParameterValueAsString")
 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 truth values (case insensitive):
 133  
      * <ul>
 134  
      *     <li>Y</li>
 135  
      *     <li>true</li>
 136  
      *     <li>N</li>
 137  
      *     <li>false</li>
 138  
      * </ul>
 139  
      *
 140  
      * @param key the key to retrieve the parameter by. cannot be null.
 141  
      * @return a boolean value or null
 142  
      * @throws IllegalArgumentException if the key is null
 143  
      */
 144  
     @WebMethod(operationName="getParameterValueAsBoolean")
 145  
     @WebResult(name = "value")
 146  
     Boolean getParameterValueAsBoolean(@WebParam(name = "key") ParameterKey key);
 147  
 
 148  
     /**
 149  
      * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey}
 150  
      * where the value is split on a semi-colon delimeter and each token is trimmed
 151  
      * of white space.
 152  
      *
 153  
      * for example:  param_name=foo; bar; baz
 154  
      *
 155  
      * will yield a collection containing foo, bar, baz
 156  
      *
 157  
      * <p>
 158  
      *     If the parameter does not exist under the application
 159  
      *     code passed, then this method will check if the parameter
 160  
      *     exists under the default rice application id and
 161  
      *     will return that parameter.
 162  
      * </p>
 163  
      *
 164  
      * <p>
 165  
      *   This method will always return an <b>immutable</b> Collection
 166  
      *   even when no values exist.
 167  
      * </p>
 168  
      *
 169  
      * @param key the key to retrieve the parameter by. cannot be null.
 170  
      * @return an immutable collection of strings
 171  
      * @throws IllegalArgumentException if the key is null
 172  
      */
 173  
     @WebMethod(operationName="getParameterValuesAsString")
 174  
     @XmlElementWrapper(name = "values", required = true)
 175  
     @XmlElement(name = "value", required = false)
 176  
     @WebResult(name = "values")
 177  
     Collection<String> getParameterValuesAsString(@WebParam(name = "key") ParameterKey key);
 178  
 
 179  
     /**
 180  
      * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey}
 181  
      * where the value is split on a semi-colon delimeter and each token is trimmed
 182  
      * of white space.  Those values are themselves keyvalue pairs which are searched
 183  
      * for the sub parameter name.
 184  
      *
 185  
      * for example:
 186  
      *
 187  
      * param_name=foo=f1; bar=b1; baz=z1
 188  
      * subParameterName=bar
 189  
      *
 190  
      * will yield b1
 191  
      *
 192  
      * <p>if multiple subparameters are contained in the parameter value the first one is returned</p>
 193  
      *
 194  
      * <p>
 195  
      *     If the parameter does not exist under the application
 196  
      *     code passed, then this method will check if the parameter
 197  
      *     exists under the default rice application id and
 198  
      *     will return that parameter.
 199  
      * </p>
 200  
      *
 201  
      * <p>
 202  
      *   This method will always return null when the subparameter does not
 203  
      *   exist or if the parameter value does not conform to the following format(s):
 204  
      *   <ol>
 205  
      *      <li>subparameter_name=subparameter_value;</li>
 206  
      *   </ol>
 207  
      * </p>
 208  
      *
 209  
      * @param key the key to retrieve the parameter by. cannot be null.
 210  
      * @param subParameterName the sub parameter to search for
 211  
      * @return a string value or null
 212  
      * @throws IllegalArgumentException if the key is null or if the subParameterName is blank
 213  
      */
 214  
     @WebMethod(operationName="getSubParameterValueAsString")
 215  
     @WebResult(name = "value")
 216  
     String getSubParameterValueAsString(@WebParam(name = "key") ParameterKey key,
 217  
                                         @WebParam(name = "subParameterName") String subParameterName)
 218  
             throws RiceIllegalArgumentException;
 219  
 
 220  
     /**
 221  
      * Gets a {@link ParameterContract#getValue()} from a {@link ParameterKey}
 222  
      * where the value is split on a semi-colon delimeter and each token is trimmed
 223  
      * of white space.  Those values are themselves keyvalue pairs which are searched
 224  
      * for the sub parameter name.  After the sub parameter is found it is split on a comma
 225  
      * and trimmed or whitespace before adding it to the final collection for return.
 226  
      *
 227  
      * for example:
 228  
      *
 229  
      * param_name=foo=f1,f2,f3; bar=b1,b2; baz=z1
 230  
      * subParameterName=bar
 231  
      *
 232  
      * will yield a collection containing b1, b2
 233  
      *
 234  
      * <p>if multiple subparameters are contained in the parameter value the first one is returned</p>
 235  
      *
 236  
      * <p>
 237  
      *     If the parameter does not exist under the application
 238  
      *     code passed, then this method will check if the parameter
 239  
      *     exists under the default rice application id and
 240  
      *     will return that parameter.
 241  
      * </p>
 242  
      *
 243  
      * <p>
 244  
      *   This method will always return an <b>immutable</b> Collection
 245  
      *   even when no values exist.
 246  
      * </p>
 247  
      *
 248  
      *  <p>
 249  
      *   This method will always return an empty <b>immutable</b> Collection when
 250  
      *   the subparameter does not exist or if the parameter value does not
 251  
      *   conform to the following format(s):
 252  
      *   <ol>
 253  
      *      <li>subparameter_name=subparameter_value;</li>
 254  
      *      <li>subparameter_name=subparameter_value1, subparameter_value2;</li>
 255  
      *      <li>subparameter_name=subparameter_value1, subparameter_value2,;</li>
 256  
      *   </ol>
 257  
      * </p>
 258  
      *
 259  
      * @param key the key to retrieve the parameter by. cannot be null.
 260  
      * @param subParameterName the sub parameter to search for
 261  
      * @return an immutable collection of strings
 262  
      * @throws IllegalArgumentException if the key is null or if the subParameterName is blank
 263  
      */
 264  
     @WebMethod(operationName="getSubParameterValuesAsString")
 265  
     @XmlElementWrapper(name = "values", required = true)
 266  
     @XmlElement(name = "value", required = false)
 267  
     @WebResult(name = "values")
 268  
     Collection<String> getSubParameterValuesAsString(@WebParam(name = "key") ParameterKey key,
 269  
                                                      @WebParam(name = "subParameterName") String subParameterName)
 270  
             throws RiceIllegalArgumentException;
 271  
     
 272  
     @WebMethod(operationName="findParameters")
 273  
     @WebResult(name = "results")
 274  
     ParameterQueryResults findParameters(@WebParam(name = "query") QueryByCriteria queryByCriteria);
 275  
 }