001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.search; 029 030import java.util.ArrayList; 031import java.util.List; 032 033/** 034 * A document type specifies which document factory class is used to pull the 035 * content of an OpenCms document into a Lucene index document.<p> 036 * 037 * The appropriate document factory class gets triggerd while the search index is built 038 * for OpenCms documents matching the specified resource type and/or mimetype combination 039 * in a document factory class instance.<p> 040 * 041 * @since 6.0.0 042 */ 043public class CmsSearchDocumentType { 044 045 /** The name of the document factory class. */ 046 private String m_className; 047 048 /** The mimetype to trigger the document factory class. */ 049 private List<String> m_mimeTypes; 050 051 /** The logical key/name of this document type. */ 052 private String m_name; 053 054 /** A list of Cms resource types to trigger the document factory. */ 055 private List<String> m_resourceTypes; 056 057 /** 058 * Default constructor.<p> 059 */ 060 public CmsSearchDocumentType() { 061 062 m_resourceTypes = new ArrayList<String>(); 063 m_mimeTypes = new ArrayList<String>(); 064 } 065 066 /** 067 * Adds a mimetype.<p> 068 * 069 * @param mimeType a mimetype 070 */ 071 public void addMimeType(String mimeType) { 072 073 m_mimeTypes.add(mimeType); 074 } 075 076 /** 077 * Adds the class name of a resource type.<p> 078 * 079 * @param resourceType the class name of a resource type 080 */ 081 public void addResourceType(String resourceType) { 082 083 m_resourceTypes.add(resourceType); 084 } 085 086 /** 087 * Returns the name of the document factory class.<p> 088 * 089 * @return the name of the document factory class 090 */ 091 public String getClassName() { 092 093 return m_className; 094 } 095 096 /** 097 * Returns the mimetypes to trigger the document factory class.<p> 098 * 099 * @return the mimetypes to trigger the document factory class 100 */ 101 public List<String> getMimeTypes() { 102 103 return m_mimeTypes; 104 } 105 106 /** 107 * Returns the logical key/name of this document type.<p> 108 * 109 * @return the logical key/name of this document type 110 */ 111 public String getName() { 112 113 return m_name; 114 } 115 116 /** 117 * Returns the list of Cms resource types to trigger the document factory.<p> 118 * 119 * @return the list of Cms resource types to trigger the document factory 120 */ 121 public List<String> getResourceTypes() { 122 123 return m_resourceTypes; 124 } 125 126 /** 127 * Sets the name of the document factory class.<p> 128 * 129 * @param className the name of the document factory class 130 */ 131 public void setClassName(String className) { 132 133 m_className = className; 134 } 135 136 /** 137 * Sets the mimetypes to trigger the document factory class.<p> 138 * 139 * @param mimetypes the mimetypes to trigger the document factory class 140 */ 141 public void setMimeTypes(List<String> mimetypes) { 142 143 m_mimeTypes = mimetypes; 144 } 145 146 /** 147 * Sets the logical key/name of this document type.<p> 148 * 149 * @param name the logical key/name of this document type 150 */ 151 public void setName(String name) { 152 153 m_name = name; 154 } 155 156 /** 157 * Sets the list of Cms resource types to trigger the document factory.<p> 158 * 159 * @param resourceTypes the list of Cms resource types to trigger the document factory 160 */ 161 public void setResourceTypes(List<String> resourceTypes) { 162 163 m_resourceTypes = resourceTypes; 164 } 165}