001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.staging;
016    
017    import com.liferay.portal.model.Layout;
018    import com.liferay.portal.model.Portlet;
019    
020    import java.util.Date;
021    import java.util.List;
022    import java.util.Map;
023    
024    import javax.portlet.PortletRequest;
025    
026    /**
027     * @author Raymond Augé
028     */
029    public class StagingUtil {
030    
031            public static void copyFromLive(PortletRequest PortletRequest)
032                    throws Exception {
033    
034                    getStaging().copyFromLive(PortletRequest);
035            }
036    
037            public static void copyFromLive(
038                            PortletRequest PortletRequest, Portlet portlet)
039                    throws Exception {
040    
041                    getStaging().copyFromLive(PortletRequest, portlet);
042            }
043    
044            public static void copyPortlet(
045                            PortletRequest PortletRequest, long sourceGroupId,
046                            long targetGroupId, long sourcePlid, long targetPlid,
047                            String portletId)
048                    throws Exception {
049    
050                    getStaging().copyPortlet(
051                            PortletRequest, sourceGroupId, targetGroupId, sourcePlid,
052                            targetPlid, portletId);
053            }
054    
055            public static void copyRemoteLayouts(
056                            long sourceGroupId, boolean privateLayout,
057                            Map<Long, Boolean> layoutIdMap,
058                            Map<String, String[]> exportParameterMap, String remoteAddress,
059                            int remotePort, boolean secureConnection, long remoteGroupId,
060                            boolean remotePrivateLayout,
061                            Map<String, String[]> importParameterMap, Date startDate,
062                            Date endDate)
063                    throws Exception {
064    
065                    getStaging().copyRemoteLayouts(
066                            sourceGroupId, privateLayout, layoutIdMap, exportParameterMap,
067                            remoteAddress, remotePort, secureConnection, remoteGroupId,
068                            remotePrivateLayout, importParameterMap, startDate, endDate);
069            }
070    
071            public static List<Layout> getMissingParentLayouts(
072                            Layout layout, long liveGroupId)
073                    throws Exception {
074    
075                    return getStaging().getMissingParentLayouts(layout, liveGroupId);
076            }
077    
078            public static String getSchedulerGroupName(
079                    String destinationName, long groupId) {
080    
081                    return getStaging().getSchedulerGroupName(destinationName, groupId);
082            }
083    
084            public static Staging getStaging() {
085                    return _staging;
086            }
087    
088            public static Map<String, String[]> getStagingParameters() {
089                    return getStaging().getStagingParameters();
090            }
091    
092            public static Map<String, String[]> getStagingParameters(
093                    PortletRequest PortletRequest) {
094    
095                    return getStaging().getStagingParameters(PortletRequest);
096            }
097    
098            public static void publishLayout(
099                            long plid, long liveGroupId, boolean includeChildren)
100                    throws Exception {
101    
102                    getStaging().publishLayout(plid, liveGroupId, includeChildren);
103            }
104    
105            public static void publishLayouts(
106                            long sourceGroupId, long targetGroupId, boolean privateLayout,
107                            long[] layoutIds, Map<String, String[]> parameterMap,
108                            Date startDate, Date endDate)
109                    throws Exception {
110    
111                    getStaging().publishLayouts(
112                            sourceGroupId, targetGroupId, privateLayout, layoutIds,
113                            parameterMap, startDate, endDate);
114            }
115    
116            public static void publishLayouts(
117                            long sourceGroupId, long targetGroupId, boolean privateLayout,
118                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
119                            Date startDate, Date endDate)
120                    throws Exception {
121    
122                    getStaging().publishLayouts(
123                            sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
124                            parameterMap, startDate, endDate);
125            }
126    
127            public static void publishLayouts(
128                            long sourceGroupId, long targetGroupId, boolean privateLayout,
129                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
130                    throws Exception {
131    
132                    getStaging().publishLayouts(
133                            sourceGroupId, targetGroupId, privateLayout, parameterMap,
134                            startDate, endDate);
135            }
136    
137            public static void publishToLive(PortletRequest PortletRequest)
138                    throws Exception {
139    
140                    getStaging().publishToLive(PortletRequest);
141            }
142    
143            public static void publishToLive(
144                            PortletRequest PortletRequest, Portlet portlet)
145                    throws Exception {
146    
147                    getStaging().publishToLive(PortletRequest, portlet);
148            }
149    
150            public static void publishToRemote(PortletRequest PortletRequest)
151                    throws Exception {
152    
153                    getStaging().publishToRemote(PortletRequest);
154            }
155    
156            public static void scheduleCopyFromLive(PortletRequest PortletRequest)
157                    throws Exception {
158    
159                    getStaging().scheduleCopyFromLive(PortletRequest);
160            }
161    
162            public static void schedulePublishToLive(PortletRequest PortletRequest)
163                    throws Exception {
164    
165                    getStaging().schedulePublishToLive(PortletRequest);
166            }
167    
168            public static void schedulePublishToRemote(PortletRequest PortletRequest)
169                    throws Exception {
170    
171                    getStaging().schedulePublishToRemote(PortletRequest);
172            }
173    
174            public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
175                    throws Exception {
176    
177                    getStaging().unscheduleCopyFromLive(PortletRequest);
178            }
179    
180            public static void unschedulePublishToLive(PortletRequest PortletRequest)
181                    throws Exception {
182    
183                    getStaging().unschedulePublishToLive(PortletRequest);
184            }
185    
186            public static void unschedulePublishToRemote(PortletRequest PortletRequest)
187                    throws Exception {
188    
189                    getStaging().unschedulePublishToRemote(PortletRequest);
190            }
191    
192            public static void updateStaging(PortletRequest PortletRequest)
193                    throws Exception {
194    
195                    getStaging().updateStaging(PortletRequest);
196            }
197    
198            public void setStaging(Staging staging) {
199                    _staging = staging;
200            }
201    
202            private static Staging _staging;
203    
204    }