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