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.XmlExporter;
019import org.kuali.rice.kew.api.rule.Rule;
020import org.kuali.rice.kew.doctype.bo.DocumentType;
021import org.kuali.rice.kim.api.permission.Permission;
022import org.springframework.cache.annotation.CacheEvict;
023import org.springframework.cache.annotation.Cacheable;
024
025import java.util.List;
026
027
028/**
029 * Service for data access of document types.
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033public interface DocumentTypeService extends DocumentTypeQueryService, XmlExporter {
034    @CacheEvict(value={Rule.Cache.NAME, org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, Permission.Cache.NAME}, allEntries = true)
035    void versionAndSave(DocumentType documentType);
036
037    @CacheEvict(value={Rule.Cache.NAME, org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, Permission.Cache.NAME}, allEntries = true)
038    void save(DocumentType documentType);
039
040    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}allCurrentRootDocuments'")
041    List<DocumentType> findAllCurrentRootDocuments();
042
043    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}allCurrent'")
044    List<DocumentType> findAllCurrent();
045
046    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}{previousInstances}' + 'documentTypeName=' + #p0")
047    List<DocumentType> findPreviousInstances(String documentTypeName);
048
049    @Cacheable(value= org.kuali.rice.kew.api.doctype.DocumentType.Cache.NAME, key="'{BO}{childDocumentTypes}' + 'documentTypeId=' + #p0")
050    List<DocumentType> getChildDocumentTypes(String documentTypeId);
051
052    /**
053     *
054     * This method is similar to the findByName method except it is case insensitive.
055     *
056     * @param name
057     * @return
058     */
059    DocumentType findByNameCaseInsensitive(String name);
060}