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