001
014
015 package com.liferay.portlet.exportimport.staging;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.exception.PortalException;
020 import com.liferay.portal.kernel.json.JSONArray;
021 import com.liferay.portal.kernel.json.JSONObject;
022 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
023 import com.liferay.portal.kernel.util.UnicodeProperties;
024 import com.liferay.portal.kernel.workflow.WorkflowTask;
025 import com.liferay.portal.kernel.xml.Element;
026 import com.liferay.portal.model.Group;
027 import com.liferay.portal.model.Layout;
028 import com.liferay.portal.model.LayoutRevision;
029 import com.liferay.portal.model.Portlet;
030 import com.liferay.portal.model.User;
031 import com.liferay.portal.service.ServiceContext;
032 import com.liferay.portlet.exportimport.lar.MissingReference;
033 import com.liferay.portlet.exportimport.lar.PortletDataContext;
034 import com.liferay.portlet.exportimport.model.ExportImportConfiguration;
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 @ProviderType
052 public class StagingUtil {
053
054 public static String buildRemoteURL(
055 String remoteAddress, int remotePort, String remotePathContext,
056 boolean secureConnection, long remoteGroupId, boolean privateLayout) {
057
058 return getStaging().buildRemoteURL(
059 remoteAddress, remotePort, remotePathContext, secureConnection,
060 remoteGroupId, privateLayout);
061 }
062
063 public static String buildRemoteURL(
064 UnicodeProperties typeSettingsProperties) {
065
066 return getStaging().buildRemoteURL(typeSettingsProperties);
067 }
068
069
075 @Deprecated
076 public static void checkDefaultLayoutSetBranches(
077 long userId, Group liveGroup, boolean branchingPublic,
078 boolean branchingPrivate, boolean remote,
079 ServiceContext serviceContext)
080 throws PortalException {
081
082 getStaging().checkDefaultLayoutSetBranches(
083 userId, liveGroup, branchingPublic, branchingPrivate, remote,
084 serviceContext);
085 }
086
087 public static void copyFromLive(PortletRequest PortletRequest)
088 throws PortalException {
089
090 getStaging().copyFromLive(PortletRequest);
091 }
092
093 public static void copyFromLive(
094 PortletRequest PortletRequest, Portlet portlet)
095 throws PortalException {
096
097 getStaging().copyFromLive(PortletRequest, portlet);
098 }
099
100
104 @Deprecated
105 public static void copyPortlet(
106 PortletRequest PortletRequest, long sourceGroupId,
107 long targetGroupId, long sourcePlid, long targetPlid,
108 String portletId)
109 throws PortalException {
110
111 getStaging().copyPortlet(
112 PortletRequest, sourceGroupId, targetGroupId, sourcePlid,
113 targetPlid, portletId);
114 }
115
116 public static void copyRemoteLayouts(
117 ExportImportConfiguration exportImportConfiguration)
118 throws PortalException {
119
120 getStaging().copyRemoteLayouts(exportImportConfiguration);
121 }
122
123 public static void copyRemoteLayouts(long exportImportConfigurationId)
124 throws PortalException {
125
126 getStaging().copyRemoteLayouts(exportImportConfigurationId);
127 }
128
129 public static void copyRemoteLayouts(
130 long sourceGroupId, boolean privateLayout,
131 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
132 String remoteAddress, int remotePort, String remotePathContext,
133 boolean secureConnection, long remoteGroupId,
134 boolean remotePrivateLayout)
135 throws PortalException {
136
137 getStaging().copyRemoteLayouts(
138 sourceGroupId, privateLayout, layoutIdMap, parameterMap,
139 remoteAddress, remotePort, remotePathContext, secureConnection,
140 remoteGroupId, remotePrivateLayout);
141 }
142
143
148 @Deprecated
149 public static void copyRemoteLayouts(
150 long sourceGroupId, boolean privateLayout,
151 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
152 String remoteAddress, int remotePort, String remotePathContext,
153 boolean secureConnection, long remoteGroupId,
154 boolean remotePrivateLayout, Date startDate, Date endDate)
155 throws PortalException {
156
157 getStaging().copyRemoteLayouts(
158 sourceGroupId, privateLayout, layoutIdMap, parameterMap,
159 remoteAddress, remotePort, remotePathContext, secureConnection,
160 remoteGroupId, remotePrivateLayout, startDate, endDate);
161 }
162
163 public static void deleteLastImportSettings(
164 Group liveGroup, boolean privateLayout)
165 throws PortalException {
166
167 getStaging().deleteLastImportSettings(liveGroup, privateLayout);
168 }
169
170 public static void deleteRecentLayoutRevisionId(
171 HttpServletRequest request, long layoutSetBranchId, long plid) {
172
173 getStaging().deleteRecentLayoutRevisionId(
174 request, layoutSetBranchId, plid);
175 }
176
177 public static void deleteRecentLayoutRevisionId(
178 long userId, long layoutSetBranchId, long plid) {
179
180 getStaging().deleteRecentLayoutRevisionId(
181 userId, layoutSetBranchId, plid);
182 }
183
184
188 @Deprecated
189 public static void deleteRecentLayoutRevisionId(
190 User user, long layoutSetBranchId, long plid) {
191
192 getStaging().deleteRecentLayoutRevisionId(
193 user, layoutSetBranchId, plid);
194 }
195
196
201 @Deprecated
202 public static void disableStaging(
203 Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
204 throws Exception {
205
206 getStaging().disableStaging(scopeGroup, liveGroup, serviceContext);
207 }
208
209
214 @Deprecated
215 public static void disableStaging(
216 Group liveGroup, ServiceContext serviceContext)
217 throws Exception {
218
219 getStaging().disableStaging(liveGroup, serviceContext);
220 }
221
222
227 @Deprecated
228 public static void disableStaging(
229 PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
230 ServiceContext serviceContext)
231 throws Exception {
232
233 getStaging().disableStaging(
234 portletRequest, scopeGroup, liveGroup, serviceContext);
235 }
236
237
242 @Deprecated
243 public static void disableStaging(
244 PortletRequest portletRequest, Group liveGroup,
245 ServiceContext serviceContext)
246 throws Exception {
247
248 getStaging().disableStaging(portletRequest, liveGroup, serviceContext);
249 }
250
251
256 @Deprecated
257 public static void enableLocalStaging(
258 long userId, Group scopeGroup, Group liveGroup,
259 boolean branchingPublic, boolean branchingPrivate,
260 ServiceContext serviceContext)
261 throws Exception {
262
263 getStaging().enableLocalStaging(
264 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
265 serviceContext);
266 }
267
268
274 @Deprecated
275 public static void enableRemoteStaging(
276 long userId, Group scopeGroup, Group liveGroup,
277 boolean branchingPublic, boolean branchingPrivate,
278 String remoteAddress, int remotePort, String remotePathContext,
279 boolean secureConnection, long remoteGroupId,
280 ServiceContext serviceContext)
281 throws Exception {
282
283 getStaging().enableRemoteStaging(
284 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
285 remoteAddress, remotePort, remotePathContext, secureConnection,
286 remoteGroupId, serviceContext);
287 }
288
289 public static JSONArray getErrorMessagesJSONArray(
290 Locale locale, Map<String, MissingReference> missingReferences,
291 Map<String, Serializable> contextMap) {
292
293 return getStaging().getErrorMessagesJSONArray(
294 locale, missingReferences, contextMap);
295 }
296
297 public static JSONObject getExceptionMessagesJSONObject(
298 Locale locale, Exception e, Map<String, Serializable> contextMap) {
299
300 return getStaging().getExceptionMessagesJSONObject(
301 locale, e, contextMap);
302 }
303
304 public static Group getLiveGroup(long groupId) {
305 return getStaging().getLiveGroup(groupId);
306 }
307
308 public static long getLiveGroupId(long groupId) {
309 return getStaging().getLiveGroupId(groupId);
310 }
311
312
317 @Deprecated
318 public static List<Layout> getMissingParentLayouts(
319 Layout layout, long liveGroupId)
320 throws Exception {
321
322 return getStaging().getMissingParentLayouts(layout, liveGroupId);
323 }
324
325 public static long getRecentLayoutRevisionId(
326 HttpServletRequest request, long layoutSetBranchId, long plid)
327 throws PortalException {
328
329 return getStaging().getRecentLayoutRevisionId(
330 request, layoutSetBranchId, plid);
331 }
332
333 public static long getRecentLayoutRevisionId(
334 User user, long layoutSetBranchId, long plid)
335 throws PortalException {
336
337 return getStaging().getRecentLayoutRevisionId(
338 user, layoutSetBranchId, plid);
339 }
340
341 public static long getRecentLayoutSetBranchId(
342 HttpServletRequest request, long layoutSetId) {
343
344 return getStaging().getRecentLayoutSetBranchId(request, layoutSetId);
345 }
346
347 public static long getRecentLayoutSetBranchId(User user, long layoutSetId) {
348 return getStaging().getRecentLayoutSetBranchId(user, layoutSetId);
349 }
350
351 public static String getSchedulerGroupName(
352 String destinationName, long groupId) {
353
354 return getStaging().getSchedulerGroupName(destinationName, groupId);
355 }
356
357 public static String getStagedPortletId(String portletId) {
358 return getStaging().getStagedPortletId(portletId);
359 }
360
361 public static Staging getStaging() {
362 PortalRuntimePermission.checkGetBeanProperty(StagingUtil.class);
363
364 return _staging;
365 }
366
367 public static Group getStagingGroup(long groupId) {
368 return getStaging().getStagingGroup(groupId);
369 }
370
371
376 @Deprecated
377 public static Map<String, String[]> getStagingParameters() {
378 return getStaging().getStagingParameters();
379 }
380
381
386 @Deprecated
387 public static Map<String, String[]> getStagingParameters(
388 PortletRequest PortletRequest) {
389
390 return getStaging().getStagingParameters(PortletRequest);
391 }
392
393 public static JSONArray getWarningMessagesJSONArray(
394 Locale locale, Map<String, MissingReference> missingReferences,
395 Map<String, Serializable> contextMap) {
396
397 return getStaging().getWarningMessagesJSONArray(
398 locale, missingReferences, contextMap);
399 }
400
401 public static WorkflowTask getWorkflowTask(
402 long userId, LayoutRevision layoutRevision)
403 throws PortalException {
404
405 return getStaging().getWorkflowTask(userId, layoutRevision);
406 }
407
408 public static boolean hasWorkflowTask(
409 long userId, LayoutRevision layoutRevision)
410 throws PortalException {
411
412 return getStaging().hasWorkflowTask(userId, layoutRevision);
413 }
414
415 public static boolean isIncomplete(Layout layout, long layoutSetBranchId) {
416 return getStaging().isIncomplete(layout, layoutSetBranchId);
417 }
418
419
424 @Deprecated
425 public static void lockGroup(long userId, long groupId)
426 throws PortalException {
427
428 getStaging().lockGroup(userId, groupId);
429 }
430
431 public static void publishLayout(
432 long userId, long plid, long liveGroupId, boolean includeChildren)
433 throws PortalException {
434
435 getStaging().publishLayout(userId, plid, liveGroupId, includeChildren);
436 }
437
438 public static void publishLayouts(
439 long userId, ExportImportConfiguration exportImportConfiguration)
440 throws PortalException {
441
442 getStaging().publishLayouts(userId, exportImportConfiguration);
443 }
444
445 public static void publishLayouts(
446 long userId, long exportImportConfigurationId)
447 throws PortalException {
448
449 getStaging().publishLayouts(userId, exportImportConfigurationId);
450 }
451
452 public static void publishLayouts(
453 long userId, long sourceGroupId, long targetGroupId,
454 boolean privateLayout, long[] layoutIds,
455 Map<String, String[]> parameterMap)
456 throws PortalException {
457
458 getStaging().publishLayouts(
459 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
460 parameterMap);
461 }
462
463
467 @Deprecated
468 public static void publishLayouts(
469 long userId, long sourceGroupId, long targetGroupId,
470 boolean privateLayout, long[] layoutIds,
471 Map<String, String[]> parameterMap, Date startDate, Date endDate)
472 throws PortalException {
473
474 getStaging().publishLayouts(
475 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
476 parameterMap, startDate, endDate);
477 }
478
479
483 @Deprecated
484 public static void publishLayouts(
485 long userId, long sourceGroupId, long targetGroupId,
486 boolean privateLayout, Map<Long, Boolean> layoutIdMap,
487 Map<String, String[]> parameterMap, Date startDate, Date endDate)
488 throws PortalException {
489
490 getStaging().publishLayouts(
491 userId, sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
492 parameterMap, startDate, endDate);
493 }
494
495 public static void publishLayouts(
496 long userId, long sourceGroupId, long targetGroupId,
497 boolean privateLayout, Map<String, String[]> parameterMap)
498 throws PortalException {
499
500 getStaging().publishLayouts(
501 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap);
502 }
503
504
508 @Deprecated
509 public static void publishLayouts(
510 long userId, long sourceGroupId, long targetGroupId,
511 boolean privateLayout, Map<String, String[]> parameterMap,
512 Date startDate, Date endDate)
513 throws PortalException {
514
515 getStaging().publishLayouts(
516 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap,
517 startDate, endDate);
518 }
519
520 public static void publishPortlet(
521 long userId, ExportImportConfiguration exportImportConfiguration)
522 throws PortalException {
523
524 getStaging().publishPortlet(userId, exportImportConfiguration);
525 }
526
527 public static void publishPortlet(
528 long userId, long exportImportConfigurationId)
529 throws PortalException {
530
531 getStaging().publishPortlet(userId, exportImportConfigurationId);
532 }
533
534 public static void publishPortlet(
535 long userId, long sourceGroupId, long targetGroupId,
536 long sourcePlid, long targetPlid, String portletId,
537 Map<String, String[]> parameterMap)
538 throws PortalException {
539
540 getStaging().publishPortlet(
541 userId, sourceGroupId, targetGroupId, sourcePlid, targetPlid,
542 portletId, parameterMap);
543 }
544
545 public static void publishToLive(PortletRequest PortletRequest)
546 throws PortalException {
547
548 getStaging().publishToLive(PortletRequest);
549 }
550
551 public static void publishToLive(
552 PortletRequest PortletRequest, Portlet portlet)
553 throws PortalException {
554
555 getStaging().publishToLive(PortletRequest, portlet);
556 }
557
558 public static void publishToRemote(PortletRequest PortletRequest)
559 throws PortalException {
560
561 getStaging().publishToRemote(PortletRequest);
562 }
563
564 public static void scheduleCopyFromLive(PortletRequest PortletRequest)
565 throws PortalException {
566
567 getStaging().scheduleCopyFromLive(PortletRequest);
568 }
569
570 public static void schedulePublishToLive(PortletRequest PortletRequest)
571 throws PortalException {
572
573 getStaging().schedulePublishToLive(PortletRequest);
574 }
575
576 public static void schedulePublishToRemote(PortletRequest PortletRequest)
577 throws PortalException {
578
579 getStaging().schedulePublishToRemote(PortletRequest);
580 }
581
582 public static void setRecentLayoutBranchId(
583 HttpServletRequest request, long layoutSetBranchId, long plid,
584 long layoutBranchId) {
585
586 getStaging().setRecentLayoutBranchId(
587 request, layoutSetBranchId, plid, layoutBranchId);
588 }
589
590 public static void setRecentLayoutBranchId(
591 User user, long layoutSetBranchId, long plid, long layoutBranchId) {
592
593 getStaging().setRecentLayoutBranchId(
594 user, layoutSetBranchId, plid, layoutBranchId);
595 }
596
597 public static void setRecentLayoutRevisionId(
598 HttpServletRequest request, long layoutSetBranchId, long plid,
599 long layoutRevisionId) {
600
601 getStaging().setRecentLayoutRevisionId(
602 request, layoutSetBranchId, plid, layoutRevisionId);
603 }
604
605 public static void setRecentLayoutRevisionId(
606 User user, long layoutSetBranchId, long plid, long layoutRevisionId) {
607
608 getStaging().setRecentLayoutRevisionId(
609 user, layoutSetBranchId, plid, layoutRevisionId);
610 }
611
612 public static void setRecentLayoutSetBranchId(
613 HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {
614
615 getStaging().setRecentLayoutSetBranchId(
616 request, layoutSetId, layoutSetBranchId);
617 }
618
619 public static void setRecentLayoutSetBranchId(
620 User user, long layoutSetId, long layoutSetBranchId) {
621
622 getStaging().setRecentLayoutSetBranchId(
623 user, layoutSetId, layoutSetBranchId);
624 }
625
626 public static String stripProtocolFromRemoteAddress(String remoteAddress) {
627 return getStaging().stripProtocolFromRemoteAddress(remoteAddress);
628 }
629
630
635 @Deprecated
636 public static void unlockGroup(long groupId) {
637 getStaging().unlockGroup(groupId);
638 }
639
640 public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
641 throws PortalException {
642
643 getStaging().unscheduleCopyFromLive(PortletRequest);
644 }
645
646 public static void unschedulePublishToLive(PortletRequest PortletRequest)
647 throws PortalException {
648
649 getStaging().unschedulePublishToLive(PortletRequest);
650 }
651
652 public static void unschedulePublishToRemote(PortletRequest PortletRequest)
653 throws PortalException {
654
655 getStaging().unschedulePublishToRemote(PortletRequest);
656 }
657
658 public static void updateLastImportSettings(
659 Element layoutElement, Layout layout,
660 PortletDataContext portletDataContext)
661 throws PortalException {
662
663 getStaging().updateLastImportSettings(
664 layoutElement, layout, portletDataContext);
665 }
666
667
673 @Deprecated
674 public static void updateLastPublishDate(
675 long sourceGroupId, boolean privateLayout, Date lastPublishDate)
676 throws PortalException {
677
678 getStaging().updateLastPublishDate(
679 sourceGroupId, privateLayout, lastPublishDate);
680 }
681
682
688 @Deprecated
689 public static void updateLastPublishDate(
690 String portletId, PortletPreferences portletPreferences,
691 Date lastPublishDate)
692 throws PortalException {
693
694 getStaging().updateLastPublishDate(
695 portletId, portletPreferences, lastPublishDate);
696 }
697
698 public static void updateStaging(
699 PortletRequest PortletRequest, Group liveGroup)
700 throws PortalException {
701
702 getStaging().updateStaging(PortletRequest, liveGroup);
703 }
704
705 public static void validateRemote(
706 long groupId, String remoteAddress, int remotePort,
707 String remotePathContext, boolean secureConnection,
708 long remoteGroupId)
709 throws PortalException {
710
711 getStaging().validateRemote(
712 groupId, remoteAddress, remotePort, remotePathContext,
713 secureConnection, remoteGroupId);
714 }
715
716
720 @Deprecated
721 public static void validateRemote(
722 String remoteAddress, int remotePort, String remotePathContext,
723 boolean secureConnection, long remoteGroupId)
724 throws PortalException {
725
726 getStaging().validateRemote(
727 remoteAddress, remotePort, remotePathContext, secureConnection,
728 remoteGroupId);
729 }
730
731 public void setStaging(Staging staging) {
732 PortalRuntimePermission.checkSetBeanProperty(getClass());
733
734 _staging = staging;
735 }
736
737 private static Staging _staging;
738
739 }