001
014
015 package com.liferay.portlet.assetpublisher.util;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.exception.PortalException;
020 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
021 import com.liferay.portal.model.Group;
022 import com.liferay.portal.model.Layout;
023 import com.liferay.portal.model.User;
024 import com.liferay.portal.security.permission.PermissionChecker;
025 import com.liferay.portal.theme.ThemeDisplay;
026 import com.liferay.portlet.asset.model.AssetEntry;
027 import com.liferay.portlet.asset.model.AssetRendererFactory;
028 import com.liferay.portlet.asset.model.ClassType;
029 import com.liferay.portlet.asset.service.persistence.AssetEntryQuery;
030
031 import java.util.List;
032 import java.util.Locale;
033 import java.util.Map;
034
035 import javax.portlet.PortletPreferences;
036 import javax.portlet.PortletRequest;
037
038
041 @ProviderType
042 public class AssetPublisherUtil {
043
044 public static void addAndStoreSelection(
045 PortletRequest portletRequest, String className, long classPK,
046 int assetEntryOrder)
047 throws Exception {
048
049 getAssetPublisher().addAndStoreSelection(
050 portletRequest, className, classPK, assetEntryOrder);
051 }
052
053 public static void addRecentFolderId(
054 PortletRequest portletRequest, String className, long classPK) {
055
056 getAssetPublisher().addRecentFolderId(
057 portletRequest, className, classPK);
058 }
059
060 public static void addSelection(
061 PortletRequest portletRequest,
062 PortletPreferences portletPreferences, String portletId)
063 throws Exception {
064
065 getAssetPublisher().addSelection(
066 portletRequest, portletPreferences, portletId);
067 }
068
069 public static void addSelection(
070 ThemeDisplay themeDisplay, PortletPreferences portletPreferences,
071 String portletId, long assetEntryId, int assetEntryOrder,
072 String assetEntryType)
073 throws Exception {
074
075 getAssetPublisher().addSelection(
076 themeDisplay, portletPreferences, portletId, assetEntryId,
077 assetEntryOrder, assetEntryType);
078 }
079
080 public static void addUserAttributes(
081 User user, String[] customUserAttributeNames,
082 AssetEntryQuery assetEntryQuery)
083 throws Exception {
084
085 getAssetPublisher().addUserAttributes(
086 user, customUserAttributeNames, assetEntryQuery);
087 }
088
089 public static void checkAssetEntries() throws Exception {
090 getAssetPublisher().checkAssetEntries();
091 }
092
093 public static long[] getAssetCategoryIds(
094 PortletPreferences portletPreferences)
095 throws Exception {
096
097 return getAssetPublisher().getAssetCategoryIds(portletPreferences);
098 }
099
100 public static List<AssetEntry> getAssetEntries(
101 long[] groupIds, long[] classNameIds, String keywords, String userName,
102 String title, String description, boolean advancedSearch,
103 boolean andOperator, int start, int end, String orderByCol1,
104 String orderByCol2, String orderByType1, String orderByType2) {
105
106 return getAssetPublisher().getAssetEntries(
107 groupIds, classNameIds, keywords, userName, title, description,
108 advancedSearch, andOperator, start, end, orderByCol1, orderByCol2,
109 orderByType1, orderByType2);
110 }
111
112 public static List<AssetEntry> getAssetEntries(
113 PortletPreferences portletPreferences, Layout layout,
114 long scopeGroupId, int max, boolean checkPermission)
115 throws PortalException {
116
117 return getAssetPublisher().getAssetEntries(
118 portletPreferences, layout, scopeGroupId, max, checkPermission);
119 }
120
121 public static List<AssetEntry> getAssetEntries(
122 PortletRequest portletRequest,
123 PortletPreferences portletPreferences,
124 PermissionChecker permissionChecker, long[] groupIds,
125 boolean deleteMissingAssetEntries, boolean checkPermission)
126 throws Exception {
127
128 return getAssetPublisher().getAssetEntries(
129 portletRequest, portletPreferences, permissionChecker, groupIds,
130 deleteMissingAssetEntries, checkPermission);
131 }
132
133 public static List<AssetEntry> getAssetEntries(
134 PortletRequest portletRequest,
135 PortletPreferences portletPreferences,
136 PermissionChecker permissionChecker, long[] groupIds,
137 long[] allCategoryIds, String[] allTagNames,
138 boolean deleteMissingAssetEntries, boolean checkPermission)
139 throws Exception {
140
141 return getAssetPublisher().getAssetEntries(
142 portletRequest, portletPreferences, permissionChecker, groupIds,
143 allCategoryIds, allTagNames, deleteMissingAssetEntries,
144 checkPermission);
145 }
146
147
153 @Deprecated
154 public static List<AssetEntry> getAssetEntries(
155 PortletRequest portletRequest,
156 PortletPreferences portletPreferences,
157 PermissionChecker permissionChecker, long[] groupIds,
158 long[] assetCategoryIds, String[] assetEntryXmls,
159 String[] assetTagNames, boolean deleteMissingAssetEntries,
160 boolean checkPermission)
161 throws Exception {
162
163 return getAssetPublisher().getAssetEntries(
164 portletRequest, portletPreferences, permissionChecker, groupIds,
165 assetCategoryIds, assetEntryXmls, assetTagNames,
166 deleteMissingAssetEntries, checkPermission);
167 }
168
169
175 @Deprecated
176 public static List<AssetEntry> getAssetEntries(
177 PortletRequest portletRequest,
178 PortletPreferences portletPreferences,
179 PermissionChecker permissionChecker, long[] groupIds,
180 String[] assetEntryXmls, boolean deleteMissingAssetEntries,
181 boolean checkPermission)
182 throws Exception {
183
184 return getAssetPublisher().getAssetEntries(
185 portletRequest, portletPreferences, permissionChecker, groupIds,
186 assetEntryXmls, deleteMissingAssetEntries, checkPermission);
187 }
188
189 public static int getAssetEntriesCount(
190 long[] groupIds, long[] classNameIds, String keywords, String userName,
191 String title, String description, boolean advancedSearch,
192 boolean andOperator, int start, int end) {
193
194 return getAssetPublisher().getAssetEntriesCount(
195 groupIds, classNameIds, keywords, userName, title, description,
196 advancedSearch, andOperator, start, end);
197 }
198
199
204 @Deprecated
205 public static AssetEntryQuery getAssetEntryQuery(
206 PortletPreferences portletPreferences, long[] siteGroupIds)
207 throws PortalException {
208
209 return getAssetPublisher().getAssetEntryQuery(
210 portletPreferences, siteGroupIds);
211 }
212
213 public static AssetEntryQuery getAssetEntryQuery(
214 PortletPreferences portletPreferences, long[] scopeGroupIds,
215 long[] overrideAllAssetCategoryIds,
216 String[] overrideAllAssetTagNames)
217 throws PortalException {
218
219 return getAssetPublisher().getAssetEntryQuery(
220 portletPreferences, scopeGroupIds, overrideAllAssetCategoryIds,
221 overrideAllAssetTagNames);
222 }
223
224 public static AssetPublisher getAssetPublisher() {
225 PortalRuntimePermission.checkGetBeanProperty(AssetPublisherUtil.class);
226
227 return _assetPublisher;
228 }
229
230 public static String[] getAssetTagNames(
231 PortletPreferences portletPreferences)
232 throws Exception {
233
234 return getAssetPublisher().getAssetTagNames(portletPreferences);
235 }
236
237
241 @Deprecated
242 public static String[] getAssetTagNames(
243 PortletPreferences portletPreferences, long scopeGroupId)
244 throws Exception {
245
246 return getAssetPublisher().getAssetTagNames(
247 portletPreferences, scopeGroupId);
248 }
249
250 public static String getClassName(
251 AssetRendererFactory assetRendererFactory) {
252
253 return getAssetPublisher().getClassName(assetRendererFactory);
254 }
255
256 public static long[] getClassNameIds(
257 PortletPreferences portletPreferences, long[] availableClassNameIds) {
258
259 return getAssetPublisher().getClassNameIds(
260 portletPreferences, availableClassNameIds);
261 }
262
263 public static Long[] getClassTypeIds(
264 PortletPreferences portletPreferences, String className,
265 List<ClassType> availableClassTypes) {
266
267 return getAssetPublisher().getClassTypeIds(
268 portletPreferences, className, availableClassTypes);
269 }
270
271 public static Long[] getClassTypeIds(
272 PortletPreferences portletPreferences, String className,
273 Long[] availableClassTypeIds) {
274
275 return getAssetPublisher().getClassTypeIds(
276 portletPreferences, className, availableClassTypeIds);
277 }
278
279 public static Map<Locale, String> getEmailAssetEntryAddedBodyMap(
280 PortletPreferences portletPreferences) {
281
282 return getAssetPublisher().getEmailAssetEntryAddedBodyMap(
283 portletPreferences);
284 }
285
286 public static boolean getEmailAssetEntryAddedEnabled(
287 PortletPreferences portletPreferences) {
288
289 return getAssetPublisher().getEmailAssetEntryAddedEnabled(
290 portletPreferences);
291 }
292
293 public static Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
294 PortletPreferences portletPreferences) {
295
296 return getAssetPublisher().getEmailAssetEntryAddedSubjectMap(
297 portletPreferences);
298 }
299
300 public static Map<String, String> getEmailDefinitionTerms(
301 PortletRequest portletRequest, String emailFromAddress,
302 String emailFromName) {
303
304 return getAssetPublisher().getEmailDefinitionTerms(
305 portletRequest, emailFromAddress, emailFromName);
306 }
307
308 public static String getEmailFromAddress(
309 PortletPreferences portletPreferences, long companyId) {
310
311 return getAssetPublisher().getEmailFromAddress(
312 portletPreferences, companyId);
313 }
314
315 public static String getEmailFromName(
316 PortletPreferences portletPreferences, long companyId) {
317
318 return getAssetPublisher().getEmailFromName(
319 portletPreferences, companyId);
320 }
321
322 public static long getGroupIdFromScopeId(
323 String scopeId, long siteGroupId, boolean privateLayout)
324 throws PortalException {
325
326 return getAssetPublisher().getGroupIdFromScopeId(
327 scopeId, siteGroupId, privateLayout);
328 }
329
330 public static long[] getGroupIds(
331 PortletPreferences portletPreferences, long scopeGroupId,
332 Layout layout) {
333
334 return getAssetPublisher().getGroupIds(
335 portletPreferences, scopeGroupId, layout);
336 }
337
338 public static long getRecentFolderId(
339 PortletRequest portletRequest, String className) {
340
341 return getAssetPublisher().getRecentFolderId(portletRequest, className);
342 }
343
344 public static String getScopeId(Group group, long scopeGroupId)
345 throws PortalException {
346
347 return getAssetPublisher().getScopeId(group, scopeGroupId);
348 }
349
350 public static long getSubscriptionClassPK(long plid, String portletId)
351 throws PortalException {
352
353 return getAssetPublisher().getSubscriptionClassPK(plid, portletId);
354 }
355
356 public static boolean isScopeIdSelectable(
357 PermissionChecker permissionChecker, String scopeId,
358 long companyGroupId, Layout layout)
359 throws PortalException {
360
361 return getAssetPublisher().isScopeIdSelectable(
362 permissionChecker, scopeId, companyGroupId, layout);
363 }
364
365 public static boolean isSubscribed(
366 long companyId, long userId, long plid, String portletId)
367 throws PortalException {
368
369 return getAssetPublisher().isSubscribed(
370 companyId, userId, plid, portletId);
371 }
372
373 public static void notifySubscribers(
374 PortletPreferences portletPreferences, long plid, String portletId,
375 List<AssetEntry> assetEntries)
376 throws PortalException {
377
378 getAssetPublisher().notifySubscribers(
379 portletPreferences, plid, portletId, assetEntries);
380 }
381
382 public static void processAssetEntryQuery(
383 User user, PortletPreferences portletPreferences,
384 AssetEntryQuery assetEntryQuery)
385 throws Exception {
386
387 getAssetPublisher().processAssetEntryQuery(
388 user, portletPreferences, assetEntryQuery);
389 }
390
391 public static void registerAssetQueryProcessor(
392 String name, AssetEntryQueryProcessor assetQueryProcessor) {
393
394 getAssetPublisher().registerAssetQueryProcessor(
395 name, assetQueryProcessor);
396 }
397
398 public static void removeAndStoreSelection(
399 List<String> assetEntryUuids, PortletPreferences portletPreferences)
400 throws Exception {
401
402 getAssetPublisher().removeAndStoreSelection(
403 assetEntryUuids, portletPreferences);
404 }
405
406 public static void removeRecentFolderId(
407 PortletRequest portletRequest, String className, long classPK) {
408
409 getAssetPublisher().removeRecentFolderId(
410 portletRequest, className, classPK);
411 }
412
413 public static void subscribe(
414 PermissionChecker permissionChecker, long groupId, long plid,
415 String portletId)
416 throws PortalException {
417
418 getAssetPublisher().subscribe(
419 permissionChecker, groupId, plid, portletId);
420 }
421
422 public static void unregisterAssetQueryProcessor(
423 String assetQueryProcessorClassName) {
424
425 getAssetPublisher().unregisterAssetQueryProcessor(
426 assetQueryProcessorClassName);
427 }
428
429 public static void unsubscribe(
430 PermissionChecker permissionChecker, long plid, String portletId)
431 throws PortalException {
432
433 getAssetPublisher().unsubscribe(permissionChecker, plid, portletId);
434 }
435
436 public void setAssetPublisher(AssetPublisher assetPublisher) {
437 PortalRuntimePermission.checkSetBeanProperty(getClass());
438
439 _assetPublisher = assetPublisher;
440 }
441
442 private static AssetPublisher _assetPublisher;
443
444 }