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