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