1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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  /**
33   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   *
37   */
38  public interface Hook {
39  
40      public static final double DEFAULT_VERSION = 1.0;
41  
42      public void addDirectory(long companyId, long repositoryId, String dirName)
43          throws PortalException, SystemException;
44  
45      public void addFile(
46              long companyId, String portletId, long groupId, long repositoryId,
47              String fileName, String properties, File file)
48          throws PortalException, SystemException;
49  
50      public void addFile(
51              long companyId, String portletId, long groupId, long repositoryId,
52              String fileName, String properties, byte[] byteArray)
53          throws PortalException, SystemException;
54  
55      public void addFile(
56              long companyId, String portletId, long groupId, long repositoryId,
57              String fileName, String properties, InputStream is)
58          throws PortalException, SystemException;
59  
60      public void checkRoot(long companyId) throws SystemException;
61  
62      public void deleteDirectory(
63              long companyId, String portletId, long repositoryId, String dirName)
64          throws PortalException, SystemException;
65  
66      public void deleteFile(
67              long companyId, String portletId, long repositoryId,
68              String fileName)
69          throws PortalException, SystemException;
70  
71      public void deleteFile(
72              long companyId, String portletId, long repositoryId,
73              String fileName, double versionNumber)
74          throws PortalException, SystemException;
75  
76      public byte[] getFile(long companyId, long repositoryId, String fileName)
77          throws PortalException, SystemException;
78  
79      public byte[] getFile(
80              long companyId, long repositoryId, String fileName,
81              double versionNumber)
82          throws PortalException, SystemException;
83  
84      public InputStream getFileAsStream(
85              long companyId, long repositoryId, String fileName)
86          throws PortalException, SystemException;
87  
88      public InputStream getFileAsStream(
89              long companyId, long repositoryId, String fileName,
90              double versionNumber)
91          throws PortalException, SystemException;
92  
93      public String[] getFileNames(
94              long companyId, long repositoryId, String dirName)
95          throws PortalException, SystemException;
96  
97      public long getFileSize(
98              long companyId, long repositoryId, String fileName)
99          throws PortalException, SystemException;
100 
101     public boolean hasFile(
102             long companyId, long repositoryId, String fileName,
103             double versionNumber)
104         throws PortalException, SystemException;
105 
106     public void move(String srcDir, String destDir) throws SystemException;
107 
108     public void reIndex(String[] ids) throws SearchException;
109 
110     public void updateFile(
111             long companyId, String portletId, long groupId, long repositoryId,
112             String fileName, double versionNumber, String sourceFileName,
113             String properties, File file)
114         throws PortalException, SystemException;
115 
116     public void updateFile(
117             long companyId, String portletId, long groupId, long repositoryId,
118             String fileName, double versionNumber, String sourceFileName,
119             String properties, byte[] byteArray)
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             String properties, InputStream is)
126         throws PortalException, SystemException;
127 
128     public void updateFile(
129             long companyId, String portletId, long groupId, long repositoryId,
130             long newRepositoryId, String fileName)
131         throws PortalException, SystemException;
132 
133 }