View Javadoc

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.shareddata.api.county;
18  
19  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
20  import org.kuali.rice.shareddata.api.SharedDataConstants;
21  import org.springframework.cache.annotation.Cacheable;
22  
23  import javax.jws.WebMethod;
24  import javax.jws.WebParam;
25  import javax.jws.WebResult;
26  import javax.jws.WebService;
27  import javax.jws.soap.SOAPBinding;
28  import javax.xml.bind.annotation.XmlElement;
29  import javax.xml.bind.annotation.XmlElementWrapper;
30  import java.util.List;
31  
32  @WebService(name = "CountyService", targetNamespace = SharedDataConstants.Namespaces.SHAREDDATA_NAMESPACE)
33  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
34  public interface CountyService {
35  
36      /**
37       * Gets a {@link County} from a postal country code and postal code value.
38       * <p/>
39       * <p>
40       * This method will return null if the state does not exist.
41       * </p>
42       * <p/>
43       * <p>
44       * This method will return active or inactive counties.
45       * </p>
46       *
47       * @param countryCode country code. cannot be blank.
48       * @param stateCode   postal state code. cannot be blank.
49       * @param code        county code. cannot be blank
50       * @return a {@link County} or null
51       * @throws IllegalArgumentException country code, postal state code, or county code is blank
52       */
53      @WebMethod(operationName = "getCounty")
54      @WebResult(name = "county")
55      @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #countryCode + '|' + 'stateCode=' + #stateCode + '|' + 'code=' + #code")
56      County getCounty(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode, @WebParam(name = "code") String code)
57              throws RiceIllegalArgumentException;
58  
59      /**
60       * Gets all the {@link County County} for postal country code & postal state code.
61       * <p/>
62       * <p>
63       * This method will always return an <b>immutable</b> Collection
64       * even when no values exist.
65       * </p>
66       * <p/>
67       * <p>
68       * This method will only return active counties.
69       * </p>
70       *
71       * @param countryCode state code. cannot be blank.
72       * @param stateCode   postal state code. cannot be blank.
73       * @return an immutable collection of counties
74       * @throws IllegalArgumentException country code, postal state code is blank
75       */
76      @WebMethod(operationName = "findAllCountiesInCountryAndState")
77      @XmlElementWrapper(name = "counties", required = true)
78      @XmlElement(name = "county", required = false)
79      @WebResult(name = "counties")
80      @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #countryCode + '|' + 'stateCode=' + #stateCode")
81      List<County> findAllCountiesInCountryAndState(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode)
82              throws RiceIllegalArgumentException;
83  }