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