1   /**
2    * Copyright (c) 2000-2008 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, String[] tagsEntries, 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, String[] tagsEntries,
53              byte[] bytes)
54          throws PortalException, SystemException;
55  
56      public void addFile(
57              long companyId, String portletId, long groupId, long repositoryId,
58              String fileName, String properties, String[] tagsEntries,
59              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, String[] tagsEntries, File file)
116         throws PortalException, SystemException;
117 
118     public void updateFile(
119             long companyId, String portletId, long groupId, long repositoryId,
120             String fileName, double versionNumber, String sourceFileName,
121             String properties, 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             String properties, String[] tagsEntries, InputStream is)
128         throws PortalException, SystemException;
129 
130     public void updateFile(
131             long companyId, String portletId, long groupId, long repositoryId,
132             long newRepositoryId, String fileName)
133         throws PortalException, SystemException;
134 
135 }