1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.documentlibrary.util;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.kernel.search.SearchException;
25  
26  import java.io.File;
27  import java.io.InputStream;
28  
29  import java.util.Date;
30  
31  /**
32   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   *
36   */
37  public interface Hook {
38  
39      public static final double DEFAULT_VERSION = 1.0;
40  
41      public void addDirectory(long companyId, long repositoryId, String dirName)
42          throws PortalException, SystemException;
43  
44      public void addFile(
45              long companyId, String portletId, long groupId, long repositoryId,
46              String fileName, long fileEntryId, String properties,
47              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
48              byte[] bytes)
49          throws PortalException, SystemException;
50  
51      public void addFile(
52              long companyId, String portletId, long groupId, long repositoryId,
53              String fileName, long fileEntryId, String properties,
54              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
55              File file)
56          throws PortalException, SystemException;
57  
58      public void addFile(
59              long companyId, String portletId, long groupId, long repositoryId,
60              String fileName, long fileEntryId, String properties,
61              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
62              InputStream is)
63          throws PortalException, SystemException;
64  
65      public void checkRoot(long companyId) throws SystemException;
66  
67      public void deleteDirectory(
68              long companyId, String portletId, long repositoryId, String dirName)
69          throws PortalException, SystemException;
70  
71      public void deleteFile(
72              long companyId, String portletId, long repositoryId,
73              String fileName)
74          throws PortalException, SystemException;
75  
76      public void deleteFile(
77              long companyId, String portletId, long repositoryId,
78              String fileName, double versionNumber)
79          throws PortalException, SystemException;
80  
81      public byte[] getFile(long companyId, long repositoryId, String fileName)
82          throws PortalException, SystemException;
83  
84      public byte[] getFile(
85              long companyId, long repositoryId, String fileName,
86              double versionNumber)
87          throws PortalException, SystemException;
88  
89      public InputStream getFileAsStream(
90              long companyId, long repositoryId, String fileName)
91          throws PortalException, SystemException;
92  
93      public InputStream getFileAsStream(
94              long companyId, long repositoryId, String fileName,
95              double versionNumber)
96          throws PortalException, SystemException;
97  
98      public String[] getFileNames(
99              long companyId, long repositoryId, String dirName)
100         throws PortalException, SystemException;
101 
102     public long getFileSize(
103             long companyId, long repositoryId, String fileName)
104         throws PortalException, SystemException;
105 
106     public boolean hasFile(
107             long companyId, long repositoryId, String fileName,
108             double versionNumber)
109         throws PortalException, SystemException;
110 
111     public void move(String srcDir, String destDir) throws SystemException;
112 
113     public void reIndex(String[] ids) throws SearchException;
114 
115     public void updateFile(
116             long companyId, String portletId, long groupId, long repositoryId,
117             String fileName, double versionNumber, String sourceFileName,
118             long fileEntryId, String properties, Date modifiedDate,
119             String[] tagsCategories, String[] tagsEntries, byte[] bytes)
120         throws PortalException, SystemException;
121 
122     public void updateFile(
123             long companyId, String portletId, long groupId, long repositoryId,
124             String fileName, double versionNumber, String sourceFileName,
125             long fileEntryId, String properties, Date modifiedDate,
126             String[] tagsCategories, String[] tagsEntries, File file)
127         throws PortalException, SystemException;
128 
129     public void updateFile(
130             long companyId, String portletId, long groupId, long repositoryId,
131             String fileName, double versionNumber, String sourceFileName,
132             long fileEntryId, String properties, Date modifiedDate,
133             String[] tagsCategories, String[] tagsEntries, InputStream is)
134         throws PortalException, SystemException;
135 
136     public void updateFile(
137             long companyId, String portletId, long groupId, long repositoryId,
138             long newRepositoryId, String fileName, long fileEntryId)
139         throws PortalException, SystemException;
140 
141 }