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 HookWrapper implements Hook {
031    
032            public HookWrapper(Hook hook) {
033                    _hook = hook;
034            }
035    
036            public void addDirectory(long companyId, long repositoryId, String dirName)
037                    throws PortalException, SystemException {
038    
039                    _hook.addDirectory(companyId, repositoryId, dirName);
040            }
041    
042            public void addFile(
043                            long companyId, String portletId, long groupId, long repositoryId,
044                            String fileName, long fileEntryId, String properties,
045                            Date modifiedDate, ServiceContext serviceContext, byte[] bytes)
046                    throws PortalException, SystemException {
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.addFile(
060                            companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
061                            properties, modifiedDate, serviceContext, file);
062            }
063    
064            public void addFile(
065                            long companyId, String portletId, long groupId, long repositoryId,
066                            String fileName, long fileEntryId, String properties,
067                            Date modifiedDate, ServiceContext serviceContext, InputStream is)
068                    throws PortalException, SystemException {
069    
070                    _hook.addFile(
071                            companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
072                            properties, modifiedDate, serviceContext, is);
073            }
074    
075            public void checkRoot(long companyId) throws SystemException {
076                    _hook.checkRoot(companyId);
077            }
078    
079            public void deleteDirectory(
080                            long companyId, String portletId, long repositoryId, String dirName)
081                    throws PortalException, SystemException {
082    
083                    _hook.deleteDirectory(companyId, portletId, repositoryId, dirName);
084            }
085    
086            public void deleteFile(
087                            long companyId, String portletId, long repositoryId,
088                            String fileName)
089                    throws PortalException, SystemException {
090    
091                    _hook.deleteFile(companyId, portletId, repositoryId, fileName);
092            }
093    
094            public void deleteFile(
095                            long companyId, String portletId, long repositoryId,
096                            String fileName, String versionNumber)
097                    throws PortalException, SystemException {
098    
099                    _hook.deleteFile(
100                            companyId, portletId, repositoryId, fileName, versionNumber);
101            }
102    
103            public byte[] getFile(long companyId, long repositoryId, String fileName)
104                    throws PortalException, SystemException {
105    
106                    return _hook.getFile(companyId, repositoryId, fileName);
107            }
108    
109            public byte[] getFile(
110                            long companyId, long repositoryId, String fileName,
111                            String versionNumber)
112                    throws PortalException, SystemException {
113    
114                    return _hook.getFile(companyId, repositoryId, fileName, versionNumber);
115            }
116    
117            public InputStream getFileAsStream(
118                            long companyId, long repositoryId, String fileName)
119                    throws PortalException, SystemException {
120    
121                    return _hook.getFileAsStream(companyId, repositoryId, fileName);
122            }
123    
124            public InputStream getFileAsStream(
125                            long companyId, long repositoryId, String fileName,
126                            String versionNumber)
127                    throws PortalException, SystemException {
128    
129                    return _hook.getFileAsStream(
130                            companyId, repositoryId, fileName, versionNumber);
131            }
132    
133            public String[] getFileNames(
134                            long companyId, long repositoryId, String dirName)
135                    throws PortalException, SystemException {
136    
137                    return _hook.getFileNames(companyId, repositoryId, dirName);
138            }
139    
140            public long getFileSize(
141                            long companyId, long repositoryId, String fileName)
142                    throws PortalException, SystemException {
143    
144                    return _hook.getFileSize(companyId, repositoryId, fileName);
145            }
146    
147            public boolean hasFile(
148                            long companyId, long repositoryId, String fileName,
149                            String versionNumber)
150                    throws PortalException, SystemException {
151    
152                    return _hook.hasFile(companyId, repositoryId, fileName, versionNumber);
153            }
154    
155            public void move(String srcDir, String destDir) throws SystemException {
156                    _hook.move(srcDir, destDir);
157            }
158    
159            public void reindex(String[] ids) throws SearchException {
160                    _hook.reindex(ids);
161            }
162    
163            public void updateFile(
164                            long companyId, String portletId, long groupId, long repositoryId,
165                            long newRepositoryId, String fileName, long fileEntryId)
166                    throws PortalException, SystemException {
167    
168                    _hook.updateFile(
169                            companyId, portletId, groupId, repositoryId, newRepositoryId,
170                            fileName, fileEntryId);
171            }
172    
173            public void updateFile(
174                            long companyId, String portletId, long groupId, long repositoryId,
175                            String fileName, String newFileName, boolean reindex)
176                    throws PortalException, SystemException {
177    
178                    _hook.updateFile(
179                            companyId, portletId, groupId, repositoryId, fileName,
180                            newFileName, reindex);
181            }
182    
183            public void updateFile(
184                            long companyId, String portletId, long groupId, long repositoryId,
185                            String fileName, String versionNumber, String sourceFileName,
186                            long fileEntryId, String properties, Date modifiedDate,
187                            ServiceContext serviceContext, byte[] bytes)
188                    throws PortalException, SystemException {
189    
190                    _hook.updateFile(
191                            companyId, portletId, groupId, repositoryId, fileName,
192                            versionNumber, sourceFileName, fileEntryId, properties,
193                            modifiedDate, serviceContext, bytes);
194            }
195    
196            public void updateFile(
197                            long companyId, String portletId, long groupId, long repositoryId,
198                            String fileName, String versionNumber, String sourceFileName,
199                            long fileEntryId, String properties, Date modifiedDate,
200                            ServiceContext serviceContext, File file)
201                    throws PortalException, SystemException {
202    
203                    _hook.updateFile(
204                            companyId, portletId, groupId, repositoryId, fileName,
205                            versionNumber, sourceFileName, fileEntryId, properties,
206                            modifiedDate, serviceContext, file);
207            }
208    
209            public void updateFile(
210                            long companyId, String portletId, long groupId, long repositoryId,
211                            String fileName, String versionNumber, String sourceFileName,
212                            long fileEntryId, String properties, Date modifiedDate,
213                            ServiceContext serviceContext, InputStream is)
214                    throws PortalException, SystemException {
215    
216                    _hook.updateFile(
217                            companyId, portletId, groupId, repositoryId, fileName,
218                            versionNumber, sourceFileName, fileEntryId, properties,
219                            modifiedDate, serviceContext, is);
220            }
221    
222            private Hook _hook;
223    
224    }