Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CountryService |
|
| 1.0;1 |
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.country; | |
17 | ||
18 | import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; | |
19 | import org.kuali.rice.core.api.exception.RiceIllegalStateException; | |
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 java.util.List; | |
29 | ||
30 | ||
31 | /** | |
32 | * <p>CountryService interface.</p> | |
33 | * | |
34 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
35 | */ | |
36 | @WebService(name = "CountryService", targetNamespace = LocationConstants.Namespaces.LOCATION_NAMESPACE_2_0) | |
37 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
38 | public interface CountryService { | |
39 | ||
40 | /** | |
41 | * Lookup a country object based on the given country code. | |
42 | * | |
43 | * @param code the given country code | |
44 | * @return a country object with the given country code. A null reference is returned if an invalid or | |
45 | * non-existant code is supplied. | |
46 | */ | |
47 | @WebMethod(operationName = "getCountry") | |
48 | @WebResult(name = "country") | |
49 | @Cacheable(value=Country.Cache.NAME, key="'code=' + #p0") | |
50 | Country getCountry(@WebParam(name = "code") String code) throws RiceIllegalArgumentException; | |
51 | ||
52 | /** | |
53 | * Get a country object based on an alternate country code | |
54 | * | |
55 | * @param alternateCode the given alternate country code | |
56 | * @return A country object with the given alternate country code if a country with that alternate country code | |
57 | * exists. Otherwise, null is returned. | |
58 | * @throws IllegalStateException if multiple Countries exist with the same passed in alternateCode | |
59 | * @throws IllegalArgumentException if alternateCode is null or is a whitespace only string. | |
60 | */ | |
61 | @WebMethod(operationName = "getCountryByAlternateCode") | |
62 | @WebResult(name = "country") | |
63 | @Cacheable(value=Country.Cache.NAME, key="'alternateCode=' + #p0") | |
64 | Country getCountryByAlternateCode(@WebParam(name = "alternateCode") String alternateCode) | |
65 | throws RiceIllegalStateException, RiceIllegalArgumentException; | |
66 | ||
67 | /** | |
68 | * Returns all Countries that are not restricted. | |
69 | * | |
70 | * @return all countries that are not restricted | |
71 | */ | |
72 | @WebMethod(operationName = "findAllCountriesNotRestricted") | |
73 | @WebResult(name = "countriesNotRestricted") | |
74 | @Cacheable(value=Country.Cache.NAME, key="'allRestricted'") | |
75 | List<Country> findAllCountriesNotRestricted(); | |
76 | ||
77 | /** | |
78 | * Returns all Countries | |
79 | * | |
80 | * @return all countries | |
81 | */ | |
82 | @WebMethod(operationName = "findAllCountries") | |
83 | @WebResult(name = "allCountries") | |
84 | @Cacheable(value=Country.Cache.NAME, key="'all'") | |
85 | List<Country> findAllCountries(); | |
86 | } |