001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.xml.Element;
021    import com.liferay.portal.model.Group;
022    import com.liferay.portal.model.Layout;
023    import com.liferay.portal.model.Portlet;
024    import com.liferay.portal.model.User;
025    import com.liferay.portal.service.ServiceContext;
026    
027    import java.util.Date;
028    import java.util.List;
029    import java.util.Map;
030    
031    import javax.portlet.PortletRequest;
032    
033    import javax.servlet.http.HttpServletRequest;
034    
035    /**
036     * @author Raymond Augé
037     */
038    public interface Staging {
039    
040            public String buildRemoteURL(
041                    String remoteAddress, int remotePort, boolean secureConnection,
042                    long remoteGroupId, boolean privateLayout);
043    
044            public void copyFromLive(PortletRequest PortletRequest) throws Exception;
045    
046            public void copyFromLive(PortletRequest PortletRequest, Portlet portlet)
047                    throws Exception;
048    
049            public void copyPortlet(
050                            PortletRequest PortletRequest, long sourceGroupId,
051                            long targetGroupId, long sourcePlid, long targetPlid,
052                            String portletId)
053                    throws Exception;
054    
055            public 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            public void deleteLastImportSettings(Group liveGroup, boolean privateLayout)
064                    throws Exception;
065    
066            public void deleteRecentLayoutRevisionId(
067                            HttpServletRequest request, long layoutSetBranchId, long plid)
068                    throws SystemException;
069    
070            public void deleteRecentLayoutRevisionId(
071                            User user, long layoutSetBranchId, long plid)
072                    throws SystemException;
073    
074            public void disableStaging(
075                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
076                    throws Exception;
077    
078            public void disableStaging(
079                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
080                            ServiceContext serviceContext)
081                    throws Exception;
082    
083            public void enableLocalStaging(
084                            long userId, Group scopeGroup, Group liveGroup,
085                            boolean branchingPublic, boolean branchingPrivate,
086                            ServiceContext serviceContext)
087                    throws Exception;
088    
089            public void enableRemoteStaging(
090                            long userId, Group scopeGroup, Group liveGroup,
091                            boolean branchingPublic, boolean branchingPrivate,
092                            String remoteAddress, long remoteGroupId, int remotePort,
093                            boolean secureConnection, ServiceContext serviceContext)
094                    throws Exception;
095    
096            public Group getLiveGroup(long groupId)
097                    throws PortalException, SystemException;
098    
099            public long getLiveGroupId(long groupId)
100                    throws PortalException, SystemException;
101    
102            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
103                    throws Exception;
104    
105            public long getRecentLayoutRevisionId(
106                            HttpServletRequest request, long layoutSetBranchId, long plid)
107                    throws PortalException, SystemException;
108    
109            public long getRecentLayoutRevisionId(
110                            User user, long layoutSetBranchId, long plid)
111                    throws PortalException, SystemException;
112    
113            public long getRecentLayoutSetBranchId(
114                    HttpServletRequest request, long layoutSetId);
115    
116            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
117                    throws SystemException;
118    
119            public String getSchedulerGroupName(String destinationName, long groupId);
120    
121            public Map<String, String[]> getStagingParameters();
122    
123            public Map<String, String[]> getStagingParameters(
124                    PortletRequest PortletRequest);
125    
126            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
127    
128            public void publishLayout(
129                            long userId, long plid, long liveGroupId, boolean includeChildren)
130                    throws Exception;
131    
132            public void publishLayouts(
133                            long userId, long sourceGroupId, long targetGroupId,
134                            boolean privateLayout, long[] layoutIds,
135                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
136                    throws Exception;
137    
138            public void publishLayouts(
139                            long userId, long sourceGroupId, long targetGroupId,
140                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
141                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
142                    throws Exception;
143    
144            public void publishLayouts(
145                            long userId, long sourceGroupId, long targetGroupId,
146                            boolean privateLayout, Map<String, String[]> parameterMap,
147                            Date startDate, Date endDate)
148                    throws Exception;
149    
150            public void publishToLive(PortletRequest PortletRequest) throws Exception;
151    
152            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
153                    throws Exception;
154    
155            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
156    
157            public void scheduleCopyFromLive(PortletRequest PortletRequest)
158                    throws Exception;
159    
160            public void schedulePublishToLive(PortletRequest PortletRequest)
161                    throws Exception;
162    
163            public void schedulePublishToRemote(PortletRequest PortletRequest)
164                    throws Exception;
165    
166            public void setRecentLayoutBranchId(
167                            HttpServletRequest request, long layoutSetBranchId, long plid,
168                            long layoutBranchId)
169                    throws SystemException;
170    
171            public void setRecentLayoutBranchId(
172                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
173                    throws SystemException;
174    
175            public void setRecentLayoutRevisionId(
176                            HttpServletRequest request, long layoutSetBranchId, long plid,
177                            long layoutRevisionId)
178                    throws SystemException;
179    
180            public void setRecentLayoutRevisionId(
181                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
182                    throws SystemException;
183    
184            public void setRecentLayoutSetBranchId(
185                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
186    
187            public void setRecentLayoutSetBranchId(
188                            User user, long layoutSetId, long layoutSetBranchId)
189                    throws SystemException;
190    
191            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
192                    throws Exception;
193    
194            public void unschedulePublishToLive(PortletRequest PortletRequest)
195                    throws Exception;
196    
197            public void unschedulePublishToRemote(PortletRequest PortletRequest)
198                    throws Exception;
199    
200            public void updateLastImportSettings(
201                            Element layoutElement, Layout layout,
202                            PortletDataContext portletDataContext)
203                    throws Exception;
204    
205            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
206                    throws Exception;
207    
208    }