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.util.Date;
31  
32  /**
33   * <a href="DLServiceUtil.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   */
37  public class DLServiceUtil {
38  
39      public static void addDirectory(
40              long companyId, long repositoryId, String dirName)
41          throws PortalException, 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, long fileEntryId, String properties,
49              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
50              File file)
51          throws PortalException, SystemException {
52  
53          _service.addFile(
54              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
55              properties, modifiedDate, tagsCategories, tagsEntries, file);
56      }
57  
58      public static void addFile(
59              long companyId, String portletId, long groupId, long repositoryId,
60              String fileName, long fileEntryId, String properties,
61              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
62              byte[] bytes)
63          throws PortalException, SystemException {
64  
65          _service.addFile(
66              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
67              properties, modifiedDate, tagsCategories, tagsEntries, bytes);
68      }
69  
70      public static void deleteDirectory(
71              long companyId, String portletId, long repositoryId, String dirName)
72          throws PortalException, 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, 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, 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, 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, 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, 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, SystemException {
124 
125         return _service.getFileSize(companyId, repositoryId, fileName);
126     }
127 
128     public static void reIndex(String[] ids) throws SystemException {
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             long fileEntryId, String properties, Date modifiedDate,
136             String[] tagsCategories, String[] tagsEntries, File file)
137         throws PortalException, SystemException {
138 
139         _service.updateFile(
140             companyId, portletId, groupId, repositoryId, fileName,
141             versionNumber, sourceFileName, fileEntryId, properties,
142             modifiedDate, tagsCategories, tagsEntries, file);
143     }
144 
145     public static void updateFile(
146             long companyId, String portletId, long groupId, long repositoryId,
147             String fileName, double versionNumber, String sourceFileName,
148             long fileEntryId, String properties, Date modifiedDate,
149             String[] tagsCategories, String[] tagsEntries, byte[] bytes)
150         throws PortalException, SystemException {
151 
152         DLService _service = DLServiceFactory.getService();
153 
154         _service.updateFile(
155             companyId, portletId, groupId, repositoryId, fileName,
156             versionNumber, sourceFileName, fileEntryId, properties,
157             modifiedDate, tagsCategories, tagsEntries, bytes);
158     }
159 
160     public static void updateFile(
161             long companyId, String portletId, long groupId, long repositoryId,
162             long newRepositoryId, String fileName, long fileEntryId)
163         throws PortalException, SystemException {
164 
165         _service.updateFile(
166             companyId, portletId, groupId, repositoryId, newRepositoryId,
167             fileName, fileEntryId);
168     }
169 
170     public void setService(DLService service) {
171         _service = service;
172     }
173 
174     private static DLService _service;
175 
176 }