001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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(
110                            long companyId, long repositoryId, String fileName)
111                    throws PortalException, SystemException {
112    
113                    Store store = StoreFactory.getInstance();
114    
115                    return store.getFile(companyId, repositoryId, fileName);
116            }
117    
118            public File getFile(
119                            long companyId, long repositoryId, String fileName,
120                            String versionLabel)
121                    throws PortalException, SystemException {
122    
123                    Store store = StoreFactory.getInstance();
124    
125                    return store.getFile(companyId, repositoryId, fileName, versionLabel);
126            }
127    
128            public byte[] getFileAsBytes(
129                            long companyId, long repositoryId, String fileName)
130                    throws PortalException, SystemException {
131    
132                    Store store = StoreFactory.getInstance();
133    
134                    return store.getFileAsBytes(companyId, repositoryId, fileName);
135            }
136    
137            public byte[] getFileAsBytes(
138                            long companyId, long repositoryId, String fileName,
139                            String versionLabel)
140                    throws PortalException, SystemException {
141    
142                    Store store = StoreFactory.getInstance();
143    
144                    return store.getFileAsBytes(
145                            companyId, repositoryId, fileName, versionLabel);
146            }
147    
148            public InputStream getFileAsStream(
149                            long companyId, long repositoryId, String fileName)
150                    throws PortalException, SystemException {
151    
152                    Store store = StoreFactory.getInstance();
153    
154                    return store.getFileAsStream(companyId, repositoryId, fileName);
155            }
156    
157            public InputStream getFileAsStream(
158                            long companyId, long repositoryId, String fileName,
159                            String versionLabel)
160                    throws PortalException, SystemException {
161    
162                    Store store = StoreFactory.getInstance();
163    
164                    return store.getFileAsStream(
165                            companyId, repositoryId, fileName, versionLabel);
166            }
167    
168            public String[] getFileNames(long companyId, long repositoryId)
169                    throws SystemException {
170    
171                    Store store = StoreFactory.getInstance();
172    
173                    return store.getFileNames(companyId, repositoryId);
174            }
175    
176            public String[] getFileNames(
177                            long companyId, long repositoryId, String dirName)
178                    throws PortalException, SystemException {
179    
180                    Store store = StoreFactory.getInstance();
181    
182                    return store.getFileNames(companyId, repositoryId, dirName);
183            }
184    
185            public long getFileSize(
186                            long companyId, long repositoryId, String fileName)
187                    throws PortalException, SystemException {
188    
189                    Store store = StoreFactory.getInstance();
190    
191                    return store.getFileSize(companyId, repositoryId, fileName);
192            }
193    
194            public boolean hasDirectory(
195                            long companyId, long repositoryId, String dirName)
196                    throws PortalException, SystemException {
197    
198                    Store store = StoreFactory.getInstance();
199    
200                    return store.hasDirectory(companyId, repositoryId, dirName);
201            }
202    
203            public boolean hasFile(long companyId, long repositoryId, String fileName)
204                    throws PortalException, SystemException {
205    
206                    Store store = StoreFactory.getInstance();
207    
208                    return store.hasFile(companyId, repositoryId, fileName);
209            }
210    
211            public boolean hasFile(
212                            long companyId, long repositoryId, String fileName,
213                            String versionLabel)
214                    throws PortalException, SystemException {
215    
216                    Store store = StoreFactory.getInstance();
217    
218                    return store.hasFile(companyId, repositoryId, fileName, versionLabel);
219            }
220    
221            public void move(String srcDir, String destDir) throws SystemException {
222                    Store store = StoreFactory.getInstance();
223    
224                    store.move(srcDir, destDir);
225            }
226    
227            public void updateFile(
228                            long companyId, long repositoryId, long newRepositoryId,
229                            String fileName)
230                    throws PortalException, SystemException {
231    
232                    Store store = StoreFactory.getInstance();
233    
234                    store.updateFile(companyId, repositoryId, newRepositoryId, fileName);
235            }
236    
237            public void updateFile(
238                            long companyId, long repositoryId, String fileName,
239                            String newFileName)
240                    throws PortalException, SystemException {
241    
242                    Store store = StoreFactory.getInstance();
243    
244                    store.updateFile(companyId, repositoryId, fileName, newFileName);
245            }
246    
247            public void updateFile(
248                            long companyId, long repositoryId, String fileName,
249                            String versionLabel, byte[] bytes)
250                    throws PortalException, SystemException {
251    
252                    Store store = StoreFactory.getInstance();
253    
254                    store.updateFile(
255                            companyId, repositoryId, fileName, versionLabel, bytes);
256            }
257    
258            public void updateFile(
259                            long companyId, long repositoryId, String fileName,
260                            String versionLabel, File file)
261                    throws PortalException, SystemException {
262    
263                    Store store = StoreFactory.getInstance();
264    
265                    store.updateFile(companyId, repositoryId, fileName, versionLabel, file);
266            }
267    
268            public void updateFile(
269                            long companyId, long repositoryId, String fileName,
270                            String versionLabel, InputStream is)
271                    throws PortalException, SystemException {
272    
273                    Store store = StoreFactory.getInstance();
274    
275                    store.updateFile(companyId, repositoryId, fileName, versionLabel, is);
276            }
277    
278            public void updateFileVersion(
279                            long companyId, long repositoryId, String fileName,
280                            String fromVersionLabel, String toVersionLabel)
281                    throws PortalException, SystemException {
282    
283                    Store store = StoreFactory.getInstance();
284    
285                    store.updateFileVersion(
286                            companyId, repositoryId, fileName, fromVersionLabel,
287                            toVersionLabel);
288            }
289    
290    }