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.documentlibrary.service;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.search.Hits;
020    import com.liferay.portal.kernel.transaction.Transactional;
021    import com.liferay.portal.service.ServiceContext;
022    
023    import java.io.File;
024    import java.io.InputStream;
025    
026    import java.util.Date;
027    
028    /**
029     * @author Brian Wing Shun Chan
030     * @author Alexander Chow
031     */
032    @Transactional(rollbackFor = {PortalException.class, SystemException.class})
033    public interface DLLocalService {
034    
035            public void addDirectory(long companyId, long repositoryId, String dirName)
036                    throws PortalException, SystemException;
037    
038            public void addFile(
039                            long companyId, String portletId, long groupId, long repositoryId,
040                            String fileName, boolean validateFileExtension, long fileEntryId,
041                            String properties, Date modifiedDate, ServiceContext serviceContext,
042                            InputStream is)
043                    throws PortalException, SystemException;
044    
045            public void addFile(
046                            long companyId, String portletId, long groupId, long repositoryId,
047                            String fileName, long fileEntryId, String properties,
048                            Date modifiedDate, ServiceContext serviceContext, byte[] bytes)
049                    throws PortalException, SystemException;
050    
051            public void addFile(
052                            long companyId, String portletId, long groupId, long repositoryId,
053                            String fileName, long fileEntryId, String properties,
054                            Date modifiedDate, ServiceContext serviceContext, File file)
055                    throws PortalException, SystemException;
056    
057            public void checkRoot(long companyId) throws SystemException;
058    
059            public void deleteDirectory(
060                            long companyId, String portletId, long repositoryId, String dirName)
061                    throws PortalException, SystemException;
062    
063            public void deleteFile(
064                            long companyId, String portletId, long repositoryId,
065                            String fileName)
066                    throws PortalException, SystemException;
067    
068            public void deleteFile(
069                            long companyId, String portletId, long repositoryId,
070                            String fileName, String versionNumber)
071                    throws PortalException, SystemException;
072    
073            public byte[] getFile(long companyId, long repositoryId, String fileName)
074                    throws PortalException, SystemException;
075    
076            public byte[] getFile(
077                            long companyId, long repositoryId, String fileName,
078                            String versionNumber)
079                    throws PortalException, SystemException;
080    
081            public InputStream getFileAsStream(
082                            long companyId, long repositoryId, String fileName)
083                    throws PortalException, SystemException;
084    
085            public InputStream getFileAsStream(
086                            long companyId, long repositoryId, String fileName,
087                            String versionNumber)
088                    throws PortalException, SystemException;
089    
090            public String[] getFileNames(
091                            long companyId, long repositoryId, String dirName)
092                    throws PortalException, SystemException;
093    
094            public long getFileSize(long companyId, long repositoryId, String fileName)
095                    throws PortalException, SystemException;
096    
097            public boolean hasFile(
098                            long companyId, long repositoryId, String fileName,
099                            String versionNumber)
100                    throws PortalException, SystemException;
101    
102            public void move(String srcDir, String destDir) throws SystemException;
103    
104            public Hits search(
105                            long companyId, String portletId, long groupId,
106                            long userId, long[] repositoryIds, String keywords, int start,
107                            int end)
108                    throws SystemException;
109    
110            public void updateFile(
111                            long companyId, String portletId, long groupId, long repositoryId,
112                            long newRepositoryId, String fileName, long fileEntryId)
113                    throws PortalException, SystemException;
114    
115            public void updateFile(
116                            long companyId, String portletId, long groupId, long repositoryId,
117                            String fileName, String newFileName, boolean reindex)
118                    throws PortalException, SystemException;
119    
120            public void updateFile(
121                            long companyId, String portletId, long groupId, long repositoryId,
122                            String fileName, String fileExtension,
123                            boolean validateFileExtension, String versionNumber,
124                            String sourceFileName, long fileEntryId, String properties,
125                            Date modifiedDate, ServiceContext serviceContext, InputStream is)
126                    throws PortalException, SystemException;
127    
128            public void updateFile(
129                            long companyId, String portletId, long groupId, long repositoryId,
130                            String fileName, String versionNumber, String sourceFileName,
131                            long fileEntryId, String properties, Date modifiedDate,
132                            ServiceContext serviceContext, byte[] bytes)
133                    throws PortalException, SystemException;
134    
135            public void updateFile(
136                            long companyId, String portletId, long groupId, long repositoryId,
137                            String fileName, String versionNumber, String sourceFileName,
138                            long fileEntryId, String properties, Date modifiedDate,
139                            ServiceContext serviceContext, File file)
140                    throws PortalException, SystemException;
141    
142            public void validate(String fileName, boolean validateFileExtension)
143                    throws PortalException, SystemException;
144    
145            public void validate(
146                            String fileName, boolean validateFileExtension, byte[] bytes)
147                    throws PortalException, SystemException;
148    
149            public void validate(
150                            String fileName, boolean validateFileExtension, File file)
151                    throws PortalException, SystemException;
152    
153            public void validate(
154                            String fileName, boolean validateFileExtension, InputStream is)
155                    throws PortalException, SystemException;
156    
157            public void validate(
158                            String fileName, String fileExtension, String sourceFileName,
159                            boolean validateFileExtension, InputStream is)
160                    throws PortalException, SystemException;
161    
162    }