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.portal.repository.proxy;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.repository.model.FileEntry;
020    import com.liferay.portal.kernel.repository.model.FileVersion;
021    import com.liferay.portal.kernel.repository.model.Folder;
022    import com.liferay.portal.model.Lock;
023    import com.liferay.portal.security.permission.PermissionChecker;
024    import com.liferay.portlet.expando.model.ExpandoBridge;
025    
026    import java.io.InputStream;
027    import java.io.Serializable;
028    
029    import java.util.Date;
030    import java.util.List;
031    import java.util.Map;
032    
033    /**
034     * @author Mika Koivisto
035     */
036    public class FileEntryProxyBean
037            extends RepositoryModelProxyBean implements FileEntry {
038    
039            public FileEntryProxyBean(FileEntry fileEntry, ClassLoader classLoader) {
040                    super(classLoader);
041    
042                    _fileEntry = fileEntry;
043            }
044    
045            @Override
046            public boolean containsPermission(
047                            PermissionChecker permissionChecker, String actionId)
048                    throws PortalException, SystemException {
049    
050                    return _fileEntry.containsPermission(permissionChecker, actionId);
051            }
052    
053            @Override
054            public Map<String, Serializable> getAttributes() {
055                    return _fileEntry.getAttributes();
056            }
057    
058            @Override
059            public long getCompanyId() {
060                    return _fileEntry.getCompanyId();
061            }
062    
063            @Override
064            public InputStream getContentStream()
065                    throws PortalException, SystemException {
066    
067                    return _fileEntry.getContentStream();
068            }
069    
070            @Override
071            public InputStream getContentStream(String version)
072                    throws PortalException, SystemException {
073    
074                    return _fileEntry.getContentStream(version);
075            }
076    
077            @Override
078            public Date getCreateDate() {
079                    return _fileEntry.getCreateDate();
080            }
081    
082            @Override
083            public String getDescription() {
084                    return _fileEntry.getDescription();
085            }
086    
087            @Override
088            public ExpandoBridge getExpandoBridge() {
089                    ExpandoBridge expandoBridge = _fileEntry.getExpandoBridge();
090    
091                    return (ExpandoBridge)newProxyInstance(
092                            expandoBridge, ExpandoBridge.class);
093            }
094    
095            @Override
096            public String getExtension() {
097                    return _fileEntry.getExtension();
098            }
099    
100            @Override
101            public long getFileEntryId() {
102                    return _fileEntry.getFileEntryId();
103            }
104    
105            @Override
106            public FileVersion getFileVersion()
107                    throws PortalException, SystemException {
108    
109                    FileVersion fileVersion = _fileEntry.getFileVersion();
110    
111                    return newFileVersionProxyBean(fileVersion);
112            }
113    
114            @Override
115            public FileVersion getFileVersion(String version)
116                    throws PortalException, SystemException {
117    
118                    FileVersion fileVersion = _fileEntry.getFileVersion(version);
119    
120                    return newFileVersionProxyBean(fileVersion);
121            }
122    
123            @Override
124            public List<FileVersion> getFileVersions(int status)
125                    throws SystemException {
126    
127                    List<FileVersion> fileVersions = _fileEntry.getFileVersions(status);
128    
129                    return toFileVersionProxyBeans(fileVersions);
130            }
131    
132            @Override
133            public Folder getFolder() {
134                    Folder folder = _fileEntry.getFolder();
135    
136                    return newFolderProxyBean(folder);
137            }
138    
139            @Override
140            public long getFolderId() {
141                    return _fileEntry.getFolderId();
142            }
143    
144            @Override
145            public long getGroupId() {
146                    return _fileEntry.getGroupId();
147            }
148    
149            @Override
150            public String getIcon() {
151                    return _fileEntry.getIcon();
152            }
153    
154            @Override
155            public FileVersion getLatestFileVersion()
156                    throws PortalException, SystemException {
157    
158                    FileVersion fileVersion = _fileEntry.getLatestFileVersion();
159    
160                    return newFileVersionProxyBean(fileVersion);
161            }
162    
163            @Override
164            public Lock getLock() {
165                    Lock lock = _fileEntry.getLock();
166    
167                    return (Lock)newProxyInstance(lock, Lock.class);
168            }
169    
170            @Override
171            public String getMimeType() {
172                    return _fileEntry.getMimeType();
173            }
174    
175            @Override
176            public String getMimeType(String version) {
177                    return _fileEntry.getMimeType(version);
178            }
179    
180            @Override
181            public Object getModel() {
182                    return _fileEntry.getModel();
183            }
184    
185            @Override
186            public Class<?> getModelClass() {
187                    return _fileEntry.getModelClass();
188            }
189    
190            @Override
191            public String getModelClassName() {
192                    return _fileEntry.getModelClassName();
193            }
194    
195            @Override
196            public Date getModifiedDate() {
197                    return _fileEntry.getModifiedDate();
198            }
199    
200            @Override
201            public long getPrimaryKey() {
202                    return _fileEntry.getPrimaryKey();
203            }
204    
205            @Override
206            public Serializable getPrimaryKeyObj() {
207                    return _fileEntry.getPrimaryKeyObj();
208            }
209    
210            @Override
211            public int getReadCount() {
212                    return _fileEntry.getReadCount();
213            }
214    
215            @Override
216            public long getRepositoryId() {
217                    return _fileEntry.getRepositoryId();
218            }
219    
220            @Override
221            public long getSize() {
222                    return _fileEntry.getSize();
223            }
224    
225            @Override
226            public String getTitle() {
227                    return _fileEntry.getTitle();
228            }
229    
230            @Override
231            public long getUserId() {
232                    return _fileEntry.getUserId();
233            }
234    
235            @Override
236            public String getUserName() {
237                    return _fileEntry.getUserName();
238            }
239    
240            @Override
241            public String getUserUuid() throws SystemException {
242                    return _fileEntry.getUserUuid();
243            }
244    
245            @Override
246            public String getUuid() {
247                    return _fileEntry.getUuid();
248            }
249    
250            @Override
251            public String getVersion() {
252                    return _fileEntry.getVersion();
253            }
254    
255            @Override
256            public long getVersionUserId() {
257                    return _fileEntry.getVersionUserId();
258            }
259    
260            @Override
261            public String getVersionUserName() {
262                    return _fileEntry.getVersionUserName();
263            }
264    
265            @Override
266            public String getVersionUserUuid() throws SystemException {
267                    return _fileEntry.getVersionUserUuid();
268            }
269    
270            @Override
271            public boolean hasLock() {
272                    return _fileEntry.hasLock();
273            }
274    
275            @Override
276            public boolean isCheckedOut() {
277                    return _fileEntry.isCheckedOut();
278            }
279    
280            @Override
281            public boolean isDefaultRepository() {
282                    return _fileEntry.isDefaultRepository();
283            }
284    
285            @Override
286            public boolean isEscapedModel() {
287                    return _fileEntry.isEscapedModel();
288            }
289    
290            @Override
291            public boolean isSupportsLocking() {
292                    return _fileEntry.isSupportsLocking();
293            }
294    
295            @Override
296            public boolean isSupportsMetadata() {
297                    return _fileEntry.isSupportsMetadata();
298            }
299    
300            @Override
301            public boolean isSupportsSocial() {
302                    return _fileEntry.isSupportsSocial();
303            }
304    
305            @Override
306            public void setCompanyId(long companyId) {
307                    _fileEntry.setCompanyId(companyId);
308            }
309    
310            @Override
311            public void setCreateDate(Date date) {
312                    _fileEntry.setCreateDate(date);
313            }
314    
315            @Override
316            public void setGroupId(long groupId) {
317                    _fileEntry.setGroupId(groupId);
318            }
319    
320            @Override
321            public void setModifiedDate(Date date) {
322                    _fileEntry.setModifiedDate(date);
323            }
324    
325            @Override
326            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
327                    _fileEntry.setPrimaryKeyObj(primaryKeyObj);
328            }
329    
330            @Override
331            public void setUserId(long userId) {
332                    _fileEntry.setUserId(userId);
333            }
334    
335            @Override
336            public void setUserName(String userName) {
337                    _fileEntry.setUserName(userName);
338            }
339    
340            @Override
341            public void setUserUuid(String userUuid) {
342                    _fileEntry.setUserUuid(userUuid);
343            }
344    
345            @Override
346            public FileEntry toEscapedModel() {
347                    FileEntry fileEntry = _fileEntry.toEscapedModel();
348    
349                    return newFileEntryProxyBean(fileEntry);
350            }
351    
352            @Override
353            public FileEntry toUnescapedModel() {
354                    FileEntry fileEntry = _fileEntry.toUnescapedModel();
355    
356                    return newFileEntryProxyBean(fileEntry);
357            }
358    
359            private FileEntry _fileEntry;
360    
361    }