1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.documentlibrary.util;
24  
25  import com.liferay.portal.kernel.search.Document;
26  import com.liferay.portal.kernel.search.DocumentSummary;
27  import com.liferay.portal.kernel.search.SearchEngineUtil;
28  import com.liferay.portal.kernel.search.SearchException;
29  
30  import java.util.Date;
31  
32  import javax.portlet.PortletURL;
33  
34  /**
35   * <a href="Indexer.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   * @author Harry Mark
39   * @author Bruno Farache
40   * @author Raymond Augé
41   */
42  public class Indexer implements com.liferay.portal.kernel.search.Indexer {
43  
44      /**
45       * @deprecated Use {@link DLIndexerUtil}.
46       */
47      public static void addFile(
48              long companyId, String portletId, long groupId, long repositoryId,
49              String fileName)
50          throws SearchException {
51  
52          DLIndexerUtil.addFile(
53              companyId, portletId, groupId, repositoryId, fileName);
54      }
55  
56      /**
57       * @deprecated Use {@link DLIndexerUtil}.
58       */
59      public static void addFile(
60              long companyId, String portletId, long groupId, long repositoryId,
61              String fileName, long fileEntryId, String properties,
62              Date modifiedDate, String[] tagsCategories, String[] tagsEntries)
63          throws SearchException {
64  
65          DLIndexerUtil.addFile(
66              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
67              properties, modifiedDate, tagsCategories, tagsEntries);
68      }
69  
70      /**
71       * @deprecated Use {@link DLIndexerUtil}.
72       */
73      public static void deleteFile(
74              long companyId, String portletId, long repositoryId,
75              String fileName)
76          throws SearchException {
77  
78          DLIndexerUtil.deleteFile(companyId, portletId, repositoryId, fileName);
79      }
80  
81      /**
82       * @deprecated Use {@link DLIndexerUtil}.
83       */
84      public static Document getFileDocument(
85              long companyId, String portletId, long groupId, long repositoryId,
86              String fileName)
87          throws SearchException {
88  
89          return DLIndexerUtil.getFileDocument(
90              companyId, portletId, groupId, repositoryId, fileName);
91      }
92  
93      /**
94       * @deprecated Use {@link DLIndexerUtil}.
95       */
96      public static Document getFileDocument(
97              long companyId, String portletId, long groupId, long repositoryId,
98              String fileName, long fileEntryId, String properties,
99              Date modifiedDate, String[] tagsCategories, String[] tagsEntries)
100         throws SearchException {
101 
102         return DLIndexerUtil.getFileDocument(
103             companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
104             properties, modifiedDate, tagsCategories, tagsEntries);
105     }
106 
107     /**
108      * @deprecated Use {@link DLIndexerUtil}.
109      */
110     public static String getFileUID(
111         String portletId, long repositoryId, String fileName) {
112 
113         return DLIndexerUtil.getFileUID(portletId, repositoryId, fileName);
114     }
115 
116     /**
117      * @deprecated Use {@link DLIndexerUtil}.
118      */
119     public static void updateFile(
120             long companyId, String portletId, long groupId, long repositoryId,
121             String fileName, long fileEntryId, String properties,
122             Date modifiedDate, String[] tagsCategories, String[] tagsEntries)
123         throws SearchException {
124 
125         DLIndexerUtil.updateFile(
126             companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
127             properties, modifiedDate, tagsCategories, tagsEntries);
128     }
129 
130     public String[] getClassNames() {
131         return _CLASS_NAMES;
132     }
133 
134     public DocumentSummary getDocumentSummary(
135         Document doc, String snippet, PortletURL portletURL) {
136 
137         return null;
138     }
139 
140     public void reIndex(String className, long classPK) {
141     }
142 
143     public void reIndex(String[] ids) throws SearchException {
144         if (SearchEngineUtil.isIndexReadOnly()) {
145             return;
146         }
147 
148         Hook hook = HookFactory.getInstance();
149 
150         hook.reIndex(ids);
151     }
152 
153     private static final String[] _CLASS_NAMES = new String[0];
154 
155 }