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, String properties, Date modifiedDate,
37              String[] tagsEntries, InputStream is)
38          throws PortalException, SystemException {
39  
40          getService().addFile(
41              companyId, portletId, groupId, repositoryId, fileName, properties,
42              modifiedDate, tagsEntries, is);
43      }
44  
45      public static void checkRoot(long companyId) throws SystemException {
46          getService().checkRoot(companyId);
47      }
48  
49      public static InputStream getFileAsStream(
50              long companyId, long repositoryId, String fileName)
51          throws PortalException, SystemException {
52  
53          return getService().getFileAsStream(companyId, repositoryId, fileName);
54      }
55  
56      public static InputStream getFileAsStream(
57              long companyId, long repositoryId, String fileName,
58              double versionNumber)
59          throws PortalException, SystemException {
60  
61          return getService().getFileAsStream(
62              companyId, repositoryId, fileName, versionNumber);
63      }
64  
65      public static DLLocalService getService() {
66          if (_service == null) {
67              _service = (DLLocalService)PortalBeanLocatorUtil.locate(
68                  DLLocalService.class.getName());
69          }
70  
71          return _service;
72      }
73  
74      public static boolean hasFile(
75              long companyId, long repositoryId, String fileName,
76              double versionNumber)
77          throws PortalException, SystemException {
78  
79          return getService().hasFile(
80              companyId, repositoryId, fileName, versionNumber);
81      }
82  
83      public static void move(String srcDir, String destDir)
84          throws SystemException {
85  
86          getService().move(srcDir, destDir);
87      }
88  
89      public static Hits search(
90              long companyId, String portletId, long groupId,
91              long[] repositoryIds, String keywords, int start, int end)
92          throws SystemException {
93  
94          return getService().search(
95              companyId, portletId, groupId, repositoryIds, keywords, start, end);
96      }
97  
98      public static void updateFile(
99              long companyId, String portletId, long groupId, long repositoryId,
100             String fileName, double versionNumber, String sourceFileName,
101             String properties, Date modifiedDate, String[] tagsEntries,
102             InputStream is)
103         throws PortalException, SystemException {
104 
105         getService().updateFile(
106             companyId, portletId, groupId, repositoryId, fileName,
107             versionNumber, sourceFileName, properties, modifiedDate,
108             tagsEntries, is);
109     }
110 
111     public static void validate(String fileName, File file)
112         throws PortalException, SystemException {
113 
114         getService().validate(fileName, file);
115     }
116 
117     public static void validate(String fileName, byte[] bytes)
118         throws PortalException, SystemException {
119 
120         getService().validate(fileName, bytes);
121     }
122 
123     public static void validate(String fileName, InputStream is)
124         throws PortalException, SystemException {
125 
126         getService().validate(fileName, is);
127     }
128 
129     public static void validate(
130             String fileName, String sourceFileName, InputStream is)
131         throws PortalException, SystemException {
132 
133         getService().validate(fileName, sourceFileName, is);
134     }
135 
136     public void setService(DLLocalService service) {
137         _service = service;
138     }
139 
140     private static DLLocalService _service;
141 
142 }