001    /**
002     * Copyright (c) 2000-2012 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                            public Long get(FileEntry fileEntry) {
038                                    return fileEntry.getFileEntryId();
039                            }
040    
041                    };
042    
043            public boolean containsPermission(
044                            PermissionChecker permissionChecker, String actionId)
045                    throws PortalException, SystemException;
046    
047            public long getCompanyId();
048    
049            /**
050             * Retrieves the content stream of the current file version. In a Liferay
051             * repository, this is the latest approved version. In third-party
052             * repositories, this may be the latest content regardless of workflow
053             * state.
054             *
055             * @return content stream of the current file version
056             * @throws PortalException if a portal exception occurred
057             * @throws SystemException if a system exception occurred
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            public Date getCreateDate();
067    
068            public String getDescription();
069    
070            public String getExtension();
071    
072            public long getFileEntryId();
073    
074            /**
075             * Retrieves the current file version. The workflow state of the latest file
076             * version may affect what is returned by this method. In a Liferay
077             * repository, this will return the latest approved version; the latest
078             * version regardless of workflow state can be retrieved by {@link
079             * #getLatestFileVersion()}. In third-party repositories, these two methods
080             * may function identically.
081             *
082             * @return current file version
083             * @throws PortalException if a portal exception occurred
084             * @throws SystemException if a system exception occurred
085             */
086            public FileVersion getFileVersion() throws PortalException, SystemException;
087    
088            public FileVersion getFileVersion(String version)
089                    throws PortalException, SystemException;
090    
091            public List<FileVersion> getFileVersions(int status)
092                    throws SystemException;
093    
094            public Folder getFolder();
095    
096            public long getFolderId();
097    
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             * @throws PortalException if a portal exception occurred
110             * @throws SystemException if a system exception occurred
111             */
112            public FileVersion getLatestFileVersion()
113                    throws PortalException, SystemException;
114    
115            public Lock getLock();
116    
117            public String getMimeType();
118    
119            public String getMimeType(String version);
120    
121            public Date getModifiedDate();
122    
123            public int getReadCount();
124    
125            public long getRepositoryId();
126    
127            public long getSize();
128    
129            public String getTitle();
130    
131            public long getUserId();
132    
133            public String getUserName();
134    
135            public String getUserUuid() throws SystemException;
136    
137            public String getUuid();
138    
139            public String getVersion();
140    
141            public long getVersionUserId();
142    
143            public String getVersionUserName();
144    
145            public String getVersionUserUuid() throws SystemException;
146    
147            public boolean hasLock();
148    
149            public boolean isCheckedOut();
150    
151            public boolean isDefaultRepository();
152    
153            public boolean isManualCheckInRequired();
154    
155            public boolean isSupportsLocking();
156    
157            public boolean isSupportsMetadata();
158    
159            public boolean isSupportsSocial();
160    
161    }