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             * @see    #getFileVersion()
059             */
060            public InputStream getContentStream()
061                    throws PortalException, SystemException;
062    
063            public InputStream getContentStream(String version)
064                    throws PortalException, SystemException;
065    
066            @Override
067            public Date getCreateDate();
068    
069            public String getDescription();
070    
071            public String getExtension();
072    
073            public long getFileEntryId();
074    
075            /**
076             * Retrieves the current file version. The workflow state of the latest file
077             * version may affect what is returned by this method. In a Liferay
078             * repository, this will return the latest approved version; the latest
079             * version regardless of workflow state can be retrieved by {@link
080             * #getLatestFileVersion()}. In third-party repositories, these two methods
081             * may function identically.
082             *
083             * @return current file version
084             */
085            public FileVersion getFileVersion() throws PortalException, SystemException;
086    
087            public FileVersion getFileVersion(String version)
088                    throws PortalException, SystemException;
089    
090            public List<FileVersion> getFileVersions(int status)
091                    throws SystemException;
092    
093            public Folder getFolder();
094    
095            public long getFolderId();
096    
097            @Override
098            public long getGroupId();
099    
100            public String getIcon();
101    
102            /**
103             * Retrieves the latest file version. In a Liferay repository, this means
104             * the latest version regardless of workflow state. In third-party
105             * repositories, this may have an identical functionality with {@link
106             * #getFileVersion()}.
107             *
108             * @return latest file version
109             */
110            public FileVersion getLatestFileVersion()
111                    throws PortalException, SystemException;
112    
113            public Lock getLock();
114    
115            public String getMimeType();
116    
117            public String getMimeType(String version);
118    
119            @Override
120            public Date getModifiedDate();
121    
122            public int getReadCount();
123    
124            public long getRepositoryId();
125    
126            public long getSize();
127    
128            public String getTitle();
129    
130            @Override
131            public long getUserId();
132    
133            @Override
134            public String getUserName();
135    
136            @Override
137            public String getUserUuid() throws SystemException;
138    
139            public String getUuid();
140    
141            public String getVersion();
142    
143            public long getVersionUserId();
144    
145            public String getVersionUserName();
146    
147            public String getVersionUserUuid() throws SystemException;
148    
149            public boolean hasLock();
150    
151            public boolean isCheckedOut();
152    
153            public boolean isDefaultRepository();
154    
155            public boolean isSupportsLocking();
156    
157            public boolean isSupportsMetadata();
158    
159            public boolean isSupportsSocial();
160    
161    }