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