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