1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.documentlibrary.service;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  
25  import java.io.File;
26  
27  import java.rmi.RemoteException;
28  
29  import java.util.Date;
30  
31  /**
32   * <a href="DLServiceUtil.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   *
36   */
37  public class DLServiceUtil {
38  
39      public static void addDirectory(
40              long companyId, long repositoryId, String dirName)
41          throws PortalException, RemoteException, SystemException {
42  
43          _service.addDirectory(companyId, repositoryId, dirName);
44      }
45  
46      public static void addFile(
47              long companyId, String portletId, long groupId, long repositoryId,
48              String fileName, String properties, Date modifiedDate,
49              String[] tagsEntries, byte[] bytes)
50          throws PortalException, RemoteException, SystemException {
51  
52          _service.addFile(
53              companyId, portletId, groupId, repositoryId, fileName, properties,
54              modifiedDate, tagsEntries, bytes);
55      }
56  
57      public static void addFile(
58              long companyId, String portletId, long groupId, long repositoryId,
59              String fileName, String properties, Date modifiedDate,
60              String[] tagsEntries, File file)
61          throws PortalException, RemoteException, SystemException {
62  
63          _service.addFile(
64              companyId, portletId, groupId, repositoryId, fileName, properties,
65              modifiedDate, tagsEntries, file);
66      }
67  
68      public static void deleteDirectory(
69              long companyId, String portletId, long repositoryId, String dirName)
70          throws PortalException, RemoteException, SystemException {
71  
72          DLService _service = DLServiceFactory.getService();
73  
74          _service.deleteDirectory(companyId, portletId, repositoryId, dirName);
75      }
76  
77      public static void deleteFile(
78              long companyId, String portletId, long repositoryId,
79              String fileName)
80          throws PortalException, RemoteException, SystemException {
81  
82          _service.deleteFile(companyId, portletId, repositoryId, fileName);
83      }
84  
85      public static void deleteFile(
86              long companyId, String portletId, long repositoryId,
87              String fileName, double versionNumber)
88          throws PortalException, RemoteException, SystemException {
89  
90          _service.deleteFile(
91              companyId, portletId, repositoryId, fileName, versionNumber);
92      }
93  
94      public static byte[] getFile(
95              long companyId, long repositoryId, String fileName)
96          throws PortalException, RemoteException, SystemException {
97  
98          return _service.getFile(companyId, repositoryId, fileName);
99      }
100 
101     public static byte[] getFile(
102             long companyId, long repositoryId, String fileName,
103             double versionNumber)
104         throws PortalException, RemoteException, SystemException {
105 
106         DLService _service = DLServiceFactory.getService();
107 
108         return _service.getFile(
109             companyId, repositoryId, fileName, versionNumber);
110     }
111 
112     public static String[] getFileNames(
113             long companyId, long repositoryId, String dirName)
114         throws PortalException, RemoteException, SystemException {
115 
116         return _service.getFileNames(companyId, repositoryId, dirName);
117     }
118 
119     public static long getFileSize(
120             long companyId, long repositoryId, String fileName)
121         throws PortalException, RemoteException, SystemException {
122 
123         return _service.getFileSize(companyId, repositoryId, fileName);
124     }
125 
126     public static void reIndex(String[] ids)
127         throws RemoteException, SystemException {
128 
129         _service.reIndex(ids);
130     }
131 
132     public static void updateFile(
133             long companyId, String portletId, long groupId, long repositoryId,
134             String fileName, double versionNumber, String sourceFileName,
135             String properties, Date modifiedDate, String[] tagsEntries,
136             byte[] bytes)
137         throws PortalException, RemoteException, SystemException {
138 
139         DLService _service = DLServiceFactory.getService();
140 
141         _service.updateFile(
142             companyId, portletId, groupId, repositoryId, fileName,
143             versionNumber, sourceFileName, properties, modifiedDate,
144             tagsEntries, bytes);
145     }
146 
147     public static void updateFile(
148             long companyId, String portletId, long groupId, long repositoryId,
149             String fileName, double versionNumber, String sourceFileName,
150             String properties, Date modifiedDate, String[] tagsEntries,
151             File file)
152         throws PortalException, RemoteException, SystemException {
153 
154         _service.updateFile(
155             companyId, portletId, groupId, repositoryId, fileName,
156             versionNumber, sourceFileName, properties, modifiedDate,
157             tagsEntries, file);
158     }
159 
160     public static void updateFile(
161             long companyId, String portletId, long groupId, long repositoryId,
162             long newRepositoryId, String fileName)
163         throws PortalException, RemoteException, SystemException {
164 
165         _service.updateFile(
166             companyId, portletId, groupId, repositoryId, newRepositoryId,
167             fileName);
168     }
169 
170     public void setService(DLService service) {
171         _service = service;
172     }
173 
174     private static DLService _service;
175 
176 }