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 As of 6.2.0, replaced by {@link #disableStaging(Group,
078             *             ServiceContext)}
079             */
080            public void disableStaging(
081                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
082                    throws Exception;
083    
084            public void disableStaging(Group liveGroup, ServiceContext serviceContext)
085                    throws Exception;
086    
087            /**
088             * @deprecated As of 6.2.0, replaced by {@link
089             *             #disableStaging(PortletRequest, Group, ServiceContext)}
090             */
091            public void disableStaging(
092                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
093                            ServiceContext serviceContext)
094                    throws Exception;
095    
096            public void disableStaging(
097                            PortletRequest portletRequest, Group liveGroup,
098                            ServiceContext serviceContext)
099                    throws Exception;
100    
101            public void enableLocalStaging(
102                            long userId, Group scopeGroup, Group liveGroup,
103                            boolean branchingPublic, boolean branchingPrivate,
104                            ServiceContext serviceContext)
105                    throws Exception;
106    
107            public void enableRemoteStaging(
108                            long userId, Group scopeGroup, Group liveGroup,
109                            boolean branchingPublic, boolean branchingPrivate,
110                            String remoteAddress, int remotePort, String remotePathContext,
111                            boolean secureConnection, long remoteGroupId,
112                            ServiceContext serviceContext)
113                    throws Exception;
114    
115            public Group getLiveGroup(long groupId)
116                    throws PortalException, SystemException;
117    
118            public long getLiveGroupId(long groupId)
119                    throws PortalException, SystemException;
120    
121            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
122                    throws Exception;
123    
124            public long getRecentLayoutRevisionId(
125                            HttpServletRequest request, long layoutSetBranchId, long plid)
126                    throws PortalException, SystemException;
127    
128            public long getRecentLayoutRevisionId(
129                            User user, long layoutSetBranchId, long plid)
130                    throws PortalException, SystemException;
131    
132            public long getRecentLayoutSetBranchId(
133                    HttpServletRequest request, long layoutSetId);
134    
135            public long getRecentLayoutSetBranchId(User user, long layoutSetId)
136                    throws SystemException;
137    
138            public String getSchedulerGroupName(String destinationName, long groupId);
139    
140            public Map<String, String[]> getStagingParameters();
141    
142            public Map<String, String[]> getStagingParameters(
143                    PortletRequest PortletRequest);
144    
145            public WorkflowTask getWorkflowTask(
146                            long userId, LayoutRevision layoutRevision)
147                    throws PortalException, SystemException;
148    
149            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
150                    throws PortalException, SystemException;
151    
152            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
153    
154            public void publishLayout(
155                            long userId, long plid, long liveGroupId, boolean includeChildren)
156                    throws Exception;
157    
158            public void publishLayouts(
159                            long userId, long sourceGroupId, long targetGroupId,
160                            boolean privateLayout, long[] layoutIds,
161                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
162                    throws Exception;
163    
164            public void publishLayouts(
165                            long userId, long sourceGroupId, long targetGroupId,
166                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
167                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
168                    throws Exception;
169    
170            public void publishLayouts(
171                            long userId, long sourceGroupId, long targetGroupId,
172                            boolean privateLayout, Map<String, String[]> parameterMap,
173                            Date startDate, Date endDate)
174                    throws Exception;
175    
176            public void publishToLive(PortletRequest PortletRequest) throws Exception;
177    
178            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
179                    throws Exception;
180    
181            public void publishToRemote(PortletRequest PortletRequest) throws Exception;
182    
183            public void scheduleCopyFromLive(PortletRequest PortletRequest)
184                    throws Exception;
185    
186            public void schedulePublishToLive(PortletRequest PortletRequest)
187                    throws Exception;
188    
189            public void schedulePublishToRemote(PortletRequest PortletRequest)
190                    throws Exception;
191    
192            public void setRecentLayoutBranchId(
193                            HttpServletRequest request, long layoutSetBranchId, long plid,
194                            long layoutBranchId)
195                    throws SystemException;
196    
197            public void setRecentLayoutBranchId(
198                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
199                    throws SystemException;
200    
201            public void setRecentLayoutRevisionId(
202                            HttpServletRequest request, long layoutSetBranchId, long plid,
203                            long layoutRevisionId)
204                    throws SystemException;
205    
206            public void setRecentLayoutRevisionId(
207                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
208                    throws SystemException;
209    
210            public void setRecentLayoutSetBranchId(
211                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
212    
213            public void setRecentLayoutSetBranchId(
214                            User user, long layoutSetId, long layoutSetBranchId)
215                    throws SystemException;
216    
217            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
218                    throws Exception;
219    
220            public void unschedulePublishToLive(PortletRequest PortletRequest)
221                    throws Exception;
222    
223            public void unschedulePublishToRemote(PortletRequest PortletRequest)
224                    throws Exception;
225    
226            public void updateLastImportSettings(
227                            Element layoutElement, Layout layout,
228                            PortletDataContext portletDataContext)
229                    throws Exception;
230    
231            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
232                    throws Exception;
233    
234    }