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