1   /**
2    * Copyright (c) 2000-2009 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  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   */
40  public class DLServiceUtil {
41  
42      public static void addDirectory(
43              long companyId, long repositoryId, String dirName)
44          throws PortalException, RemoteException, SystemException {
45  
46          _service.addDirectory(companyId, repositoryId, dirName);
47      }
48  
49      public static void addFile(
50              long companyId, String portletId, long groupId, long repositoryId,
51              String fileName, String properties, Date modifiedDate,
52              String[] tagsEntries, byte[] bytes)
53          throws PortalException, RemoteException, SystemException {
54  
55          _service.addFile(
56              companyId, portletId, groupId, repositoryId, fileName, properties,
57              modifiedDate, tagsEntries, bytes);
58      }
59  
60      public static void addFile(
61              long companyId, String portletId, long groupId, long repositoryId,
62              String fileName, String properties, Date modifiedDate,
63              String[] tagsEntries, File file)
64          throws PortalException, RemoteException, SystemException {
65  
66          _service.addFile(
67              companyId, portletId, groupId, repositoryId, fileName, properties,
68              modifiedDate, tagsEntries, file);
69      }
70  
71      public static void deleteDirectory(
72              long companyId, String portletId, long repositoryId, String dirName)
73          throws PortalException, RemoteException, SystemException {
74  
75          DLService _service = DLServiceFactory.getService();
76  
77          _service.deleteDirectory(companyId, portletId, repositoryId, dirName);
78      }
79  
80      public static void deleteFile(
81              long companyId, String portletId, long repositoryId,
82              String fileName)
83          throws PortalException, RemoteException, SystemException {
84  
85          _service.deleteFile(companyId, portletId, repositoryId, fileName);
86      }
87  
88      public static void deleteFile(
89              long companyId, String portletId, long repositoryId,
90              String fileName, double versionNumber)
91          throws PortalException, RemoteException, SystemException {
92  
93          _service.deleteFile(
94              companyId, portletId, repositoryId, fileName, versionNumber);
95      }
96  
97      public static byte[] getFile(
98              long companyId, long repositoryId, String fileName)
99          throws PortalException, RemoteException, SystemException {
100 
101         return _service.getFile(companyId, repositoryId, fileName);
102     }
103 
104     public static byte[] getFile(
105             long companyId, long repositoryId, String fileName,
106             double versionNumber)
107         throws PortalException, RemoteException, SystemException {
108 
109         DLService _service = DLServiceFactory.getService();
110 
111         return _service.getFile(
112             companyId, repositoryId, fileName, versionNumber);
113     }
114 
115     public static String[] getFileNames(
116             long companyId, long repositoryId, String dirName)
117         throws PortalException, RemoteException, SystemException {
118 
119         return _service.getFileNames(companyId, repositoryId, dirName);
120     }
121 
122     public static long getFileSize(
123             long companyId, long repositoryId, String fileName)
124         throws PortalException, RemoteException, SystemException {
125 
126         return _service.getFileSize(companyId, repositoryId, fileName);
127     }
128 
129     public static void reIndex(String[] ids)
130         throws RemoteException, SystemException {
131 
132         _service.reIndex(ids);
133     }
134 
135     public static void updateFile(
136             long companyId, String portletId, long groupId, long repositoryId,
137             String fileName, double versionNumber, String sourceFileName,
138             String properties, Date modifiedDate, String[] tagsEntries,
139             byte[] bytes)
140         throws PortalException, RemoteException, SystemException {
141 
142         DLService _service = DLServiceFactory.getService();
143 
144         _service.updateFile(
145             companyId, portletId, groupId, repositoryId, fileName,
146             versionNumber, sourceFileName, properties, modifiedDate,
147             tagsEntries, bytes);
148     }
149 
150     public static void updateFile(
151             long companyId, String portletId, long groupId, long repositoryId,
152             String fileName, double versionNumber, String sourceFileName,
153             String properties, Date modifiedDate, String[] tagsEntries,
154             File file)
155         throws PortalException, RemoteException, SystemException {
156 
157         _service.updateFile(
158             companyId, portletId, groupId, repositoryId, fileName,
159             versionNumber, sourceFileName, properties, modifiedDate,
160             tagsEntries, file);
161     }
162 
163     public static void updateFile(
164             long companyId, String portletId, long groupId, long repositoryId,
165             long newRepositoryId, String fileName)
166         throws PortalException, RemoteException, SystemException {
167 
168         _service.updateFile(
169             companyId, portletId, groupId, repositoryId, newRepositoryId,
170             fileName);
171     }
172 
173     public void setService(DLService service) {
174         _service = service;
175     }
176 
177     private static DLService _service;
178 
179 }