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 AssetEntryQuery getAssetEntryQuery(
135 PortletPreferences portletPreferences, long[] scopeGroupIds)
136 throws PortalException, SystemException {
137
138 return getAssetPublisher().getAssetEntryQuery(
139 portletPreferences, scopeGroupIds);
140 }
141
142 public static AssetPublisher getAssetPublisher() {
143 PortalRuntimePermission.checkGetBeanProperty(AssetPublisherUtil.class);
144
145 return _assetPublisher;
146 }
147
148 public static String[] getAssetTagNames(
149 PortletPreferences portletPreferences, long scopeGroupId)
150 throws Exception {
151
152 return getAssetPublisher().getAssetTagNames(
153 portletPreferences, scopeGroupId);
154 }
155
156 public static String getClassName(
157 AssetRendererFactory assetRendererFactory) {
158
159 return getAssetPublisher().getClassName(assetRendererFactory);
160 }
161
162 public static long[] getClassNameIds(
163 PortletPreferences portletPreferences, long[] availableClassNameIds) {
164
165 return getAssetPublisher().getClassNameIds(
166 portletPreferences, availableClassNameIds);
167 }
168
169 public static Long[] getClassTypeIds(
170 PortletPreferences portletPreferences, String className,
171 Long[] availableClassTypeIds) {
172
173 return getAssetPublisher().getClassTypeIds(
174 portletPreferences, className, availableClassTypeIds);
175 }
176
177 public static Map<Locale, String> getEmailAssetEntryAddedBodyMap(
178 PortletPreferences portletPreferences) {
179
180 return getAssetPublisher().getEmailAssetEntryAddedBodyMap(
181 portletPreferences);
182 }
183
184 public static boolean getEmailAssetEntryAddedEnabled(
185 PortletPreferences portletPreferences) {
186
187 return getAssetPublisher().getEmailAssetEntryAddedEnabled(
188 portletPreferences);
189 }
190
191 public static Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
192 PortletPreferences portletPreferences) {
193
194 return getAssetPublisher().getEmailAssetEntryAddedSubjectMap(
195 portletPreferences);
196 }
197
198 public static String getEmailFromAddress(
199 PortletPreferences portletPreferences, long companyId)
200 throws SystemException {
201
202 return getAssetPublisher().getEmailFromAddress(
203 portletPreferences, companyId);
204 }
205
206 public static String getEmailFromName(
207 PortletPreferences portletPreferences, long companyId)
208 throws SystemException {
209
210 return getAssetPublisher().getEmailFromName(
211 portletPreferences, companyId);
212 }
213
214 public static long getGroupIdFromScopeId(
215 String scopeId, long siteGroupId, boolean privateLayout)
216 throws PortalException, SystemException {
217
218 return getAssetPublisher().getGroupIdFromScopeId(
219 scopeId, siteGroupId, privateLayout);
220 }
221
222 public static long[] getGroupIds(
223 PortletPreferences portletPreferences, long scopeGroupId,
224 Layout layout) {
225
226 return getAssetPublisher().getGroupIds(
227 portletPreferences, scopeGroupId, layout);
228 }
229
230 public static long getRecentFolderId(
231 PortletRequest portletRequest, String className) {
232
233 return getAssetPublisher().getRecentFolderId(portletRequest, className);
234 }
235
236 public static String getScopeId(Group group, long scopeGroupId)
237 throws PortalException, SystemException {
238
239 return getAssetPublisher().getScopeId(group, scopeGroupId);
240 }
241
242 public static long getSubscriptionClassPK(long plid, String portletId)
243 throws PortalException, SystemException {
244
245 return getAssetPublisher().getSubscriptionClassPK(plid, portletId);
246 }
247
248 public static boolean isScopeIdSelectable(
249 PermissionChecker permissionChecker, String scopeId,
250 long companyGroupId, Layout layout)
251 throws PortalException, SystemException {
252
253 return getAssetPublisher().isScopeIdSelectable(
254 permissionChecker, scopeId, companyGroupId, layout);
255 }
256
257 public static boolean isSubscribed(
258 long companyId, long userId, long plid, String portletId)
259 throws PortalException, SystemException {
260
261 return getAssetPublisher().isSubscribed(
262 companyId, userId, plid, portletId);
263 }
264
265 public static void notifySubscribers(
266 PortletPreferences portletPreferences, long plid, String portletId,
267 List<AssetEntry> assetEntries)
268 throws PortalException, SystemException {
269
270 getAssetPublisher().notifySubscribers(
271 portletPreferences, plid, portletId, assetEntries);
272 }
273
274 public static void processAssetEntryQuery(
275 User user, PortletPreferences portletPreferences,
276 AssetEntryQuery assetEntryQuery)
277 throws Exception {
278
279 getAssetPublisher().processAssetEntryQuery(
280 user, portletPreferences, assetEntryQuery);
281 }
282
283 public static void registerAssetQueryProcessor(
284 String name, AssetEntryQueryProcessor assetQueryProcessor) {
285
286 getAssetPublisher().registerAssetQueryProcessor(
287 name, assetQueryProcessor);
288 }
289
290 public static void removeAndStoreSelection(
291 List<String> assetEntryUuids, PortletPreferences portletPreferences)
292 throws Exception {
293
294 getAssetPublisher().removeAndStoreSelection(
295 assetEntryUuids, portletPreferences);
296 }
297
298 public static void removeRecentFolderId(
299 PortletRequest portletRequest, String className, long classPK) {
300
301 getAssetPublisher().removeRecentFolderId(
302 portletRequest, className, classPK);
303 }
304
305 public static void subscribe(
306 PermissionChecker permissionChecker, long groupId, long plid,
307 String portletId)
308 throws PortalException, SystemException {
309
310 getAssetPublisher().subscribe(
311 permissionChecker, groupId, plid, portletId);
312 }
313
314 public static void unregisterAssetQueryProcessor(
315 String assetQueryProcessorClassName) {
316
317 getAssetPublisher().unregisterAssetQueryProcessor(
318 assetQueryProcessorClassName);
319 }
320
321 public static void unsubscribe(
322 PermissionChecker permissionChecker, long plid, String portletId)
323 throws PortalException, SystemException {
324
325 getAssetPublisher().unsubscribe(permissionChecker, plid, portletId);
326 }
327
328 public void setAssetPublisher(AssetPublisher assetPublisher) {
329 PortalRuntimePermission.checkSetBeanProperty(getClass());
330
331 _assetPublisher = assetPublisher;
332 }
333
334 private static AssetPublisher _assetPublisher;
335
336 }