1   /**
2    * Copyright (c) 2000-2009 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  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   */
40  public interface Hook {
41  
42      public static final double DEFAULT_VERSION = 1.0;
43  
44      public void addDirectory(long companyId, long repositoryId, String dirName)
45          throws PortalException, SystemException;
46  
47      public void addFile(
48              long companyId, String portletId, long groupId, long repositoryId,
49              String fileName, long fileEntryId, String properties,
50              Date modifiedDate, String[] tagsEntries, 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[] tagsEntries, File file)
57          throws PortalException, SystemException;
58  
59      public void addFile(
60              long companyId, String portletId, long groupId, long repositoryId,
61              String fileName, long fileEntryId, String properties,
62              Date modifiedDate, String[] tagsEntries, InputStream is)
63          throws PortalException, SystemException;
64  
65      public void checkRoot(long companyId) throws SystemException;
66  
67      public void deleteDirectory(
68              long companyId, String portletId, long repositoryId, String dirName)
69          throws PortalException, SystemException;
70  
71      public void deleteFile(
72              long companyId, String portletId, long repositoryId,
73              String fileName)
74          throws PortalException, SystemException;
75  
76      public void deleteFile(
77              long companyId, String portletId, long repositoryId,
78              String fileName, double versionNumber)
79          throws PortalException, SystemException;
80  
81      public byte[] getFile(long companyId, long repositoryId, String fileName)
82          throws PortalException, SystemException;
83  
84      public byte[] getFile(
85              long companyId, long repositoryId, String fileName,
86              double versionNumber)
87          throws PortalException, SystemException;
88  
89      public InputStream getFileAsStream(
90              long companyId, long repositoryId, String fileName)
91          throws PortalException, SystemException;
92  
93      public InputStream getFileAsStream(
94              long companyId, long repositoryId, String fileName,
95              double versionNumber)
96          throws PortalException, SystemException;
97  
98      public String[] getFileNames(
99              long companyId, long repositoryId, String dirName)
100         throws PortalException, SystemException;
101 
102     public long getFileSize(
103             long companyId, long repositoryId, String fileName)
104         throws PortalException, SystemException;
105 
106     public boolean hasFile(
107             long companyId, long repositoryId, String fileName,
108             double versionNumber)
109         throws PortalException, SystemException;
110 
111     public void move(String srcDir, String destDir) throws SystemException;
112 
113     public void reIndex(String[] ids) throws SearchException;
114 
115     public void updateFile(
116             long companyId, String portletId, long groupId, long repositoryId,
117             String fileName, double versionNumber, String sourceFileName,
118             long fileEntryId, String properties, Date modifiedDate,
119             String[] tagsEntries, byte[] bytes)
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             long fileEntryId, String properties, Date modifiedDate,
126             String[] tagsEntries, File file)
127         throws PortalException, SystemException;
128 
129     public void updateFile(
130             long companyId, String portletId, long groupId, long repositoryId,
131             String fileName, double versionNumber, String sourceFileName,
132             long fileEntryId, String properties, Date modifiedDate,
133             String[] tagsEntries, InputStream is)
134         throws PortalException, SystemException;
135 
136     public void updateFile(
137             long companyId, String portletId, long groupId, long repositoryId,
138             long newRepositoryId, String fileName, long fileEntryId)
139         throws PortalException, SystemException;
140 
141 }