View Javadoc

1   /**
2    * Copyright 2005-2013 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  package org.kuali.rice.location.api.county;
17  
18  import org.kuali.rice.core.api.criteria.QueryByCriteria;
19  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
20  import org.kuali.rice.location.api.LocationConstants;
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  /**
33   * <p>CountyService interface.</p>
34   *
35   * @author Kuali Rice Team (rice.collab@kuali.org)
36   */
37  @WebService(name = "CountyService", targetNamespace = LocationConstants.Namespaces.LOCATION_NAMESPACE_2_0)
38  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
39  public interface CountyService {
40  
41      /**
42       * Gets a {@link County} from a postal country code and postal code value.
43       * <p/>
44       * <p>
45       * This method will return null if the state does not exist.
46       * </p>
47       * <p/>
48       * <p>
49       * This method will return active or inactive counties.
50       * </p>
51       *
52       * @param countryCode country code. cannot be blank.
53       * @param stateCode   postal state code. cannot be blank.
54       * @param code        county code. cannot be blank
55       * @return a {@link County} or null
56       * @throws RiceIllegalArgumentException country code, postal state code, or county code is blank
57       */
58      @WebMethod(operationName = "getCounty")
59      @WebResult(name = "county")
60      @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'stateCode=' + #p1 + '|' + 'code=' + #p3")
61      County getCounty(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode, @WebParam(name = "code") String code)
62              throws RiceIllegalArgumentException;
63  
64      /**
65       * Gets all the {@link County County} for postal country code & postal state code.
66       * <p/>
67       * <p>
68       * This method will always return an <b>immutable</b> Collection
69       * even when no values exist.
70       * </p>
71       * <p/>
72       * <p>
73       * This method will only return active counties.
74       * </p>
75       *
76       * @param countryCode state code. cannot be blank.
77       * @param stateCode   postal state code. cannot be blank.
78       * @return an immutable collection of counties
79       * @throws RiceIllegalArgumentException country code, postal state code is blank
80       */
81      @WebMethod(operationName = "findAllCountiesInCountryAndState")
82      @XmlElementWrapper(name = "counties", required = true)
83      @XmlElement(name = "county", required = false)
84      @WebResult(name = "counties")
85      @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'stateCode=' + #p1")
86      List<County> findAllCountiesInCountryAndState(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode)
87              throws RiceIllegalArgumentException;
88  
89      /**
90       * This method find Counties based on a query criteria.  The criteria cannot be null.
91       *
92       * @since 2.0.1
93       * @param queryByCriteria the criteria.  Cannot be null.
94       * @return query results.  will never return null.
95       * @throws IllegalArgumentException if the queryByCriteria is null
96       */
97      @WebMethod(operationName = "findCounties")
98      @WebResult(name = "results")
99      CountyQueryResults findCounties(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
100 }