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