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 User user, long layoutSetBranchId, long plid)
141 throws SystemException {
142
143 getStaging().deleteRecentLayoutRevisionId(
144 user, layoutSetBranchId, plid);
145 }
146
147
152 public static void disableStaging(
153 Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
154 throws Exception {
155
156 getStaging().disableStaging(scopeGroup, liveGroup, serviceContext);
157 }
158
159
164 public static void disableStaging(
165 Group liveGroup, ServiceContext serviceContext)
166 throws Exception {
167
168 getStaging().disableStaging(liveGroup, serviceContext);
169 }
170
171
176 public static void disableStaging(
177 PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
178 ServiceContext serviceContext)
179 throws Exception {
180
181 getStaging().disableStaging(
182 portletRequest, scopeGroup, liveGroup, serviceContext);
183 }
184
185
190 public static void disableStaging(
191 PortletRequest portletRequest, Group liveGroup,
192 ServiceContext serviceContext)
193 throws Exception {
194
195 getStaging().disableStaging(portletRequest, liveGroup, serviceContext);
196 }
197
198
203 public static void enableLocalStaging(
204 long userId, Group scopeGroup, Group liveGroup,
205 boolean branchingPublic, boolean branchingPrivate,
206 ServiceContext serviceContext)
207 throws Exception {
208
209 getStaging().enableLocalStaging(
210 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
211 serviceContext);
212 }
213
214
220 public static void enableRemoteStaging(
221 long userId, Group scopeGroup, Group liveGroup,
222 boolean branchingPublic, boolean branchingPrivate,
223 String remoteAddress, int remotePort, String remotePathContext,
224 boolean secureConnection, long remoteGroupId,
225 ServiceContext serviceContext)
226 throws Exception {
227
228 getStaging().enableRemoteStaging(
229 userId, scopeGroup, liveGroup, branchingPublic, branchingPrivate,
230 remoteAddress, remotePort, remotePathContext, secureConnection,
231 remoteGroupId, serviceContext);
232 }
233
234 public static JSONArray getErrorMessagesJSONArray(
235 Locale locale, Map<String, MissingReference> missingReferences,
236 Map<String, Serializable> contextMap) {
237
238 return getStaging().getErrorMessagesJSONArray(
239 locale, missingReferences, contextMap);
240 }
241
242 public static JSONObject getExceptionMessagesJSONObject(
243 Locale locale, Exception e, Map<String, Serializable> contextMap) {
244
245 return getStaging().getExceptionMessagesJSONObject(
246 locale, e, contextMap);
247 }
248
249 public static Group getLiveGroup(long groupId)
250 throws PortalException, SystemException {
251
252 return getStaging().getLiveGroup(groupId);
253 }
254
255 public static long getLiveGroupId(long groupId)
256 throws PortalException, SystemException {
257
258 return getStaging().getLiveGroupId(groupId);
259 }
260
261 public static List<Layout> getMissingParentLayouts(
262 Layout layout, long liveGroupId)
263 throws Exception {
264
265 return getStaging().getMissingParentLayouts(layout, liveGroupId);
266 }
267
268 public static long getRecentLayoutRevisionId(
269 HttpServletRequest request, long layoutSetBranchId, long plid)
270 throws PortalException, SystemException {
271
272 return getStaging().getRecentLayoutRevisionId(
273 request, layoutSetBranchId, plid);
274 }
275
276 public static long getRecentLayoutRevisionId(
277 User user, long layoutSetBranchId, long plid)
278 throws PortalException, SystemException {
279
280 return getStaging().getRecentLayoutRevisionId(
281 user, layoutSetBranchId, plid);
282 }
283
284 public static long getRecentLayoutSetBranchId(
285 HttpServletRequest request, long layoutSetId) {
286
287 return getStaging().getRecentLayoutSetBranchId(request, layoutSetId);
288 }
289
290 public static long getRecentLayoutSetBranchId(User user, long layoutSetId)
291 throws SystemException {
292
293 return getStaging().getRecentLayoutSetBranchId(user, layoutSetId);
294 }
295
296 public static String getSchedulerGroupName(
297 String destinationName, long groupId) {
298
299 return getStaging().getSchedulerGroupName(destinationName, groupId);
300 }
301
302 public static String getStagedPortletId(String portletId) {
303 return getStaging().getStagedPortletId(portletId);
304 }
305
306 public static Staging getStaging() {
307 PortalRuntimePermission.checkGetBeanProperty(StagingUtil.class);
308
309 return _staging;
310 }
311
312 public static Map<String, String[]> getStagingParameters() {
313 return getStaging().getStagingParameters();
314 }
315
316 public static Map<String, String[]> getStagingParameters(
317 PortletRequest PortletRequest) {
318
319 return getStaging().getStagingParameters(PortletRequest);
320 }
321
322 public static JSONArray getWarningMessagesJSONArray(
323 Locale locale, Map<String, MissingReference> missingReferences,
324 Map<String, Serializable> contextMap) {
325
326 return getStaging().getWarningMessagesJSONArray(
327 locale, missingReferences, contextMap);
328 }
329
330 public static WorkflowTask getWorkflowTask(
331 long userId, LayoutRevision layoutRevision)
332 throws PortalException, SystemException {
333
334 return getStaging().getWorkflowTask(userId, layoutRevision);
335 }
336
337 public static boolean hasWorkflowTask(
338 long userId, LayoutRevision layoutRevision)
339 throws PortalException, SystemException {
340
341 return getStaging().hasWorkflowTask(userId, layoutRevision);
342 }
343
344 public static boolean isIncomplete(Layout layout, long layoutSetBranchId) {
345 return getStaging().isIncomplete(layout, layoutSetBranchId);
346 }
347
348 public static void lockGroup(long userId, long groupId) throws Exception {
349 getStaging().lockGroup(userId, groupId);
350 }
351
352 public static void publishLayout(
353 long userId, long plid, long liveGroupId, boolean includeChildren)
354 throws Exception {
355
356 getStaging().publishLayout(userId, plid, liveGroupId, includeChildren);
357 }
358
359 public static void publishLayouts(
360 long userId, long sourceGroupId, long targetGroupId,
361 boolean privateLayout, long[] layoutIds,
362 Map<String, String[]> parameterMap, Date startDate, Date endDate)
363 throws PortalException, SystemException {
364
365 getStaging().publishLayouts(
366 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
367 parameterMap, startDate, endDate);
368 }
369
370 public static void publishLayouts(
371 long userId, long sourceGroupId, long targetGroupId,
372 boolean privateLayout, Map<Long, Boolean> layoutIdMap,
373 Map<String, String[]> parameterMap, Date startDate, Date endDate)
374 throws PortalException, SystemException {
375
376 getStaging().publishLayouts(
377 userId, sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
378 parameterMap, startDate, endDate);
379 }
380
381 public static void publishLayouts(
382 long userId, long sourceGroupId, long targetGroupId,
383 boolean privateLayout, Map<String, String[]> parameterMap,
384 Date startDate, Date endDate)
385 throws PortalException, SystemException {
386
387 getStaging().publishLayouts(
388 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap,
389 startDate, endDate);
390 }
391
392 public static void publishToLive(PortletRequest PortletRequest)
393 throws Exception {
394
395 getStaging().publishToLive(PortletRequest);
396 }
397
398 public static void publishToLive(
399 PortletRequest PortletRequest, Portlet portlet)
400 throws Exception {
401
402 getStaging().publishToLive(PortletRequest, portlet);
403 }
404
405 public static void publishToRemote(PortletRequest PortletRequest)
406 throws Exception {
407
408 getStaging().publishToRemote(PortletRequest);
409 }
410
411 public static void scheduleCopyFromLive(PortletRequest PortletRequest)
412 throws Exception {
413
414 getStaging().scheduleCopyFromLive(PortletRequest);
415 }
416
417 public static void schedulePublishToLive(PortletRequest PortletRequest)
418 throws Exception {
419
420 getStaging().schedulePublishToLive(PortletRequest);
421 }
422
423 public static void schedulePublishToRemote(PortletRequest PortletRequest)
424 throws Exception {
425
426 getStaging().schedulePublishToRemote(PortletRequest);
427 }
428
429 public static void setRecentLayoutBranchId(
430 HttpServletRequest request, long layoutSetBranchId, long plid,
431 long layoutBranchId)
432 throws SystemException {
433
434 getStaging().setRecentLayoutBranchId(
435 request, layoutSetBranchId, plid, layoutBranchId);
436 }
437
438 public static void setRecentLayoutBranchId(
439 User user, long layoutSetBranchId, long plid, long layoutBranchId)
440 throws SystemException {
441
442 getStaging().setRecentLayoutBranchId(
443 user, layoutSetBranchId, plid, layoutBranchId);
444 }
445
446 public static void setRecentLayoutRevisionId(
447 HttpServletRequest request, long layoutSetBranchId, long plid,
448 long layoutRevisionId)
449 throws SystemException {
450
451 getStaging().setRecentLayoutRevisionId(
452 request, layoutSetBranchId, plid, layoutRevisionId);
453 }
454
455 public static void setRecentLayoutRevisionId(
456 User user, long layoutSetBranchId, long plid, long layoutRevisionId)
457 throws SystemException {
458
459 getStaging().setRecentLayoutRevisionId(
460 user, layoutSetBranchId, plid, layoutRevisionId);
461 }
462
463 public static void setRecentLayoutSetBranchId(
464 HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {
465
466 getStaging().setRecentLayoutSetBranchId(
467 request, layoutSetId, layoutSetBranchId);
468 }
469
470 public static void setRecentLayoutSetBranchId(
471 User user, long layoutSetId, long layoutSetBranchId)
472 throws SystemException {
473
474 getStaging().setRecentLayoutSetBranchId(
475 user, layoutSetId, layoutSetBranchId);
476 }
477
478 public static void unlockGroup(long groupId) throws SystemException {
479 getStaging().unlockGroup(groupId);
480 }
481
482 public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
483 throws Exception {
484
485 getStaging().unscheduleCopyFromLive(PortletRequest);
486 }
487
488 public static void unschedulePublishToLive(PortletRequest PortletRequest)
489 throws Exception {
490
491 getStaging().unschedulePublishToLive(PortletRequest);
492 }
493
494 public static void unschedulePublishToRemote(PortletRequest PortletRequest)
495 throws Exception {
496
497 getStaging().unschedulePublishToRemote(PortletRequest);
498 }
499
500 public static void updateLastImportSettings(
501 Element layoutElement, Layout layout,
502 PortletDataContext portletDataContext)
503 throws Exception {
504
505 getStaging().updateLastImportSettings(
506 layoutElement, layout, portletDataContext);
507 }
508
509 public static void updateLastPublishDate(
510 long sourceGroupId, boolean privateLayout, Date lastPublishDate)
511 throws Exception {
512
513 getStaging().updateLastPublishDate(
514 sourceGroupId, privateLayout, lastPublishDate);
515 }
516
517 public static void updateLastPublishDate(
518 long sourceGroupId, boolean privateLayout, DateRange dateRange,
519 Date lastPublishDate)
520 throws Exception {
521
522 getStaging().updateLastPublishDate(
523 sourceGroupId, privateLayout, dateRange, lastPublishDate);
524 }
525
526 public static Date getLastPublishDate(LayoutSet layoutSet)
527 throws PortalException {
528
529 return getStaging().getLastPublishDate(layoutSet);
530 }
531
532 public static Date getLastPublishDate(
533 PortletPreferences jxPortletPreferences) {
534
535 return getStaging().getLastPublishDate(jxPortletPreferences);
536 }
537
538 public static void updateLastPublishDate(
539 String portletId, PortletPreferences portletPreferences,
540 Date lastPublishDate)
541 throws Exception {
542
543 getStaging().updateLastPublishDate(
544 portletId, portletPreferences, lastPublishDate);
545 }
546
547 public static void updateLastPublishDate(
548 String portletId, PortletPreferences portletPreferences,
549 DateRange dateRange, Date lastPublishDate)
550 throws Exception {
551
552 getStaging().updateLastPublishDate(
553 portletId, portletPreferences, dateRange, lastPublishDate);
554 }
555
556 public static void updateStaging(
557 PortletRequest PortletRequest, Group liveGroup)
558 throws Exception {
559
560 getStaging().updateStaging(PortletRequest, liveGroup);
561 }
562
563 public static void validateRemote(
564 String remoteAddress, int remotePort, String remotePathContext,
565 boolean secureConnection, long remoteGroupId)
566 throws PortalException {
567
568 getStaging().validateRemote(
569 remoteAddress, remotePort, remotePathContext, secureConnection,
570 remoteGroupId);
571 }
572
573 public void setStaging(Staging staging) {
574 PortalRuntimePermission.checkSetBeanProperty(getClass());
575
576 _staging = staging;
577 }
578
579 private static Staging _staging;
580
581 }