1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.documentlibrary.util;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.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  import com.liferay.portal.service.ServiceContext;
23  
24  import java.io.File;
25  import java.io.InputStream;
26  
27  import java.util.Date;
28  
29  @MessagingProxy(mode = ProxyMode.SYNC)
30  /**
31   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Brian Wing Shun Chan
34   */
35  public interface Hook {
36  
37      public static final String DEFAULT_VERSION = "1.0";
38  
39      public void addDirectory(long companyId, long repositoryId, String dirName)
40          throws PortalException, SystemException;
41  
42      @MessagingProxy(mode = ProxyMode.ASYNC)
43      public void addFile(
44              long companyId, String portletId, long groupId, long repositoryId,
45              String fileName, long fileEntryId, String properties,
46              Date modifiedDate, ServiceContext serviceContext, byte[] bytes)
47          throws PortalException, SystemException;
48  
49      @MessagingProxy(mode = ProxyMode.ASYNC)
50      public void addFile(
51              long companyId, String portletId, long groupId, long repositoryId,
52              String fileName, long fileEntryId, String properties,
53              Date modifiedDate, ServiceContext serviceContext, File file)
54          throws PortalException, SystemException;
55  
56      @MessagingProxy(mode = ProxyMode.ASYNC)
57      public void addFile(
58              long companyId, String portletId, long groupId, long repositoryId,
59              String fileName, long fileEntryId, String properties,
60              Date modifiedDate, ServiceContext serviceContext, InputStream is)
61          throws PortalException, SystemException;
62  
63      public void checkRoot(long companyId) throws SystemException;
64  
65      public void deleteDirectory(
66              long companyId, String portletId, long repositoryId, String dirName)
67          throws PortalException, SystemException;
68  
69      public void deleteFile(
70              long companyId, String portletId, long repositoryId,
71              String fileName)
72          throws PortalException, SystemException;
73  
74      public void deleteFile(
75              long companyId, String portletId, long repositoryId,
76              String fileName, String versionNumber)
77          throws PortalException, SystemException;
78  
79      public byte[] getFile(long companyId, long repositoryId, String fileName)
80          throws PortalException, SystemException;
81  
82      public byte[] getFile(
83              long companyId, long repositoryId, String fileName,
84              String versionNumber)
85          throws PortalException, SystemException;
86  
87      public InputStream getFileAsStream(
88              long companyId, long repositoryId, String fileName)
89          throws PortalException, SystemException;
90  
91      public InputStream getFileAsStream(
92              long companyId, long repositoryId, String fileName,
93              String versionNumber)
94          throws PortalException, SystemException;
95  
96      public String[] getFileNames(
97              long companyId, long repositoryId, String dirName)
98          throws PortalException, SystemException;
99  
100     public long getFileSize(
101             long companyId, long repositoryId, String fileName)
102         throws PortalException, SystemException;
103 
104     public boolean hasFile(
105             long companyId, long repositoryId, String fileName,
106             String versionNumber)
107         throws PortalException, SystemException;
108 
109     public void move(String srcDir, String destDir) throws SystemException;
110 
111     public void reindex(String[] ids) throws SearchException;
112 
113     @MessagingProxy(mode = ProxyMode.ASYNC)
114     public void updateFile(
115             long companyId, String portletId, long groupId, long repositoryId,
116             long newRepositoryId, String fileName, long fileEntryId)
117         throws PortalException, SystemException;
118 
119     @MessagingProxy(mode = ProxyMode.ASYNC)
120     public void updateFile(
121             long companyId, String portletId, long groupId, long repositoryId,
122             String fileName, String versionNumber, String sourceFileName,
123             long fileEntryId, String properties, Date modifiedDate,
124             ServiceContext serviceContext, byte[] bytes)
125         throws PortalException, SystemException;
126 
127     @MessagingProxy(mode = ProxyMode.ASYNC)
128     public void updateFile(
129             long companyId, String portletId, long groupId, long repositoryId,
130             String fileName, String versionNumber, String sourceFileName,
131             long fileEntryId, String properties, Date modifiedDate,
132             ServiceContext serviceContext, File file)
133         throws PortalException, SystemException;
134 
135     @MessagingProxy(mode = ProxyMode.ASYNC)
136     public void updateFile(
137             long companyId, String portletId, long groupId, long repositoryId,
138             String fileName, String versionNumber, String sourceFileName,
139             long fileEntryId, String properties, Date modifiedDate,
140             ServiceContext serviceContext, InputStream is)
141         throws PortalException, SystemException;
142 
143     @MessagingProxy(mode = ProxyMode.ASYNC)
144     public void updateFile(
145             long companyId, String portletId, long groupId, long repositoryId,
146             String fileName, String newFileName, boolean reindex)
147         throws PortalException, SystemException;
148 
149 }