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.security.pacl.permission.PortalRuntimePermission;
021 import com.liferay.portal.kernel.util.ObjectValuePair;
022 import com.liferay.portal.kernel.util.OrderByComparator;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
025 import com.liferay.portlet.documentlibrary.model.DLFolder;
026
027 import java.io.File;
028 import java.io.InputStream;
029
030 import java.util.List;
031
032
035 public class PortletFileRepositoryUtil {
036
037 public static void addPortletFileEntries(
038 long groupId, long userId, String portletId, long folderId,
039 List<ObjectValuePair<String, InputStream>> inputStreamOVPs)
040 throws PortalException, SystemException {
041
042 getPortletFileRepository().addPortletFileEntries(
043 groupId, userId, portletId, folderId, inputStreamOVPs);
044 }
045
046 public static FileEntry addPortletFileEntry(
047 long groupId, long userId, String portletId, long folderId,
048 File file, String fileName)
049 throws PortalException, SystemException {
050
051 return getPortletFileRepository().addPortletFileEntry(
052 groupId, userId, portletId, folderId, file, fileName);
053 }
054
055 public static FileEntry addPortletFileEntry(
056 long groupId, long userId, String portletId, long folderId,
057 InputStream inputStream, String fileName)
058 throws PortalException, SystemException {
059
060 return getPortletFileRepository().addPortletFileEntry(
061 groupId, userId, portletId, folderId, inputStream, fileName);
062 }
063
064 public static void deleteFolder(long folderId)
065 throws PortalException, SystemException {
066
067 getPortletFileRepository().deleteFolder(folderId);
068 }
069
070 public static void deletePortletFileEntries(long groupId, long folderId)
071 throws PortalException, SystemException {
072
073 getPortletFileRepository().deletePortletFileEntries(groupId, folderId);
074 }
075
076 public static void deletePortletFileEntries(
077 long groupId, long folderId, int status)
078 throws PortalException, SystemException {
079
080 getPortletFileRepository().deletePortletFileEntries(
081 groupId, folderId, status);
082 }
083
084 public static void deletePortletFileEntry(long fileEntryId)
085 throws PortalException, SystemException {
086
087 getPortletFileRepository().deletePortletFileEntry(fileEntryId);
088 }
089
090 public static void deletePortletFileEntry(
091 long groupId, long folderId, String fileName)
092 throws PortalException, SystemException {
093
094 getPortletFileRepository().deletePortletFileEntry(
095 groupId, folderId, fileName);
096 }
097
098 public static List<DLFileEntry> getPortletFileEntries(
099 long groupId, long folderId)
100 throws SystemException {
101
102 return getPortletFileRepository().getPortletFileEntries(
103 groupId, folderId);
104 }
105
106 public static List<DLFileEntry> getPortletFileEntries(
107 long groupId, long folderId, int status)
108 throws SystemException {
109
110 return getPortletFileRepository().getPortletFileEntries(
111 groupId, folderId, status);
112 }
113
114 public static List<DLFileEntry> getPortletFileEntries(
115 long groupId, long folderId, int status, int start, int end,
116 OrderByComparator obc)
117 throws SystemException {
118
119 return getPortletFileRepository().getPortletFileEntries(
120 groupId, folderId, status, start, end, obc);
121 }
122
123 public static int getPortletFileEntriesCount(long groupId, long folderId)
124 throws SystemException {
125
126 return getPortletFileRepository().getPortletFileEntriesCount(
127 groupId, folderId);
128 }
129
130 public static int getPortletFileEntriesCount(
131 long groupId, long folderId, int status)
132 throws SystemException {
133
134 return getPortletFileRepository().getPortletFileEntriesCount(
135 groupId, folderId, status);
136 }
137
138 public static DLFileEntry getPortletFileEntry(long fileEntryId)
139 throws PortalException, SystemException {
140
141 return getPortletFileRepository().getPortletFileEntry(fileEntryId);
142 }
143
144 public static DLFileEntry getPortletFileEntry(
145 long groupId, long folderId, String fileName)
146 throws PortalException, SystemException {
147
148 return getPortletFileRepository().getPortletFileEntry(
149 groupId, folderId, fileName);
150 }
151
152 public static PortletFileRepository getPortletFileRepository() {
153 PortalRuntimePermission.checkGetBeanProperty(
154 PortletFileRepositoryUtil.class);
155
156 return _portletFileRepository;
157 }
158
159 public static DLFolder getPortletFolder(long folderId)
160 throws PortalException, SystemException {
161
162 return getPortletFileRepository().getPortletFolder(folderId);
163 }
164
165 public static DLFolder getPortletFolder(
166 long userId, long repositoryId, long parentFolderId,
167 String folderName, ServiceContext serviceContext)
168 throws PortalException, SystemException {
169
170 return getPortletFileRepository().getPortletFolder(
171 userId, repositoryId, parentFolderId, folderName, serviceContext);
172 }
173
174 public static long getPortletRepository(
175 long groupId, String portletId, ServiceContext serviceContext)
176 throws PortalException, SystemException {
177
178 return getPortletFileRepository().getPortletRepository(
179 groupId, portletId, serviceContext);
180 }
181
182 public static void movePortletFileEntryToTrash(
183 long userId, long fileEntryId)
184 throws PortalException, SystemException {
185
186 getPortletFileRepository().movePortletFileEntryToTrash(
187 userId, fileEntryId);
188 }
189
190 public static void movePortletFileEntryToTrash(
191 long groupId, long userId, long folderId, String fileName)
192 throws PortalException, SystemException {
193
194 getPortletFileRepository().movePortletFileEntryToTrash(
195 groupId, userId, folderId, fileName);
196 }
197
198 public static void restorePortletFileEntryFromTrash(
199 long userId, long fileEntryId)
200 throws PortalException, SystemException {
201
202 getPortletFileRepository().restorePortletFileEntryFromTrash(
203 userId, fileEntryId);
204 }
205
206 public static void restorePortletFileEntryFromTrash(
207 long groupId, long userId, long folderId, String fileName)
208 throws PortalException, SystemException {
209
210 getPortletFileRepository().restorePortletFileEntryFromTrash(
211 groupId, userId, folderId, fileName);
212 }
213
214 public void setPortletFileRepository(
215 PortletFileRepository portletFileRepository) {
216
217 PortalRuntimePermission.checkSetBeanProperty(getClass());
218
219 _portletFileRepository = portletFileRepository;
220 }
221
222 private static PortletFileRepository _portletFileRepository;
223
224 }