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, String properties, Date modifiedDate,
47              String[] tagsEntries, byte[] bytes)
48          throws PortalException, SystemException;
49  
50      public void addFile(
51              long companyId, String portletId, long groupId, long repositoryId,
52              String fileName, String properties, Date modifiedDate,
53              String[] tagsEntries, File file)
54          throws PortalException, SystemException;
55  
56      public void addFile(
57              long companyId, String portletId, long groupId, long repositoryId,
58              String fileName, String properties, Date modifiedDate,
59              String[] tagsEntries, InputStream is)
60          throws PortalException, SystemException;
61  
62      public void checkRoot(long companyId) throws SystemException;
63  
64      public void deleteDirectory(
65              long companyId, String portletId, long repositoryId, String dirName)
66          throws PortalException, SystemException;
67  
68      public void deleteFile(
69              long companyId, String portletId, long repositoryId,
70              String fileName)
71          throws PortalException, SystemException;
72  
73      public void deleteFile(
74              long companyId, String portletId, long repositoryId,
75              String fileName, double versionNumber)
76          throws PortalException, SystemException;
77  
78      public byte[] getFile(long companyId, long repositoryId, String fileName)
79          throws PortalException, SystemException;
80  
81      public byte[] getFile(
82              long companyId, long repositoryId, String fileName,
83              double versionNumber)
84          throws PortalException, SystemException;
85  
86      public InputStream getFileAsStream(
87              long companyId, long repositoryId, String fileName)
88          throws PortalException, SystemException;
89  
90      public InputStream getFileAsStream(
91              long companyId, long repositoryId, String fileName,
92              double versionNumber)
93          throws PortalException, SystemException;
94  
95      public String[] getFileNames(
96              long companyId, long repositoryId, String dirName)
97          throws PortalException, SystemException;
98  
99      public long getFileSize(
100             long companyId, long repositoryId, String fileName)
101         throws PortalException, SystemException;
102 
103     public boolean hasFile(
104             long companyId, long repositoryId, String fileName,
105             double versionNumber)
106         throws PortalException, SystemException;
107 
108     public void move(String srcDir, String destDir) throws SystemException;
109 
110     public void reIndex(String[] ids) throws SearchException;
111 
112     public void updateFile(
113             long companyId, String portletId, long groupId, long repositoryId,
114             String fileName, double versionNumber, String sourceFileName,
115             String properties, Date modifiedDate, String[] tagsEntries,
116             byte[] bytes)
117         throws PortalException, SystemException;
118 
119     public void updateFile(
120             long companyId, String portletId, long groupId, long repositoryId,
121             String fileName, double versionNumber, String sourceFileName,
122             String properties, Date modifiedDate, String[] tagsEntries,
123             File file)
124         throws PortalException, SystemException;
125 
126     public void updateFile(
127             long companyId, String portletId, long groupId, long repositoryId,
128             String fileName, double versionNumber, String sourceFileName,
129             String properties, Date modifiedDate, String[] tagsEntries,
130             InputStream is)
131         throws PortalException, SystemException;
132 
133     public void updateFile(
134             long companyId, String portletId, long groupId, long repositoryId,
135             long newRepositoryId, String fileName)
136         throws PortalException, SystemException;
137 
138 }