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