1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   * 
13   */
14  
15  package com.liferay.documentlibrary.service;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
20  import com.liferay.portal.kernel.search.Hits;
21  
22  import java.io.File;
23  import java.io.InputStream;
24  
25  import java.util.Date;
26  
27  /**
28   * <a href="DLLocalServiceUtil.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public class DLLocalServiceUtil {
33  
34      public static void addFile(
35              long companyId, String portletId, long groupId, long repositoryId,
36              String fileName, long fileEntryId, String properties,
37              Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
38              InputStream is)
39          throws PortalException, SystemException {
40  
41          getService().addFile(
42              companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
43              properties, modifiedDate, tagsCategories, tagsEntries, is);
44      }
45  
46      public static void checkRoot(long companyId) throws SystemException {
47          getService().checkRoot(companyId);
48      }
49  
50      public static InputStream getFileAsStream(
51              long companyId, long repositoryId, String fileName)
52          throws PortalException, SystemException {
53  
54          return getService().getFileAsStream(companyId, repositoryId, fileName);
55      }
56  
57      public static InputStream getFileAsStream(
58              long companyId, long repositoryId, String fileName,
59              double versionNumber)
60          throws PortalException, SystemException {
61  
62          return getService().getFileAsStream(
63              companyId, repositoryId, fileName, versionNumber);
64      }
65  
66      public static DLLocalService getService() {
67          if (_service == null) {
68              _service = (DLLocalService)PortalBeanLocatorUtil.locate(
69                  DLLocalService.class.getName());
70          }
71  
72          return _service;
73      }
74  
75      public static boolean hasFile(
76              long companyId, long repositoryId, String fileName,
77              double versionNumber)
78          throws PortalException, SystemException {
79  
80          return getService().hasFile(
81              companyId, repositoryId, fileName, versionNumber);
82      }
83  
84      public static void move(String srcDir, String destDir)
85          throws SystemException {
86  
87          getService().move(srcDir, destDir);
88      }
89  
90      public static Hits search(
91              long companyId, String portletId, long groupId,
92              long userId, long[] repositoryIds, String keywords, int start,
93              int end)
94          throws SystemException {
95  
96          return getService().search(
97              companyId, portletId, groupId, userId, repositoryIds, keywords,
98              start, end);
99      }
100 
101     public static void updateFile(
102             long companyId, String portletId, long groupId, long repositoryId,
103             String fileName, double versionNumber, String sourceFileName,
104             long fileEntryId, String properties, Date modifiedDate,
105             String[] tagsCategories, String[] tagsEntries, InputStream is)
106         throws PortalException, SystemException {
107 
108         getService().updateFile(
109             companyId, portletId, groupId, repositoryId, fileName,
110             versionNumber, sourceFileName, fileEntryId, properties,
111             modifiedDate, tagsCategories, tagsEntries, is);
112     }
113 
114     public static void validate(String fileName, File file)
115         throws PortalException, SystemException {
116 
117         getService().validate(fileName, file);
118     }
119 
120     public static void validate(String fileName, byte[] bytes)
121         throws PortalException, SystemException {
122 
123         getService().validate(fileName, bytes);
124     }
125 
126     public static void validate(String fileName, InputStream is)
127         throws PortalException, SystemException {
128 
129         getService().validate(fileName, is);
130     }
131 
132     public static void validate(
133             String fileName, String sourceFileName, InputStream is)
134         throws PortalException, SystemException {
135 
136         getService().validate(fileName, sourceFileName, is);
137     }
138 
139     public void setService(DLLocalService service) {
140         _service = service;
141     }
142 
143     private static DLLocalService _service;
144 
145 }