1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.documentlibrary.util;
16  
17  import com.liferay.portal.kernel.search.Document;
18  import com.liferay.portal.kernel.search.SearchException;
19  
20  import java.util.Date;
21  
22  /**
23   * <a href="DLIndexerUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class DLIndexerUtil {
28  
29      public static void addFile(
30              long companyId, String portletId, long groupId, long repositoryId,
31              String fileName)
32          throws SearchException {
33  
34          getDLIndexer().addFile(
35              companyId, portletId, groupId, repositoryId, fileName);
36      }
37  
38      public static void addFile(
39              long companyId, String portletId, long groupId, long repositoryId,
40              String fileName, String properties, Date modifiedDate,
41              String[] tagsEntries)
42          throws SearchException {
43  
44          getDLIndexer().addFile(
45              companyId, portletId, groupId, repositoryId, fileName, properties,
46              modifiedDate, tagsEntries);
47      }
48  
49      public static void deleteFile(
50              long companyId, String portletId, long repositoryId,
51              String fileName)
52          throws SearchException {
53  
54          getDLIndexer().deleteFile(companyId, portletId, repositoryId, fileName);
55      }
56  
57      public static DLIndexer getDLIndexer() {
58          return _dlIndexer;
59      }
60  
61      public static Document getFileDocument(
62              long companyId, String portletId, long groupId, long repositoryId,
63              String fileName)
64          throws SearchException {
65  
66          return getDLIndexer().getFileDocument(
67              companyId, portletId, groupId, repositoryId, fileName);
68      }
69  
70      public static Document getFileDocument(
71              long companyId, String portletId, long groupId, long repositoryId,
72              String fileName, String properties, Date modifiedDate,
73              String[] tagsEntries)
74          throws SearchException{
75  
76          return getDLIndexer().getFileDocument(
77              companyId, portletId, groupId, repositoryId, fileName, properties,
78              modifiedDate, tagsEntries);
79      }
80  
81      public static String getFileUID(
82          String portletId, long repositoryId, String fileName) {
83  
84          return getDLIndexer().getFileUID(portletId, repositoryId, fileName);
85      }
86  
87      public static void updateFile(
88              long companyId, String portletId, long groupId, long repositoryId,
89              String fileName, String properties, Date modifiedDate,
90              String[] tagsEntries)
91          throws SearchException {
92  
93          getDLIndexer().updateFile(
94              companyId, portletId, groupId, repositoryId, fileName, properties,
95              modifiedDate, tagsEntries);
96      }
97  
98      public void setDLIndexer(DLIndexer dlIndexer) {
99          _dlIndexer = dlIndexer;
100     }
101 
102     private static DLIndexer _dlIndexer;
103 
104 }