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.kernel.repository.model;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.Accessor;
020    import com.liferay.portal.model.Lock;
021    import com.liferay.portal.security.permission.PermissionChecker;
022    
023    import java.io.InputStream;
024    
025    import java.util.Date;
026    import java.util.List;
027    
028    /**
029     * @author Alexander Chow
030     */
031    public interface FileEntry extends RepositoryModel<FileEntry> {
032    
033            public static final Accessor<FileEntry, Long> FILE_ENTRY_ID_ACCESSOR =
034    
035                    new Accessor<FileEntry, Long>() {
036    
037                            @Override
038                            public Long get(FileEntry fileEntry) {
039                                    return fileEntry.getFileEntryId();
040                            }
041    
042                    };
043    
044            public boolean containsPermission(
045                            PermissionChecker permissionChecker, String actionId)
046                    throws PortalException, SystemException;
047    
048            @Override
049            public long getCompanyId();
050    
051            /**
052             * Retrieves the content stream of the current file version. In a Liferay
053             * repository, this is the latest approved version. In third-party
054             * repositories, this may be the latest content regardless of workflow
055             * state.
056             *
057             * @return content stream of the current file version
058             * @throws PortalException if a portal exception occurred
059             * @throws SystemException if a system exception occurred
060             * @see    #getFileVersion()
061             */
062            public InputStream getContentStream()
063                    throws PortalException, SystemException;
064    
065            public InputStream getContentStream(String version)
066                    throws PortalException, SystemException;
067    
068            @Override
069            public Date getCreateDate();
070    
071            public String getDescription();
072    
073            public String getExtension();
074    
075            public long getFileEntryId();
076    
077            /**
078             * Retrieves the current file version. The workflow state of the latest file
079             * version may affect what is returned by this method. In a Liferay
080             * repository, this will return the latest approved version; the latest
081             * version regardless of workflow state can be retrieved by {@link
082             * #getLatestFileVersion()}. In third-party repositories, these two methods
083             * may function identically.
084             *
085             * @return current file version
086             * @throws PortalException if a portal exception occurred
087             * @throws SystemException if a system exception occurred
088             */
089            public FileVersion getFileVersion() throws PortalException, SystemException;
090    
091            public FileVersion getFileVersion(String version)
092                    throws PortalException, SystemException;
093    
094            public List<FileVersion> getFileVersions(int status)
095                    throws SystemException;
096    
097            public Folder getFolder();
098    
099            public long getFolderId();
100    
101            @Override
102            public long getGroupId();
103    
104            public String getIcon();
105    
106            /**
107             * Retrieves the latest file version. In a Liferay repository, this means
108             * the latest version regardless of workflow state. In third-party
109             * repositories, this may have an identical functionality with {@link
110             * #getFileVersion()}.
111             *
112             * @return latest file version
113             * @throws PortalException if a portal exception occurred
114             * @throws SystemException if a system exception occurred
115             */
116            public FileVersion getLatestFileVersion()
117                    throws PortalException, SystemException;
118    
119            public Lock getLock();
120    
121            public String getMimeType();
122    
123            public String getMimeType(String version);
124    
125            @Override
126            public Date getModifiedDate();
127    
128            public int getReadCount();
129    
130            public long getRepositoryId();
131    
132            public long getSize();
133    
134            public String getTitle();
135    
136            @Override
137            public long getUserId();
138    
139            @Override
140            public String getUserName();
141    
142            @Override
143            public String getUserUuid() throws SystemException;
144    
145            @Override
146            public String getUuid();
147    
148            public String getVersion();
149    
150            public long getVersionUserId();
151    
152            public String getVersionUserName();
153    
154            public String getVersionUserUuid() throws SystemException;
155    
156            public boolean hasLock();
157    
158            public boolean isCheckedOut();
159    
160            public boolean isDefaultRepository();
161    
162            public boolean isInTrash();
163    
164            public boolean isInTrashContainer();
165    
166            public boolean isManualCheckInRequired();
167    
168            public boolean isSupportsLocking();
169    
170            public boolean isSupportsMetadata();
171    
172            public boolean isSupportsSocial();
173    
174    }