1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.documentlibrary.util;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.search.SearchException;
20  
21  import java.io.File;
22  import java.io.InputStream;
23  
24  import java.util.Date;
25  
26  /**
27   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public interface Hook {
32  
33      public static final double DEFAULT_VERSION = 1.0;
34  
35      public void addDirectory(long companyId, long repositoryId, String dirName)
36          throws PortalException, SystemException;
37  
38      public void addFile(
39              long companyId, String portletId, long groupId, long repositoryId,
40              String fileName, long fileEntryId, String properties,
41              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
42              byte[] bytes)
43          throws PortalException, SystemException;
44  
45      public void addFile(
46              long companyId, String portletId, long groupId, long repositoryId,
47              String fileName, long fileEntryId, String properties,
48              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
49              File file)
50          throws PortalException, SystemException;
51  
52      public void addFile(
53              long companyId, String portletId, long groupId, long repositoryId,
54              String fileName, long fileEntryId, String properties,
55              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
56              InputStream is)
57          throws PortalException, SystemException;
58  
59      public void checkRoot(long companyId) throws SystemException;
60  
61      public void deleteDirectory(
62              long companyId, String portletId, long repositoryId, String dirName)
63          throws PortalException, SystemException;
64  
65      public void deleteFile(
66              long companyId, String portletId, long repositoryId,
67              String fileName)
68          throws PortalException, SystemException;
69  
70      public void deleteFile(
71              long companyId, String portletId, long repositoryId,
72              String fileName, double versionNumber)
73          throws PortalException, SystemException;
74  
75      public byte[] getFile(long companyId, long repositoryId, String fileName)
76          throws PortalException, SystemException;
77  
78      public byte[] getFile(
79              long companyId, long repositoryId, String fileName,
80              double versionNumber)
81          throws PortalException, SystemException;
82  
83      public InputStream getFileAsStream(
84              long companyId, long repositoryId, String fileName)
85          throws PortalException, SystemException;
86  
87      public InputStream getFileAsStream(
88              long companyId, long repositoryId, String fileName,
89              double versionNumber)
90          throws PortalException, SystemException;
91  
92      public String[] getFileNames(
93              long companyId, long repositoryId, String dirName)
94          throws PortalException, SystemException;
95  
96      public long getFileSize(
97              long companyId, long repositoryId, String fileName)
98          throws PortalException, SystemException;
99  
100     public boolean hasFile(
101             long companyId, long repositoryId, String fileName,
102             double versionNumber)
103         throws PortalException, SystemException;
104 
105     public void move(String srcDir, String destDir) throws SystemException;
106 
107     public void reIndex(String[] ids) throws SearchException;
108 
109     public void updateFile(
110             long companyId, String portletId, long groupId, long repositoryId,
111             long newRepositoryId, String fileName, long fileEntryId)
112         throws PortalException, SystemException;
113 
114     public void updateFile(
115             long companyId, String portletId, long groupId, long repositoryId,
116             String fileName, double versionNumber, String sourceFileName,
117             long fileEntryId, String properties, Date modifiedDate,
118             String[] tagsCategories, String[] tagsEntries, byte[] bytes)
119         throws PortalException, SystemException;
120 
121     public void updateFile(
122             long companyId, String portletId, long groupId, long repositoryId,
123             String fileName, double versionNumber, String sourceFileName,
124             long fileEntryId, String properties, Date modifiedDate,
125             String[] tagsCategories, String[] tagsEntries, File file)
126         throws PortalException, SystemException;
127 
128     public void updateFile(
129             long companyId, String portletId, long groupId, long repositoryId,
130             String fileName, double versionNumber, String sourceFileName,
131             long fileEntryId, String properties, Date modifiedDate,
132             String[] tagsCategories, String[] tagsEntries, InputStream is)
133         throws PortalException, SystemException;
134 
135     public void updateFile(
136             long companyId, String portletId, long groupId, long repositoryId,
137             String fileName, String newFileName, boolean reIndex)
138         throws PortalException, SystemException;
139 
140 }