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