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.lar;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.repository.model.FileEntry;
021    import com.liferay.portal.kernel.util.DateRange;
022    import com.liferay.portal.kernel.xml.Document;
023    import com.liferay.portal.kernel.xml.Element;
024    import com.liferay.portal.kernel.zip.ZipWriter;
025    import com.liferay.portal.model.Layout;
026    import com.liferay.portal.model.Portlet;
027    import com.liferay.portal.model.StagedModel;
028    import com.liferay.portal.theme.ThemeDisplay;
029    
030    import java.io.File;
031    
032    import java.util.Calendar;
033    import java.util.List;
034    import java.util.Map;
035    
036    import javax.portlet.PortletPreferences;
037    import javax.portlet.PortletRequest;
038    
039    /**
040     * @author Zsolt Berentey
041     */
042    @ProviderType
043    public interface ExportImportHelper {
044    
045            /**
046             * @deprecated As of 7.0.0, with no direct replacement
047             */
048            @Deprecated
049            public static final String DATA_HANDLER_COMPANY_SECURE_URL =
050                    "@data_handler_company_secure_url@";
051    
052            /**
053             * @deprecated As of 7.0.0, with no direct replacement
054             */
055            @Deprecated
056            public static final String DATA_HANDLER_COMPANY_URL =
057                    "@data_handler_company_url@";
058    
059            /**
060             * @deprecated As of 7.0.0, with no direct replacement
061             */
062            @Deprecated
063            public static final String DATA_HANDLER_GROUP_FRIENDLY_URL =
064                    "@data_handler_group_friendly_url@";
065    
066            /**
067             * @deprecated As of 7.0.0, with no direct replacement
068             */
069            @Deprecated
070            public static final String DATA_HANDLER_PATH_CONTEXT =
071                    "@data_handler_path_context@";
072    
073            /**
074             * @deprecated As of 7.0.0, with no direct replacement
075             */
076            @Deprecated
077            public static final String DATA_HANDLER_PRIVATE_GROUP_SERVLET_MAPPING =
078                    "@data_handler_private_group_servlet_mapping@";
079    
080            /**
081             * @deprecated As of 7.0.0, with no direct replacement
082             */
083            @Deprecated
084            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL =
085                    "@data_handler_private_layout_set_secure_url@";
086    
087            /**
088             * @deprecated As of 7.0.0, with no direct replacement
089             */
090            @Deprecated
091            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_URL =
092                    "@data_handler_private_layout_set_url@";
093    
094            /**
095             * @deprecated As of 7.0.0, with no direct replacement
096             */
097            @Deprecated
098            public static final String DATA_HANDLER_PRIVATE_USER_SERVLET_MAPPING =
099                    "@data_handler_private_user_servlet_mapping@";
100    
101            /**
102             * @deprecated As of 7.0.0, with no direct replacement
103             */
104            @Deprecated
105            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL =
106                    "@data_handler_public_layout_set_secure_url@";
107    
108            /**
109             * @deprecated As of 7.0.0, with no direct replacement
110             */
111            @Deprecated
112            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_URL =
113                    "@data_handler_public_layout_set_url@";
114    
115            /**
116             * @deprecated As of 7.0.0, with no direct replacement
117             */
118            @Deprecated
119            public static final String DATA_HANDLER_PUBLIC_SERVLET_MAPPING =
120                    "@data_handler_public_servlet_mapping@";
121    
122            public static final String TEMP_FOLDER_NAME =
123                    ExportImportHelper.class.getName();
124    
125            public long[] getAllLayoutIds(long groupId, boolean privateLayout);
126    
127            public Map<Long, Boolean> getAllLayoutIdsMap(
128                    long groupId, boolean privateLayout);
129    
130            /**
131             * @deprecated As of 7.0.0, moved to {@link
132             *             ExportImportDateUtil#getCalendar(PortletRequest, String,
133             *             boolean)}
134             */
135            @Deprecated
136            public Calendar getCalendar(
137                    PortletRequest portletRequest, String paramPrefix,
138                    boolean timeZoneSensitive);
139    
140            public List<Portlet> getDataSiteLevelPortlets(long companyId)
141                    throws Exception;
142    
143            public List<Portlet> getDataSiteLevelPortlets(
144                            long companyId, boolean excludeDataAlwaysStaged)
145                    throws Exception;
146    
147            /**
148             * @deprecated As of 7.0.0, moved to {@link
149             *             ExportImportDateUtil#getDateRange(PortletRequest, long,
150             *             boolean, long, String, String)}
151             */
152            @Deprecated
153            public DateRange getDateRange(
154                            PortletRequest portletRequest, long groupId, boolean privateLayout,
155                            long plid, String portletId, String defaultRange)
156                    throws Exception;
157    
158            public Layout getExportableLayout(ThemeDisplay themeDisplay)
159                    throws PortalException;
160    
161            public String getExportableRootPortletId(long companyId, String portletId)
162                    throws Exception;
163    
164            /**
165             * @deprecated As of 7.0.0, replaced by {@link
166             *             #getExportPortletControlsMap(long, String, Map)}
167             */
168            @Deprecated
169            public boolean[] getExportPortletControls(
170                            long companyId, String portletId,
171                            Map<String, String[]> parameterMap)
172                    throws Exception;
173    
174            /**
175             * @deprecated As of 7.0.0, replaced by {@link
176             *             #getExportPortletControlsMap(long, String, Map, String)}
177             */
178            @Deprecated
179            public boolean[] getExportPortletControls(
180                            long companyId, String portletId,
181                            Map<String, String[]> parameterMap, String type)
182                    throws Exception;
183    
184            public Map<String, Boolean> getExportPortletControlsMap(
185                            long companyId, String portletId,
186                            Map<String, String[]> parameterMap)
187                    throws Exception;
188    
189            public Map<String, Boolean> getExportPortletControlsMap(
190                            long companyId, String portletId,
191                            Map<String, String[]> parameterMap, String type)
192                    throws Exception;
193    
194            /**
195             * @deprecated As of 7.0.0, replaced by {@link
196             *             #getImportPortletControlsMap(long, String, Map, Element,
197             *             ManifestSummary)}
198             */
199            @Deprecated
200            public boolean[] getImportPortletControls(
201                            long companyId, String portletId,
202                            Map<String, String[]> parameterMap, Element portletDataElement)
203                    throws Exception;
204    
205            /**
206             * @deprecated As of 7.0.0, replaced by {@link
207             *             #getImportPortletControlsMap(long, String, Map, Element,
208             *             ManifestSummary)}
209             */
210            @Deprecated
211            public boolean[] getImportPortletControls(
212                            long companyId, String portletId,
213                            Map<String, String[]> parameterMap, Element portletDataElement,
214                            ManifestSummary manifestSummary)
215                    throws Exception;
216    
217            public Map<String, Boolean> getImportPortletControlsMap(
218                            long companyId, String portletId,
219                            Map<String, String[]> parameterMap, Element portletDataElement,
220                            ManifestSummary manifestSummary)
221                    throws Exception;
222    
223            public Map<Long, Boolean> getLayoutIdMap(PortletRequest portletRequest)
224                    throws PortalException;
225    
226            public long[] getLayoutIds(List<Layout> layouts);
227    
228            public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap)
229                    throws PortalException;
230    
231            public long[] getLayoutIds(
232                            Map<Long, Boolean> layoutIdMap, long targetGroupId)
233                    throws PortalException;
234    
235            public long[] getLayoutIds(PortletRequest portletRequest)
236                    throws PortalException;
237    
238            public long[] getLayoutIds(
239                            PortletRequest portletRequest, long targetGroupId)
240                    throws PortalException;
241    
242            public ZipWriter getLayoutSetZipWriter(long groupId);
243    
244            /**
245             * @deprecated As of 7.0.0, replaced by {@link
246             *             #getManifestSummary(PortletDataContext)}
247             */
248            @Deprecated
249            public ManifestSummary getManifestSummary(
250                            long userId, long groupId, Map<String, String[]> parameterMap,
251                            File file)
252                    throws Exception;
253    
254            public ManifestSummary getManifestSummary(
255                            long userId, long groupId, Map<String, String[]> parameterMap,
256                            FileEntry fileEntry)
257                    throws Exception;
258    
259            public ManifestSummary getManifestSummary(
260                            PortletDataContext portletDataContext)
261                    throws Exception;
262    
263            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
264                    throws PortalException;
265    
266            public long getModelDeletionCount(
267                            final PortletDataContext portletDataContext,
268                            final StagedModelType stagedModelType)
269                    throws PortalException;
270    
271            public ZipWriter getPortletZipWriter(String portletId);
272    
273            public String getSelectedLayoutsJSON(
274                    long groupId, boolean privateLayout, String selectedNodes);
275    
276            public FileEntry getTempFileEntry(
277                            long groupId, long userId, String folderName)
278                    throws PortalException;
279    
280            public UserIdStrategy getUserIdStrategy(long userId, String userIdStrategy)
281                    throws PortalException;
282    
283            public boolean isReferenceWithinExportScope(
284                    PortletDataContext portletDataContext, StagedModel stagedModel);
285    
286            /**
287             * @deprecated As of 7.0.0, replaced by
288             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceExportContentReferences(
289             *             PortletDataContext, StagedModel, String, boolean, boolean) in
290             *             the export-import-api module
291             */
292            @Deprecated
293            public String replaceExportContentReferences(
294                            PortletDataContext portletDataContext,
295                            StagedModel entityStagedModel, Element entityElement,
296                            String content, boolean exportReferencedContent)
297                    throws Exception;
298    
299            /**
300             * @deprecated As of 7.0.0, replaced by
301             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceExportContentReferences(
302             *             PortletDataContext, StagedModel, String, boolean, boolean) in
303             *             the export-import-api module
304             */
305            @Deprecated
306            public String replaceExportContentReferences(
307                            PortletDataContext portletDataContext,
308                            StagedModel entityStagedModel, String content,
309                            boolean exportReferencedContent)
310                    throws Exception;
311    
312            /**
313             * @deprecated As of 7.0.0, replaced by
314             *             com.liferay.exportimport.content.processor.ExportImportContentProcessorr#replaceExportContentReferences(
315             *             PortletDataContext, StagedModel, String, boolean, boolean) in
316             *             the export-import-api module
317             */
318            @Deprecated
319            public String replaceExportContentReferences(
320                            PortletDataContext portletDataContext,
321                            StagedModel entityStagedModel, String content,
322                            boolean exportReferencedContent, boolean escapeContent)
323                    throws Exception;
324    
325            /**
326             * @deprecated As of 7.0.0, with no direct replacement
327             */
328            @Deprecated
329            public String replaceExportDLReferences(
330                            PortletDataContext portletDataContext,
331                            StagedModel entityStagedModel, Element entityElement,
332                            String content, boolean exportReferencedContent)
333                    throws Exception;
334    
335            /**
336             * @deprecated As of 7.0.0, with no direct replacement
337             */
338            @Deprecated
339            public String replaceExportDLReferences(
340                            PortletDataContext portletDataContext,
341                            StagedModel entityStagedModel, String content,
342                            boolean exportReferencedContent)
343                    throws Exception;
344    
345            /**
346             * @deprecated As of 7.0.0, with no direct replacement
347             */
348            @Deprecated
349            public String replaceExportLayoutReferences(
350                            PortletDataContext portletDataContext, String content)
351                    throws Exception;
352    
353            /**
354             * @deprecated As of 7.0.0, with no direct replacement
355             */
356            @Deprecated
357            public String replaceExportLayoutReferences(
358                            PortletDataContext portletDataContext, String content,
359                            boolean exportReferencedContent)
360                    throws Exception;
361    
362            /**
363             * @deprecated As of 7.0.0, with no direct replacement
364             */
365            @Deprecated
366            public String replaceExportLinksToLayouts(
367                            PortletDataContext portletDataContext,
368                            StagedModel entityStagedModel, Element entityElement,
369                            String content, boolean exportReferencedContent)
370                    throws Exception;
371    
372            /**
373             * @deprecated As of 7.0.0, with no direct replacement
374             */
375            @Deprecated
376            public String replaceExportLinksToLayouts(
377                            PortletDataContext portletDataContext,
378                            StagedModel entityStagedModel, String content)
379                    throws Exception;
380    
381            /**
382             * @deprecated As of 7.0.0, replaced by
383             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceImportContentReferences(
384             *             PortletDataContext, StagedModel, String) in the
385             *             export-import-api module
386             */
387            @Deprecated
388            public String replaceImportContentReferences(
389                            PortletDataContext portletDataContext, Element entityElement,
390                            String content, boolean importReferencedContent)
391                    throws Exception;
392    
393            /**
394             * @deprecated As of 7.0.0, replaced by
395             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceImportContentReferences(
396             *             PortletDataContext, StagedModel, String) in the
397             *             export-import-api module
398             */
399            @Deprecated
400            public String replaceImportContentReferences(
401                            PortletDataContext portletDataContext,
402                            StagedModel entityStagedModel, String content)
403                    throws Exception;
404    
405            /**
406             * @deprecated As of 7.0.0, with no direct replacement
407             */
408            @Deprecated
409            public String replaceImportDLReferences(
410                            PortletDataContext portletDataContext, Element entityElement,
411                            String content, boolean importReferencedContent)
412                    throws Exception;
413    
414            /**
415             * @deprecated As of 7.0.0, with no direct replacement
416             */
417            @Deprecated
418            public String replaceImportDLReferences(
419                            PortletDataContext portletDataContext,
420                            StagedModel entityStagedModel, String content)
421                    throws Exception;
422    
423            /**
424             * @deprecated As of 7.0.0, with no direct replacement
425             */
426            @Deprecated
427            public String replaceImportLayoutReferences(
428                            PortletDataContext portletDataContext, String content)
429                    throws Exception;
430    
431            /**
432             * @deprecated As of 7.0.0, with no direct replacement
433             */
434            @Deprecated
435            public String replaceImportLayoutReferences(
436                            PortletDataContext portletDataContext, String content,
437                            boolean importReferencedContent)
438                    throws Exception;
439    
440            /**
441             * @deprecated As of 7.0.0, with no direct replacement
442             */
443            @Deprecated
444            public String replaceImportLinksToLayouts(
445                            PortletDataContext portletDataContext, String content)
446                    throws Exception;
447    
448            /**
449             * @deprecated As of 7.0.0, with no direct replacement
450             */
451            @Deprecated
452            public String replaceImportLinksToLayouts(
453                            PortletDataContext portletDataContext, String content,
454                            boolean importReferencedContent)
455                    throws Exception;
456    
457            /**
458             * @deprecated As of 7.0.0, see {@link
459             *             DefaultConfigurationPortletDataHandler#updateExportPortletPreferencesClassPKs(
460             *             PortletDataContext, Portlet, PortletPreferences, String,
461             *             String)}
462             */
463            @Deprecated
464            public void updateExportPortletPreferencesClassPKs(
465                            PortletDataContext portletDataContext, Portlet portlet,
466                            PortletPreferences portletPreferences, String key, String className)
467                    throws Exception;
468    
469            /**
470             * @deprecated As of 7.0.0, replaced by {@link
471             *             #updateExportPortletPreferencesClassPKs(PortletDataContext,
472             *             Portlet, PortletPreferences, String, String)}
473             */
474            @Deprecated
475            public void updateExportPortletPreferencesClassPKs(
476                            PortletDataContext portletDataContext, Portlet portlet,
477                            PortletPreferences portletPreferences, String key, String className,
478                            Element rootElement)
479                    throws Exception;
480    
481            /**
482             * @deprecated As of 7.0.0, see {@link
483             *             DefaultConfigurationPortletDataHandler#updateImportPortletPreferencesClassPKs(
484             *             PortletDataContext, PortletPreferences, String, Class, long)}
485             */
486            @Deprecated
487            public void updateImportPortletPreferencesClassPKs(
488                            PortletDataContext portletDataContext,
489                            PortletPreferences portletPreferences, String key, Class<?> clazz,
490                            long companyGroupId)
491                    throws Exception;
492    
493            /**
494             * @deprecated As of 7.0.0, replaced by {@link
495             *             #validateMissingReferences(PortletDataContext)}
496             */
497            @Deprecated
498            public MissingReferences validateMissingReferences(
499                            long userId, long groupId, Map<String, String[]> parameterMap,
500                            File file)
501                    throws Exception;
502    
503            public MissingReferences validateMissingReferences(
504                            final PortletDataContext portletDataContext)
505                    throws Exception;
506    
507            public void writeManifestSummary(
508                    Document document, ManifestSummary manifestSummary);
509    
510    }