1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.documentlibrary.service;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  
28  import java.io.File;
29  
30  import java.rmi.RemoteException;
31  
32  /**
33   * <a href="DLServiceUtil.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   *
37   */
38  public class DLServiceUtil {
39  
40      public static void addDirectory(
41              long companyId, long repositoryId, String dirName)
42          throws PortalException, RemoteException, SystemException {
43  
44          _service.addDirectory(companyId, repositoryId, dirName);
45      }
46  
47      public static void addFile(
48              long companyId, String portletId, long groupId, long repositoryId,
49              String fileName, String properties, String[] tagsEntries, File file)
50          throws PortalException, RemoteException, SystemException {
51  
52          _service.addFile(
53              companyId, portletId, groupId, repositoryId, fileName, properties,
54              tagsEntries, file);
55      }
56  
57      public static void addFile(
58              long companyId, String portletId, long groupId, long repositoryId,
59              String fileName, String properties, String[] tagsEntries,
60              byte[] bytes)
61          throws PortalException, RemoteException, SystemException {
62  
63          _service.addFile(
64              companyId, portletId, groupId, repositoryId, fileName, properties,
65              tagsEntries, bytes);
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, String[] tagsEntries, File file)
136         throws PortalException, RemoteException, SystemException {
137 
138         _service.updateFile(
139             companyId, portletId, groupId, repositoryId, fileName,
140             versionNumber, sourceFileName, properties, tagsEntries, file);
141     }
142 
143     public static void updateFile(
144             long companyId, String portletId, long groupId, long repositoryId,
145             String fileName, double versionNumber, String sourceFileName,
146             String properties, String[] tagsEntries, byte[] bytes)
147         throws PortalException, RemoteException, SystemException {
148 
149         DLService _service = DLServiceFactory.getService();
150 
151         _service.updateFile(
152             companyId, portletId, groupId, repositoryId, fileName,
153             versionNumber, sourceFileName, properties, tagsEntries, bytes);
154     }
155 
156     public static void updateFile(
157             long companyId, String portletId, long groupId, long repositoryId,
158             long newRepositoryId, String fileName)
159         throws PortalException, RemoteException, SystemException {
160 
161         _service.updateFile(
162             companyId, portletId, groupId, repositoryId, newRepositoryId,
163             fileName);
164     }
165 
166     public void setService(DLService service) {
167         _service = service;
168     }
169 
170     private static DLService _service;
171 
172 }