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