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.portlet.documentlibrary.service;
24  
25  
26  /**
27   * <a href="DLFileEntryServiceUtil.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides static methods for the
36   * <code>com.liferay.portlet.documentlibrary.service.DLFileEntryService</code>
37   * bean. The static methods of this class calls the same methods of the bean
38   * instance. It's convenient to be able to just write one line to call a method
39   * on a bean instead of writing a lookup call and a method call.
40   * </p>
41   *
42   * @author Brian Wing Shun Chan
43   *
44   * @see com.liferay.portlet.documentlibrary.service.DLFileEntryService
45   *
46   */
47  public class DLFileEntryServiceUtil {
48      public static com.liferay.portlet.documentlibrary.model.DLFileEntry addFileEntry(
49          long folderId, java.lang.String name, java.lang.String title,
50          java.lang.String description, java.lang.String extraSettings,
51          java.io.File file,
52          com.liferay.portal.service.ServiceContext serviceContext)
53          throws com.liferay.portal.PortalException,
54              com.liferay.portal.SystemException {
55          return getService()
56                     .addFileEntry(folderId, name, title, description,
57              extraSettings, file, serviceContext);
58      }
59  
60      public static com.liferay.portlet.documentlibrary.model.DLFileEntry addFileEntry(
61          long folderId, java.lang.String name, java.lang.String title,
62          java.lang.String description, java.lang.String extraSettings,
63          byte[] bytes, com.liferay.portal.service.ServiceContext serviceContext)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          return getService()
67                     .addFileEntry(folderId, name, title, description,
68              extraSettings, bytes, serviceContext);
69      }
70  
71      public static void deleteFileEntry(long folderId, java.lang.String name)
72          throws com.liferay.portal.PortalException,
73              com.liferay.portal.SystemException {
74          getService().deleteFileEntry(folderId, name);
75      }
76  
77      public static void deleteFileEntry(long folderId, java.lang.String name,
78          double version)
79          throws com.liferay.portal.PortalException,
80              com.liferay.portal.SystemException {
81          getService().deleteFileEntry(folderId, name, version);
82      }
83  
84      public static void deleteFileEntryByTitle(long folderId,
85          java.lang.String titleWithExtension)
86          throws com.liferay.portal.PortalException,
87              com.liferay.portal.SystemException {
88          getService().deleteFileEntryByTitle(folderId, titleWithExtension);
89      }
90  
91      public static java.util.List<com.liferay.portlet.documentlibrary.model.DLFileEntry> getFileEntries(
92          long folderId)
93          throws com.liferay.portal.PortalException,
94              com.liferay.portal.SystemException {
95          return getService().getFileEntries(folderId);
96      }
97  
98      public static com.liferay.portlet.documentlibrary.model.DLFileEntry getFileEntry(
99          long folderId, java.lang.String name)
100         throws com.liferay.portal.PortalException,
101             com.liferay.portal.SystemException {
102         return getService().getFileEntry(folderId, name);
103     }
104 
105     public static com.liferay.portlet.documentlibrary.model.DLFileEntry getFileEntryByTitle(
106         long folderId, java.lang.String titleWithExtension)
107         throws com.liferay.portal.PortalException,
108             com.liferay.portal.SystemException {
109         return getService().getFileEntryByTitle(folderId, titleWithExtension);
110     }
111 
112     public static boolean hasFileEntryLock(long folderId, java.lang.String name)
113         throws com.liferay.portal.PortalException {
114         return getService().hasFileEntryLock(folderId, name);
115     }
116 
117     public static com.liferay.lock.model.Lock lockFileEntry(long folderId,
118         java.lang.String name)
119         throws com.liferay.portal.PortalException,
120             com.liferay.portal.SystemException {
121         return getService().lockFileEntry(folderId, name);
122     }
123 
124     public static com.liferay.lock.model.Lock lockFileEntry(long folderId,
125         java.lang.String name, java.lang.String owner, long expirationTime)
126         throws com.liferay.portal.PortalException,
127             com.liferay.portal.SystemException {
128         return getService().lockFileEntry(folderId, name, owner, expirationTime);
129     }
130 
131     public static com.liferay.lock.model.Lock refreshFileEntryLock(
132         java.lang.String lockUuid, long expirationTime)
133         throws com.liferay.portal.PortalException {
134         return getService().refreshFileEntryLock(lockUuid, expirationTime);
135     }
136 
137     public static void unlockFileEntry(long folderId, java.lang.String name) {
138         getService().unlockFileEntry(folderId, name);
139     }
140 
141     public static void unlockFileEntry(long folderId, java.lang.String name,
142         java.lang.String lockUuid) throws com.liferay.portal.PortalException {
143         getService().unlockFileEntry(folderId, name, lockUuid);
144     }
145 
146     public static com.liferay.portlet.documentlibrary.model.DLFileEntry updateFileEntry(
147         long folderId, long newFolderId, java.lang.String name,
148         java.lang.String sourceFileName, java.lang.String title,
149         java.lang.String description, java.lang.String extraSettings,
150         byte[] bytes, com.liferay.portal.service.ServiceContext serviceContext)
151         throws com.liferay.portal.PortalException,
152             com.liferay.portal.SystemException {
153         return getService()
154                    .updateFileEntry(folderId, newFolderId, name,
155             sourceFileName, title, description, extraSettings, bytes,
156             serviceContext);
157     }
158 
159     public static boolean verifyFileEntryLock(long folderId,
160         java.lang.String name, java.lang.String lockUuid)
161         throws com.liferay.portal.PortalException {
162         return getService().verifyFileEntryLock(folderId, name, lockUuid);
163     }
164 
165     public static DLFileEntryService getService() {
166         if (_service == null) {
167             throw new RuntimeException("DLFileEntryService is not set");
168         }
169 
170         return _service;
171     }
172 
173     public void setService(DLFileEntryService service) {
174         _service = service;
175     }
176 
177     private static DLFileEntryService _service;
178 }