001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.search.SearchException;
020    import com.liferay.portal.service.ServiceContext;
021    
022    import java.io.File;
023    import java.io.InputStream;
024    
025    import java.util.Date;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public class HookProxyImpl implements Hook {
031    
032            public void addDirectory(long companyId, long repositoryId, String dirName)
033                    throws PortalException, SystemException {
034    
035                    Hook hook = HookFactory.getInstance();
036    
037                    hook.addDirectory(companyId, repositoryId, dirName);
038            }
039    
040            public void addFile(
041                            long companyId, String portletId, long groupId, long repositoryId,
042                            String fileName, long fileEntryId, String properties,
043                            Date modifiedDate, ServiceContext serviceContext, byte[] bytes)
044                    throws PortalException, SystemException {
045    
046                    Hook hook = HookFactory.getInstance();
047    
048                    hook.addFile(
049                            companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
050                            properties, modifiedDate, serviceContext, bytes);
051            }
052    
053            public void addFile(
054                            long companyId, String portletId, long groupId, long repositoryId,
055                            String fileName, long fileEntryId, String properties,
056                            Date modifiedDate, ServiceContext serviceContext, File file)
057                    throws PortalException, SystemException {
058    
059                    Hook hook = HookFactory.getInstance();
060    
061                    hook.addFile(
062                            companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
063                            properties, modifiedDate, serviceContext, file);
064            }
065    
066            public void addFile(
067                            long companyId, String portletId, long groupId, long repositoryId,
068                            String fileName, long fileEntryId, String properties,
069                            Date modifiedDate, ServiceContext serviceContext, InputStream is)
070                    throws PortalException, SystemException {
071    
072                    Hook hook = HookFactory.getInstance();
073    
074                    hook.addFile(
075                            companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
076                            properties, modifiedDate, serviceContext, is);
077            }
078    
079            public void checkRoot(long companyId) throws SystemException {
080                    Hook hook = HookFactory.getInstance();
081    
082                    hook.checkRoot(companyId);
083            }
084    
085            public void deleteDirectory(
086                            long companyId, String portletId, long repositoryId, String dirName)
087                    throws PortalException, SystemException {
088    
089                    Hook hook = HookFactory.getInstance();
090    
091                    hook.deleteDirectory(companyId, portletId, repositoryId, dirName);
092            }
093    
094            public void deleteFile(
095                            long companyId, String portletId, long repositoryId,
096                            String fileName)
097                    throws PortalException, SystemException {
098    
099                    Hook hook = HookFactory.getInstance();
100    
101                    hook.deleteFile(companyId, portletId, repositoryId, fileName);
102            }
103    
104            public void deleteFile(
105                            long companyId, String portletId, long repositoryId,
106                            String fileName, String versionNumber)
107                    throws PortalException, SystemException {
108    
109                    Hook hook = HookFactory.getInstance();
110    
111                    hook.deleteFile(
112                            companyId, portletId, repositoryId, fileName, versionNumber);
113            }
114    
115            public byte[] getFile(long companyId, long repositoryId, String fileName)
116                    throws PortalException, SystemException {
117    
118                    Hook hook = HookFactory.getInstance();
119    
120                    return hook.getFile(companyId, repositoryId, fileName);
121            }
122    
123            public byte[] getFile(
124                            long companyId, long repositoryId, String fileName,
125                            String versionNumber)
126                    throws PortalException, SystemException {
127    
128                    Hook hook = HookFactory.getInstance();
129    
130                    return hook.getFile(companyId, repositoryId, fileName, versionNumber);
131            }
132    
133            public InputStream getFileAsStream(
134                            long companyId, long repositoryId, String fileName)
135                    throws PortalException, SystemException {
136    
137                    Hook hook = HookFactory.getInstance();
138    
139                    return hook.getFileAsStream(companyId, repositoryId, fileName);
140            }
141    
142            public InputStream getFileAsStream(
143                            long companyId, long repositoryId, String fileName,
144                            String versionNumber)
145                    throws PortalException, SystemException {
146    
147                    Hook hook = HookFactory.getInstance();
148    
149                    return hook.getFileAsStream(
150                            companyId, repositoryId, fileName, versionNumber);
151            }
152    
153            public String[] getFileNames(
154                            long companyId, long repositoryId, String dirName)
155                    throws PortalException, SystemException {
156    
157                    Hook hook = HookFactory.getInstance();
158    
159                    return hook.getFileNames(companyId, repositoryId, dirName);
160            }
161    
162            public long getFileSize(
163                            long companyId, long repositoryId, String fileName)
164                    throws PortalException, SystemException {
165    
166                    Hook hook = HookFactory.getInstance();
167    
168                    return hook.getFileSize(companyId, repositoryId, fileName);
169            }
170    
171            public boolean hasFile(
172                            long companyId, long repositoryId, String fileName,
173                            String versionNumber)
174                    throws PortalException, SystemException {
175    
176                    Hook hook = HookFactory.getInstance();
177    
178                    return hook.hasFile(companyId, repositoryId, fileName, versionNumber);
179            }
180    
181            public void move(String srcDir, String destDir) throws SystemException {
182                    Hook hook = HookFactory.getInstance();
183    
184                    hook.move(srcDir, destDir);
185            }
186    
187            public void reindex(String[] ids) throws SearchException {
188                    Hook hook = HookFactory.getInstance();
189    
190                    hook.reindex(ids);
191            }
192    
193            public void updateFile(
194                            long companyId, String portletId, long groupId, long repositoryId,
195                            long newRepositoryId, String fileName, long fileEntryId)
196                    throws PortalException, SystemException {
197    
198                    Hook hook = HookFactory.getInstance();
199    
200                    hook.updateFile(
201                            companyId, portletId, groupId, repositoryId, newRepositoryId,
202                            fileName, fileEntryId);
203            }
204    
205            public void updateFile(
206                            long companyId, String portletId, long groupId, long repositoryId,
207                            String fileName, String newFileName, boolean reindex)
208                    throws PortalException, SystemException {
209    
210                    Hook hook = HookFactory.getInstance();
211    
212                    hook.updateFile(
213                            companyId, portletId, groupId, repositoryId, fileName,
214                            newFileName, reindex);
215            }
216    
217            public void updateFile(
218                            long companyId, String portletId, long groupId, long repositoryId,
219                            String fileName, String versionNumber, String sourceFileName,
220                            long fileEntryId, String properties, Date modifiedDate,
221                            ServiceContext serviceContext, 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, serviceContext, bytes);
230            }
231    
232            public void updateFile(
233                            long companyId, String portletId, long groupId, long repositoryId,
234                            String fileName, String versionNumber, String sourceFileName,
235                            long fileEntryId, String properties, Date modifiedDate,
236                            ServiceContext serviceContext, 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, serviceContext, file);
245            }
246    
247            public void updateFile(
248                            long companyId, String portletId, long groupId, long repositoryId,
249                            String fileName, String versionNumber, String sourceFileName,
250                            long fileEntryId, String properties, Date modifiedDate,
251                            ServiceContext serviceContext, 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, serviceContext, is);
260            }
261    
262    }