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) throws SystemException {
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 throws SystemException {
243
244 return getStaging().getExceptionMessagesJSONObject(
245 locale, e, contextMap);
246 }
247
248 public static Group getLiveGroup(long groupId)
249 throws PortalException, SystemException {
250
251 return getStaging().getLiveGroup(groupId);
252 }
253
254 public static long getLiveGroupId(long groupId)
255 throws PortalException, SystemException {
256
257 return getStaging().getLiveGroupId(groupId);
258 }
259
260 public static List<Layout> getMissingParentLayouts(
261 Layout layout, long liveGroupId)
262 throws Exception {
263
264 return getStaging().getMissingParentLayouts(layout, liveGroupId);
265 }
266
267 public static long getRecentLayoutRevisionId(
268 HttpServletRequest request, long layoutSetBranchId, long plid)
269 throws PortalException, SystemException {
270
271 return getStaging().getRecentLayoutRevisionId(
272 request, layoutSetBranchId, plid);
273 }
274
275 public static long getRecentLayoutRevisionId(
276 User user, long layoutSetBranchId, long plid)
277 throws PortalException, SystemException {
278
279 return getStaging().getRecentLayoutRevisionId(
280 user, layoutSetBranchId, plid);
281 }
282
283 public static long getRecentLayoutSetBranchId(
284 HttpServletRequest request, long layoutSetId) {
285
286 return getStaging().getRecentLayoutSetBranchId(request, layoutSetId);
287 }
288
289 public static long getRecentLayoutSetBranchId(User user, long layoutSetId)
290 throws SystemException {
291
292 return getStaging().getRecentLayoutSetBranchId(user, layoutSetId);
293 }
294
295 public static String getSchedulerGroupName(
296 String destinationName, long groupId) {
297
298 return getStaging().getSchedulerGroupName(destinationName, groupId);
299 }
300
301 public static String getStagedPortletId(String portletId) {
302 return getStaging().getStagedPortletId(portletId);
303 }
304
305 public static Staging getStaging() {
306 PortalRuntimePermission.checkGetBeanProperty(StagingUtil.class);
307
308 return _staging;
309 }
310
311 public static Map<String, String[]> getStagingParameters() {
312 return getStaging().getStagingParameters();
313 }
314
315 public static Map<String, String[]> getStagingParameters(
316 PortletRequest PortletRequest) {
317
318 return getStaging().getStagingParameters(PortletRequest);
319 }
320
321 public static JSONArray getWarningMessagesJSONArray(
322 Locale locale, Map<String, MissingReference> missingReferences,
323 Map<String, Serializable> contextMap) {
324
325 return getStaging().getWarningMessagesJSONArray(
326 locale, missingReferences, contextMap);
327 }
328
329 public static WorkflowTask getWorkflowTask(
330 long userId, LayoutRevision layoutRevision)
331 throws PortalException, SystemException {
332
333 return getStaging().getWorkflowTask(userId, layoutRevision);
334 }
335
336 public static boolean hasWorkflowTask(
337 long userId, LayoutRevision layoutRevision)
338 throws PortalException, SystemException {
339
340 return getStaging().hasWorkflowTask(userId, layoutRevision);
341 }
342
343 public static boolean isIncomplete(Layout layout, long layoutSetBranchId) {
344 return getStaging().isIncomplete(layout, layoutSetBranchId);
345 }
346
347 public static void lockGroup(long userId, long groupId) throws Exception {
348 getStaging().lockGroup(userId, groupId);
349 }
350
351 public static void publishLayout(
352 long userId, long plid, long liveGroupId, boolean includeChildren)
353 throws Exception {
354
355 getStaging().publishLayout(userId, plid, liveGroupId, includeChildren);
356 }
357
358 public static void publishLayouts(
359 long userId, long sourceGroupId, long targetGroupId,
360 boolean privateLayout, long[] layoutIds,
361 Map<String, String[]> parameterMap, Date startDate, Date endDate)
362 throws PortalException, SystemException {
363
364 getStaging().publishLayouts(
365 userId, sourceGroupId, targetGroupId, privateLayout, layoutIds,
366 parameterMap, startDate, endDate);
367 }
368
369 public static void publishLayouts(
370 long userId, long sourceGroupId, long targetGroupId,
371 boolean privateLayout, Map<Long, Boolean> layoutIdMap,
372 Map<String, String[]> parameterMap, Date startDate, Date endDate)
373 throws PortalException, SystemException {
374
375 getStaging().publishLayouts(
376 userId, sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
377 parameterMap, startDate, endDate);
378 }
379
380 public static void publishLayouts(
381 long userId, long sourceGroupId, long targetGroupId,
382 boolean privateLayout, Map<String, String[]> parameterMap,
383 Date startDate, Date endDate)
384 throws PortalException, SystemException {
385
386 getStaging().publishLayouts(
387 userId, sourceGroupId, targetGroupId, privateLayout, parameterMap,
388 startDate, endDate);
389 }
390
391 public static void publishToLive(PortletRequest PortletRequest)
392 throws Exception {
393
394 getStaging().publishToLive(PortletRequest);
395 }
396
397 public static void publishToLive(
398 PortletRequest PortletRequest, Portlet portlet)
399 throws Exception {
400
401 getStaging().publishToLive(PortletRequest, portlet);
402 }
403
404 public static void publishToRemote(PortletRequest PortletRequest)
405 throws Exception {
406
407 getStaging().publishToRemote(PortletRequest);
408 }
409
410 public static void scheduleCopyFromLive(PortletRequest PortletRequest)
411 throws Exception {
412
413 getStaging().scheduleCopyFromLive(PortletRequest);
414 }
415
416 public static void schedulePublishToLive(PortletRequest PortletRequest)
417 throws Exception {
418
419 getStaging().schedulePublishToLive(PortletRequest);
420 }
421
422 public static void schedulePublishToRemote(PortletRequest PortletRequest)
423 throws Exception {
424
425 getStaging().schedulePublishToRemote(PortletRequest);
426 }
427
428 public static void setRecentLayoutBranchId(
429 HttpServletRequest request, long layoutSetBranchId, long plid,
430 long layoutBranchId)
431 throws SystemException {
432
433 getStaging().setRecentLayoutBranchId(
434 request, layoutSetBranchId, plid, layoutBranchId);
435 }
436
437 public static void setRecentLayoutBranchId(
438 User user, long layoutSetBranchId, long plid, long layoutBranchId)
439 throws SystemException {
440
441 getStaging().setRecentLayoutBranchId(
442 user, layoutSetBranchId, plid, layoutBranchId);
443 }
444
445 public static void setRecentLayoutRevisionId(
446 HttpServletRequest request, long layoutSetBranchId, long plid,
447 long layoutRevisionId)
448 throws SystemException {
449
450 getStaging().setRecentLayoutRevisionId(
451 request, layoutSetBranchId, plid, layoutRevisionId);
452 }
453
454 public static void setRecentLayoutRevisionId(
455 User user, long layoutSetBranchId, long plid, long layoutRevisionId)
456 throws SystemException {
457
458 getStaging().setRecentLayoutRevisionId(
459 user, layoutSetBranchId, plid, layoutRevisionId);
460 }
461
462 public static void setRecentLayoutSetBranchId(
463 HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {
464
465 getStaging().setRecentLayoutSetBranchId(
466 request, layoutSetId, layoutSetBranchId);
467 }
468
469 public static void setRecentLayoutSetBranchId(
470 User user, long layoutSetId, long layoutSetBranchId)
471 throws SystemException {
472
473 getStaging().setRecentLayoutSetBranchId(
474 user, layoutSetId, layoutSetBranchId);
475 }
476
477 public static void unlockGroup(long groupId) throws SystemException {
478 getStaging().unlockGroup(groupId);
479 }
480
481 public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
482 throws Exception {
483
484 getStaging().unscheduleCopyFromLive(PortletRequest);
485 }
486
487 public static void unschedulePublishToLive(PortletRequest PortletRequest)
488 throws Exception {
489
490 getStaging().unschedulePublishToLive(PortletRequest);
491 }
492
493 public static void unschedulePublishToRemote(PortletRequest PortletRequest)
494 throws Exception {
495
496 getStaging().unschedulePublishToRemote(PortletRequest);
497 }
498
499 public static void updateLastImportSettings(
500 Element layoutElement, Layout layout,
501 PortletDataContext portletDataContext)
502 throws Exception {
503
504 getStaging().updateLastImportSettings(
505 layoutElement, layout, portletDataContext);
506 }
507
508 public static void updateLastPublishDate(
509 long sourceGroupId, boolean privateLayout, Date lastPublishDate)
510 throws Exception {
511
512 getStaging().updateLastPublishDate(
513 sourceGroupId, privateLayout, lastPublishDate);
514 }
515
516 public static void updateLastPublishDate(
517 String portletId, PortletPreferences portletPreferences,
518 Date lastPublishDate)
519 throws Exception {
520
521 getStaging().updateLastPublishDate(
522 portletId, portletPreferences, lastPublishDate);
523 }
524
525 public static void updateStaging(
526 PortletRequest PortletRequest, Group liveGroup)
527 throws Exception {
528
529 getStaging().updateStaging(PortletRequest, liveGroup);
530 }
531
532 public static void validateRemote(
533 String remoteAddress, int remotePort, String remotePathContext,
534 boolean secureConnection, long remoteGroupId)
535 throws PortalException {
536
537 getStaging().validateRemote(
538 remoteAddress, remotePort, remotePathContext, secureConnection,
539 remoteGroupId);
540 }
541
542 public void setStaging(Staging staging) {
543 PortalRuntimePermission.checkSetBeanProperty(getClass());
544
545 _staging = staging;
546 }
547
548 private static Staging _staging;
549
550 }