1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  import java.util.Date;
33  
34  /**
35   * <a href="DLServiceUtil.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   */
39  public class DLServiceUtil {
40  
41      public static void addDirectory(
42              long companyId, long repositoryId, String dirName)
43          throws PortalException, RemoteException, SystemException {
44  
45          _service.addDirectory(companyId, repositoryId, dirName);
46      }
47  
48      public static void addFile(
49              long companyId, String portletId, long groupId, long repositoryId,
50              String fileName, String properties, Date modifiedDate,
51              String[] tagsEntries, byte[] bytes)
52          throws PortalException, RemoteException, SystemException {
53  
54          _service.addFile(
55              companyId, portletId, groupId, repositoryId, fileName, properties,
56              modifiedDate, tagsEntries, bytes);
57      }
58  
59      public static void addFile(
60              long companyId, String portletId, long groupId, long repositoryId,
61              String fileName, String properties, Date modifiedDate,
62              String[] tagsEntries, File file)
63          throws PortalException, RemoteException, SystemException {
64  
65          _service.addFile(
66              companyId, portletId, groupId, repositoryId, fileName, properties,
67              modifiedDate, tagsEntries, file);
68      }
69  
70      public static void deleteDirectory(
71              long companyId, String portletId, long repositoryId, String dirName)
72          throws PortalException, RemoteException, SystemException {
73  
74          DLService _service = DLServiceFactory.getService();
75  
76          _service.deleteDirectory(companyId, portletId, repositoryId, dirName);
77      }
78  
79      public static void deleteFile(
80              long companyId, String portletId, long repositoryId,
81              String fileName)
82          throws PortalException, RemoteException, SystemException {
83  
84          _service.deleteFile(companyId, portletId, repositoryId, fileName);
85      }
86  
87      public static void deleteFile(
88              long companyId, String portletId, long repositoryId,
89              String fileName, double versionNumber)
90          throws PortalException, RemoteException, SystemException {
91  
92          _service.deleteFile(
93              companyId, portletId, repositoryId, fileName, versionNumber);
94      }
95  
96      public static byte[] getFile(
97              long companyId, long repositoryId, String fileName)
98          throws PortalException, RemoteException, SystemException {
99  
100         return _service.getFile(companyId, repositoryId, fileName);
101     }
102 
103     public static byte[] getFile(
104             long companyId, long repositoryId, String fileName,
105             double versionNumber)
106         throws PortalException, RemoteException, SystemException {
107 
108         DLService _service = DLServiceFactory.getService();
109 
110         return _service.getFile(
111             companyId, repositoryId, fileName, versionNumber);
112     }
113 
114     public static String[] getFileNames(
115             long companyId, long repositoryId, String dirName)
116         throws PortalException, RemoteException, SystemException {
117 
118         return _service.getFileNames(companyId, repositoryId, dirName);
119     }
120 
121     public static long getFileSize(
122             long companyId, long repositoryId, String fileName)
123         throws PortalException, RemoteException, SystemException {
124 
125         return _service.getFileSize(companyId, repositoryId, fileName);
126     }
127 
128     public static void reIndex(String[] ids)
129         throws RemoteException, SystemException {
130 
131         _service.reIndex(ids);
132     }
133 
134     public static void updateFile(
135             long companyId, String portletId, long groupId, long repositoryId,
136             String fileName, double versionNumber, String sourceFileName,
137             String properties, Date modifiedDate, String[] tagsEntries,
138             byte[] bytes)
139         throws PortalException, RemoteException, SystemException {
140 
141         DLService _service = DLServiceFactory.getService();
142 
143         _service.updateFile(
144             companyId, portletId, groupId, repositoryId, fileName,
145             versionNumber, sourceFileName, properties, modifiedDate,
146             tagsEntries, bytes);
147     }
148 
149     public static void updateFile(
150             long companyId, String portletId, long groupId, long repositoryId,
151             String fileName, double versionNumber, String sourceFileName,
152             String properties, Date modifiedDate, String[] tagsEntries,
153             File file)
154         throws PortalException, RemoteException, SystemException {
155 
156         _service.updateFile(
157             companyId, portletId, groupId, repositoryId, fileName,
158             versionNumber, sourceFileName, properties, modifiedDate,
159             tagsEntries, file);
160     }
161 
162     public static void updateFile(
163             long companyId, String portletId, long groupId, long repositoryId,
164             long newRepositoryId, String fileName)
165         throws PortalException, RemoteException, SystemException {
166 
167         _service.updateFile(
168             companyId, portletId, groupId, repositoryId, newRepositoryId,
169             fileName);
170     }
171 
172     public void setService(DLService service) {
173         _service = service;
174     }
175 
176     private static DLService _service;
177 
178 }