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 isGroupAccessible(Group group, Group fromGroup);
254    
255            public boolean isGroupAccessible(long groupId, long fromGroupId)
256                    throws PortalException;
257    
258            public boolean isIncomplete(Layout layout, long layoutSetBranchId);
259    
260            /**
261             * @deprecated As of 7.0.0, see {@link
262             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
263             *             )}
264             */
265            @Deprecated
266            public void lockGroup(long userId, long groupId) throws PortalException;
267    
268            public void publishLayout(
269                            long userId, long plid, long liveGroupId, boolean includeChildren)
270                    throws PortalException;
271    
272            public void publishLayouts(
273                            long userId, ExportImportConfiguration exportImportConfiguration)
274                    throws PortalException;
275    
276            public void publishLayouts(long userId, long exportImportConfigurationId)
277                    throws PortalException;
278    
279            public void publishLayouts(
280                            long userId, long sourceGroupId, long targetGroupId,
281                            boolean privateLayout, long[] layoutIds,
282                            Map<String, String[]> parameterMap)
283                    throws PortalException;
284    
285            /**
286             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
287             *             long, boolean, long[], Map)}
288             */
289            @Deprecated
290            public void publishLayouts(
291                            long userId, long sourceGroupId, long targetGroupId,
292                            boolean privateLayout, long[] layoutIds,
293                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
294                    throws PortalException;
295    
296            public void publishLayouts(
297                            long userId, long sourceGroupId, long targetGroupId,
298                            boolean privateLayout, long[] layoutIds, String name,
299                            Map<String, String[]> parameterMap)
300                    throws PortalException;
301    
302            /**
303             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
304             *             long, boolean, long[], Map)}
305             */
306            @Deprecated
307            public void publishLayouts(
308                            long userId, long sourceGroupId, long targetGroupId,
309                            boolean privateLayout, Map<Long, Boolean> layoutIdMap,
310                            Map<String, String[]> parameterMap, Date startDate, Date endDate)
311                    throws PortalException;
312    
313            public void publishLayouts(
314                            long userId, long sourceGroupId, long targetGroupId,
315                            boolean privateLayout, Map<String, String[]> parameterMap)
316                    throws PortalException;
317    
318            /**
319             * @deprecated As of 7.0.0, replaced by {@link #publishLayouts(long, long,
320             *             long, boolean, Map)}
321             */
322            @Deprecated
323            public void publishLayouts(
324                            long userId, long sourceGroupId, long targetGroupId,
325                            boolean privateLayout, Map<String, String[]> parameterMap,
326                            Date startDate, Date endDate)
327                    throws PortalException;
328    
329            public void publishPortlet(
330                            long userId, ExportImportConfiguration exportImportConfiguration)
331                    throws PortalException;
332    
333            public void publishPortlet(long userId, long exportImportConfigurationId)
334                    throws PortalException;
335    
336            public void publishPortlet(
337                            long userId, long sourceGroupId, long targetGroupId,
338                            long sourcePlid, long targetPlid, String portletId,
339                            Map<String, String[]> parameterMap)
340                    throws PortalException;
341    
342            public void publishToLive(PortletRequest PortletRequest)
343                    throws PortalException;
344    
345            public void publishToLive(PortletRequest PortletRequest, Portlet portlet)
346                    throws PortalException;
347    
348            public void publishToRemote(PortletRequest PortletRequest)
349                    throws PortalException;
350    
351            public void scheduleCopyFromLive(PortletRequest PortletRequest)
352                    throws PortalException;
353    
354            public void schedulePublishToLive(PortletRequest PortletRequest)
355                    throws PortalException;
356    
357            public void schedulePublishToRemote(PortletRequest PortletRequest)
358                    throws PortalException;
359    
360            public void setRecentLayoutBranchId(
361                            HttpServletRequest request, long layoutSetBranchId, long plid,
362                            long layoutBranchId)
363                    throws PortalException;
364    
365            public void setRecentLayoutBranchId(
366                            User user, long layoutSetBranchId, long plid, long layoutBranchId)
367                    throws PortalException;
368    
369            public void setRecentLayoutRevisionId(
370                            HttpServletRequest request, long layoutSetBranchId, long plid,
371                            long layoutRevisionId)
372                    throws PortalException;
373    
374            public void setRecentLayoutRevisionId(
375                            User user, long layoutSetBranchId, long plid, long layoutRevisionId)
376                    throws PortalException;
377    
378            public void setRecentLayoutSetBranchId(
379                            HttpServletRequest request, long layoutSetId,
380                            long layoutSetBranchId)
381                    throws PortalException;
382    
383            public void setRecentLayoutSetBranchId(
384                            User user, long layoutSetId, long layoutSetBranchId)
385                    throws PortalException;
386    
387            public String stripProtocolFromRemoteAddress(String remoteAddress);
388    
389            /**
390             * @deprecated As of 7.0.0, see {@link
391             *             com.liferay.portal.kernel.backgroundtask.BackgroundTaskExecutor#getIsolationLevel(
392             *             )}
393             */
394            @Deprecated
395            public void unlockGroup(long groupId);
396    
397            public void unscheduleCopyFromLive(PortletRequest PortletRequest)
398                    throws PortalException;
399    
400            public void unschedulePublishToLive(PortletRequest PortletRequest)
401                    throws PortalException;
402    
403            public void unschedulePublishToRemote(PortletRequest PortletRequest)
404                    throws PortalException;
405    
406            public void updateLastImportSettings(
407                            Element layoutElement, Layout layout,
408                            PortletDataContext portletDataContext)
409                    throws PortalException;
410    
411            /**
412             * @deprecated As of 7.0.0, replaced by {@link
413             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
414             *             long, boolean, com.liferay.portal.kernel.util.DateRange,
415             *             Date)}
416             */
417            @Deprecated
418            public void updateLastPublishDate(
419                            long sourceGroupId, boolean privateLayout, Date lastPublishDate)
420                    throws PortalException;
421    
422            /**
423             * @deprecated As of 7.0.0, replaced by {@link
424             *             com.liferay.portlet.exportimport.lar.ExportImportDateUtil#updateLastPublishDate(
425             *             String, PortletPreferences,
426             *             com.liferay.portal.kernel.util.DateRange, Date)}
427             */
428            @Deprecated
429            public void updateLastPublishDate(
430                            String portletId, PortletPreferences portletPreferences,
431                            Date lastPublishDate)
432                    throws PortalException;
433    
434            public void updateStaging(PortletRequest PortletRequest, Group liveGroup)
435                    throws PortalException;
436    
437            public void validateRemote(
438                            long groupId, String remoteAddress, int remotePort,
439                            String remotePathContext, boolean secureConnection,
440                            long remoteGroupId)
441                    throws PortalException;
442    
443            /**
444             * @deprecated As of 7.0.0, replaced by {@link #validateRemote(long, String,
445             *             int, String, boolean, long)}
446             */
447            @Deprecated
448            public void validateRemote(
449                            String remoteAddress, int remotePort, String remotePathContext,
450                            boolean secureConnection, long remoteGroupId)
451                    throws PortalException;
452    
453    }