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