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