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