001    /**
002     * Copyright 2005-2012 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.krms.impl.repository;
017    
018    import java.util.List;
019    
020    import org.kuali.rice.krms.api.repository.term.TermDefinition;
021    import org.kuali.rice.krms.api.repository.term.TermRepositoryService;
022    import org.kuali.rice.krms.api.repository.term.TermResolverDefinition;
023    import org.kuali.rice.krms.api.repository.term.TermSpecificationDefinition;
024    import org.springframework.cache.annotation.CacheEvict;
025    import org.springframework.cache.annotation.Cacheable;
026    
027    /**
028     * BO service for terms and related entities
029     * 
030     * @author Kuali Rice Team (rice.collab@kuali.org)
031     *
032     */
033    public interface TermBoService extends TermRepositoryService {
034            
035            // TODO: javadocs
036        @Cacheable(value= TermSpecificationDefinition.Cache.NAME, key="'id=' + #p0")
037            TermSpecificationDefinition getTermSpecificationById(String id);
038    
039        @CacheEvict(value={TermSpecificationDefinition.Cache.NAME, TermDefinition.Cache.NAME}, allEntries = true)
040            TermSpecificationDefinition createTermSpecification(TermSpecificationDefinition termSpec);
041    
042        @Cacheable(value= TermDefinition.Cache.NAME, key="'id=' + #p0")
043        TermDefinition getTerm(String id);
044    
045        @CacheEvict(value={TermDefinition.Cache.NAME}, allEntries = true)
046            TermDefinition createTerm(TermDefinition termDef);
047    
048        @Cacheable(value= TermResolverDefinition.Cache.NAME, key="'id=' + #p0")
049            TermResolverDefinition getTermResolverById(String id);
050    
051        /**
052         * Get the {@link TermResolverDefinition}s for any term resolvers in the specified namespace that have the given
053         * term specification as their output.
054         *
055         * @param id the id for the term specification
056         * @param namespace the namespace to search
057         * @return the List of term resolvers found.  If none are found, an empty list will be returned.
058         */
059        @Cacheable(value= TermResolverDefinition.Cache.NAME, key="'id=' + #p0 + '|' + 'namespace=' + #p1")
060        List<TermResolverDefinition> findTermResolversByOutputId(String id, String namespace);
061    
062        @Cacheable(value= TermResolverDefinition.Cache.NAME, key="'namespace=' + #p0")
063        List<TermResolverDefinition> findTermResolversByNamespace(String namespace);
064    
065        @CacheEvict(value={TermResolverDefinition.Cache.NAME, TermDefinition.Cache.NAME}, allEntries = true)
066            TermResolverDefinition createTermResolver(TermResolverDefinition termResolver);
067    }