001    /**
002     * Copyright (c) 2000-2010 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.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.search.SearchException;
020    import com.liferay.portal.service.ServiceContext;
021    
022    import java.io.File;
023    import java.io.InputStream;
024    
025    import java.util.Date;
026    
027    /**
028     * @author Brian Wing Shun Chan
029     */
030    public interface Hook {
031    
032            public static final String DEFAULT_VERSION = "1.0";
033    
034            public void addDirectory(long companyId, long repositoryId, String dirName)
035                    throws PortalException, SystemException;
036    
037            public void addFile(
038                            long companyId, String portletId, long groupId, long repositoryId,
039                            String fileName, long fileEntryId, String properties,
040                            Date modifiedDate, ServiceContext serviceContext, byte[] bytes)
041                    throws PortalException, SystemException;
042    
043            public void addFile(
044                            long companyId, String portletId, long groupId, long repositoryId,
045                            String fileName, long fileEntryId, String properties,
046                            Date modifiedDate, ServiceContext serviceContext, File file)
047                    throws PortalException, SystemException;
048    
049            public void addFile(
050                            long companyId, String portletId, long groupId, long repositoryId,
051                            String fileName, long fileEntryId, String properties,
052                            Date modifiedDate, ServiceContext serviceContext, InputStream is)
053                    throws PortalException, SystemException;
054    
055            public void checkRoot(long companyId) throws SystemException;
056    
057            public void deleteDirectory(
058                            long companyId, String portletId, long repositoryId, String dirName)
059                    throws PortalException, SystemException;
060    
061            public void deleteFile(
062                            long companyId, String portletId, long repositoryId,
063                            String fileName)
064                    throws PortalException, SystemException;
065    
066            public void deleteFile(
067                            long companyId, String portletId, long repositoryId,
068                            String fileName, String versionNumber)
069                    throws PortalException, SystemException;
070    
071            public byte[] getFile(long companyId, long repositoryId, String fileName)
072                    throws PortalException, SystemException;
073    
074            public byte[] getFile(
075                            long companyId, long repositoryId, String fileName,
076                            String versionNumber)
077                    throws PortalException, SystemException;
078    
079            public InputStream getFileAsStream(
080                            long companyId, long repositoryId, String fileName)
081                    throws PortalException, SystemException;
082    
083            public InputStream getFileAsStream(
084                            long companyId, long repositoryId, String fileName,
085                            String versionNumber)
086                    throws PortalException, SystemException;
087    
088            public String[] getFileNames(
089                            long companyId, long repositoryId, String dirName)
090                    throws PortalException, SystemException;
091    
092            public long getFileSize(
093                            long companyId, long repositoryId, String fileName)
094                    throws PortalException, SystemException;
095    
096            public boolean hasFile(
097                            long companyId, long repositoryId, String fileName,
098                            String versionNumber)
099                    throws PortalException, SystemException;
100    
101            public void move(String srcDir, String destDir) throws SystemException;
102    
103            public void reindex(String[] ids) throws SearchException;
104    
105            public void updateFile(
106                            long companyId, String portletId, long groupId, long repositoryId,
107                            long newRepositoryId, String fileName, long fileEntryId)
108                    throws PortalException, SystemException;
109    
110            public void updateFile(
111                            long companyId, String portletId, long groupId, long repositoryId,
112                            String fileName, String newFileName, boolean reindex)
113                    throws PortalException, SystemException;
114    
115            public void updateFile(
116                            long companyId, String portletId, long groupId, long repositoryId,
117                            String fileName, String versionNumber, String sourceFileName,
118                            long fileEntryId, String properties, Date modifiedDate,
119                            ServiceContext serviceContext, byte[] bytes)
120                    throws PortalException, SystemException;
121    
122            public void updateFile(
123                            long companyId, String portletId, long groupId, long repositoryId,
124                            String fileName, String versionNumber, String sourceFileName,
125                            long fileEntryId, String properties, Date modifiedDate,
126                            ServiceContext serviceContext, File file)
127                    throws PortalException, SystemException;
128    
129            public void updateFile(
130                            long companyId, String portletId, long groupId, long repositoryId,
131                            String fileName, String versionNumber, String sourceFileName,
132                            long fileEntryId, String properties, Date modifiedDate,
133                            ServiceContext serviceContext, InputStream is)
134                    throws PortalException, SystemException;
135    
136    }