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.messaging.proxy.MessagingProxy;
20  import com.liferay.portal.kernel.messaging.proxy.ProxyMode;
21  import com.liferay.portal.kernel.search.SearchException;
22  
23  import java.io.File;
24  import java.io.InputStream;
25  
26  import java.util.Date;
27  
28  @MessagingProxy(mode = ProxyMode.SYNC)
29  /**
30   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   */
34  public interface Hook {
35  
36      public static final double DEFAULT_VERSION = 1.0;
37  
38      public void addDirectory(long companyId, long repositoryId, String dirName)
39          throws PortalException, SystemException;
40  
41      @MessagingProxy(mode = ProxyMode.ASYNC)
42      public void addFile(
43              long companyId, String portletId, long groupId, long repositoryId,
44              String fileName, String properties, Date modifiedDate,
45              String[] tagsEntries, byte[] bytes)
46          throws PortalException, SystemException;
47  
48      @MessagingProxy(mode = ProxyMode.ASYNC)
49      public void addFile(
50              long companyId, String portletId, long groupId, long repositoryId,
51              String fileName, String properties, Date modifiedDate,
52              String[] tagsEntries, File file)
53          throws PortalException, SystemException;
54  
55      @MessagingProxy(mode = ProxyMode.ASYNC)
56      public void addFile(
57              long companyId, String portletId, long groupId, long repositoryId,
58              String fileName, String properties, Date modifiedDate,
59              String[] tagsEntries, 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     @MessagingProxy(mode = ProxyMode.ASYNC)
113     public void updateFile(
114             long companyId, String portletId, long groupId, long repositoryId,
115             long newRepositoryId, String fileName)
116         throws PortalException, SystemException;
117 
118     @MessagingProxy(mode = ProxyMode.ASYNC)
119     public void updateFile(
120             long companyId, String portletId, long groupId, long repositoryId,
121             String fileName, double versionNumber, String sourceFileName,
122             String properties, Date modifiedDate, String[] tagsEntries,
123             byte[] bytes)
124         throws PortalException, SystemException;
125 
126     @MessagingProxy(mode = ProxyMode.ASYNC)
127     public void updateFile(
128             long companyId, String portletId, long groupId, long repositoryId,
129             String fileName, double versionNumber, String sourceFileName,
130             String properties, Date modifiedDate, String[] tagsEntries,
131             File file)
132         throws PortalException, SystemException;
133 
134     @MessagingProxy(mode = ProxyMode.ASYNC)
135     public void updateFile(
136             long companyId, String portletId, long groupId, long repositoryId,
137             String fileName, double versionNumber, String sourceFileName,
138             String properties, Date modifiedDate, String[] tagsEntries,
139             InputStream is)
140         throws PortalException, SystemException;
141 
142 }