001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.location.api.postalcode; 017 018import org.kuali.rice.core.api.criteria.QueryByCriteria; 019import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 020import org.kuali.rice.location.api.LocationConstants; 021import org.springframework.cache.annotation.Cacheable; 022 023import javax.jws.WebMethod; 024import javax.jws.WebParam; 025import javax.jws.WebResult; 026import javax.jws.WebService; 027import javax.jws.soap.SOAPBinding; 028import javax.xml.bind.annotation.XmlElement; 029import javax.xml.bind.annotation.XmlElementWrapper; 030import java.util.List; 031 032/** 033 * Service for interacting with {@link PostalCode PostalCodes}. 034 * 035 * @author Kuali Rice Team (rice.collab@kuali.org) 036 */ 037@WebService(name = "PostalCodeService", targetNamespace = LocationConstants.Namespaces.LOCATION_NAMESPACE_2_0) 038@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) 039public interface PostalCodeService { 040 041 /** 042 * Gets a {@link PostalCode} from a postal country code and postal code value. 043 * 044 * <p> 045 * This method will return null if the state does not exist. 046 * </p> 047 * 048 * <p> 049 * This method will return active or inactive postal codes. 050 * </p> 051 * 052 * @param countryCode country code. cannot be blank. 053 * @param code postal code value. cannot be blank. 054 * @return a {@link PostalCode} or null 055 * @throws RiceIllegalArgumentException country code or postal code value is blank 056 */ 057 @WebMethod(operationName="getPostalCode") 058 @WebResult(name = "postalCode") 059 @Cacheable(value=PostalCode.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'code=' + #p1") 060 PostalCode getPostalCode(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "code") String code) 061 throws RiceIllegalArgumentException; 062 063 /** 064 * Gets all the {@link PostalCode PostalCode} for postal country code. 065 * 066 * <p> 067 * This method will always return an <b>immutable</b> Collection 068 * even when no values exist. 069 * </p> 070 * 071 * <p> 072 * This method will only return active postal codes. 073 * </p> 074 * 075 * @param countryCode state code. cannot be blank. 076 * @return an immutable collection of states 077 * @throws RiceIllegalArgumentException country code is blank 078 */ 079 @WebMethod(operationName="findAllPostalCodesInCountry") 080 @XmlElementWrapper(name = "postalCodes", required = false) 081 @XmlElement(name = "postalCode", required = false) 082 @WebResult(name = "postalCodes") 083 @Cacheable(value=PostalCode.Cache.NAME, key="'countryCode=' + #p0") 084 List<PostalCode> findAllPostalCodesInCountry(@WebParam(name = "countryCode") String countryCode) 085 throws RiceIllegalArgumentException; 086 087 /** 088 * This method find PostalCodes based on a query criteria. The criteria cannot be null. 089 * 090 * @since 2.0.1 091 * @param queryByCriteria the criteria. Cannot be null. 092 * @return query results. will never return null. 093 * @throws IllegalArgumentException if the queryByCriteria is null 094 */ 095 @WebMethod(operationName = "findPostalCodes") 096 @WebResult(name = "results") 097 PostalCodeQueryResults findPostalCodes(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException; 098}