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