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 org.kuali.rice.core.framework.impex.xml.XmlLoader; 019import org.kuali.rice.kew.doctype.bo.DocumentType; 020import org.springframework.cache.annotation.Cacheable; 021 022import java.util.Collection; 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() + '|' + 'active=' + #p0.isActive() +'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 /** 053 * Returns the name fo the parent document type for the document type with the given name, or null 054 * if the specified document type doesn't have a parent document type. 055 * @param documentTypeName the name of the document type for which to find the parent 056 * @return the name of the specified document types parent documenttype, or null if the document type is a root document type 057 */ 058 @Cacheable(value = org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}' + 'parentOfName=' + #p0") 059 String findParentNameByName(String documentTypeName); 060 061 062}