001
014
015 package com.liferay.portlet.sites.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.LayoutPrototype;
023 import com.liferay.portal.model.LayoutSet;
024 import com.liferay.portal.model.LayoutSetPrototype;
025 import com.liferay.portal.model.User;
026 import com.liferay.portal.security.permission.PermissionChecker;
027 import com.liferay.portal.service.ServiceContext;
028
029 import java.io.File;
030 import java.io.InputStream;
031
032 import java.util.List;
033 import java.util.Map;
034
035 import javax.portlet.ActionRequest;
036 import javax.portlet.ActionResponse;
037 import javax.portlet.PortletPreferences;
038 import javax.portlet.PortletURL;
039 import javax.portlet.RenderRequest;
040 import javax.portlet.RenderResponse;
041
042 import javax.servlet.http.HttpServletRequest;
043 import javax.servlet.http.HttpServletResponse;
044
045
050 public class SitesUtil {
051
052 public static void addMergeFailFriendlyURLLayout(Layout layout)
053 throws PortalException, SystemException {
054
055 getSites().addMergeFailFriendlyURLLayout(layout);
056 }
057
058 public static void addPortletBreadcrumbEntries(
059 Group group, HttpServletRequest request,
060 RenderResponse renderResponse)
061 throws Exception {
062
063 getSites().addPortletBreadcrumbEntries(group, request, renderResponse);
064 }
065
066 public static void addPortletBreadcrumbEntries(
067 Group group, String pagesName, PortletURL redirectURL,
068 HttpServletRequest request, RenderResponse renderResponse)
069 throws Exception {
070
071 getSites().addPortletBreadcrumbEntries(
072 group, pagesName, redirectURL, request, renderResponse);
073 }
074
075 public static void applyLayoutPrototype(
076 LayoutPrototype layoutPrototype, Layout targetLayout,
077 boolean linkEnabled)
078 throws Exception {
079
080 getSites().applyLayoutPrototype(
081 layoutPrototype, targetLayout, linkEnabled);
082 }
083
084 public static void copyLayout(
085 long userId, Layout sourceLayout, Layout targetLayout,
086 ServiceContext serviceContext)
087 throws Exception {
088
089 getSites().copyLayout(
090 userId, sourceLayout, targetLayout, serviceContext);
091 }
092
093 public static void copyLookAndFeel(Layout targetLayout, Layout sourceLayout)
094 throws Exception {
095
096 getSites().copyLookAndFeel(targetLayout, sourceLayout);
097 }
098
099 public static void copyPortletPermissions(
100 Layout targetLayout, Layout sourceLayout)
101 throws Exception {
102
103 getSites().copyPortletPermissions(targetLayout, sourceLayout);
104 }
105
106 public static void copyPortletSetups(
107 Layout sourceLayout, Layout targetLayout)
108 throws Exception {
109
110 getSites().copyPortletSetups(sourceLayout, targetLayout);
111 }
112
113 public static void copyTypeSettings(Group sourceGroup, Group targetGroup)
114 throws Exception {
115
116 getSites().copyTypeSettings(sourceGroup, targetGroup);
117 }
118
119 public static Object[] deleteLayout(
120 ActionRequest actionRequest, ActionResponse actionResponse)
121 throws Exception {
122
123 return getSites().deleteLayout(actionRequest, actionResponse);
124 }
125
126 public static Object[] deleteLayout(
127 HttpServletRequest request, HttpServletResponse response)
128 throws Exception {
129
130 return getSites().deleteLayout(request, response);
131 }
132
133 public static void deleteLayout(
134 RenderRequest renderRequest, RenderResponse renderResponse)
135 throws Exception {
136
137 getSites().deleteLayout(renderRequest, renderResponse);
138 }
139
140 public static File exportLayoutSetPrototype(
141 LayoutSetPrototype layoutSetPrototype,
142 ServiceContext serviceContext)
143 throws PortalException, SystemException {
144
145 return getSites().exportLayoutSetPrototype(
146 layoutSetPrototype, serviceContext);
147 }
148
149 public static Long[] filterGroups(List<Group> groups, String[] names) {
150 return getSites().filterGroups(groups, names);
151 }
152
153 public static Layout getLayoutSetPrototypeLayout(Layout layout) {
154 return getSites().getLayoutSetPrototypeLayout(layout);
155 }
156
157 public static Map<String, String[]> getLayoutSetPrototypeParameters(
158 ServiceContext serviceContext) {
159
160 return getSites().getLayoutSetPrototypeParameters(serviceContext);
161 }
162
163 public static int getMergeFailCount(LayoutPrototype layoutPrototype)
164 throws PortalException, SystemException {
165
166 return getSites().getMergeFailCount(layoutPrototype);
167 }
168
169 public static int getMergeFailCount(LayoutSetPrototype layoutSetPrototype)
170 throws PortalException, SystemException {
171
172 return getSites().getMergeFailCount(layoutSetPrototype);
173 }
174
175 public static List<Layout> getMergeFailFriendlyURLLayouts(
176 LayoutSet layoutSet)
177 throws PortalException, SystemException {
178
179 return getSites().getMergeFailFriendlyURLLayouts(layoutSet);
180 }
181
182 public static Sites getSites() {
183 PortalRuntimePermission.checkGetBeanProperty(SitesUtil.class);
184
185 return _sites;
186 }
187
188 public static void importLayoutSetPrototype(
189 LayoutSetPrototype layoutSetPrototype, InputStream inputStream,
190 ServiceContext serviceContext)
191 throws PortalException, SystemException {
192
193 getSites().importLayoutSetPrototype(
194 layoutSetPrototype, inputStream, serviceContext);
195 }
196
197 public static boolean isContentSharingWithChildrenEnabled(Group group)
198 throws SystemException {
199
200 return getSites().isContentSharingWithChildrenEnabled(group);
201 }
202
203 public static boolean isFirstLayout(
204 long groupId, boolean privateLayout, long layoutId)
205 throws SystemException {
206
207 return getSites().isFirstLayout(groupId, privateLayout, layoutId);
208 }
209
210 public static boolean isLayoutDeleteable(Layout layout) {
211 return getSites().isLayoutDeleteable(layout);
212 }
213
214 public static boolean isLayoutModifiedSinceLastMerge(Layout layout)
215 throws PortalException, SystemException {
216
217 return getSites().isLayoutModifiedSinceLastMerge(layout);
218 }
219
220 public static boolean isLayoutSetMergeable(Group group, LayoutSet layoutSet)
221 throws PortalException, SystemException {
222
223 return getSites().isLayoutSetMergeable(group, layoutSet);
224 }
225
226 public static boolean isLayoutSetPrototypeUpdateable(LayoutSet layoutSet) {
227 return getSites().isLayoutSetPrototypeUpdateable(layoutSet);
228 }
229
230 public static boolean isLayoutSortable(Layout layout) {
231 return getSites().isLayoutSortable(layout);
232 }
233
234 public static boolean isLayoutUpdateable(Layout layout) {
235 return getSites().isLayoutUpdateable(layout);
236 }
237
238 public static boolean isOrganizationUser(
239 long companyId, Group group, User user,
240 List<String> organizationNames)
241 throws Exception {
242
243 return getSites().isOrganizationUser(
244 companyId, group, user, organizationNames);
245 }
246
247 public static boolean isUserGroupLayoutSetViewable(
248 PermissionChecker permissionChecker, Group userGroupGroup)
249 throws PortalException, SystemException {
250
251 return getSites().isUserGroupLayoutSetViewable(
252 permissionChecker, userGroupGroup);
253 }
254
255 public static boolean isUserGroupUser(
256 long companyId, Group group, User user, List<String> userGroupNames)
257 throws Exception {
258
259 return getSites().isUserGroupUser(
260 companyId, group, user, userGroupNames);
261 }
262
263 public static void mergeLayoutPrototypeLayout(Group group, Layout layout)
264 throws Exception {
265
266 getSites().mergeLayoutPrototypeLayout(group, layout);
267 }
268
269
273 public static void mergeLayoutProtypeLayout(Group group, Layout layout)
274 throws Exception {
275
276 getSites().mergeLayoutProtypeLayout(group, layout);
277 }
278
279 public static void mergeLayoutSetPrototypeLayouts(
280 Group group, LayoutSet layoutSet)
281 throws Exception {
282
283 getSites().mergeLayoutSetPrototypeLayouts(group, layoutSet);
284 }
285
286
290 public static void mergeLayoutSetProtypeLayouts(
291 Group group, LayoutSet layoutSet)
292 throws Exception {
293
294 getSites().mergeLayoutSetProtypeLayouts(group, layoutSet);
295 }
296
297 public static void removeMergeFailFriendlyURLLayouts(LayoutSet layoutSet)
298 throws SystemException {
299
300 getSites().removeMergeFailFriendlyURLLayouts(layoutSet);
301 }
302
303 public static void resetPrototype(Layout layout)
304 throws PortalException, SystemException {
305
306 getSites().resetPrototype(layout);
307 }
308
309 public static void resetPrototype(LayoutSet layoutSet)
310 throws PortalException, SystemException {
311
312 getSites().resetPrototype(layoutSet);
313 }
314
315 public static void setMergeFailCount(
316 LayoutPrototype layoutPrototype, int newMergeFailCount)
317 throws PortalException, SystemException {
318
319 getSites().setMergeFailCount(layoutPrototype, newMergeFailCount);
320 }
321
322 public static void setMergeFailCount(
323 LayoutSetPrototype layoutSetPrototype, int newMergeFailCount)
324 throws PortalException, SystemException {
325
326 getSites().setMergeFailCount(layoutSetPrototype, newMergeFailCount);
327 }
328
329 public static void updateLayoutScopes(
330 long userId, Layout sourceLayout, Layout targetLayout,
331 PortletPreferences sourcePreferences,
332 PortletPreferences targetPreferences, String sourcePortletId,
333 String languageId)
334 throws Exception {
335
336 getSites().updateLayoutScopes(
337 userId, sourceLayout, targetLayout, sourcePreferences,
338 targetPreferences, sourcePortletId, languageId);
339 }
340
341 public static void updateLayoutSetPrototypesLinks(
342 Group group, long publicLayoutSetPrototypeId,
343 long privateLayoutSetPrototypeId,
344 boolean publicLayoutSetPrototypeLinkEnabled,
345 boolean privateLayoutSetPrototypeLinkEnabled)
346 throws Exception {
347
348 getSites().updateLayoutSetPrototypesLinks(
349 group, publicLayoutSetPrototypeId, privateLayoutSetPrototypeId,
350 publicLayoutSetPrototypeLinkEnabled,
351 privateLayoutSetPrototypeLinkEnabled);
352 }
353
354 public void setSites(Sites sites) {
355 PortalRuntimePermission.checkSetBeanProperty(getClass());
356
357 _sites = sites;
358 }
359
360 private static Sites _sites;
361
362 }