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