001    /**
002     * Copyright (c) 2000-2011 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, Map<String, String[]> parameterMap,
058                            String remoteAddress, int remotePort, boolean secureConnection,
059                            long remoteGroupId, boolean remotePrivateLayout, Date startDate,
060                            Date endDate)
061                    throws Exception {
062    
063                    getStaging().copyRemoteLayouts(
064                            sourceGroupId, privateLayout, layoutIdMap, parameterMap,
065                            remoteAddress, remotePort, secureConnection, remoteGroupId,
066                            remotePrivateLayout, startDate, endDate);
067            }
068    
069            public static List<Layout> getMissingParentLayouts(
070                            Layout layout, long liveGroupId)
071                    throws Exception {
072    
073                    return getStaging().getMissingParentLayouts(layout, liveGroupId);
074            }
075    
076            public static String getSchedulerGroupName(
077                    String destinationName, long groupId) {
078    
079                    return getStaging().getSchedulerGroupName(destinationName, groupId);
080            }
081    
082            public static Staging getStaging() {
083                    return _staging;
084            }
085    
086            public static Map<String, String[]> getStagingParameters() {
087                    return getStaging().getStagingParameters();
088            }
089    
090            public static Map<String, String[]> getStagingParameters(
091                    PortletRequest PortletRequest) {
092    
093                    return getStaging().getStagingParameters(PortletRequest);
094            }
095    
096            public static void publishLayout(
097                            long plid, long liveGroupId, boolean includeChildren)
098                    throws Exception {
099    
100                    getStaging().publishLayout(plid, liveGroupId, includeChildren);
101            }
102    
103            public static void publishLayouts(
104                            long sourceGroupId, long targetGroupId, boolean privateLayout,
105                            long[] layoutIds, Map<String, String[]> parameterMap,
106                            Date startDate, Date endDate)
107                    throws Exception {
108    
109                    getStaging().publishLayouts(
110                            sourceGroupId, targetGroupId, privateLayout, layoutIds,
111                            parameterMap, startDate, endDate);
112            }
113    
114            public static void publishLayouts(
115                            long sourceGroupId, long targetGroupId, boolean privateLayout,
116                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
117                            Date startDate, Date endDate)
118                    throws Exception {
119    
120                    getStaging().publishLayouts(
121                            sourceGroupId, targetGroupId, privateLayout, layoutIdMap,
122                            parameterMap, startDate, endDate);
123            }
124    
125            public static void publishLayouts(
126                            long sourceGroupId, long targetGroupId, boolean privateLayout,
127                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
128                    throws Exception {
129    
130                    getStaging().publishLayouts(
131                            sourceGroupId, targetGroupId, privateLayout, parameterMap,
132                            startDate, endDate);
133            }
134    
135            public static void publishToLive(PortletRequest PortletRequest)
136                    throws Exception {
137    
138                    getStaging().publishToLive(PortletRequest);
139            }
140    
141            public static void publishToLive(
142                            PortletRequest PortletRequest, Portlet portlet)
143                    throws Exception {
144    
145                    getStaging().publishToLive(PortletRequest, portlet);
146            }
147    
148            public static void publishToRemote(PortletRequest PortletRequest)
149                    throws Exception {
150    
151                    getStaging().publishToRemote(PortletRequest);
152            }
153    
154            public static void scheduleCopyFromLive(PortletRequest PortletRequest)
155                    throws Exception {
156    
157                    getStaging().scheduleCopyFromLive(PortletRequest);
158            }
159    
160            public static void schedulePublishToLive(PortletRequest PortletRequest)
161                    throws Exception {
162    
163                    getStaging().schedulePublishToLive(PortletRequest);
164            }
165    
166            public static void schedulePublishToRemote(PortletRequest PortletRequest)
167                    throws Exception {
168    
169                    getStaging().schedulePublishToRemote(PortletRequest);
170            }
171    
172            public static void unscheduleCopyFromLive(PortletRequest PortletRequest)
173                    throws Exception {
174    
175                    getStaging().unscheduleCopyFromLive(PortletRequest);
176            }
177    
178            public static void unschedulePublishToLive(PortletRequest PortletRequest)
179                    throws Exception {
180    
181                    getStaging().unschedulePublishToLive(PortletRequest);
182            }
183    
184            public static void unschedulePublishToRemote(PortletRequest PortletRequest)
185                    throws Exception {
186    
187                    getStaging().unschedulePublishToRemote(PortletRequest);
188            }
189    
190            public static void updateStaging(PortletRequest PortletRequest)
191                    throws Exception {
192    
193                    getStaging().updateStaging(PortletRequest);
194            }
195    
196            public void setStaging(Staging staging) {
197                    _staging = staging;
198            }
199    
200            private static Staging _staging;
201    
202    }