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.krms.api.repository.term;
017
018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
019import org.kuali.rice.krms.api.KrmsConstants;
020import org.springframework.cache.annotation.Cacheable;
021
022import javax.jws.WebMethod;
023import javax.jws.WebParam;
024import javax.jws.WebResult;
025import javax.jws.WebService;
026import javax.jws.soap.SOAPBinding;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlElementWrapper;
029import java.util.List;
030
031/**
032 * The TermRepositoryService provides the basic access to terms and term resolvers in the repository needed
033 * for executing rules.
034 *
035 * @author Kuali Rice Team (rice.collab@kuali.org)
036 *
037 */
038@WebService(name = "termRepositoryService", targetNamespace = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0)
039@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
040public interface TermRepositoryService {
041
042
043    /**
044     * Retrieves all {@link TermResolverDefinition}s for the given namespace.
045     *
046     * @since 2.1.1
047     * @param namespace the namespace for which to get all term resolvers.
048     * @return the List of {@link TermResolverDefinition}s for the given namespace. May be empty, but never null.
049     *
050     * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException if the namespace is null or blank.
051     */
052    @WebMethod(operationName = "findTermResolversByNamespace")
053    @XmlElementWrapper(name = "termResolvers", required = true)
054    @XmlElement(name = "termResolver", required = false)
055    @WebResult(name = "termResolvers")
056    @Cacheable(value= TermResolverDefinition.Cache.NAME, key="'namespace=' + #p0")
057    List<TermResolverDefinition> findTermResolversByNamespace(@WebParam(name = "namespace") String namespace) throws RiceIllegalArgumentException;;
058
059    /**
060     * Retrieves the {@link TermDefinition} with the given termId.
061     *
062     * @since 2.1.1
063     * @param termId the identifier of the term to retrieve.
064     * @return the {@link TermDefinition} with the given termId.  May be null if there is no term with the given termId
065     * in the repository.
066     *
067     * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException if the termId is null or blank.
068     */
069    @WebMethod(operationName = "getTerm")
070    @WebResult(name = "term")
071    @Cacheable(value= TermDefinition.Cache.NAME, key="'id=' + #p0")
072    TermDefinition getTerm(@WebParam(name = "termId") String termId) throws RiceIllegalArgumentException;;
073
074    /**
075     * Retrieves all the {@link TermSpecificationDefinition}s that are valid for the context with the given contextId.
076     *
077     * @since 2.1.4
078     * @param contextId the identifier for the context whose valid {@link TermSpecificationDefinition}s are to be retrieved. 
079     * @return all the {@link TermSpecificationDefinition}s that are valid for the context with the given contextId. May be empty but never null
080     *
081     * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException if the contextId is null or blank.
082     */
083    @WebMethod(operationName = "findAllTermSpecificationsByContextId")
084    @XmlElementWrapper(name = "termSpecifications", required = true)
085    @XmlElement(name = "termSpecification", required = false)
086    @WebResult(name = "termSpecifications")
087    @Cacheable(value= TermSpecificationDefinition.Cache.NAME, key="'id=' + #p0")
088    List<TermSpecificationDefinition> findAllTermSpecificationsByContextId(@WebParam(name = "contextId") String contextId) throws RiceIllegalArgumentException;;
089}