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