001    /**
002     * Copyright (c) 2000-2013 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.workflow.WorkflowTask;
021    import com.liferay.portal.kernel.xml.Element;
022    import com.liferay.portal.model.Group;
023    import com.liferay.portal.model.Layout;
024    import com.liferay.portal.model.LayoutRevision;
025    import com.liferay.portal.model.Portlet;
026    import com.liferay.portal.model.User;
027    import com.liferay.portal.service.ServiceContext;
028    
029    import java.util.Date;
030    import java.util.List;
031    import java.util.Map;
032    
033    import javax.portlet.PortletRequest;
034    
035    import javax.servlet.http.HttpServletRequest;
036    
037    /**
038     * @author Raymond Aug??
039     */
040    public interface Staging {
041    
042            public String buildRemoteURL(
043                    String remoteAddress, int remotePort, String remotePathContext,
044                    boolean secureConnection, long remoteGroupId, boolean privateLayout);
045    
046            public void copyFromLive(PortletRequest PortletRequest) throws Exception;
047    
048            public void copyFromLive(PortletRequest PortletRequest, Portlet portlet)
049                    throws Exception;
050    
051            public void copyPortlet(
052                            PortletRequest PortletRequest, long sourceGroupId,
053                            long targetGroupId, long sourcePlid, long targetPlid,
054                            String portletId)
055                    throws Exception;
056    
057            public void copyRemoteLayouts(
058                            long sourceGroupId, boolean privateLayout,
059                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
060                            String remoteAddress, int remotePort, String remotePathContext,
061                            boolean secureConnection, long remoteGroupId,
062                            boolean remotePrivateLayout, Date startDate, Date endDate)
063                    throws Exception;
064    
065            public void deleteLastImportSettings(Group liveGroup, boolean privateLayout)
066                    throws Exception;
067    
068            public void deleteRecentLayoutRevisionId(
069                            HttpServletRequest request, long layoutSetBranchId, long plid)
070                    throws SystemException;
071    
072            public void deleteRecentLayoutRevisionId(
073                            User user, long layoutSetBranchId, long plid)
074                    throws SystemException;
075    
076            /**
077             * @deprecated {@link #disableStaging(Group, ServiceContext)}
078             */
079            public void disableStaging(
080                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
081                    throws Exception;
082    
083            public void disableStaging(Group liveGroup, ServiceContext serviceContext)
084                    throws Exception;
085    
086            /**
087             * @deprecated {@link #disableStaging(PortletRequest, Group,
088             *             ServiceContext)}
089             */
090            public void disableStaging(
091                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
092                            ServiceContext serviceContext)
093                    throws Exception;
094    
095            public void disableStaging(
096                            PortletRequest portletRequest, Group liveGroup,
097                            ServiceContext serviceContext)
098                    throws Exception;
099    
100            public void enableLocalStaging(
101                            long userId, Group scopeGroup, Group liveGroup,
102                            boolean branchingPublic, boolean branchingPrivate,
103                            ServiceContext serviceContext)
104                    throws Exception;
105    
106            public void enableRemoteStaging(
107                            long userId, Group scopeGroup, Group liveGroup,
108                            boolean branchingPublic, boolean branchingPrivate,
109                            String remoteAddress, int remotePort, String remotePathContext,
110                            boolean secureConnection, long remoteGroupId,
111                            ServiceContext serviceContext)
112                    throws Exception;
113    
114            public Group getLiveGroup(long groupId)
115                    throws PortalException, SystemException;
116    
117            public long getLiveGroupId(long groupId)
118                    throws PortalException, SystemException;
119    
120            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
121                    throws Exception;
122    
123            public long getRecentLayoutRevisionId(
124                            HttpServletRequest request, long layoutSetBranchId, long plid)
125                    throws PortalException, SystemException;
126    
127            public long getRecentLayoutRevisionId(
128                            User user, long layoutSetBranchId, long plid)
129                    throws PortalException, SystemException;
130    
131            public long getRecentLayoutSetBranchId(
132                    HttpServletRequest request, long layoutSetId);
133    
134            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
135                    throws SystemException;
136    
137            public String getSchedulerGroupName(String destinationName, long groupId);
138    
139            public Map<String, String[]> getStagingParameters();
140    
141            public Map<String, String[]> getStagingParameters(
142                    PortletRequest PortletRequest);
143    
144            public WorkflowTask getWorkflowTask(
145                            long userId, LayoutRevision layoutRevision)
146                    throws PortalException, SystemException;
147    
148            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
149                    throws PortalException, SystemException;
150    
151            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
152    
153            public void publishLayout(
154                            long userId, long plid, long liveGroupId, boolean includeChildren)
155                    throws Exception;
156    
157            public void publishLayouts(
158                            long userId, long sourceGroupId, long targetGroupId,
159                            boolean privateLayout, long[] layoutIds,
160                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
161                    throws Exception;
162    
163            public void publishLayouts(
164                            long userId, long sourceGroupId, long targetGroupId,
165                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
166                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
167                    throws Exception;
168    
169            public void publishLayouts(
170                            long userId, long sourceGroupId, long targetGroupId,
171                            boolean privateLayout, Map<String, String[]> parameterMap,
172                            Date startDate, Date endDate)
173                    throws Exception;
174    
175            public void publishToLive(PortletRequest PortletRequest) throws Exception;
176    
177            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
178                    throws Exception;
179    
180            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
181    
182            public void scheduleCopyFromLive(PortletRequest PortletRequest)
183                    throws Exception;
184    
185            public void schedulePublishToLive(PortletRequest PortletRequest)
186                    throws Exception;
187    
188            public void schedulePublishToRemote(PortletRequest PortletRequest)
189                    throws Exception;
190    
191            public void setRecentLayoutBranchId(
192                            HttpServletRequest request, long layoutSetBranchId, long plid,
193                            long layoutBranchId)
194                    throws SystemException;
195    
196            public void setRecentLayoutBranchId(
197                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
198                    throws SystemException;
199    
200            public void setRecentLayoutRevisionId(
201                            HttpServletRequest request, long layoutSetBranchId, long plid,
202                            long layoutRevisionId)
203                    throws SystemException;
204    
205            public void setRecentLayoutRevisionId(
206                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
207                    throws SystemException;
208    
209            public void setRecentLayoutSetBranchId(
210                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
211    
212            public void setRecentLayoutSetBranchId(
213                            User user, long layoutSetId, long layoutSetBranchId)
214                    throws SystemException;
215    
216            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
217                    throws Exception;
218    
219            public void unschedulePublishToLive(PortletRequest PortletRequest)
220                    throws Exception;
221    
222            public void unschedulePublishToRemote(PortletRequest PortletRequest)
223                    throws Exception;
224    
225            public void updateLastImportSettings(
226                            Element layoutElement, Layout layout,
227                            PortletDataContext portletDataContext)
228                    throws Exception;
229    
230            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
231                    throws Exception;
232    
233    }