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