001
014
015 package com.liferay.portlet.assetpublisher.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
020 import com.liferay.portal.model.Group;
021 import com.liferay.portal.model.Layout;
022 import com.liferay.portal.model.User;
023 import com.liferay.portal.security.permission.PermissionChecker;
024 import com.liferay.portal.theme.ThemeDisplay;
025 import com.liferay.portlet.asset.model.AssetEntry;
026 import com.liferay.portlet.asset.model.AssetRendererFactory;
027 import com.liferay.portlet.asset.service.persistence.AssetEntryQuery;
028
029 import java.util.List;
030 import java.util.Locale;
031 import java.util.Map;
032
033 import javax.portlet.PortletPreferences;
034 import javax.portlet.PortletRequest;
035
036
039 public class AssetPublisherUtil {
040
041 public static void addAndStoreSelection(
042 PortletRequest portletRequest, String className, long classPK,
043 int assetEntryOrder)
044 throws Exception {
045
046 getAssetPublisher().addAndStoreSelection(
047 portletRequest, className, classPK, assetEntryOrder);
048 }
049
050 public static void addRecentFolderId(
051 PortletRequest portletRequest, String className, long classPK) {
052
053 getAssetPublisher().addRecentFolderId(
054 portletRequest, className, classPK);
055 }
056
057 public static void addSelection(
058 PortletRequest portletRequest,
059 PortletPreferences portletPreferences, String portletId)
060 throws Exception {
061
062 getAssetPublisher().addSelection(
063 portletRequest, portletPreferences, portletId);
064 }
065
066 public static void addSelection(
067 ThemeDisplay themeDisplay, PortletPreferences portletPreferences,
068 String portletId, long assetEntryId, int assetEntryOrder,
069 String assetEntryType)
070 throws Exception {
071
072 getAssetPublisher().addSelection(
073 themeDisplay, portletPreferences, portletId, assetEntryId,
074 assetEntryOrder, assetEntryType);
075 }
076
077 public static void addUserAttributes(
078 User user, String[] customUserAttributeNames,
079 AssetEntryQuery assetEntryQuery)
080 throws Exception {
081
082 getAssetPublisher().addUserAttributes(
083 user, customUserAttributeNames, assetEntryQuery);
084 }
085
086 public static void checkAssetEntries() throws Exception {
087 getAssetPublisher().checkAssetEntries();
088 }
089
090 public static long[] getAssetCategoryIds(
091 PortletPreferences portletPreferences)
092 throws Exception {
093
094 return getAssetPublisher().getAssetCategoryIds(portletPreferences);
095 }
096
097 public static List<AssetEntry> getAssetEntries(
098 PortletPreferences portletPreferences, Layout layout,
099 long scopeGroupId, int max, boolean checkPermission)
100 throws PortalException, SystemException {
101
102 return getAssetPublisher().getAssetEntries(
103 portletPreferences, layout, scopeGroupId, max, checkPermission);
104 }
105
106 public static List<AssetEntry> getAssetEntries(
107 PortletRequest portletRequest,
108 PortletPreferences portletPreferences,
109 PermissionChecker permissionChecker, long[] groupIds,
110 long[] assetCategoryIds, String[] assetEntryXmls,
111 String[] assetTagNames, boolean deleteMissingAssetEntries,
112 boolean checkPermission)
113 throws Exception {
114
115 return getAssetPublisher().getAssetEntries(
116 portletRequest, portletPreferences, permissionChecker, groupIds,
117 assetCategoryIds, assetEntryXmls, assetTagNames,
118 deleteMissingAssetEntries, checkPermission);
119 }
120
121 public static List<AssetEntry> getAssetEntries(
122 PortletRequest portletRequest,
123 PortletPreferences portletPreferences,
124 PermissionChecker permissionChecker, long[] groupIds,
125 String[] assetEntryXmls, boolean deleteMissingAssetEntries,
126 boolean checkPermission)
127 throws Exception {
128
129 return getAssetPublisher().getAssetEntries(
130 portletRequest, portletPreferences, permissionChecker, groupIds,
131 assetEntryXmls, deleteMissingAssetEntries, checkPermission);
132 }
133
134 public static List<AssetEntry> getAssetEntries(
135 PortletRequest portletRequest,
136 PortletPreferences portletPreferences,
137 PermissionChecker permissionChecker, long[] groupIds,
138 String[] assetEntryXmls, boolean deleteMissingAssetEntries,
139 boolean checkPermission, boolean includeNonVisibleAssets)
140 throws Exception {
141
142 return getAssetPublisher().getAssetEntries(
143 portletRequest, portletPreferences, permissionChecker, groupIds,
144 assetEntryXmls, deleteMissingAssetEntries, checkPermission,
145 includeNonVisibleAssets);
146 }
147
148 public static AssetEntryQuery getAssetEntryQuery(
149 PortletPreferences portletPreferences, long[] scopeGroupIds)
150 throws PortalException, SystemException {
151
152 return getAssetPublisher().getAssetEntryQuery(
153 portletPreferences, scopeGroupIds);
154 }
155
156 public static AssetPublisher getAssetPublisher() {
157 PortalRuntimePermission.checkGetBeanProperty(AssetPublisherUtil.class);
158
159 return _assetPublisher;
160 }
161
162 public static String[] getAssetTagNames(
163 PortletPreferences portletPreferences, long scopeGroupId)
164 throws Exception {
165
166 return getAssetPublisher().getAssetTagNames(
167 portletPreferences, scopeGroupId);
168 }
169
170 public static String getClassName(
171 AssetRendererFactory assetRendererFactory) {
172
173 return getAssetPublisher().getClassName(assetRendererFactory);
174 }
175
176 public static long[] getClassNameIds(
177 PortletPreferences portletPreferences, long[] availableClassNameIds) {
178
179 return getAssetPublisher().getClassNameIds(
180 portletPreferences, availableClassNameIds);
181 }
182
183 public static Long[] getClassTypeIds(
184 PortletPreferences portletPreferences, String className,
185 Long[] availableClassTypeIds) {
186
187 return getAssetPublisher().getClassTypeIds(
188 portletPreferences, className, availableClassTypeIds);
189 }
190
191 public static Map<Locale, String> getEmailAssetEntryAddedBodyMap(
192 PortletPreferences portletPreferences) {
193
194 return getAssetPublisher().getEmailAssetEntryAddedBodyMap(
195 portletPreferences);
196 }
197
198 public static boolean getEmailAssetEntryAddedEnabled(
199 PortletPreferences portletPreferences) {
200
201 return getAssetPublisher().getEmailAssetEntryAddedEnabled(
202 portletPreferences);
203 }
204
205 public static Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
206 PortletPreferences portletPreferences) {
207
208 return getAssetPublisher().getEmailAssetEntryAddedSubjectMap(
209 portletPreferences);
210 }
211
212 public static String getEmailFromAddress(
213 PortletPreferences portletPreferences, long companyId)
214 throws SystemException {
215
216 return getAssetPublisher().getEmailFromAddress(
217 portletPreferences, companyId);
218 }
219
220 public static String getEmailFromName(
221 PortletPreferences portletPreferences, long companyId)
222 throws SystemException {
223
224 return getAssetPublisher().getEmailFromName(
225 portletPreferences, companyId);
226 }
227
228 public static long getGroupIdFromScopeId(
229 String scopeId, long siteGroupId, boolean privateLayout)
230 throws PortalException, SystemException {
231
232 return getAssetPublisher().getGroupIdFromScopeId(
233 scopeId, siteGroupId, privateLayout);
234 }
235
236 public static long[] getGroupIds(
237 PortletPreferences portletPreferences, long scopeGroupId,
238 Layout layout) {
239
240 return getAssetPublisher().getGroupIds(
241 portletPreferences, scopeGroupId, layout);
242 }
243
244 public static long getRecentFolderId(
245 PortletRequest portletRequest, String className) {
246
247 return getAssetPublisher().getRecentFolderId(portletRequest, className);
248 }
249
250 public static String getScopeId(Group group, long scopeGroupId)
251 throws PortalException, SystemException {
252
253 return getAssetPublisher().getScopeId(group, scopeGroupId);
254 }
255
256 public static long getSubscriptionClassPK(long plid, String portletId)
257 throws PortalException, SystemException {
258
259 return getAssetPublisher().getSubscriptionClassPK(plid, portletId);
260 }
261
262 public static long getSubscriptionClassPK(
263 long ownerId, int ownerType, long plid, String portletId)
264 throws PortalException, SystemException {
265
266 return getAssetPublisher().getSubscriptionClassPK(
267 ownerId, ownerType, plid, portletId);
268 }
269
270 public static boolean isScopeIdSelectable(
271 PermissionChecker permissionChecker, String scopeId,
272 long companyGroupId, Layout layout)
273 throws PortalException, SystemException {
274
275 return getAssetPublisher().isScopeIdSelectable(
276 permissionChecker, scopeId, companyGroupId, layout);
277 }
278
279 public static boolean isSubscribed(
280 long companyId, long userId, long plid, String portletId)
281 throws PortalException, SystemException {
282
283 return getAssetPublisher().isSubscribed(
284 companyId, userId, plid, portletId);
285 }
286
287 public static void notifySubscribers(
288 PortletPreferences portletPreferences, long plid, String portletId,
289 List<AssetEntry> assetEntries)
290 throws PortalException, SystemException {
291
292 getAssetPublisher().notifySubscribers(
293 portletPreferences, plid, portletId, assetEntries);
294 }
295
296 public static void processAssetEntryQuery(
297 User user, PortletPreferences portletPreferences,
298 AssetEntryQuery assetEntryQuery)
299 throws Exception {
300
301 getAssetPublisher().processAssetEntryQuery(
302 user, portletPreferences, assetEntryQuery);
303 }
304
305 public static void registerAssetQueryProcessor(
306 String name, AssetEntryQueryProcessor assetQueryProcessor) {
307
308 getAssetPublisher().registerAssetQueryProcessor(
309 name, assetQueryProcessor);
310 }
311
312 public static void removeAndStoreSelection(
313 List<String> assetEntryUuids, PortletPreferences portletPreferences)
314 throws Exception {
315
316 getAssetPublisher().removeAndStoreSelection(
317 assetEntryUuids, portletPreferences);
318 }
319
320 public static void removeRecentFolderId(
321 PortletRequest portletRequest, String className, long classPK) {
322
323 getAssetPublisher().removeRecentFolderId(
324 portletRequest, className, classPK);
325 }
326
327 public static void subscribe(
328 PermissionChecker permissionChecker, long groupId, long plid,
329 String portletId)
330 throws PortalException, SystemException {
331
332 getAssetPublisher().subscribe(
333 permissionChecker, groupId, plid, portletId);
334 }
335
336 public static void unregisterAssetQueryProcessor(
337 String assetQueryProcessorClassName) {
338
339 getAssetPublisher().unregisterAssetQueryProcessor(
340 assetQueryProcessorClassName);
341 }
342
343 public static void unsubscribe(
344 PermissionChecker permissionChecker, long plid, String portletId)
345 throws PortalException, SystemException {
346
347 getAssetPublisher().unsubscribe(permissionChecker, plid, portletId);
348 }
349
350 public void setAssetPublisher(AssetPublisher assetPublisher) {
351 PortalRuntimePermission.checkSetBeanProperty(getClass());
352
353 _assetPublisher = assetPublisher;
354 }
355
356 private static AssetPublisher _assetPublisher;
357
358 }