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
200 return getPortletFileRepository().getPortletFileEntryURL(
201 themeDisplay, fileEntry, queryString);
202 }
203
204 public static String getPortletFileEntryURL(
205 ThemeDisplay themeDisplay, FileEntry fileEntry, String queryString,
206 boolean absoluteURL) {
207
208 return getPortletFileRepository().getPortletFileEntryURL(
209 themeDisplay, fileEntry, queryString, absoluteURL);
210 }
211
212 public static PortletFileRepository getPortletFileRepository() {
213 PortalRuntimePermission.checkGetBeanProperty(
214 PortletFileRepositoryUtil.class);
215
216 return _portletFileRepository;
217 }
218
219 public static Folder getPortletFolder(long folderId)
220 throws PortalException, SystemException {
221
222 return getPortletFileRepository().getPortletFolder(folderId);
223 }
224
225 public static Folder getPortletFolder(
226 long userId, long repositoryId, long parentFolderId,
227 String folderName, ServiceContext serviceContext)
228 throws PortalException, SystemException {
229
230 return getPortletFileRepository().getPortletFolder(
231 repositoryId, parentFolderId, folderName);
232 }
233
234 public static Repository getPortletRepository(
235 long groupId, String portletId)
236 throws PortalException, SystemException {
237
238 return getPortletFileRepository().getPortletRepository(
239 groupId, portletId);
240 }
241
242 public static FileEntry movePortletFileEntryToTrash(
243 long userId, long fileEntryId)
244 throws PortalException, SystemException {
245
246 return getPortletFileRepository().movePortletFileEntryToTrash(
247 userId, fileEntryId);
248 }
249
250 public static FileEntry movePortletFileEntryToTrash(
251 long groupId, long userId, long folderId, String fileName)
252 throws PortalException, SystemException {
253
254 return getPortletFileRepository().movePortletFileEntryToTrash(
255 groupId, userId, folderId, fileName);
256 }
257
258 public static void restorePortletFileEntryFromTrash(
259 long userId, long fileEntryId)
260 throws PortalException, SystemException {
261
262 getPortletFileRepository().restorePortletFileEntryFromTrash(
263 userId, fileEntryId);
264 }
265
266 public static void restorePortletFileEntryFromTrash(
267 long groupId, long userId, long folderId, String fileName)
268 throws PortalException, SystemException {
269
270 getPortletFileRepository().restorePortletFileEntryFromTrash(
271 groupId, userId, folderId, fileName);
272 }
273
274 public void setPortletFileRepository(
275 PortletFileRepository portletFileRepository) {
276
277 PortalRuntimePermission.checkSetBeanProperty(getClass());
278
279 _portletFileRepository = portletFileRepository;
280 }
281
282 private static PortletFileRepository _portletFileRepository;
283
284 }