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