View Javadoc

1   /**
2    * Copyright 2005-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  package org.kuali.rice.location.api.postalcode;
17  
18  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
19  import org.kuali.rice.location.api.LocationConstants;
20  import org.springframework.cache.annotation.Cacheable;
21  
22  import javax.jws.WebMethod;
23  import javax.jws.WebParam;
24  import javax.jws.WebResult;
25  import javax.jws.WebService;
26  import javax.jws.soap.SOAPBinding;
27  import java.util.List;
28  
29  /**
30   * Service for interacting with {@link PostalCode PostalCodes}.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  @WebService(name = "PostalCodeService", targetNamespace = LocationConstants.Namespaces.LOCATION_NAMESPACE_2_0)
35  @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
36  public interface PostalCodeService {
37  
38      /**
39       * Gets a {@link PostalCode} from a postal country code and postal code value.
40       *
41       * <p>
42       *   This method will return null if the state does not exist.
43       * </p>
44       *
45       * <p>
46       *     This method will return active or inactive postal codes.
47       * </p>
48       *
49       * @param countryCode country code. cannot be blank.
50       * @param code postal code value. cannot be blank.
51       * @return a {@link PostalCode} or null
52       * @throws IllegalArgumentException country code or postal code value is blank
53       */
54      @WebMethod(operationName="getPostalCode")
55      @WebResult(name = "postalCode")
56      @Cacheable(value=PostalCode.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'code=' + #p1")
57      PostalCode getPostalCode(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "code") String code)
58              throws RiceIllegalArgumentException;
59  
60      /**
61       * Gets all the {@link PostalCode PostalCode} for postal country code.
62       *
63       * <p>
64       *   This method will always return an <b>immutable</b> Collection
65       *   even when no values exist.
66       * </p>
67       *
68       *  <p>
69       *     This method will only return active postal codes.
70       * </p>
71       *
72       * @param countryCode state code. cannot be blank.
73       * @return an immutable collection of states
74       * @throws IllegalArgumentException country code is blank
75       */
76      @WebMethod(operationName="findAllPostalCodesInCountry")
77      @WebResult(name = "postalCodes")
78      @Cacheable(value=PostalCode.Cache.NAME, key="'countryCode=' + #p0")
79      List<PostalCode> findAllPostalCodesInCountry(@WebParam(name = "countryCode") String countryCode)
80              throws RiceIllegalArgumentException;
81  }