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