001
014
015 package com.liferay.portal.portletfilerepository;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.exception.PortalException;
020 import com.liferay.portal.kernel.repository.model.FileEntry;
021 import com.liferay.portal.kernel.repository.model.Folder;
022 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
023 import com.liferay.portal.kernel.util.ObjectValuePair;
024 import com.liferay.portal.kernel.util.OrderByComparator;
025 import com.liferay.portal.model.Repository;
026 import com.liferay.portal.service.ServiceContext;
027 import com.liferay.portal.theme.ThemeDisplay;
028
029 import java.io.File;
030 import java.io.InputStream;
031
032 import java.util.List;
033
034
038 @ProviderType
039 public class PortletFileRepositoryUtil {
040
041 public static void addPortletFileEntries(
042 long groupId, long userId, String className, long classPK,
043 String portletId, long folderId,
044 List<ObjectValuePair<String, InputStream>> inputStreamOVPs)
045 throws PortalException {
046
047 getPortletFileRepository().addPortletFileEntries(
048 groupId, userId, className, classPK, portletId, folderId,
049 inputStreamOVPs);
050 }
051
052 public static FileEntry addPortletFileEntry(
053 long groupId, long userId, String className, long classPK,
054 String portletId, long folderId, File file, String fileName,
055 String mimeType, boolean indexingEnabled)
056 throws PortalException {
057
058 return getPortletFileRepository().addPortletFileEntry(
059 groupId, userId, className, classPK, portletId, folderId, file,
060 fileName, mimeType, indexingEnabled);
061 }
062
063 public static FileEntry addPortletFileEntry(
064 long groupId, long userId, String className, long classPK,
065 String portletId, long folderId, InputStream inputStream,
066 String fileName, String mimeType, boolean indexingEnabled)
067 throws PortalException {
068
069 return getPortletFileRepository().addPortletFileEntry(
070 groupId, userId, className, classPK, portletId, folderId,
071 inputStream, fileName, mimeType, indexingEnabled);
072 }
073
074 public static Folder addPortletFolder(
075 long userId, long repositoryId, long parentFolderId,
076 String folderName, ServiceContext serviceContext)
077 throws PortalException {
078
079 return getPortletFileRepository().addPortletFolder(
080 userId, repositoryId, parentFolderId, folderName, serviceContext);
081 }
082
083 public static Folder addPortletFolder(
084 long groupId, long userId, String portletId, long parentFolderId,
085 String folderName, ServiceContext serviceContext)
086 throws PortalException {
087
088 return getPortletFileRepository().addPortletFolder(
089 groupId, userId, portletId, parentFolderId, folderName,
090 serviceContext);
091 }
092
093 public static Repository addPortletRepository(
094 long groupId, String portletId, ServiceContext serviceContext)
095 throws PortalException {
096
097 return getPortletFileRepository().addPortletRepository(
098 groupId, portletId, serviceContext);
099 }
100
101
104 @Deprecated
105 public static void deleteFolder(long folderId) throws PortalException {
106 getPortletFileRepository().deleteFolder(folderId);
107 }
108
109 public static void deletePortletFileEntries(long groupId, long folderId)
110 throws PortalException {
111
112 getPortletFileRepository().deletePortletFileEntries(groupId, folderId);
113 }
114
115 public static void deletePortletFileEntries(
116 long groupId, long folderId, int status)
117 throws PortalException {
118
119 getPortletFileRepository().deletePortletFileEntries(
120 groupId, folderId, status);
121 }
122
123 public static void deletePortletFileEntry(long fileEntryId)
124 throws PortalException {
125
126 getPortletFileRepository().deletePortletFileEntry(fileEntryId);
127 }
128
129 public static void deletePortletFileEntry(
130 long groupId, long folderId, String fileName)
131 throws PortalException {
132
133 getPortletFileRepository().deletePortletFileEntry(
134 groupId, folderId, fileName);
135 }
136
137 public static void deletePortletFolder(long folderId)
138 throws PortalException {
139
140 getPortletFileRepository().deletePortletFolder(folderId);
141 }
142
143 public static void deletePortletRepository(long groupId, String portletId)
144 throws PortalException {
145
146 getPortletFileRepository().deletePortletRepository(groupId, portletId);
147 }
148
149 public static Repository fetchPortletRepository(
150 long groupId, String portletId) {
151
152 return getPortletFileRepository().fetchPortletRepository(
153 groupId, portletId);
154 }
155
156 public static String getDownloadPortletFileEntryURL(
157 ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString) {
158
159 return getPortletFileRepository().getDownloadPortletFileEntryURL(
160 themeDisplay, fileEntry, queryString);
161 }
162
163 public static String getDownloadPortletFileEntryURL(
164 ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
165 boolean absoluteURL) {
166
167 return getPortletFileRepository().getDownloadPortletFileEntryURL(
168 themeDisplay, fileEntry, queryString, absoluteURL);
169 }
170
171 public static List<FileEntry> getPortletFileEntries(
172 long groupId, long folderId) {
173
174 return getPortletFileRepository().getPortletFileEntries(
175 groupId, folderId);
176 }
177
178 public static List<FileEntry> getPortletFileEntries(
179 long groupId, long folderId, int status) {
180
181 return getPortletFileRepository().getPortletFileEntries(
182 groupId, folderId, status);
183 }
184
185 public static List<FileEntry> getPortletFileEntries(
186 long groupId, long folderId, int status, int start, int end,
187 OrderByComparator<FileEntry> obc) {
188
189 return getPortletFileRepository().getPortletFileEntries(
190 groupId, folderId, status, start, end, obc);
191 }
192
193 public static List<FileEntry> getPortletFileEntries(
194 long groupId, long folderId, OrderByComparator<FileEntry> obc) {
195
196 return getPortletFileRepository().getPortletFileEntries(
197 groupId, folderId, obc);
198 }
199
200 public static int getPortletFileEntriesCount(long groupId, long folderId) {
201 return getPortletFileRepository().getPortletFileEntriesCount(
202 groupId, folderId);
203 }
204
205 public static int getPortletFileEntriesCount(
206 long groupId, long folderId, int status) {
207
208 return getPortletFileRepository().getPortletFileEntriesCount(
209 groupId, folderId, status);
210 }
211
212 public static FileEntry getPortletFileEntry(long fileEntryId)
213 throws PortalException {
214
215 return getPortletFileRepository().getPortletFileEntry(fileEntryId);
216 }
217
218 public static FileEntry getPortletFileEntry(
219 long groupId, long folderId, String fileName)
220 throws PortalException {
221
222 return getPortletFileRepository().getPortletFileEntry(
223 groupId, folderId, fileName);
224 }
225
226 public static FileEntry getPortletFileEntry(String uuid, long groupId)
227 throws PortalException {
228
229 return getPortletFileRepository().getPortletFileEntry(uuid, groupId);
230 }
231
232 public static String getPortletFileEntryURL(
233 ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString) {
234
235 return getPortletFileRepository().getPortletFileEntryURL(
236 themeDisplay, fileEntry, queryString);
237 }
238
239 public static String getPortletFileEntryURL(
240 ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
241 boolean absoluteURL) {
242
243 return getPortletFileRepository().getPortletFileEntryURL(
244 themeDisplay, fileEntry, queryString, absoluteURL);
245 }
246
247 public static PortletFileRepository getPortletFileRepository() {
248 PortalRuntimePermission.checkGetBeanProperty(
249 PortletFileRepositoryUtil.class);
250
251 return _portletFileRepository;
252 }
253
254 public static Folder getPortletFolder(long folderId)
255 throws PortalException {
256
257 return getPortletFileRepository().getPortletFolder(folderId);
258 }
259
260 public static Folder getPortletFolder(
261 long repositoryId, long parentFolderId, String folderName)
262 throws PortalException {
263
264 return getPortletFileRepository().getPortletFolder(
265 repositoryId, parentFolderId, folderName);
266 }
267
268 public static Repository getPortletRepository(
269 long groupId, String portletId)
270 throws PortalException {
271
272 return getPortletFileRepository().getPortletRepository(
273 groupId, portletId);
274 }
275
276 public static FileEntry movePortletFileEntryToTrash(
277 long userId, long fileEntryId)
278 throws PortalException {
279
280 return getPortletFileRepository().movePortletFileEntryToTrash(
281 userId, fileEntryId);
282 }
283
284 public static FileEntry movePortletFileEntryToTrash(
285 long groupId, long userId, long folderId, String fileName)
286 throws PortalException {
287
288 return getPortletFileRepository().movePortletFileEntryToTrash(
289 groupId, userId, folderId, fileName);
290 }
291
292 public static void restorePortletFileEntryFromTrash(
293 long userId, long fileEntryId)
294 throws PortalException {
295
296 getPortletFileRepository().restorePortletFileEntryFromTrash(
297 userId, fileEntryId);
298 }
299
300 public static void restorePortletFileEntryFromTrash(
301 long groupId, long userId, long folderId, String fileName)
302 throws PortalException {
303
304 getPortletFileRepository().restorePortletFileEntryFromTrash(
305 groupId, userId, folderId, fileName);
306 }
307
308 public void setPortletFileRepository(
309 PortletFileRepository portletFileRepository) {
310
311 PortalRuntimePermission.checkSetBeanProperty(getClass());
312
313 _portletFileRepository = portletFileRepository;
314 }
315
316 private static PortletFileRepository _portletFileRepository;
317
318 }