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  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
28  import com.liferay.portal.kernel.search.Hits;
29  
30  import java.io.File;
31  import java.io.InputStream;
32  
33  import java.util.Date;
34  
35  /**
36   * <a href="DLLocalServiceUtil.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Brian Wing Shun Chan
39   */
40  public class DLLocalServiceUtil {
41  
42      public static void addFile(
43              long companyId, String portletId, long groupId, long repositoryId,
44              String fileName, long fileEntryId, String properties,
45              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
46              InputStream is)
47          throws PortalException, SystemException {
48  
49          getService().addFile(
50              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
51              properties, modifiedDate, tagsCategories, tagsEntries, is);
52      }
53  
54      public static void checkRoot(long companyId) throws SystemException {
55          getService().checkRoot(companyId);
56      }
57  
58      public static InputStream getFileAsStream(
59              long companyId, long repositoryId, String fileName)
60          throws PortalException, SystemException {
61  
62          return getService().getFileAsStream(companyId, repositoryId, fileName);
63      }
64  
65      public static InputStream getFileAsStream(
66              long companyId, long repositoryId, String fileName,
67              double versionNumber)
68          throws PortalException, SystemException {
69  
70          return getService().getFileAsStream(
71              companyId, repositoryId, fileName, versionNumber);
72      }
73  
74      public static DLLocalService getService() {
75          if (_service == null) {
76              _service = (DLLocalService)PortalBeanLocatorUtil.locate(
77                  DLLocalService.class.getName());
78          }
79  
80          return _service;
81      }
82  
83      public static boolean hasFile(
84              long companyId, long repositoryId, String fileName,
85              double versionNumber)
86          throws PortalException, SystemException {
87  
88          return getService().hasFile(
89              companyId, repositoryId, fileName, versionNumber);
90      }
91  
92      public static void move(String srcDir, String destDir)
93          throws SystemException {
94  
95          getService().move(srcDir, destDir);
96      }
97  
98      public static Hits search(
99              long companyId, String portletId, long groupId,
100             long userId, long[] repositoryIds, String keywords, int start,
101             int end)
102         throws SystemException {
103 
104         return getService().search(
105             companyId, portletId, groupId, userId, repositoryIds, keywords,
106             start, end);
107     }
108 
109     public static void updateFile(
110             long companyId, String portletId, long groupId, long repositoryId,
111             String fileName, double versionNumber, String sourceFileName,
112             long fileEntryId, String properties, Date modifiedDate,
113             String[] tagsCategories, String[] tagsEntries, InputStream is)
114         throws PortalException, SystemException {
115 
116         getService().updateFile(
117             companyId, portletId, groupId, repositoryId, fileName,
118             versionNumber, sourceFileName, fileEntryId, properties,
119             modifiedDate, tagsCategories, tagsEntries, is);
120     }
121 
122     public static void validate(String fileName, File file)
123         throws PortalException, SystemException {
124 
125         getService().validate(fileName, file);
126     }
127 
128     public static void validate(String fileName, byte[] bytes)
129         throws PortalException, SystemException {
130 
131         getService().validate(fileName, bytes);
132     }
133 
134     public static void validate(String fileName, InputStream is)
135         throws PortalException, SystemException {
136 
137         getService().validate(fileName, is);
138     }
139 
140     public static void validate(
141             String fileName, String sourceFileName, InputStream is)
142         throws PortalException {
143 
144         getService().validate(fileName, sourceFileName, is);
145     }
146 
147     public void setService(DLLocalService service) {
148         _service = service;
149     }
150 
151     private static DLLocalService _service;
152 
153 }