001/**
002 * Copyright 2005-2017 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.dao;
017
018import org.kuali.rice.kew.doctype.bo.DocumentType;
019
020import java.util.Collection;
021import java.util.List;
022
023
024/**
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027public interface DocumentTypeDAO {
028
029    /**
030     * Find Document Type by name (case sensitive by default)
031     * @param name
032     * @return DocumentType or null
033     */
034    DocumentType findByName(String name);
035
036    /**
037     * Find Document Type by name
038     * @param name
039     * @param caseSensitive
040     * @return DocumentType or null
041     */
042    DocumentType findByName(String name, boolean caseSensitive);
043
044    /**
045     * Find Document Types by document type and parent name
046     * @param documentType
047     * @param docTypeParentName
048     * @param climbHierarchy
049     * @return Collection of matching document types
050     */
051    Collection<DocumentType> find(DocumentType documentType, DocumentType docTypeParentName, boolean climbHierarchy);
052
053    /**
054     * Get Max version number of document type
055     * @param docTypeName
056     * @return max version number
057     */
058    Integer getMaxVersionNumber(String docTypeName);
059
060    /**
061     * Find all current document types
062     * @return List of current DocumentTypes
063     */
064    List findAllCurrent();
065
066    /**
067     * Find all current with name
068     * @param name
069     * @return List of Document Type by name
070     */
071    List findAllCurrentByName(String name);
072
073    /**
074     * Get Child Document Type ids by parent id
075     * @param parentDocumentTypeId
076     * @return List of child document type ids
077     */
078    List<String> getChildDocumentTypeIds(String parentDocumentTypeId);
079
080    /**
081     * Find document type id by name
082     * @param documentTypeName
083     * @return document type id
084     */
085    String findDocumentTypeIdByName(String documentTypeName);
086
087    /**
088     * Find Document type name by id
089     * @param documentTypeId
090     * @return document type name
091     */
092    String findDocumentTypeNameById(String documentTypeId);
093
094    /**
095     * Find Document Type by document id
096     * @param documentId
097     * @return DocumentType
098     */
099    DocumentType findDocumentTypeByDocumentId(String documentId);
100
101    /**
102     * Increments the optimstic locking version number for the document type with the given id.
103     *
104     * @param documentTypeId the id of the document type for which to increment the version number
105     */
106    void incrementOptimisticLock(String documentTypeId);
107
108    String findParentNameByName(String documentTypeName);
109
110}