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 preferences, Layout layout, long scopeGroupId,
092 int max, boolean checkPermission)
093 throws PortalException, SystemException {
094
095 return getAssetPublisher().getAssetEntries(
096 preferences, layout, scopeGroupId, max, checkPermission);
097 }
098
099 public static AssetEntryQuery getAssetEntryQuery(
100 PortletPreferences portletPreferences, long[] scopeGroupIds)
101 throws PortalException, SystemException {
102
103 return getAssetPublisher().getAssetEntryQuery(
104 portletPreferences, scopeGroupIds);
105 }
106
107 public static AssetPublisher getAssetPublisher() {
108 PortalRuntimePermission.checkGetBeanProperty(AssetPublisherUtil.class);
109
110 return _assetPublisher;
111 }
112
113 public static String[] getAssetTagNames(
114 PortletPreferences portletPreferences, long scopeGroupId)
115 throws Exception {
116
117 return getAssetPublisher().getAssetTagNames(
118 portletPreferences, scopeGroupId);
119 }
120
121 public static String getClassName(
122 AssetRendererFactory assetRendererFactory) {
123
124 return getAssetPublisher().getClassName(assetRendererFactory);
125 }
126
127 public static long[] getClassNameIds(
128 PortletPreferences portletPreferences, long[] availableClassNameIds) {
129
130 return getAssetPublisher().getClassNameIds(
131 portletPreferences, availableClassNameIds);
132 }
133
134 public static Long[] getClassTypeIds(
135 PortletPreferences portletPreferences, String className,
136 Long[] availableClassTypeIds) {
137
138 return getAssetPublisher().getClassTypeIds(
139 portletPreferences, className, availableClassTypeIds);
140 }
141
142 public static Map<Locale, String> getEmailAssetEntryAddedBodyMap(
143 PortletPreferences preferences) {
144
145 return getAssetPublisher().getEmailAssetEntryAddedBodyMap(preferences);
146 }
147
148 public static boolean getEmailAssetEntryAddedEnabled(
149 PortletPreferences preferences) {
150
151 return getAssetPublisher().getEmailAssetEntryAddedEnabled(preferences);
152 }
153
154 public static Map<Locale, String> getEmailAssetEntryAddedSubjectMap(
155 PortletPreferences preferences) {
156
157 return getAssetPublisher().getEmailAssetEntryAddedSubjectMap(
158 preferences);
159 }
160
161 public static String getEmailFromAddress(
162 PortletPreferences preferences, long companyId)
163 throws SystemException {
164
165 return getAssetPublisher().getEmailFromAddress(preferences, companyId);
166 }
167
168 public static String getEmailFromName(
169 PortletPreferences preferences, long companyId)
170 throws SystemException {
171
172 return getAssetPublisher().getEmailFromName(preferences, companyId);
173 }
174
175 public static long getGroupIdFromScopeId(
176 String scopeId, long siteGroupId, boolean privateLayout)
177 throws PortalException, SystemException {
178
179 return getAssetPublisher().getGroupIdFromScopeId(
180 scopeId, siteGroupId, privateLayout);
181 }
182
183 public static long[] getGroupIds(
184 PortletPreferences portletPreferences, long scopeGroupId,
185 Layout layout) {
186
187 return getAssetPublisher().getGroupIds(
188 portletPreferences, scopeGroupId, layout);
189 }
190
191 public static long getRecentFolderId(
192 PortletRequest portletRequest, String className) {
193
194 return getAssetPublisher().getRecentFolderId(portletRequest, className);
195 }
196
197 public static String getScopeId(Group group, long scopeGroupId)
198 throws PortalException, SystemException {
199
200 return getAssetPublisher().getScopeId(group, scopeGroupId);
201 }
202
203 public static boolean isScopeIdSelectable(
204 PermissionChecker permissionChecker, String scopeId,
205 long companyGroupId, Layout layout)
206 throws PortalException, SystemException {
207
208 return getAssetPublisher().isScopeIdSelectable(
209 permissionChecker, scopeId, companyGroupId, layout);
210 }
211
212 public static boolean isSubscribed(
213 long companyId, long userId, long plid, String portletId)
214 throws PortalException, SystemException {
215
216 return getAssetPublisher().isSubscribed(
217 companyId, userId, plid, portletId);
218 }
219
220 public static void notifySubscribers(
221 PortletPreferences preferences, long plid, String portletId,
222 List<AssetEntry> assetEntries)
223 throws PortalException, SystemException {
224
225 getAssetPublisher().notifySubscribers(
226 preferences, plid, portletId, assetEntries);
227 }
228
229 public static void removeAndStoreSelection(
230 List<String> assetEntryUuids, PortletPreferences portletPreferences)
231 throws Exception {
232
233 getAssetPublisher().removeAndStoreSelection(
234 assetEntryUuids, portletPreferences);
235 }
236
237 public static void removeRecentFolderId(
238 PortletRequest portletRequest, String className, long classPK) {
239
240 getAssetPublisher().removeRecentFolderId(
241 portletRequest, className, classPK);
242 }
243
244 public static void subscribe(
245 PermissionChecker permissionChecker, long groupId, long plid,
246 String portletId)
247 throws PortalException, SystemException {
248
249 getAssetPublisher().subscribe(
250 permissionChecker, groupId, plid, portletId);
251 }
252
253 public static void unsubscribe(
254 PermissionChecker permissionChecker, long plid, String portletId)
255 throws PortalException, SystemException {
256
257 getAssetPublisher().unsubscribe(permissionChecker, plid, portletId);
258 }
259
260 public void setAssetPublisher(AssetPublisher assetPublisher) {
261 PortalRuntimePermission.checkSetBeanProperty(getClass());
262
263 _assetPublisher = assetPublisher;
264 }
265
266 private static AssetPublisher _assetPublisher;
267
268 }