001    /**
002     * Copyright (c) 2000-2011 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             * @see    #getFileVersion()
057             */
058            public InputStream getContentStream()
059                    throws PortalException, SystemException;
060    
061            public InputStream getContentStream(String version)
062                    throws PortalException, SystemException;
063    
064            public Date getCreateDate();
065    
066            public long getCustom1ImageId();
067    
068            public long getCustom2ImageId();
069    
070            public String getDescription();
071    
072            public String getExtension();
073    
074            public long getFileEntryId();
075    
076            /**
077             * Retrieves the current file version. The workflow state of the latest file
078             * version may affect what is returned by this method. In a Liferay
079             * repository, this will return the latest approved version; the latest
080             * version regardless of workflow state can be retrieved by {@link
081             * #getLatestFileVersion()}. In third-party repositories, these two methods
082             * may function identically.
083             *
084             * @return current file version
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            public String getImageType();
103    
104            public long getLargeImageId();
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             */
114            public FileVersion getLatestFileVersion()
115                    throws PortalException, SystemException;
116    
117            public Lock getLock();
118    
119            public String getMimeType();
120    
121            public String getMimeType(String version);
122    
123            public Date getModifiedDate();
124    
125            public String getNameWithExtension();
126    
127            public int getReadCount();
128    
129            public long getRepositoryId();
130    
131            public long getSize();
132    
133            public long getSmallImageId();
134    
135            public String getTitle();
136    
137            public long getUserId();
138    
139            public String getUserName();
140    
141            public String getUserUuid() throws SystemException;
142    
143            public String getUuid();
144    
145            public String getVersion();
146    
147            public long getVersionUserId();
148    
149            public String getVersionUserName();
150    
151            public String getVersionUserUuid() throws SystemException;
152    
153            public boolean hasLock();
154    
155            public boolean isCheckedOut();
156    
157            public boolean isDefaultRepository();
158    
159            public boolean isSupportsLocking();
160    
161            public boolean isSupportsMetadata();
162    
163            public boolean isSupportsSocial();
164    
165    }