001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.documentlibrary.store;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.transaction.Transactional;
020    
021    import java.io.File;
022    import java.io.InputStream;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     * @author Alexander Chow
027     * @author Edward Han
028     */
029    @Transactional(rollbackFor = {PortalException.class, SystemException.class})
030    public interface DLStore {
031    
032            public void addDirectory(
033                            long companyId, long repositoryId, String dirName)
034                    throws PortalException, SystemException;
035    
036            public void addFile(
037                            long companyId, long repositoryId, String fileName,
038                            boolean validateFileExtension, byte[] bytes)
039                    throws PortalException, SystemException;
040    
041            public void addFile(
042                            long companyId, long repositoryId, String fileName,
043                            boolean validateFileExtension, File file)
044                    throws PortalException, SystemException;
045    
046            public void addFile(
047                            long companyId, long repositoryId, String fileName,
048                            boolean validateFileExtension, InputStream is)
049                    throws PortalException, SystemException;
050    
051            public void addFile(
052                            long companyId, long repositoryId, String fileName, byte[] bytes)
053                    throws PortalException, SystemException;
054    
055            public void addFile(
056                            long companyId, long repositoryId, String fileName, File file)
057                    throws PortalException, SystemException;
058    
059            public void addFile(
060                            long companyId, long repositoryId, String fileName, InputStream is)
061                    throws PortalException, SystemException;
062    
063            public void checkRoot(long companyId) throws SystemException;
064    
065            public void copyFileVersion(
066                            long companyId, long repositoryId, String fileName,
067                            String fromVersionLabel, String toVersionLabel)
068                    throws PortalException, SystemException;
069    
070            public void deleteDirectory(
071                            long companyId, long repositoryId, String dirName)
072                    throws PortalException, SystemException;
073    
074            public void deleteFile(
075                            long companyId, long repositoryId, String fileName)
076                    throws PortalException, SystemException;
077    
078            public void deleteFile(
079                            long companyId, long repositoryId, String fileName,
080                            String versionLabel)
081                    throws PortalException, SystemException;
082    
083            public File getFile(long companyId, long repositoryId, String fileName)
084                    throws PortalException, SystemException;
085    
086            public File getFile(
087                            long companyId, long repositoryId, String fileName,
088                            String versionLabel)
089                    throws PortalException, SystemException;
090    
091            public byte[] getFileAsBytes(
092                            long companyId, long repositoryId, String fileName)
093                    throws PortalException, SystemException;
094    
095            public byte[] getFileAsBytes(
096                            long companyId, long repositoryId, String fileName,
097                            String versionLabel)
098                    throws PortalException, SystemException;
099    
100            public InputStream getFileAsStream(
101                            long companyId, long repositoryId, String fileName)
102                    throws PortalException, SystemException;
103    
104            public InputStream getFileAsStream(
105                            long companyId, long repositoryId, String fileName,
106                            String versionLabel)
107                    throws PortalException, SystemException;
108    
109            public String[] getFileNames(
110                            long companyId, long repositoryId, String dirName)
111                    throws PortalException, SystemException;
112    
113            public long getFileSize(long companyId, long repositoryId, String fileName)
114                    throws PortalException, SystemException;
115    
116            public boolean hasDirectory(
117                            long companyId, long repositoryId, String dirName)
118                    throws PortalException, SystemException;
119    
120            public boolean hasFile(long companyId, long repositoryId, String fileName)
121                    throws PortalException, SystemException;
122    
123            public boolean hasFile(
124                            long companyId, long repositoryId, String fileName,
125                            String versionLabel)
126                    throws PortalException, SystemException;
127    
128            public void move(String srcDir, String destDir) throws SystemException;
129    
130            public void updateFile(
131                            long companyId, long repositoryId, long newRepositoryId,
132                            String fileName)
133                    throws PortalException, SystemException;
134    
135            public void updateFile(
136                            long companyId, long repositoryId, String fileName,
137                            String newFileName)
138                    throws PortalException, SystemException;
139    
140            public void updateFile(
141                            long companyId, long repositoryId, String fileName,
142                            String fileExtension, boolean validateFileExtension,
143                            String versionLabel, String sourceFileName, File file)
144                    throws PortalException, SystemException;
145    
146            public void updateFile(
147                            long companyId, long repositoryId, String fileName,
148                            String fileExtension, boolean validateFileExtension,
149                            String versionLabel, String sourceFileName, InputStream is)
150                    throws PortalException, SystemException;
151    
152            public void updateFileVersion(
153                            long companyId, long repositoryId, String fileName,
154                            String fromVersionLabel, String toVersionLabel)
155                    throws PortalException, SystemException;
156    
157            public void validate(
158                            String fileName, boolean validateFileExtension)
159                    throws PortalException, SystemException;
160    
161            public void validate(
162                            String fileName, boolean validateFileExtension, byte[] bytes)
163                    throws PortalException, SystemException;
164    
165            public void validate(
166                            String fileName, boolean validateFileExtension, File file)
167                    throws PortalException, SystemException;
168    
169            public void validate(
170                            String fileName, boolean validateFileExtension, InputStream is)
171                    throws PortalException, SystemException;
172    
173            public void validate(
174                            String fileName, String fileExtension, String sourceFileName,
175                            boolean validateFileExtension, File file)
176                    throws PortalException, SystemException;
177    
178            public void validate(
179                            String fileName, String fileExtension, String sourceFileName,
180                            boolean validateFileExtension, InputStream is)
181                    throws PortalException, SystemException;
182    
183    }