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.kew.doctype.service;
017
018import java.util.Collection;
019
020import org.kuali.rice.core.framework.impex.xml.XmlLoader;
021import org.kuali.rice.kew.doctype.bo.DocumentType;
022import org.springframework.cache.annotation.Cacheable;
023
024/**
025 * A service for querying document type stuff for plugins without exposing the document type service.
026 * 
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029public interface DocumentTypeQueryService extends XmlLoader {
030
031    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}' + 'documentTypeId=' + #p0")
032    public DocumentType findById(String documentTypeId);
033
034    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}' + 'name=' + #p0")
035    public DocumentType findByName(String name);
036
037    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME,
038            key="'{BO}' + 'documentTypeId=' + #p0.getId() + '|' + 'name=' + #p0.getName() + '|' + 'label=' + #p0.getLabel() + '|' +'docGroupName=' + #p1 + '|' + 'climbHierarchy=' + #p2")
039    public Collection<DocumentType> find(DocumentType documentType, String docGroupName, boolean climbHierarchy);
040
041    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}{root}' + 'documentTypeId=' + #p0.getId()")
042    public DocumentType findRootDocumentType(DocumentType docType);
043    
044    /**
045     * Returns the DocumentType of the Document with the given ID. 
046     * 
047     * @since 2.3
048     */
049    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}' + 'documentId=' + #p0")
050    public DocumentType findByDocumentId(String documentId);
051    
052}