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.search.SearchException;
20  import com.liferay.portal.service.ServiceContext;
21  
22  import java.io.File;
23  import java.io.InputStream;
24  
25  import java.util.Date;
26  
27  /**
28   * <a href="Hook.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public interface Hook {
33  
34      public static final String DEFAULT_VERSION = "1.0";
35  
36      public void addDirectory(long companyId, long repositoryId, String dirName)
37          throws PortalException, SystemException;
38  
39      public void addFile(
40              long companyId, String portletId, long groupId, long repositoryId,
41              String fileName, long fileEntryId, String properties,
42              Date modifiedDate, ServiceContext serviceContext, 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, ServiceContext serviceContext, File file)
49          throws PortalException, SystemException;
50  
51      public void addFile(
52              long companyId, String portletId, long groupId, long repositoryId,
53              String fileName, long fileEntryId, String properties,
54              Date modifiedDate, ServiceContext serviceContext, InputStream is)
55          throws PortalException, SystemException;
56  
57      public void checkRoot(long companyId) throws SystemException;
58  
59      public void deleteDirectory(
60              long companyId, String portletId, long repositoryId, String dirName)
61          throws PortalException, SystemException;
62  
63      public void deleteFile(
64              long companyId, String portletId, long repositoryId,
65              String fileName)
66          throws PortalException, SystemException;
67  
68      public void deleteFile(
69              long companyId, String portletId, long repositoryId,
70              String fileName, String versionNumber)
71          throws PortalException, SystemException;
72  
73      public byte[] getFile(long companyId, long repositoryId, String fileName)
74          throws PortalException, SystemException;
75  
76      public byte[] getFile(
77              long companyId, long repositoryId, String fileName,
78              String versionNumber)
79          throws PortalException, SystemException;
80  
81      public InputStream getFileAsStream(
82              long companyId, long repositoryId, String fileName)
83          throws PortalException, SystemException;
84  
85      public InputStream getFileAsStream(
86              long companyId, long repositoryId, String fileName,
87              String versionNumber)
88          throws PortalException, SystemException;
89  
90      public String[] getFileNames(
91              long companyId, long repositoryId, String dirName)
92          throws PortalException, SystemException;
93  
94      public long getFileSize(
95              long companyId, long repositoryId, String fileName)
96          throws PortalException, SystemException;
97  
98      public boolean hasFile(
99              long companyId, long repositoryId, String fileName,
100             String versionNumber)
101         throws PortalException, SystemException;
102 
103     public void move(String srcDir, String destDir) throws SystemException;
104 
105     public void reindex(String[] ids) throws SearchException;
106 
107     public void updateFile(
108             long companyId, String portletId, long groupId, long repositoryId,
109             long newRepositoryId, String fileName, long fileEntryId)
110         throws PortalException, SystemException;
111 
112     public void updateFile(
113             long companyId, String portletId, long groupId, long repositoryId,
114             String fileName, String newFileName, boolean reindex)
115         throws PortalException, SystemException;
116 
117     public void updateFile(
118             long companyId, String portletId, long groupId, long repositoryId,
119             String fileName, String versionNumber, String sourceFileName,
120             long fileEntryId, String properties, Date modifiedDate,
121             ServiceContext serviceContext, byte[] bytes)
122         throws PortalException, SystemException;
123 
124     public void updateFile(
125             long companyId, String portletId, long groupId, long repositoryId,
126             String fileName, String versionNumber, String sourceFileName,
127             long fileEntryId, String properties, Date modifiedDate,
128             ServiceContext serviceContext, File file)
129         throws PortalException, SystemException;
130 
131     public void updateFile(
132             long companyId, String portletId, long groupId, long repositoryId,
133             String fileName, String versionNumber, String sourceFileName,
134             long fileEntryId, String properties, Date modifiedDate,
135             ServiceContext serviceContext, InputStream is)
136         throws PortalException, SystemException;
137 
138 }