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