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.portlet.exportimport.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.util.UnicodeProperties;
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    import com.liferay.portlet.exportimport.lar.MissingReference;
032    import com.liferay.portlet.exportimport.lar.PortletDataContext;
033    import com.liferay.portlet.exportimport.model.ExportImportConfiguration;
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.portlet.exportimport.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            /**
079             * @deprecated As of 7.0.0, replaced by {@link #publishPortlet(long, long,
080             *             long, long, long, String, Map)}
081             */
082            @Deprecated
083            public void copyPortlet(
084                            PortletRequest PortletRequest, long sourceGroupId,
085                            long targetGroupId, long sourcePlid, long targetPlid,
086                            String portletId)
087                    throws PortalException;
088    
089            public void copyRemoteLayouts(
090                            ExportImportConfiguration exportImportConfiguration)
091                    throws PortalException;
092    
093            public void copyRemoteLayouts(long exportImportConfigurationId)
094                    throws PortalException;
095    
096            public void copyRemoteLayouts(
097                            long sourceGroupId, boolean privateLayout,
098                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
099                            String remoteAddress, int remotePort, String remotePathContext,
100                            boolean secureConnection, long remoteGroupId,
101                            boolean remotePrivateLayout)
102                    throws PortalException;
103    
104            /**
105             * @deprecated As of 7.0.0, replaced by {@link #copyRemoteLayouts(long,
106             *             boolean, Map, Map, String, int, String, boolean, long,
107             *             boolean)}
108             */
109            @Deprecated
110            public void copyRemoteLayouts(
111                            long sourceGroupId, boolean privateLayout,
112                            Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap,
113                            String remoteAddress, int remotePort, String remotePathContext,
114                            boolean secureConnection, long remoteGroupId,
115                            boolean remotePrivateLayout, Date startDate, Date endDate)
116                    throws PortalException;
117    
118            public void deleteLastImportSettings(Group liveGroup, boolean privateLayout)
119                    throws PortalException;
120    
121            public void deleteRecentLayoutRevisionId(
122                    HttpServletRequest request, long layoutSetBranchId, long plid);
123    
124            public void deleteRecentLayoutRevisionId(
125                    long userId, long layoutSetBranchId, long plid);
126    
127            /**
128             * @deprecated As of 7.0.0, replaced by {@link
129             *             #deleteRecentLayoutRevisionId(long, long, long)}
130             */
131            @Deprecated
132            public void deleteRecentLayoutRevisionId(
133                    User user, long layoutSetBranchId, long plid);
134    
135            /**
136             * @deprecated As of 6.2.0, replaced by {@link
137             *             com.liferay.portlet.exportimport.service.StagingLocalService#disableStaging(
138             *             Group, ServiceContext)}
139             */
140            @Deprecated
141            public void disableStaging(
142                            Group scopeGroup, Group liveGroup, ServiceContext serviceContext)
143                    throws Exception;
144    
145            /**
146             * @deprecated As of 6.2.0, replaced by {@link
147             *             com.liferay.portlet.exportimport.service.StagingLocalService#disableStaging(
148             *             Group, ServiceContext)}
149             */
150            @Deprecated
151            public void disableStaging(Group liveGroup, ServiceContext serviceContext)
152                    throws Exception;
153    
154            /**
155             * @deprecated As of 6.2.0, replaced by {@link
156             *             com.liferay.portlet.exportimport.service.StagingLocalService#disableStaging(
157             *             PortletRequest, Group, ServiceContext)}
158             */
159            @Deprecated
160            public void disableStaging(
161                            PortletRequest portletRequest, Group scopeGroup, Group liveGroup,
162                            ServiceContext serviceContext)
163                    throws Exception;
164    
165            /**
166             * @deprecated As of 6.2.0, replaced by {@link
167             *             com.liferay.portlet.exportimport.service.StagingLocalService#disableStaging(
168             *             PortletRequest, Group, ServiceContext)}
169             */
170            @Deprecated
171            public void disableStaging(
172                            PortletRequest portletRequest, Group liveGroup,
173                            ServiceContext serviceContext)
174                    throws Exception;
175    
176            /**
177             * @deprecated As of 6.2.0, replaced by {@link
178             *             com.liferay.portlet.exportimport.service.StagingLocalService#enableLocalStaging(
179             *             long, Group, boolean, boolean, ServiceContext)}
180             */
181            @Deprecated
182            public void enableLocalStaging(
183                            long userId, Group scopeGroup, Group liveGroup,
184                            boolean branchingPublic, boolean branchingPrivate,
185                            ServiceContext serviceContext)
186                    throws Exception;
187    
188            /**
189             * @deprecated As of 6.2.0, replaced by {@link
190             *             com.liferay.portlet.exportimport.service.StagingLocalService#enableRemoteStaging(
191             *             long, Group, boolean, boolean, String, int, String, boolean,
192             *             long, ServiceContext)}
193             */
194            @Deprecated
195            public void enableRemoteStaging(
196                            long userId, Group scopeGroup, Group liveGroup,
197                            boolean branchingPublic, boolean branchingPrivate,
198                            String remoteAddress, int remotePort, String remotePathContext,
199                            boolean secureConnection, long remoteGroupId,
200                            ServiceContext serviceContext)
201                    throws Exception;
202    
203            public JSONArray getErrorMessagesJSONArray(
204                    Locale locale, Map<String, MissingReference> missingReferences,
205                    Map<String, Serializable> contextMap);
206    
207            public JSONObject getExceptionMessagesJSONObject(
208                    Locale locale, Exception e, Map<String, Serializable> contextMap);
209    
210            public Group getLiveGroup(long groupId);
211    
212            public long getLiveGroupId(long groupId);
213    
214            /**
215             * @deprecated As of 7.0.0, moved to {@link
216             *             com.liferay.portlet.exportimport.lar.ExportImportHelperUtil#getMissingParentLayouts(
217             *             Layout, long)}
218             */
219            @Deprecated
220            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
221                    throws PortalException;
222    
223            public long getRecentLayoutRevisionId(
224                            HttpServletRequest request, long layoutSetBranchId, long plid)
225                    throws PortalException;
226    
227            public long getRecentLayoutRevisionId(
228                            User user, long layoutSetBranchId, long plid)
229                    throws PortalException;
230    
231            public long getRecentLayoutSetBranchId(
232                    HttpServletRequest request, long layoutSetId);
233    
234            public long getRecentLayoutSetBranchId(User user, long layoutSetId);
235    
236            public String getSchedulerGroupName(String destinationName, long groupId);
237    
238            public String getStagedPortletId(String portletId);
239    
240            public Group getStagingGroup(long groupId);
241    
242            /**
243             * @deprecated As of 7.0.0, replaced by {@link
244             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
245             *             )}
246             */
247            @Deprecated
248            public Map<String, String[]> getStagingParameters();
249    
250            /**
251             * @deprecated As of 7.0.0, replaced by {@link
252             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
253             *             PortletRequest)}
254             */
255            @Deprecated
256            public Map<String, String[]> getStagingParameters(
257                    PortletRequest PortletRequest);
258    
259            public JSONArray getWarningMessagesJSONArray(
260                    Locale locale, Map<String, MissingReference> missingReferences,
261                    Map<String, Serializable> contextMap);
262    
263            public WorkflowTask getWorkflowTask(
264                            long userId, LayoutRevision layoutRevision)
265                    throws PortalException;
266    
267            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
268                    throws PortalException;
269    
270            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
271    
272            /**
273             * @deprecated As of 7.0.0, see {@link
274             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
275             *             )}
276             */
277            @Deprecated
278            public void lockGroup(long userId, long groupId) throws PortalException;
279    
280            public void publishLayout(
281                            long userId, long plid, long liveGroupId, boolean includeChildren)
282                    throws PortalException;
283    
284            public void publishLayouts(
285                            long userId, ExportImportConfiguration exportImportConfiguration)
286                    throws PortalException;
287    
288            public void publishLayouts(long userId, long exportImportConfigurationId)
289                    throws PortalException;
290    
291            public void publishLayouts(
292                            long userId, long sourceGroupId, long targetGroupId,
293                            boolean privateLayout, long[] layoutIds,
294                            Map<String, String[]> parameterMap)
295                    throws PortalException;
296    
297            /**
298             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
299             *             long, boolean, long[], Map)}
300             */
301            @Deprecated
302            public void publishLayouts(
303                            long userId, long sourceGroupId, long targetGroupId,
304                            boolean privateLayout, long[] layoutIds,
305                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
306                    throws PortalException;
307    
308            /**
309             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
310             *             long, boolean, long[], Map)}
311             */
312            @Deprecated
313            public void publishLayouts(
314                            long userId, long sourceGroupId, long targetGroupId,
315                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
316                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
317                    throws PortalException;
318    
319            public void publishLayouts(
320                            long userId, long sourceGroupId, long targetGroupId,
321                            boolean privateLayout, Map<String, String[]> parameterMap)
322                    throws PortalException;
323    
324            /**
325             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
326             *             long, boolean, Map)}
327             */
328            @Deprecated
329            public void publishLayouts(
330                            long userId, long sourceGroupId, long targetGroupId,
331                            boolean privateLayout, Map<String, String[]> parameterMap,
332                            Date startDate, Date endDate)
333                    throws PortalException;
334    
335            public void publishPortlet(
336                            long userId, ExportImportConfiguration exportImportConfiguration)
337                    throws PortalException;
338    
339            public void publishPortlet(long userId, long exportImportConfigurationId)
340                    throws PortalException;
341    
342            public void publishPortlet(
343                            long userId, long sourceGroupId, long targetGroupId,
344                            long sourcePlid, long targetPlid, String portletId,
345                            Map<String, String[]> parameterMap)
346                    throws PortalException;
347    
348            public void publishToLive(PortletRequest PortletRequest)
349                    throws PortalException;
350    
351            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
352                    throws PortalException;
353    
354            public void publishToRemote(PortletRequest PortletRequest)
355                    throws PortalException;
356    
357            public void scheduleCopyFromLive(PortletRequest PortletRequest)
358                    throws PortalException;
359    
360            public void schedulePublishToLive(PortletRequest PortletRequest)
361                    throws PortalException;
362    
363            public void schedulePublishToRemote(PortletRequest PortletRequest)
364                    throws PortalException;
365    
366            public void setRecentLayoutBranchId(
367                    HttpServletRequest request, long layoutSetBranchId, long plid,
368                    long layoutBranchId);
369    
370            public void setRecentLayoutBranchId(
371                    User user, long layoutSetBranchId, long plid, long layoutBranchId);
372    
373            public void setRecentLayoutRevisionId(
374                    HttpServletRequest request, long layoutSetBranchId, long plid,
375                    long layoutRevisionId);
376    
377            public void setRecentLayoutRevisionId(
378                    User user, long layoutSetBranchId, long plid, long layoutRevisionId);
379    
380            public void setRecentLayoutSetBranchId(
381                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
382    
383            public void setRecentLayoutSetBranchId(
384                    User user, long layoutSetId, long layoutSetBranchId);
385    
386            public String stripProtocolFromRemoteAddress(String remoteAddress);
387    
388            /**
389             * @deprecated As of 7.0.0, see {@link
390             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
391             *             )}
392             */
393            @Deprecated
394            public void unlockGroup(long groupId);
395    
396            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
397                    throws PortalException;
398    
399            public void unschedulePublishToLive(PortletRequest PortletRequest)
400                    throws PortalException;
401    
402            public void unschedulePublishToRemote(PortletRequest PortletRequest)
403                    throws PortalException;
404    
405            public void updateLastImportSettings(
406                            Element layoutElement, Layout layout,
407                            PortletDataContext portletDataContext)
408                    throws PortalException;
409    
410            /**
411             * @deprecated As of 7.0.0, replaced by {@link
412             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
413             *             long, boolean, com.liferay.portal.kernel.util.DateRange,
414             *             Date)}
415             */
416            @Deprecated
417            public void updateLastPublishDate(
418                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
419                    throws PortalException;
420    
421            /**
422             * @deprecated As of 7.0.0, replaced by {@link
423             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
424             *             String, PortletPreferences,
425             *             com.liferay.portal.kernel.util.DateRange, Date)}
426             */
427            @Deprecated
428            public void updateLastPublishDate(
429                            String portletId, PortletPreferences portletPreferences,
430                            Date lastPublishDate)
431                    throws PortalException;
432    
433            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
434                    throws PortalException;
435    
436            public void validateRemote(
437                            long groupId, String remoteAddress, int remotePort,
438                            String remotePathContext, boolean secureConnection,
439                            long remoteGroupId)
440                    throws PortalException;
441    
442            /**
443             * @deprecated As of 7.0.0, replaced by {@link #validateRemote(long, String,
444             *             int, String, boolean, long)}
445             */
446            @Deprecated
447            public void validateRemote(
448                            String remoteAddress, int remotePort, String remotePathContext,
449                            boolean secureConnection, long remoteGroupId)
450                    throws PortalException;
451    
452    }