001
014
015 package com.liferay.portal.kernel.staging;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.lar.PortletDataContext;
020 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
021 import com.liferay.portal.kernel.workflow.WorkflowTask;
022 import com.liferay.portal.kernel.xml.Element;
023 import com.liferay.portal.model.Group;
024 import com.liferay.portal.model.Layout;
025 import com.liferay.portal.model.LayoutRevision;
026 import com.liferay.portal.model.Portlet;
027 import com.liferay.portal.model.User;
028 import com.liferay.portal.service.ServiceContext;
029
030 import java.util.Date;
031 import java.util.List;
032 import java.util.Map;
033
034 import javax.portlet.PortletRequest;
035
036 import javax.servlet.http.HttpServletRequest;
037
038
041 public class StagingUtil {
042
043 public static String buildRemoteURL(
044 String remoteAddress, int remotePort, String remotePathContext,
045 boolean secureConnection, long remoteGroupId, boolean privateLayout) {
046
047 return getStaging().buildRemoteURL(
048 remoteAddress, remotePort, remotePathContext, secureConnection,
049 remoteGroupId, privateLayout);
050 }
051
052 public static void copyFromLive(PortletRequest PortletRequest)
053 throws Exception {
054
055 getStaging().copyFromLive(PortletRequest);
056 }
057
058 public static void copyFromLive(
059 PortletRequest PortletRequest, Portlet portlet)
060 throws Exception {
061
062 getStaging().copyFromLive(PortletRequest, portlet);
063 }
064
065 public static void copyPortlet(
066 PortletRequest PortletRequest, long sourceGroupId,
067 long targetGroupId, long sourcePlid, long targetPlid,
068 String portletId)
069 throws Exception {
070
071 getStaging().copyPortlet(
072 PortletRequest, sourceGroupId, targetGroupId, sourcePlid,
073 targetPlid, portletId);
074 }
075
076 public static void copyRemoteLayouts(
077 long sourceGroupId, boolean privateLayout,
078 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
079 String remoteAddress, int remotePort, String remotePathContext,
080 boolean secureConnection, long remoteGroupId,
081 boolean remotePrivateLayout, Date startDate, Date endDate)
082 throws Exception {
083
084 getStaging().copyRemoteLayouts(
085 sourceGroupId, privateLayout, layoutIdMap, parameterMap,
086 remoteAddress, remotePort, remotePathContext, secureConnection,
087 remoteGroupId, remotePrivateLayout, startDate, endDate);
088 }
089
090 public static void deleteLastImportSettings(
091 Group liveGroup, boolean privateLayout)
092 throws Exception {
093
094 getStaging().deleteLastImportSettings(liveGroup, privateLayout);
095 }
096
097 public static void deleteRecentLayoutRevisionId(
098 HttpServletRequest request, long layoutSetBranchId, long plid)
099 throws SystemException {
100
101 getStaging().deleteRecentLayoutRevisionId(
102 request, layoutSetBranchId, plid);
103 }
104
105 public static void deleteRecentLayoutRevisionId(
106 User user, long layoutSetBranchId, long plid)
107 throws SystemException {
108
109 getStaging().deleteRecentLayoutRevisionId(
110 user, layoutSetBranchId, plid);
111 }
112
113
116 public static void disableStaging(
117 Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
118 throws Exception {
119
120 getStaging().disableStaging(scopeGroup, liveGroup, serviceContext);
121 }
122
123 public static void disableStaging(
124 Group liveGroup, ServiceContext serviceContext)
125 throws Exception {
126
127 getStaging().disableStaging(liveGroup, serviceContext);
128 }
129
130
134 public static void disableStaging(
135 PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
136 ServiceContext serviceContext)
137 throws Exception {
138
139 getStaging().disableStaging(
140 portletRequest, scopeGroup, liveGroup, serviceContext);
141 }
142
143 public static void disableStaging(
144 PortletRequest portletRequest, Group liveGroup,
145 ServiceContext serviceContext)
146 throws Exception {
147
148 getStaging().disableStaging(portletRequest, liveGroup, serviceContext);
149 }
150
151 public static void enableLocalStaging(
152 long userId, Group scopeGroup, Group liveGroup,
153 boolean branchingPublic, boolean branchingPrivate,
154 ServiceContext serviceContext)
155 throws Exception {
156
157 getStaging().enableLocalStaging(
158 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
159 serviceContext);
160 }
161
162 public static void enableRemoteStaging(
163 long userId, Group scopeGroup, Group liveGroup,
164 boolean branchingPublic, boolean branchingPrivate,
165 String remoteAddress, int remotePort, String remotePathContext,
166 boolean secureConnection, long remoteGroupId,
167 ServiceContext serviceContext)
168 throws Exception {
169
170 getStaging().enableRemoteStaging(
171 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
172 remoteAddress, remotePort, remotePathContext, secureConnection,
173 remoteGroupId, serviceContext);
174 }
175
176 public static Group getLiveGroup(long groupId)
177 throws PortalException, SystemException {
178
179 return getStaging().getLiveGroup(groupId);
180 }
181
182 public static long getLiveGroupId(long groupId)
183 throws PortalException, SystemException {
184
185 return getStaging().getLiveGroupId(groupId);
186 }
187
188 public static List<Layout> getMissingParentLayouts(
189 Layout layout, long liveGroupId)
190 throws Exception {
191
192 return getStaging().getMissingParentLayouts(layout, liveGroupId);
193 }
194
195 public static long getRecentLayoutRevisionId(
196 HttpServletRequest request, long layoutSetBranchId, long plid)
197 throws PortalException, SystemException {
198
199 return getStaging().getRecentLayoutRevisionId(
200 request, layoutSetBranchId, plid);
201 }
202
203 public static long getRecentLayoutRevisionId(
204 User user, long layoutSetBranchId, long plid)
205 throws PortalException, SystemException {
206
207 return getStaging().getRecentLayoutRevisionId(
208 user, layoutSetBranchId, plid);
209 }
210
211 public static long getRecentLayoutSetBranchId(
212 HttpServletRequest request, long layoutSetId) {
213
214 return getStaging().getRecentLayoutSetBranchId(request, layoutSetId);
215 }
216
217 public static long getRecentLayoutSetBranchId(User user, long layoutSetId)
218 throws SystemException {
219
220 return getStaging().getRecentLayoutSetBranchId(user, layoutSetId);
221 }
222
223 public static String getSchedulerGroupName(
224 String destinationName, long groupId) {
225
226 return getStaging().getSchedulerGroupName(destinationName, groupId);
227 }
228
229 public static Staging getStaging() {
230 PortalRuntimePermission.checkGetBeanProperty(StagingUtil.class);
231
232 return _staging;
233 }
234
235 public static Map<String, String[]> getStagingParameters() {
236 return getStaging().getStagingParameters();
237 }
238
239 public static Map<String, String[]> getStagingParameters(
240 PortletRequest PortletRequest) {
241
242 return getStaging().getStagingParameters(PortletRequest);
243 }
244
245 public static WorkflowTask getWorkflowTask(
246 long userId, LayoutRevision layoutRevision)
247 throws PortalException, SystemException {
248
249 return getStaging().getWorkflowTask(userId, layoutRevision);
250 }
251
252 public static boolean hasWorkflowTask(
253 long userId, LayoutRevision layoutRevision)
254 throws PortalException, SystemException {
255
256 return getStaging().hasWorkflowTask(userId, layoutRevision);
257 }
258
259 public static boolean isIncomplete(Layout layout, long layoutSetBranchId) {
260 return getStaging().isIncomplete(layout, layoutSetBranchId);
261 }
262
263 public static void publishLayout(
264 long userId, long plid, long liveGroupId, boolean includeChildren)
265 throws Exception {
266
267 getStaging().publishLayout(userId, plid, liveGroupId, includeChildren);
268 }
269
270 public static void publishLayouts(
271 long userId, long sourceGroupId, long targetGroupId,
272 boolean privateLayout, long[] layoutIds,
273 Map<String, String[]> parameterMap, Date startDate, Date endDate)
274 throws Exception {
275
276 getStaging().publishLayouts(
277 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
278 parameterMap, startDate, endDate);
279 }
280
281 public static void publishLayouts(
282 long userId, long sourceGroupId, long targetGroupId,
283 boolean privateLayout, Map<Long, Boolean> layoutIdMap,
284 Map<String, String[]> parameterMap, Date startDate, Date endDate)
285 throws Exception {
286
287 getStaging().publishLayouts(
288 userId, sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
289 parameterMap, startDate, endDate);
290 }
291
292 public static void publishLayouts(
293 long userId, long sourceGroupId, long targetGroupId,
294 boolean privateLayout, Map<String, String[]> parameterMap,
295 Date startDate, Date endDate)
296 throws Exception {
297
298 getStaging().publishLayouts(
299 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap,
300 startDate, endDate);
301 }
302
303 public static void publishToLive(PortletRequest PortletRequest)
304 throws Exception {
305
306 getStaging().publishToLive(PortletRequest);
307 }
308
309 public static void publishToLive(
310 PortletRequest PortletRequest, Portlet portlet)
311 throws Exception {
312
313 getStaging().publishToLive(PortletRequest, portlet);
314 }
315
316 public static void publishToRemote(PortletRequest PortletRequest)
317 throws Exception {
318
319 getStaging().publishToRemote(PortletRequest);
320 }
321
322 public static void scheduleCopyFromLive(PortletRequest PortletRequest)
323 throws Exception {
324
325 getStaging().scheduleCopyFromLive(PortletRequest);
326 }
327
328 public static void schedulePublishToLive(PortletRequest PortletRequest)
329 throws Exception {
330
331 getStaging().schedulePublishToLive(PortletRequest);
332 }
333
334 public static void schedulePublishToRemote(PortletRequest PortletRequest)
335 throws Exception {
336
337 getStaging().schedulePublishToRemote(PortletRequest);
338 }
339
340 public static void setRecentLayoutBranchId(
341 HttpServletRequest request, long layoutSetBranchId, long plid,
342 long layoutBranchId)
343 throws SystemException {
344
345 getStaging().setRecentLayoutBranchId(
346 request, layoutSetBranchId, plid, layoutBranchId);
347 }
348
349 public static void setRecentLayoutBranchId(
350 User user, long layoutSetBranchId, long plid, long layoutBranchId)
351 throws SystemException {
352
353 getStaging().setRecentLayoutBranchId(
354 user, layoutSetBranchId, plid, layoutBranchId);
355 }
356
357 public static void setRecentLayoutRevisionId(
358 HttpServletRequest request, long layoutSetBranchId, long plid,
359 long layoutRevisionId)
360 throws SystemException {
361
362 getStaging().setRecentLayoutRevisionId(
363 request, layoutSetBranchId, plid, layoutRevisionId);
364 }
365
366 public static void setRecentLayoutRevisionId(
367 User user, long layoutSetBranchId, long plid, long layoutRevisionId)
368 throws SystemException {
369
370 getStaging().setRecentLayoutRevisionId(
371 user, layoutSetBranchId, plid, layoutRevisionId);
372 }
373
374 public static void setRecentLayoutSetBranchId(
375 HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {
376
377 getStaging().setRecentLayoutSetBranchId(
378 request, layoutSetId, layoutSetBranchId);
379 }
380
381 public static void setRecentLayoutSetBranchId(
382 User user, long layoutSetId, long layoutSetBranchId)
383 throws SystemException {
384
385 getStaging().setRecentLayoutSetBranchId(
386 user, layoutSetId, layoutSetBranchId);
387 }
388
389 public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
390 throws Exception {
391
392 getStaging().unscheduleCopyFromLive(PortletRequest);
393 }
394
395 public static void unschedulePublishToLive(PortletRequest PortletRequest)
396 throws Exception {
397
398 getStaging().unschedulePublishToLive(PortletRequest);
399 }
400
401 public static void unschedulePublishToRemote(PortletRequest PortletRequest)
402 throws Exception {
403
404 getStaging().unschedulePublishToRemote(PortletRequest);
405 }
406
407 public static void updateLastImportSettings(
408 Element layoutElement, Layout layout,
409 PortletDataContext portletDataContext)
410 throws Exception {
411
412 getStaging().updateLastImportSettings(
413 layoutElement, layout, portletDataContext);
414 }
415
416 public static void updateStaging(
417 PortletRequest PortletRequest, Group liveGroup)
418 throws Exception {
419
420 getStaging().updateStaging(PortletRequest, liveGroup);
421 }
422
423 public void setStaging(Staging staging) {
424 PortalRuntimePermission.checkSetBeanProperty(getClass());
425
426 _staging = staging;
427 }
428
429 private static Staging _staging;
430
431 }