001    /**
002     * Copyright (c) 2000-present 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.portlet.documentlibrary.store;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    
020    import java.io.File;
021    import java.io.InputStream;
022    
023    /**
024     * @author Adolfo P??rez
025     */
026    public abstract class BaseStoreWrapper implements Store {
027    
028            public BaseStoreWrapper(Store store) {
029                    _store = store;
030            }
031    
032            public void addDirectory(long companyId, long repositoryId, String dirName)
033                    throws PortalException, SystemException {
034    
035                    Store store = getStore();
036    
037                    store.addDirectory(companyId, repositoryId, dirName);
038            }
039    
040            public void addFile(
041                            long companyId, long repositoryId, String fileName, byte[] bytes)
042                    throws PortalException, SystemException {
043    
044                    Store store = getStore();
045    
046                    store.addFile(companyId, repositoryId, fileName, bytes);
047            }
048    
049            public void addFile(
050                            long companyId, long repositoryId, String fileName, File file)
051                    throws PortalException, SystemException {
052    
053                    Store store = getStore();
054    
055                    store.addFile(companyId, repositoryId, fileName, file);
056            }
057    
058            public void addFile(
059                            long companyId, long repositoryId, String fileName, InputStream is)
060                    throws PortalException, SystemException {
061    
062                    Store store = getStore();
063    
064                    store.addFile(companyId, repositoryId, fileName, is);
065            }
066    
067            public void checkRoot(long companyId) throws SystemException {
068                    Store store = getStore();
069    
070                    store.checkRoot(companyId);
071            }
072    
073            public void copyFileVersion(
074                            long companyId, long repositoryId, String fileName,
075                            String fromVersionLabel, String toVersionLabel)
076                    throws PortalException, SystemException {
077    
078                    Store store = getStore();
079    
080                    store.copyFileVersion(
081                            companyId, repositoryId, fileName, fromVersionLabel,
082                            toVersionLabel);
083            }
084    
085            public void deleteDirectory(
086                            long companyId, long repositoryId, String dirName)
087                    throws PortalException, SystemException {
088    
089                    Store store = getStore();
090    
091                    store.deleteDirectory(companyId, repositoryId, dirName);
092            }
093    
094            public void deleteFile(long companyId, long repositoryId, String fileName)
095                    throws PortalException, SystemException {
096    
097                    Store store = getStore();
098    
099                    store.deleteFile(companyId, repositoryId, fileName);
100            }
101    
102            public void deleteFile(
103                            long companyId, long repositoryId, String fileName,
104                            String versionLabel)
105                    throws PortalException, SystemException {
106    
107                    Store store = getStore();
108    
109                    store.deleteFile(companyId, repositoryId, fileName, versionLabel);
110            }
111    
112            public File getFile(long companyId, long repositoryId, String fileName)
113                    throws PortalException, SystemException {
114    
115                    Store store = getStore();
116    
117                    return store.getFile(companyId, repositoryId, fileName);
118            }
119    
120            public File getFile(
121                            long companyId, long repositoryId, String fileName,
122                            String versionLabel)
123                    throws PortalException, SystemException {
124    
125                    Store store = getStore();
126    
127                    return store.getFile(companyId, repositoryId, fileName, versionLabel);
128            }
129    
130            public byte[] getFileAsBytes(
131                            long companyId, long repositoryId, String fileName)
132                    throws PortalException, SystemException {
133    
134                    Store store = getStore();
135    
136                    return store.getFileAsBytes(companyId, repositoryId, fileName);
137            }
138    
139            public byte[] getFileAsBytes(
140                            long companyId, long repositoryId, String fileName,
141                            String versionLabel)
142                    throws PortalException, SystemException {
143    
144                    Store store = getStore();
145    
146                    return store.getFileAsBytes(
147                            companyId, repositoryId, fileName, versionLabel);
148            }
149    
150            public InputStream getFileAsStream(
151                            long companyId, long repositoryId, String fileName)
152                    throws PortalException, SystemException {
153    
154                    Store store = getStore();
155    
156                    return store.getFileAsStream(companyId, repositoryId, fileName);
157            }
158    
159            public InputStream getFileAsStream(
160                            long companyId, long repositoryId, String fileName,
161                            String versionLabel)
162                    throws PortalException, SystemException {
163    
164                    Store store = getStore();
165    
166                    return store.getFileAsStream(
167                            companyId, repositoryId, fileName, versionLabel);
168            }
169    
170            public String[] getFileNames(long companyId, long repositoryId)
171                    throws SystemException {
172    
173                    Store store = getStore();
174    
175                    return store.getFileNames(companyId, repositoryId);
176            }
177    
178            public String[] getFileNames(
179                            long companyId, long repositoryId, String dirName)
180                    throws PortalException, SystemException {
181    
182                    Store store = getStore();
183    
184                    return store.getFileNames(companyId, repositoryId, dirName);
185            }
186    
187            public long getFileSize(long companyId, long repositoryId, String fileName)
188                    throws PortalException, SystemException {
189    
190                    Store store = getStore();
191    
192                    return store.getFileSize(companyId, repositoryId, fileName);
193            }
194    
195            public boolean hasDirectory(
196                            long companyId, long repositoryId, String dirName)
197                    throws PortalException, SystemException {
198    
199                    Store store = getStore();
200    
201                    return store.hasDirectory(companyId, repositoryId, dirName);
202            }
203    
204            public boolean hasFile(long companyId, long repositoryId, String fileName)
205                    throws PortalException, SystemException {
206    
207                    Store store = getStore();
208    
209                    return store.hasFile(companyId, repositoryId, fileName);
210            }
211    
212            public boolean hasFile(
213                            long companyId, long repositoryId, String fileName,
214                            String versionLabel)
215                    throws PortalException, SystemException {
216    
217                    Store store = getStore();
218    
219                    return store.hasFile(companyId, repositoryId, fileName, versionLabel);
220            }
221    
222            public void move(String srcDir, String destDir) throws SystemException {
223                    Store store = getStore();
224    
225                    store.move(srcDir, destDir);
226            }
227    
228            public void updateFile(
229                            long companyId, long repositoryId, long newRepositoryId,
230                            String fileName)
231                    throws PortalException, SystemException {
232    
233                    Store store = getStore();
234    
235                    store.updateFile(companyId, repositoryId, newRepositoryId, fileName);
236            }
237    
238            public void updateFile(
239                            long companyId, long repositoryId, String fileName,
240                            String newFileName)
241                    throws PortalException, SystemException {
242    
243                    Store store = getStore();
244    
245                    store.updateFile(companyId, repositoryId, fileName, newFileName);
246            }
247    
248            public void updateFile(
249                            long companyId, long repositoryId, String fileName,
250                            String versionLabel, byte[] bytes)
251                    throws PortalException, SystemException {
252    
253                    Store store = getStore();
254    
255                    store.updateFile(
256                            companyId, repositoryId, fileName, versionLabel, bytes);
257            }
258    
259            public void updateFile(
260                            long companyId, long repositoryId, String fileName,
261                            String versionLabel, File file)
262                    throws PortalException, SystemException {
263    
264                    Store store = getStore();
265    
266                    store.updateFile(companyId, repositoryId, fileName, versionLabel, file);
267            }
268    
269            public void updateFile(
270                            long companyId, long repositoryId, String fileName,
271                            String versionLabel, InputStream is)
272                    throws PortalException, SystemException {
273    
274                    Store store = getStore();
275    
276                    store.updateFile(companyId, repositoryId, fileName, versionLabel, is);
277            }
278    
279            public void updateFileVersion(
280                            long companyId, long repositoryId, String fileName,
281                            String fromVersionLabel, String toVersionLabel)
282                    throws PortalException, SystemException {
283    
284                    Store store = getStore();
285    
286                    store.updateFileVersion(
287                            companyId, repositoryId, fileName, fromVersionLabel,
288                            toVersionLabel);
289            }
290    
291            protected Store getStore() {
292                    return _store;
293            }
294    
295            private final Store _store;
296    
297    }