001    /**
002     * Copyright 2005-2013 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.kim.api.type;
017    
018    import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019    import org.kuali.rice.kim.api.KimApiConstants;
020    import org.springframework.cache.annotation.Cacheable;
021    
022    import javax.jws.WebMethod;
023    import javax.jws.WebParam;
024    import javax.jws.WebResult;
025    import javax.jws.WebService;
026    import javax.jws.soap.SOAPBinding;
027    import javax.xml.bind.annotation.XmlElement;
028    import javax.xml.bind.annotation.XmlElementWrapper;
029    import java.util.Collection;
030    
031    /**
032     *
033     * This service provides read operations for KimType
034     *
035     *@author Kuali Rice Team (rice.collab@kuali.org)
036     *
037     */
038    @WebService(name = "kimTypeInfoService", targetNamespace = KimApiConstants.Namespaces.KIM_NAMESPACE_2_0)
039    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
040    public interface KimTypeInfoService {
041    
042        /**
043         * Gets a {@link KimType} from a kim type id.
044         * <p/>
045         * <p>
046         * This method will return null if the kim type does not exist.
047         * </p>
048         *
049         * @param id the id to retrieve the kim type by. cannot be null.
050         * @return a {@link KimType} or null
051         * @throws RiceIllegalArgumentException if the id is null
052         */
053        @WebMethod(operationName="getKimType")
054        @WebResult(name = "kimType")
055        @Cacheable(value=KimType.Cache.NAME, key="'id=' + #p0")
056        KimType getKimType(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
057    
058        /**
059         * Gets a {@link KimType} from a kim type name and namespace code.
060         * <p/>
061         * <p>
062         * This method will return null if the kim type does not exist.
063         * </p>
064         * <p/>
065         * <p>
066         * This method will only return active kim types.
067         * </p>
068         *
069         * @param namespaceCode the namespaceCode to retrieve the kim type by. cannot be null.
070         * @param name          the name to retrieve the kim type by. cannot be null.
071         * @return a {@link KimType} or null
072         * @throws RiceIllegalArgumentException if the namespaceCode or name is null
073         * @throws IllegalStateException    if multiple active results are found for a namespaceCode and name
074         */
075        @WebMethod(operationName="findKimTypeByNameAndNamespace")
076        @WebResult(name = "kimType")
077        @Cacheable(value=KimType.Cache.NAME, key="'namespaceCode=' + #p0 + '|' + 'name=' + #p1")
078        KimType findKimTypeByNameAndNamespace(@WebParam(name = "namespaceCode") String namespaceCode, @WebParam(name = "name") String name) throws RiceIllegalArgumentException;
079    
080        /**
081         * Gets all the {@link KimType KimTypes}.
082         * <p/>
083         * <p>
084         * This method will always return an <b>immutable</b> Collection
085         * even when no values exist.
086         * </p>
087         * <p/>
088         * <p>
089         * This method will only return active kim types.
090         * </p>
091         *
092         * @return an immutable collection of kim types
093         */
094        @WebMethod(operationName="findAllKimTypes")
095        @XmlElementWrapper(name = "kimTypes", required = true)
096        @XmlElement(name = "kimType", required = false)
097        @WebResult(name = "kimTypes")
098        @Cacheable(value=KimType.Cache.NAME, key="'all'")
099        Collection<KimType> findAllKimTypes();
100    }