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    
206            /**
207             * @deprecated As of 7.0.0, replaced by {@link
208             *             #getErrorMessagesJSONArray(Locale, Map<String,
209             *             MissingReference>)}
210             */
211            @Deprecated
212            public JSONArray getErrorMessagesJSONArray(
213                    Locale locale, Map<String, MissingReference> missingReferences,
214                    Map<String, Serializable> contextMap);
215    
216            public JSONObject getExceptionMessagesJSONObject(
217                    Locale locale, Exception e,
218                    ExportImportConfiguration exportImportConfiguration);
219    
220            /**
221             * @deprecated As of 7.0.0, replaced by {@link
222             *             #getExceptionMessagesJSONObject(Locale, Exception,
223             *             ExportImportConfiguration)}
224             */
225            @Deprecated
226            public JSONObject getExceptionMessagesJSONObject(
227                    Locale locale, Exception e, Map<String, Serializable> contextMap);
228    
229            public Group getLiveGroup(long groupId);
230    
231            public long getLiveGroupId(long groupId);
232    
233            /**
234             * @deprecated As of 7.0.0, moved to {@link
235             *             com.liferay.portlet.exportimport.lar.ExportImportHelperUtil#getMissingParentLayouts(
236             *             Layout, long)}
237             */
238            @Deprecated
239            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
240                    throws PortalException;
241    
242            public long getRecentLayoutRevisionId(
243                            HttpServletRequest request, long layoutSetBranchId, long plid)
244                    throws PortalException;
245    
246            public long getRecentLayoutRevisionId(
247                            User user, long layoutSetBranchId, long plid)
248                    throws PortalException;
249    
250            public long getRecentLayoutSetBranchId(
251                    HttpServletRequest request, long layoutSetId);
252    
253            public long getRecentLayoutSetBranchId(User user, long layoutSetId);
254    
255            public String getSchedulerGroupName(String destinationName, long groupId);
256    
257            public String getStagedPortletId(String portletId);
258    
259            public Group getStagingGroup(long groupId);
260    
261            /**
262             * @deprecated As of 7.0.0, replaced by {@link
263             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
264             *             )}
265             */
266            @Deprecated
267            public Map<String, String[]> getStagingParameters();
268    
269            /**
270             * @deprecated As of 7.0.0, replaced by {@link
271             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
272             *             PortletRequest)}
273             */
274            @Deprecated
275            public Map<String, String[]> getStagingParameters(
276                    PortletRequest PortletRequest);
277    
278            public JSONArray getWarningMessagesJSONArray(
279                    Locale locale, Map<String, MissingReference> missingReferences);
280    
281            /**
282             * @deprecated As of 7.0.0, replaced by {@link
283             *             #getWarningMessagesJSONArray(Locale, Map<String,
284             *             MissingReference>)}
285             */
286            @Deprecated
287            public JSONArray getWarningMessagesJSONArray(
288                    Locale locale, Map<String, MissingReference> missingReferences,
289                    Map<String, Serializable> contextMap);
290    
291            public WorkflowTask getWorkflowTask(
292                            long userId, LayoutRevision layoutRevision)
293                    throws PortalException;
294    
295            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
296                    throws PortalException;
297    
298            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
299    
300            /**
301             * @deprecated As of 7.0.0, see {@link
302             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
303             *             )}
304             */
305            @Deprecated
306            public void lockGroup(long userId, long groupId) throws PortalException;
307    
308            public void publishLayout(
309                            long userId, long plid, long liveGroupId, boolean includeChildren)
310                    throws PortalException;
311    
312            public void publishLayouts(
313                            long userId, ExportImportConfiguration exportImportConfiguration)
314                    throws PortalException;
315    
316            public void publishLayouts(long userId, long exportImportConfigurationId)
317                    throws PortalException;
318    
319            public void publishLayouts(
320                            long userId, long sourceGroupId, long targetGroupId,
321                            boolean privateLayout, long[] layoutIds,
322                            Map<String, String[]> parameterMap)
323                    throws PortalException;
324    
325            /**
326             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
327             *             long, boolean, long[], Map)}
328             */
329            @Deprecated
330            public void publishLayouts(
331                            long userId, long sourceGroupId, long targetGroupId,
332                            boolean privateLayout, long[] layoutIds,
333                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
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, Map<Long, Boolean> layoutIdMap,
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, Map<String, String[]> parameterMap)
350                    throws PortalException;
351    
352            /**
353             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
354             *             long, boolean, Map)}
355             */
356            @Deprecated
357            public void publishLayouts(
358                            long userId, long sourceGroupId, long targetGroupId,
359                            boolean privateLayout, Map<String, String[]> parameterMap,
360                            Date startDate, Date endDate)
361                    throws PortalException;
362    
363            public void publishPortlet(
364                            long userId, ExportImportConfiguration exportImportConfiguration)
365                    throws PortalException;
366    
367            public void publishPortlet(long userId, long exportImportConfigurationId)
368                    throws PortalException;
369    
370            public void publishPortlet(
371                            long userId, long sourceGroupId, long targetGroupId,
372                            long sourcePlid, long targetPlid, String portletId,
373                            Map<String, String[]> parameterMap)
374                    throws PortalException;
375    
376            public void publishToLive(PortletRequest PortletRequest)
377                    throws PortalException;
378    
379            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
380                    throws PortalException;
381    
382            public void publishToRemote(PortletRequest PortletRequest)
383                    throws PortalException;
384    
385            public void scheduleCopyFromLive(PortletRequest PortletRequest)
386                    throws PortalException;
387    
388            public void schedulePublishToLive(PortletRequest PortletRequest)
389                    throws PortalException;
390    
391            public void schedulePublishToRemote(PortletRequest PortletRequest)
392                    throws PortalException;
393    
394            public void setRecentLayoutBranchId(
395                    HttpServletRequest request, long layoutSetBranchId, long plid,
396                    long layoutBranchId);
397    
398            public void setRecentLayoutBranchId(
399                    User user, long layoutSetBranchId, long plid, long layoutBranchId);
400    
401            public void setRecentLayoutRevisionId(
402                    HttpServletRequest request, long layoutSetBranchId, long plid,
403                    long layoutRevisionId);
404    
405            public void setRecentLayoutRevisionId(
406                    User user, long layoutSetBranchId, long plid, long layoutRevisionId);
407    
408            public void setRecentLayoutSetBranchId(
409                    HttpServletRequest request, long layoutSetId, long layoutSetBranchId);
410    
411            public void setRecentLayoutSetBranchId(
412                    User user, long layoutSetId, long layoutSetBranchId);
413    
414            public String stripProtocolFromRemoteAddress(String remoteAddress);
415    
416            /**
417             * @deprecated As of 7.0.0, see {@link
418             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
419             *             )}
420             */
421            @Deprecated
422            public void unlockGroup(long groupId);
423    
424            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
425                    throws PortalException;
426    
427            public void unschedulePublishToLive(PortletRequest PortletRequest)
428                    throws PortalException;
429    
430            public void unschedulePublishToRemote(PortletRequest PortletRequest)
431                    throws PortalException;
432    
433            public void updateLastImportSettings(
434                            Element layoutElement, Layout layout,
435                            PortletDataContext portletDataContext)
436                    throws PortalException;
437    
438            /**
439             * @deprecated As of 7.0.0, replaced by {@link
440             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
441             *             long, boolean, com.liferay.portal.kernel.util.DateRange,
442             *             Date)}
443             */
444            @Deprecated
445            public void updateLastPublishDate(
446                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
447                    throws PortalException;
448    
449            /**
450             * @deprecated As of 7.0.0, replaced by {@link
451             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
452             *             String, PortletPreferences,
453             *             com.liferay.portal.kernel.util.DateRange, Date)}
454             */
455            @Deprecated
456            public void updateLastPublishDate(
457                            String portletId, PortletPreferences portletPreferences,
458                            Date lastPublishDate)
459                    throws PortalException;
460    
461            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
462                    throws PortalException;
463    
464            public void validateRemote(
465                            long groupId, String remoteAddress, int remotePort,
466                            String remotePathContext, boolean secureConnection,
467                            long remoteGroupId)
468                    throws PortalException;
469    
470            /**
471             * @deprecated As of 7.0.0, replaced by {@link #validateRemote(long, String,
472             *             int, String, boolean, long)}
473             */
474            @Deprecated
475            public void validateRemote(
476                            String remoteAddress, int remotePort, String remotePathContext,
477                            boolean secureConnection, long remoteGroupId)
478                    throws PortalException;
479    
480    }