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            public JSONArray getErrorMessagesJSONArray(
153                    Locale locale, Map<String, MissingReference> missingReferences);
154    
155            /**
156             * @deprecated As of 7.0.0, replaced by {@link
157             *             #getErrorMessagesJSONArray(Locale, Map<String,
158             *             MissingReference>)}
159             */
160            @Deprecated
161            public JSONArray getErrorMessagesJSONArray(
162                    Locale locale, Map<String, MissingReference> missingReferences,
163                    Map<String, Serializable> contextMap);
164    
165            public JSONObject getExceptionMessagesJSONObject(
166                    Locale locale, Exception e,
167                    ExportImportConfiguration exportImportConfiguration);
168    
169            /**
170             * @deprecated As of 7.0.0, replaced by {@link
171             *             #getExceptionMessagesJSONObject(Locale, Exception,
172             *             ExportImportConfiguration)}
173             */
174            @Deprecated
175            public JSONObject getExceptionMessagesJSONObject(
176                    Locale locale, Exception e, Map<String, Serializable> contextMap);
177    
178            public Group getLiveGroup(long groupId);
179    
180            public long getLiveGroupId(long groupId);
181    
182            /**
183             * @deprecated As of 7.0.0, moved to {@link
184             *             com.liferay.portlet.exportimport.lar.ExportImportHelperUtil#getMissingParentLayouts(
185             *             Layout, long)}
186             */
187            @Deprecated
188            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
189                    throws PortalException;
190    
191            public long getRecentLayoutRevisionId(
192                            HttpServletRequest request, long layoutSetBranchId, long plid)
193                    throws PortalException;
194    
195            public long getRecentLayoutRevisionId(
196                            User user, long layoutSetBranchId, long plid)
197                    throws PortalException;
198    
199            public long getRecentLayoutSetBranchId(
200                    HttpServletRequest request, long layoutSetId);
201    
202            public long getRecentLayoutSetBranchId(User user, long layoutSetId);
203    
204            public String getRemoteSiteURL(Group stagingGroup, boolean privateLayout)
205                    throws PortalException;
206    
207            public String getSchedulerGroupName(String destinationName, long groupId);
208    
209            public String getStagedPortletId(String portletId);
210    
211            public long[] getStagingAndLiveGroupIds(long groupId)
212                    throws PortalException;
213    
214            public Group getStagingGroup(long groupId);
215    
216            /**
217             * @deprecated As of 7.0.0, replaced by {@link
218             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
219             *             )}
220             */
221            @Deprecated
222            public Map<String, String[]> getStagingParameters();
223    
224            /**
225             * @deprecated As of 7.0.0, replaced by {@link
226             *             com.liferay.portlet.exportimport.configuration.ExportImportConfigurationParameterMapFactory#buildParameterMap(
227             *             PortletRequest)}
228             */
229            @Deprecated
230            public Map<String, String[]> getStagingParameters(
231                    PortletRequest PortletRequest);
232    
233            public JSONArray getWarningMessagesJSONArray(
234                    Locale locale, Map<String, MissingReference> missingReferences);
235    
236            /**
237             * @deprecated As of 7.0.0, replaced by {@link
238             *             #getWarningMessagesJSONArray(Locale, Map<String,
239             *             MissingReference>)}
240             */
241            @Deprecated
242            public JSONArray getWarningMessagesJSONArray(
243                    Locale locale, Map<String, MissingReference> missingReferences,
244                    Map<String, Serializable> contextMap);
245    
246            public WorkflowTask getWorkflowTask(
247                            long userId, LayoutRevision layoutRevision)
248                    throws PortalException;
249    
250            public boolean hasWorkflowTask(long userId, LayoutRevision layoutRevision)
251                    throws PortalException;
252    
253            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
254    
255            /**
256             * @deprecated As of 7.0.0, see {@link
257             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
258             *             )}
259             */
260            @Deprecated
261            public void lockGroup(long userId, long groupId) throws PortalException;
262    
263            public void publishLayout(
264                            long userId, long plid, long liveGroupId, boolean includeChildren)
265                    throws PortalException;
266    
267            public void publishLayouts(
268                            long userId, ExportImportConfiguration exportImportConfiguration)
269                    throws PortalException;
270    
271            public void publishLayouts(long userId, long exportImportConfigurationId)
272                    throws PortalException;
273    
274            public void publishLayouts(
275                            long userId, long sourceGroupId, long targetGroupId,
276                            boolean privateLayout, long[] layoutIds,
277                            Map<String, String[]> parameterMap)
278                    throws PortalException;
279    
280            /**
281             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
282             *             long, boolean, long[], Map)}
283             */
284            @Deprecated
285            public void publishLayouts(
286                            long userId, long sourceGroupId, long targetGroupId,
287                            boolean privateLayout, long[] layoutIds,
288                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
289                    throws PortalException;
290    
291            public void publishLayouts(
292                            long userId, long sourceGroupId, long targetGroupId,
293                            boolean privateLayout, long[] layoutIds, String name,
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, Map<Long, Boolean> layoutIdMap,
305                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
306                    throws PortalException;
307    
308            public void publishLayouts(
309                            long userId, long sourceGroupId, long targetGroupId,
310                            boolean privateLayout, Map<String, String[]> parameterMap)
311                    throws PortalException;
312    
313            /**
314             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
315             *             long, boolean, Map)}
316             */
317            @Deprecated
318            public void publishLayouts(
319                            long userId, long sourceGroupId, long targetGroupId,
320                            boolean privateLayout, Map<String, String[]> parameterMap,
321                            Date startDate, Date endDate)
322                    throws PortalException;
323    
324            public void publishPortlet(
325                            long userId, ExportImportConfiguration exportImportConfiguration)
326                    throws PortalException;
327    
328            public void publishPortlet(long userId, long exportImportConfigurationId)
329                    throws PortalException;
330    
331            public void publishPortlet(
332                            long userId, long sourceGroupId, long targetGroupId,
333                            long sourcePlid, long targetPlid, String portletId,
334                            Map<String, String[]> parameterMap)
335                    throws PortalException;
336    
337            public void publishToLive(PortletRequest PortletRequest)
338                    throws PortalException;
339    
340            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
341                    throws PortalException;
342    
343            public void publishToRemote(PortletRequest PortletRequest)
344                    throws PortalException;
345    
346            public void scheduleCopyFromLive(PortletRequest PortletRequest)
347                    throws PortalException;
348    
349            public void schedulePublishToLive(PortletRequest PortletRequest)
350                    throws PortalException;
351    
352            public void schedulePublishToRemote(PortletRequest PortletRequest)
353                    throws PortalException;
354    
355            public void setRecentLayoutBranchId(
356                            HttpServletRequest request, long layoutSetBranchId, long plid,
357                            long layoutBranchId)
358                    throws PortalException;
359    
360            public void setRecentLayoutBranchId(
361                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
362                    throws PortalException;
363    
364            public void setRecentLayoutRevisionId(
365                            HttpServletRequest request, long layoutSetBranchId, long plid,
366                            long layoutRevisionId)
367                    throws PortalException;
368    
369            public void setRecentLayoutRevisionId(
370                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
371                    throws PortalException;
372    
373            public void setRecentLayoutSetBranchId(
374                            HttpServletRequest request, long layoutSetId,
375                            long layoutSetBranchId)
376                    throws PortalException;
377    
378            public void setRecentLayoutSetBranchId(
379                            User user, long layoutSetId, long layoutSetBranchId)
380                    throws PortalException;
381    
382            public String stripProtocolFromRemoteAddress(String remoteAddress);
383    
384            /**
385             * @deprecated As of 7.0.0, see {@link
386             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
387             *             )}
388             */
389            @Deprecated
390            public void unlockGroup(long groupId);
391    
392            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
393                    throws PortalException;
394    
395            public void unschedulePublishToLive(PortletRequest PortletRequest)
396                    throws PortalException;
397    
398            public void unschedulePublishToRemote(PortletRequest PortletRequest)
399                    throws PortalException;
400    
401            public void updateLastImportSettings(
402                            Element layoutElement, Layout layout,
403                            PortletDataContext portletDataContext)
404                    throws PortalException;
405    
406            /**
407             * @deprecated As of 7.0.0, replaced by {@link
408             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
409             *             long, boolean, com.liferay.portal.kernel.util.DateRange,
410             *             Date)}
411             */
412            @Deprecated
413            public void updateLastPublishDate(
414                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
415                    throws PortalException;
416    
417            /**
418             * @deprecated As of 7.0.0, replaced by {@link
419             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
420             *             String, PortletPreferences,
421             *             com.liferay.portal.kernel.util.DateRange, Date)}
422             */
423            @Deprecated
424            public void updateLastPublishDate(
425                            String portletId, PortletPreferences portletPreferences,
426                            Date lastPublishDate)
427                    throws PortalException;
428    
429            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
430                    throws PortalException;
431    
432            public void validateRemote(
433                            long groupId, String remoteAddress, int remotePort,
434                            String remotePathContext, boolean secureConnection,
435                            long remoteGroupId)
436                    throws PortalException;
437    
438            /**
439             * @deprecated As of 7.0.0, replaced by {@link #validateRemote(long, String,
440             *             int, String, boolean, long)}
441             */
442            @Deprecated
443            public void validateRemote(
444                            String remoteAddress, int remotePort, String remotePathContext,
445                            boolean secureConnection, long remoteGroupId)
446                    throws PortalException;
447    
448    }