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