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.json.JSONArray;
020 import com.liferay.portal.kernel.json.JSONObject;
021 import com.liferay.portal.kernel.lar.MissingReference;
022 import com.liferay.portal.kernel.lar.PortletDataContext;
023 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
024 import com.liferay.portal.kernel.util.DateRange;
025 import com.liferay.portal.kernel.util.UnicodeProperties;
026 import com.liferay.portal.kernel.workflow.WorkflowTask;
027 import com.liferay.portal.kernel.xml.Element;
028 import com.liferay.portal.model.Group;
029 import com.liferay.portal.model.Layout;
030 import com.liferay.portal.model.LayoutRevision;
031 import com.liferay.portal.model.LayoutSet;
032 import com.liferay.portal.model.Portlet;
033 import com.liferay.portal.model.User;
034 import com.liferay.portal.service.ServiceContext;
035
036 import java.io.Serializable;
037
038 import java.util.Date;
039 import java.util.List;
040 import java.util.Locale;
041 import java.util.Map;
042
043 import javax.portlet.PortletPreferences;
044 import javax.portlet.PortletRequest;
045
046 import javax.servlet.http.HttpServletRequest;
047
048
051 public class StagingUtil {
052
053 public static String buildRemoteURL(
054 String remoteAddress, int remotePort, String remotePathContext,
055 boolean secureConnection, long remoteGroupId, boolean privateLayout) {
056
057 return getStaging().buildRemoteURL(
058 remoteAddress, remotePort, remotePathContext, secureConnection,
059 remoteGroupId, privateLayout);
060 }
061
062 public static String buildRemoteURL(
063 UnicodeProperties typeSettingsProperties) {
064
065 return getStaging().buildRemoteURL(typeSettingsProperties);
066 }
067
068
074 @Deprecated
075 public static void checkDefaultLayoutSetBranches(
076 long userId, Group liveGroup, boolean branchingPublic,
077 boolean branchingPrivate, boolean remote,
078 ServiceContext serviceContext)
079 throws PortalException, SystemException {
080
081 getStaging().checkDefaultLayoutSetBranches(
082 userId, liveGroup, branchingPublic, branchingPrivate, remote,
083 serviceContext);
084 }
085
086 public static void copyFromLive(PortletRequest PortletRequest)
087 throws Exception {
088
089 getStaging().copyFromLive(PortletRequest);
090 }
091
092 public static void copyFromLive(
093 PortletRequest PortletRequest, Portlet portlet)
094 throws Exception {
095
096 getStaging().copyFromLive(PortletRequest, portlet);
097 }
098
099 public static void copyPortlet(
100 PortletRequest PortletRequest, long sourceGroupId,
101 long targetGroupId, long sourcePlid, long targetPlid,
102 String portletId)
103 throws Exception {
104
105 getStaging().copyPortlet(
106 PortletRequest, sourceGroupId, targetGroupId, sourcePlid,
107 targetPlid, portletId);
108 }
109
110 public static void copyRemoteLayouts(
111 long sourceGroupId, boolean privateLayout,
112 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
113 String remoteAddress, int remotePort, String remotePathContext,
114 boolean secureConnection, long remoteGroupId,
115 boolean remotePrivateLayout, Date startDate, Date endDate)
116 throws Exception {
117
118 getStaging().copyRemoteLayouts(
119 sourceGroupId, privateLayout, layoutIdMap, parameterMap,
120 remoteAddress, remotePort, remotePathContext, secureConnection,
121 remoteGroupId, remotePrivateLayout, startDate, endDate);
122 }
123
124 public static void deleteLastImportSettings(
125 Group liveGroup, boolean privateLayout)
126 throws PortalException, SystemException {
127
128 getStaging().deleteLastImportSettings(liveGroup, privateLayout);
129 }
130
131 public static void deleteRecentLayoutRevisionId(
132 HttpServletRequest request, long layoutSetBranchId, long plid)
133 throws SystemException {
134
135 getStaging().deleteRecentLayoutRevisionId(
136 request, layoutSetBranchId, plid);
137 }
138
139 public static void deleteRecentLayoutRevisionId(
140 long userId, long layoutSetBranchId, long plid)
141 throws PortalException, SystemException {
142
143 getStaging().deleteRecentLayoutRevisionId(
144 userId, layoutSetBranchId, plid);
145 }
146
147
151 @Deprecated
152 public static void deleteRecentLayoutRevisionId(
153 User user, long layoutSetBranchId, long plid)
154 throws SystemException {
155
156 getStaging().deleteRecentLayoutRevisionId(
157 user, layoutSetBranchId, plid);
158 }
159
160
165 public static void disableStaging(
166 Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
167 throws Exception {
168
169 getStaging().disableStaging(scopeGroup, liveGroup, serviceContext);
170 }
171
172
177 public static void disableStaging(
178 Group liveGroup, ServiceContext serviceContext)
179 throws Exception {
180
181 getStaging().disableStaging(liveGroup, serviceContext);
182 }
183
184
189 public static void disableStaging(
190 PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
191 ServiceContext serviceContext)
192 throws Exception {
193
194 getStaging().disableStaging(
195 portletRequest, scopeGroup, liveGroup, serviceContext);
196 }
197
198
203 public static void disableStaging(
204 PortletRequest portletRequest, Group liveGroup,
205 ServiceContext serviceContext)
206 throws Exception {
207
208 getStaging().disableStaging(portletRequest, liveGroup, serviceContext);
209 }
210
211
216 public static void enableLocalStaging(
217 long userId, Group scopeGroup, Group liveGroup,
218 boolean branchingPublic, boolean branchingPrivate,
219 ServiceContext serviceContext)
220 throws Exception {
221
222 getStaging().enableLocalStaging(
223 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
224 serviceContext);
225 }
226
227
233 public static void enableRemoteStaging(
234 long userId, Group scopeGroup, Group liveGroup,
235 boolean branchingPublic, boolean branchingPrivate,
236 String remoteAddress, int remotePort, String remotePathContext,
237 boolean secureConnection, long remoteGroupId,
238 ServiceContext serviceContext)
239 throws Exception {
240
241 getStaging().enableRemoteStaging(
242 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
243 remoteAddress, remotePort, remotePathContext, secureConnection,
244 remoteGroupId, serviceContext);
245 }
246
247 public static JSONArray getErrorMessagesJSONArray(
248 Locale locale, Map<String, MissingReference> missingReferences,
249 Map<String, Serializable> contextMap) {
250
251 return getStaging().getErrorMessagesJSONArray(
252 locale, missingReferences, contextMap);
253 }
254
255 public static JSONObject getExceptionMessagesJSONObject(
256 Locale locale, Exception e, Map<String, Serializable> contextMap) {
257
258 return getStaging().getExceptionMessagesJSONObject(
259 locale, e, contextMap);
260 }
261
262 public static Group getLiveGroup(long groupId)
263 throws PortalException, SystemException {
264
265 return getStaging().getLiveGroup(groupId);
266 }
267
268 public static long getLiveGroupId(long groupId)
269 throws PortalException, SystemException {
270
271 return getStaging().getLiveGroupId(groupId);
272 }
273
274 public static List<Layout> getMissingParentLayouts(
275 Layout layout, long liveGroupId)
276 throws Exception {
277
278 return getStaging().getMissingParentLayouts(layout, liveGroupId);
279 }
280
281 public static long getRecentLayoutRevisionId(
282 HttpServletRequest request, long layoutSetBranchId, long plid)
283 throws PortalException, SystemException {
284
285 return getStaging().getRecentLayoutRevisionId(
286 request, layoutSetBranchId, plid);
287 }
288
289 public static long getRecentLayoutRevisionId(
290 User user, long layoutSetBranchId, long plid)
291 throws PortalException, SystemException {
292
293 return getStaging().getRecentLayoutRevisionId(
294 user, layoutSetBranchId, plid);
295 }
296
297 public static long getRecentLayoutSetBranchId(
298 HttpServletRequest request, long layoutSetId) {
299
300 return getStaging().getRecentLayoutSetBranchId(request, layoutSetId);
301 }
302
303 public static long getRecentLayoutSetBranchId(User user, long layoutSetId)
304 throws SystemException {
305
306 return getStaging().getRecentLayoutSetBranchId(user, layoutSetId);
307 }
308
309 public static String getSchedulerGroupName(
310 String destinationName, long groupId) {
311
312 return getStaging().getSchedulerGroupName(destinationName, groupId);
313 }
314
315 public static String getStagedPortletId(String portletId) {
316 return getStaging().getStagedPortletId(portletId);
317 }
318
319 public static Staging getStaging() {
320 PortalRuntimePermission.checkGetBeanProperty(StagingUtil.class);
321
322 return _staging;
323 }
324
325 public static Map<String, String[]> getStagingParameters() {
326 return getStaging().getStagingParameters();
327 }
328
329 public static Map<String, String[]> getStagingParameters(
330 PortletRequest PortletRequest) {
331
332 return getStaging().getStagingParameters(PortletRequest);
333 }
334
335 public static JSONArray getWarningMessagesJSONArray(
336 Locale locale, Map<String, MissingReference> missingReferences,
337 Map<String, Serializable> contextMap) {
338
339 return getStaging().getWarningMessagesJSONArray(
340 locale, missingReferences, contextMap);
341 }
342
343 public static WorkflowTask getWorkflowTask(
344 long userId, LayoutRevision layoutRevision)
345 throws PortalException, SystemException {
346
347 return getStaging().getWorkflowTask(userId, layoutRevision);
348 }
349
350 public static boolean hasWorkflowTask(
351 long userId, LayoutRevision layoutRevision)
352 throws PortalException, SystemException {
353
354 return getStaging().hasWorkflowTask(userId, layoutRevision);
355 }
356
357 public static boolean isIncomplete(Layout layout, long layoutSetBranchId) {
358 return getStaging().isIncomplete(layout, layoutSetBranchId);
359 }
360
361 public static void lockGroup(long userId, long groupId) throws Exception {
362 getStaging().lockGroup(userId, groupId);
363 }
364
365 public static void publishLayout(
366 long userId, long plid, long liveGroupId, boolean includeChildren)
367 throws Exception {
368
369 getStaging().publishLayout(userId, plid, liveGroupId, includeChildren);
370 }
371
372 public static void publishLayouts(
373 long userId, long sourceGroupId, long targetGroupId,
374 boolean privateLayout, long[] layoutIds,
375 Map<String, String[]> parameterMap, Date startDate, Date endDate)
376 throws PortalException, SystemException {
377
378 getStaging().publishLayouts(
379 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
380 parameterMap, startDate, endDate);
381 }
382
383 public static void publishLayouts(
384 long userId, long sourceGroupId, long targetGroupId,
385 boolean privateLayout, Map<Long, Boolean> layoutIdMap,
386 Map<String, String[]> parameterMap, Date startDate, Date endDate)
387 throws PortalException, SystemException {
388
389 getStaging().publishLayouts(
390 userId, sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
391 parameterMap, startDate, endDate);
392 }
393
394 public static void publishLayouts(
395 long userId, long sourceGroupId, long targetGroupId,
396 boolean privateLayout, Map<String, String[]> parameterMap,
397 Date startDate, Date endDate)
398 throws PortalException, SystemException {
399
400 getStaging().publishLayouts(
401 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap,
402 startDate, endDate);
403 }
404
405 public static void publishToLive(PortletRequest PortletRequest)
406 throws Exception {
407
408 getStaging().publishToLive(PortletRequest);
409 }
410
411 public static void publishToLive(
412 PortletRequest PortletRequest, Portlet portlet)
413 throws Exception {
414
415 getStaging().publishToLive(PortletRequest, portlet);
416 }
417
418 public static void publishToRemote(PortletRequest PortletRequest)
419 throws Exception {
420
421 getStaging().publishToRemote(PortletRequest);
422 }
423
424 public static void scheduleCopyFromLive(PortletRequest PortletRequest)
425 throws Exception {
426
427 getStaging().scheduleCopyFromLive(PortletRequest);
428 }
429
430 public static void schedulePublishToLive(PortletRequest PortletRequest)
431 throws Exception {
432
433 getStaging().schedulePublishToLive(PortletRequest);
434 }
435
436 public static void schedulePublishToRemote(PortletRequest PortletRequest)
437 throws Exception {
438
439 getStaging().schedulePublishToRemote(PortletRequest);
440 }
441
442 public static void setRecentLayoutBranchId(
443 HttpServletRequest request, long layoutSetBranchId, long plid,
444 long layoutBranchId)
445 throws SystemException {
446
447 getStaging().setRecentLayoutBranchId(
448 request, layoutSetBranchId, plid, layoutBranchId);
449 }
450
451 public static void setRecentLayoutBranchId(
452 User user, long layoutSetBranchId, long plid, long layoutBranchId)
453 throws SystemException {
454
455 getStaging().setRecentLayoutBranchId(
456 user, layoutSetBranchId, plid, layoutBranchId);
457 }
458
459 public static void setRecentLayoutRevisionId(
460 HttpServletRequest request, long layoutSetBranchId, long plid,
461 long layoutRevisionId)
462 throws SystemException {
463
464 getStaging().setRecentLayoutRevisionId(
465 request, layoutSetBranchId, plid, layoutRevisionId);
466 }
467
468 public static void setRecentLayoutRevisionId(
469 User user, long layoutSetBranchId, long plid, long layoutRevisionId)
470 throws SystemException {
471
472 getStaging().setRecentLayoutRevisionId(
473 user, layoutSetBranchId, plid, layoutRevisionId);
474 }
475
476 public static void setRecentLayoutSetBranchId(
477 HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {
478
479 getStaging().setRecentLayoutSetBranchId(
480 request, layoutSetId, layoutSetBranchId);
481 }
482
483 public static void setRecentLayoutSetBranchId(
484 User user, long layoutSetId, long layoutSetBranchId)
485 throws SystemException {
486
487 getStaging().setRecentLayoutSetBranchId(
488 user, layoutSetId, layoutSetBranchId);
489 }
490
491 public static void unlockGroup(long groupId) throws SystemException {
492 getStaging().unlockGroup(groupId);
493 }
494
495 public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
496 throws Exception {
497
498 getStaging().unscheduleCopyFromLive(PortletRequest);
499 }
500
501 public static void unschedulePublishToLive(PortletRequest PortletRequest)
502 throws Exception {
503
504 getStaging().unschedulePublishToLive(PortletRequest);
505 }
506
507 public static void unschedulePublishToRemote(PortletRequest PortletRequest)
508 throws Exception {
509
510 getStaging().unschedulePublishToRemote(PortletRequest);
511 }
512
513 public static void updateLastImportSettings(
514 Element layoutElement, Layout layout,
515 PortletDataContext portletDataContext)
516 throws Exception {
517
518 getStaging().updateLastImportSettings(
519 layoutElement, layout, portletDataContext);
520 }
521
522 public static void updateLastPublishDate(
523 long sourceGroupId, boolean privateLayout, Date lastPublishDate)
524 throws Exception {
525
526 getStaging().updateLastPublishDate(
527 sourceGroupId, privateLayout, lastPublishDate);
528 }
529
530 public static void updateLastPublishDate(
531 long sourceGroupId, boolean privateLayout, DateRange dateRange,
532 Date lastPublishDate)
533 throws Exception {
534
535 getStaging().updateLastPublishDate(
536 sourceGroupId, privateLayout, dateRange, lastPublishDate);
537 }
538
539 public static Date getLastPublishDate(LayoutSet layoutSet)
540 throws PortalException {
541
542 return getStaging().getLastPublishDate(layoutSet);
543 }
544
545 public static Date getLastPublishDate(
546 PortletPreferences jxPortletPreferences) {
547
548 return getStaging().getLastPublishDate(jxPortletPreferences);
549 }
550
551 public static void updateLastPublishDate(
552 String portletId, PortletPreferences portletPreferences,
553 Date lastPublishDate)
554 throws Exception {
555
556 getStaging().updateLastPublishDate(
557 portletId, portletPreferences, lastPublishDate);
558 }
559
560 public static void updateLastPublishDate(
561 String portletId, PortletPreferences portletPreferences,
562 DateRange dateRange, Date lastPublishDate)
563 throws Exception {
564
565 getStaging().updateLastPublishDate(
566 portletId, portletPreferences, dateRange, lastPublishDate);
567 }
568
569 public static void updateStaging(
570 PortletRequest PortletRequest, Group liveGroup)
571 throws Exception {
572
573 getStaging().updateStaging(PortletRequest, liveGroup);
574 }
575
576 public static void validateRemote(
577 String remoteAddress, int remotePort, String remotePathContext,
578 boolean secureConnection, long remoteGroupId)
579 throws PortalException {
580
581 getStaging().validateRemote(
582 remoteAddress, remotePort, remotePathContext, secureConnection,
583 remoteGroupId);
584 }
585
586 public void setStaging(Staging staging) {
587 PortalRuntimePermission.checkSetBeanProperty(getClass());
588
589 _staging = staging;
590 }
591
592 private static Staging _staging;
593
594 }