001 /**
002 * Copyright 2005-2015 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 */
016 package org.kuali.rice.location.api.county;
017
018 import org.kuali.rice.core.api.criteria.QueryByCriteria;
019 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
020 import org.kuali.rice.location.api.LocationConstants;
021 import org.springframework.cache.annotation.Cacheable;
022
023 import javax.jws.WebMethod;
024 import javax.jws.WebParam;
025 import javax.jws.WebResult;
026 import javax.jws.WebService;
027 import javax.jws.soap.SOAPBinding;
028 import javax.xml.bind.annotation.XmlElement;
029 import javax.xml.bind.annotation.XmlElementWrapper;
030 import java.util.List;
031
032 /**
033 * <p>CountyService interface.</p>
034 *
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 */
037 @WebService(name = "CountyService", targetNamespace = LocationConstants.Namespaces.LOCATION_NAMESPACE_2_0)
038 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
039 public interface CountyService {
040
041 /**
042 * Gets a {@link County} from a postal country code and postal code value.
043 * <p/>
044 * <p>
045 * This method will return null if the state does not exist.
046 * </p>
047 * <p/>
048 * <p>
049 * This method will return active or inactive counties.
050 * </p>
051 *
052 * @param countryCode country code. cannot be blank.
053 * @param stateCode postal state code. cannot be blank.
054 * @param code county code. cannot be blank
055 * @return a {@link County} or null
056 * @throws RiceIllegalArgumentException country code, postal state code, or county code is blank
057 */
058 @WebMethod(operationName = "getCounty")
059 @WebResult(name = "county")
060 @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'stateCode=' + #p1 + '|' + 'code=' + #p3")
061 County getCounty(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode, @WebParam(name = "code") String code)
062 throws RiceIllegalArgumentException;
063
064 /**
065 * Gets all the {@link County County} for postal country code & postal state code.
066 * <p/>
067 * <p>
068 * This method will always return an <b>immutable</b> Collection
069 * even when no values exist.
070 * </p>
071 * <p/>
072 * <p>
073 * This method will only return active counties.
074 * </p>
075 *
076 * @param countryCode state code. cannot be blank.
077 * @param stateCode postal state code. cannot be blank.
078 * @return an immutable collection of counties
079 * @throws RiceIllegalArgumentException country code, postal state code is blank
080 */
081 @WebMethod(operationName = "findAllCountiesInCountryAndState")
082 @XmlElementWrapper(name = "counties", required = true)
083 @XmlElement(name = "county", required = false)
084 @WebResult(name = "counties")
085 @Cacheable(value=County.Cache.NAME, key="'countryCode=' + #p0 + '|' + 'stateCode=' + #p1")
086 List<County> findAllCountiesInCountryAndState(@WebParam(name = "countryCode") String countryCode, @WebParam(name = "stateCode") String stateCode)
087 throws RiceIllegalArgumentException;
088
089 /**
090 * This method find Counties based on a query criteria. The criteria cannot be null.
091 *
092 * @since 2.0.1
093 * @param queryByCriteria the criteria. Cannot be null.
094 * @return query results. will never return null.
095 * @throws IllegalArgumentException if the queryByCriteria is null
096 */
097 @WebMethod(operationName = "findCounties")
098 @WebResult(name = "results")
099 CountyQueryResults findCounties(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
100 }