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