1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.search.SearchException;
28  
29  import java.io.File;
30  import java.io.InputStream;
31  
32  import java.util.Date;
33  
34  /**
35   * <a href="HookProxyImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   */
39  public class HookProxyImpl implements Hook {
40  
41      public void addDirectory(long companyId, long repositoryId, String dirName)
42          throws PortalException, SystemException {
43  
44          Hook hook = HookFactory.getInstance();
45  
46          hook.addDirectory(companyId, repositoryId, dirName);
47      }
48  
49      public void addFile(
50              long companyId, String portletId, long groupId, long repositoryId,
51              String fileName, long fileEntryId, String properties,
52              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
53              byte[] bytes)
54          throws PortalException, SystemException {
55  
56          Hook hook = HookFactory.getInstance();
57  
58          hook.addFile(
59              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
60              properties, modifiedDate, tagsCategories, tagsEntries, bytes);
61      }
62  
63      public void addFile(
64              long companyId, String portletId, long groupId, long repositoryId,
65              String fileName, long fileEntryId, String properties,
66              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
67              File file)
68          throws PortalException, SystemException {
69  
70          Hook hook = HookFactory.getInstance();
71  
72          hook.addFile(
73              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
74              properties, modifiedDate, tagsCategories, tagsEntries, file);
75      }
76  
77      public void addFile(
78              long companyId, String portletId, long groupId, long repositoryId,
79              String fileName, long fileEntryId, String properties,
80              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
81              InputStream is)
82          throws PortalException, SystemException {
83  
84          Hook hook = HookFactory.getInstance();
85  
86          hook.addFile(
87              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
88              properties, modifiedDate, tagsCategories, tagsEntries, is);
89      }
90  
91      public void checkRoot(long companyId) throws SystemException {
92          Hook hook = HookFactory.getInstance();
93  
94          hook.checkRoot(companyId);
95      }
96  
97      public void deleteDirectory(
98              long companyId, String portletId, long repositoryId, String dirName)
99          throws PortalException, SystemException {
100 
101         Hook hook = HookFactory.getInstance();
102 
103         hook.deleteDirectory(companyId, portletId, repositoryId, dirName);
104     }
105 
106     public void deleteFile(
107             long companyId, String portletId, long repositoryId,
108             String fileName)
109         throws PortalException, SystemException {
110 
111         Hook hook = HookFactory.getInstance();
112 
113         hook.deleteFile(companyId, portletId, repositoryId, fileName);
114     }
115 
116     public void deleteFile(
117             long companyId, String portletId, long repositoryId,
118             String fileName, double versionNumber)
119         throws PortalException, SystemException {
120 
121         Hook hook = HookFactory.getInstance();
122 
123         hook.deleteFile(
124             companyId, portletId, repositoryId, fileName, versionNumber);
125     }
126 
127     public byte[] getFile(long companyId, long repositoryId, String fileName)
128         throws PortalException, SystemException {
129 
130         Hook hook = HookFactory.getInstance();
131 
132         return hook.getFile(companyId, repositoryId, fileName);
133     }
134 
135     public byte[] getFile(
136             long companyId, long repositoryId, String fileName,
137             double versionNumber)
138         throws PortalException, SystemException {
139 
140         Hook hook = HookFactory.getInstance();
141 
142         return hook.getFile(companyId, repositoryId, fileName, versionNumber);
143     }
144 
145     public InputStream getFileAsStream(
146             long companyId, long repositoryId, String fileName)
147         throws PortalException, SystemException {
148 
149         Hook hook = HookFactory.getInstance();
150 
151         return hook.getFileAsStream(companyId, repositoryId, fileName);
152     }
153 
154     public InputStream getFileAsStream(
155             long companyId, long repositoryId, String fileName,
156             double versionNumber)
157         throws PortalException, SystemException {
158 
159         Hook hook = HookFactory.getInstance();
160 
161         return hook.getFileAsStream(
162             companyId, repositoryId, fileName, versionNumber);
163     }
164 
165     public String[] getFileNames(
166             long companyId, long repositoryId, String dirName)
167         throws PortalException, SystemException {
168 
169         Hook hook = HookFactory.getInstance();
170 
171         return hook.getFileNames(companyId, repositoryId, dirName);
172     }
173 
174     public long getFileSize(
175             long companyId, long repositoryId, String fileName)
176         throws PortalException, SystemException {
177 
178         Hook hook = HookFactory.getInstance();
179 
180         return hook.getFileSize(companyId, repositoryId, fileName);
181     }
182 
183     public boolean hasFile(
184             long companyId, long repositoryId, String fileName,
185             double versionNumber)
186         throws PortalException, SystemException {
187 
188         Hook hook = HookFactory.getInstance();
189 
190         return hook.hasFile(companyId, repositoryId, fileName, versionNumber);
191     }
192 
193     public void move(String srcDir, String destDir) throws SystemException {
194         Hook hook = HookFactory.getInstance();
195 
196         hook.move(srcDir, destDir);
197     }
198 
199     public void reIndex(String[] ids) throws SearchException {
200         Hook hook = HookFactory.getInstance();
201 
202         hook.reIndex(ids);
203     }
204 
205     public void updateFile(
206             long companyId, String portletId, long groupId, long repositoryId,
207             long newRepositoryId, String fileName, long fileEntryId)
208         throws PortalException, SystemException {
209 
210         Hook hook = HookFactory.getInstance();
211 
212         hook.updateFile(
213             companyId, portletId, groupId, repositoryId, newRepositoryId,
214             fileName, fileEntryId);
215     }
216 
217     public void updateFile(
218             long companyId, String portletId, long groupId, long repositoryId,
219             String fileName, double versionNumber, String sourceFileName,
220             long fileEntryId, String properties, Date modifiedDate,
221             String[] tagsCategories, String[] tagsEntries, byte[] bytes)
222         throws PortalException, SystemException {
223 
224         Hook hook = HookFactory.getInstance();
225 
226         hook.updateFile(
227             companyId, portletId, groupId, repositoryId, fileName,
228             versionNumber, sourceFileName, fileEntryId, properties,
229             modifiedDate, tagsCategories, tagsEntries, bytes);
230     }
231 
232     public void updateFile(
233             long companyId, String portletId, long groupId, long repositoryId,
234             String fileName, double versionNumber, String sourceFileName,
235             long fileEntryId, String properties, Date modifiedDate,
236             String[] tagsCategories, String[] tagsEntries, File file)
237         throws PortalException, SystemException {
238 
239         Hook hook = HookFactory.getInstance();
240 
241         hook.updateFile(
242             companyId, portletId, groupId, repositoryId, fileName,
243             versionNumber, sourceFileName, fileEntryId, properties,
244             modifiedDate, tagsCategories, tagsEntries, file);
245     }
246 
247     public void updateFile(
248             long companyId, String portletId, long groupId, long repositoryId,
249             String fileName, double versionNumber, String sourceFileName,
250             long fileEntryId, String properties, Date modifiedDate,
251             String[] tagsCategories, String[] tagsEntries, InputStream is)
252         throws PortalException, SystemException {
253 
254         Hook hook = HookFactory.getInstance();
255 
256         hook.updateFile(
257             companyId, portletId, groupId, repositoryId, fileName,
258             versionNumber, sourceFileName, fileEntryId, properties,
259             modifiedDate, tagsCategories, tagsEntries, is);
260     }
261 
262 }