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.messaging.proxy.MessagingProxy;
28  import com.liferay.portal.kernel.messaging.proxy.ProxyMode;
29  import com.liferay.portal.kernel.search.SearchException;
30  
31  import java.io.File;
32  import java.io.InputStream;
33  
34  import java.util.Date;
35  
36  @MessagingProxy(mode = ProxyMode.SYNC)
37  /**
38   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
39   *
40   * @author Brian Wing Shun Chan
41   */
42  public interface Hook {
43  
44      public static final double DEFAULT_VERSION = 1.0;
45  
46      public void addDirectory(long companyId, long repositoryId, String dirName)
47          throws PortalException, SystemException;
48  
49      @MessagingProxy(mode = ProxyMode.ASYNC)
50      public void addFile(
51              long companyId, String portletId, long groupId, long repositoryId,
52              String fileName, long fileEntryId, String properties,
53              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
54              byte[] bytes)
55          throws PortalException, SystemException;
56  
57      @MessagingProxy(mode = ProxyMode.ASYNC)
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              File file)
63          throws PortalException, SystemException;
64  
65      @MessagingProxy(mode = ProxyMode.ASYNC)
66      public void addFile(
67              long companyId, String portletId, long groupId, long repositoryId,
68              String fileName, long fileEntryId, String properties,
69              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
70              InputStream is)
71          throws PortalException, SystemException;
72  
73      public void checkRoot(long companyId) throws SystemException;
74  
75      public void deleteDirectory(
76              long companyId, String portletId, long repositoryId, String dirName)
77          throws PortalException, SystemException;
78  
79      public void deleteFile(
80              long companyId, String portletId, long repositoryId,
81              String fileName)
82          throws PortalException, SystemException;
83  
84      public void deleteFile(
85              long companyId, String portletId, long repositoryId,
86              String fileName, double versionNumber)
87          throws PortalException, SystemException;
88  
89      public byte[] getFile(long companyId, long repositoryId, String fileName)
90          throws PortalException, SystemException;
91  
92      public byte[] getFile(
93              long companyId, long repositoryId, String fileName,
94              double versionNumber)
95          throws PortalException, SystemException;
96  
97      public InputStream getFileAsStream(
98              long companyId, long repositoryId, String fileName)
99          throws PortalException, SystemException;
100 
101     public InputStream getFileAsStream(
102             long companyId, long repositoryId, String fileName,
103             double versionNumber)
104         throws PortalException, SystemException;
105 
106     public String[] getFileNames(
107             long companyId, long repositoryId, String dirName)
108         throws PortalException, SystemException;
109 
110     public long getFileSize(
111             long companyId, long repositoryId, String fileName)
112         throws PortalException, SystemException;
113 
114     public boolean hasFile(
115             long companyId, long repositoryId, String fileName,
116             double versionNumber)
117         throws PortalException, SystemException;
118 
119     public void move(String srcDir, String destDir) throws SystemException;
120 
121     public void reIndex(String[] ids) throws SearchException;
122 
123     @MessagingProxy(mode = ProxyMode.ASYNC)
124     public void updateFile(
125             long companyId, String portletId, long groupId, long repositoryId,
126             long newRepositoryId, String fileName, long fileEntryId)
127         throws PortalException, SystemException;
128 
129     @MessagingProxy(mode = ProxyMode.ASYNC)
130     public void updateFile(
131             long companyId, String portletId, long groupId, long repositoryId,
132             String fileName, double versionNumber, String sourceFileName,
133             long fileEntryId, String properties, Date modifiedDate,
134             String[] tagsCategories, String[] tagsEntries, byte[] bytes)
135         throws PortalException, SystemException;
136 
137     @MessagingProxy(mode = ProxyMode.ASYNC)
138     public void updateFile(
139             long companyId, String portletId, long groupId, long repositoryId,
140             String fileName, double versionNumber, String sourceFileName,
141             long fileEntryId, String properties, Date modifiedDate,
142             String[] tagsCategories, String[] tagsEntries, File file)
143         throws PortalException, SystemException;
144 
145     @MessagingProxy(mode = ProxyMode.ASYNC)
146     public void updateFile(
147             long companyId, String portletId, long groupId, long repositoryId,
148             String fileName, double versionNumber, String sourceFileName,
149             long fileEntryId, String properties, Date modifiedDate,
150             String[] tagsCategories, String[] tagsEntries, InputStream is)
151         throws PortalException, SystemException;
152 
153 }