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.exportimport.kernel.lar;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.exception.PortalException;
020    import com.liferay.portal.kernel.model.Layout;
021    import com.liferay.portal.kernel.model.Portlet;
022    import com.liferay.portal.kernel.model.StagedModel;
023    import com.liferay.portal.kernel.repository.model.FileEntry;
024    import com.liferay.portal.kernel.theme.ThemeDisplay;
025    import com.liferay.portal.kernel.util.DateRange;
026    import com.liferay.portal.kernel.xml.Document;
027    import com.liferay.portal.kernel.xml.Element;
028    import com.liferay.portal.kernel.zip.ZipWriter;
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            /**
159             * @deprecated As of 7.0.0, with no direct replacement
160             */
161            @Deprecated
162            public Layout getExportableLayout(ThemeDisplay themeDisplay)
163                    throws PortalException;
164    
165            public String getExportableRootPortletId(long companyId, String portletId)
166                    throws Exception;
167    
168            /**
169             * @deprecated As of 7.0.0, replaced by {@link
170             *             #getExportPortletControlsMap(long, String, Map)}
171             */
172            @Deprecated
173            public boolean[] getExportPortletControls(
174                            long companyId, String portletId,
175                            Map<String, String[]> parameterMap)
176                    throws Exception;
177    
178            /**
179             * @deprecated As of 7.0.0, replaced by {@link
180             *             #getExportPortletControlsMap(long, String, Map, String)}
181             */
182            @Deprecated
183            public boolean[] getExportPortletControls(
184                            long companyId, String portletId,
185                            Map<String, String[]> parameterMap, String type)
186                    throws Exception;
187    
188            public Map<String, Boolean> getExportPortletControlsMap(
189                            long companyId, String portletId,
190                            Map<String, String[]> parameterMap)
191                    throws Exception;
192    
193            public Map<String, Boolean> getExportPortletControlsMap(
194                            long companyId, String portletId,
195                            Map<String, String[]> parameterMap, String type)
196                    throws Exception;
197    
198            /**
199             * @deprecated As of 7.0.0, replaced by {@link
200             *             #getImportPortletControlsMap(long, String, Map, Element,
201             *             ManifestSummary)}
202             */
203            @Deprecated
204            public boolean[] getImportPortletControls(
205                            long companyId, String portletId,
206                            Map<String, String[]> parameterMap, Element portletDataElement)
207                    throws Exception;
208    
209            /**
210             * @deprecated As of 7.0.0, replaced by {@link
211             *             #getImportPortletControlsMap(long, String, Map, Element,
212             *             ManifestSummary)}
213             */
214            @Deprecated
215            public boolean[] getImportPortletControls(
216                            long companyId, String portletId,
217                            Map<String, String[]> parameterMap, Element portletDataElement,
218                            ManifestSummary manifestSummary)
219                    throws Exception;
220    
221            public Map<String, Boolean> getImportPortletControlsMap(
222                            long companyId, String portletId,
223                            Map<String, String[]> parameterMap, Element portletDataElement,
224                            ManifestSummary manifestSummary)
225                    throws Exception;
226    
227            public Map<Long, Boolean> getLayoutIdMap(PortletRequest portletRequest)
228                    throws PortalException;
229    
230            public long[] getLayoutIds(List<Layout> layouts);
231    
232            public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap)
233                    throws PortalException;
234    
235            public long[] getLayoutIds(
236                            Map<Long, Boolean> layoutIdMap, long targetGroupId)
237                    throws PortalException;
238    
239            public long[] getLayoutIds(PortletRequest portletRequest)
240                    throws PortalException;
241    
242            public long[] getLayoutIds(
243                            PortletRequest portletRequest, long targetGroupId)
244                    throws PortalException;
245    
246            public ZipWriter getLayoutSetZipWriter(long groupId);
247    
248            /**
249             * @deprecated As of 7.0.0, replaced by {@link
250             *             #getManifestSummary(PortletDataContext)}
251             */
252            @Deprecated
253            public ManifestSummary getManifestSummary(
254                            long userId, long groupId, Map<String, String[]> parameterMap,
255                            File file)
256                    throws Exception;
257    
258            public ManifestSummary getManifestSummary(
259                            long userId, long groupId, Map<String, String[]> parameterMap,
260                            FileEntry fileEntry)
261                    throws Exception;
262    
263            public ManifestSummary getManifestSummary(
264                            PortletDataContext portletDataContext)
265                    throws Exception;
266    
267            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
268                    throws PortalException;
269    
270            public long getModelDeletionCount(
271                            final PortletDataContext portletDataContext,
272                            final StagedModelType stagedModelType)
273                    throws PortalException;
274    
275            public ZipWriter getPortletZipWriter(String portletId);
276    
277            public String getSelectedLayoutsJSON(
278                    long groupId, boolean privateLayout, String selectedNodes);
279    
280            public FileEntry getTempFileEntry(
281                            long groupId, long userId, String folderName)
282                    throws PortalException;
283    
284            public UserIdStrategy getUserIdStrategy(long userId, String userIdStrategy)
285                    throws PortalException;
286    
287            public boolean isReferenceWithinExportScope(
288                    PortletDataContext portletDataContext, StagedModel stagedModel);
289    
290            /**
291             * @deprecated As of 7.0.0, replaced by
292             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceExportContentReferences(
293             *             PortletDataContext, StagedModel, String, boolean, boolean) in
294             *             the export-import-api module
295             */
296            @Deprecated
297            public String replaceExportContentReferences(
298                            PortletDataContext portletDataContext,
299                            StagedModel entityStagedModel, Element entityElement,
300                            String content, boolean exportReferencedContent)
301                    throws Exception;
302    
303            /**
304             * @deprecated As of 7.0.0, replaced by
305             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceExportContentReferences(
306             *             PortletDataContext, StagedModel, String, boolean, boolean) in
307             *             the export-import-api module
308             */
309            @Deprecated
310            public String replaceExportContentReferences(
311                            PortletDataContext portletDataContext,
312                            StagedModel entityStagedModel, String content,
313                            boolean exportReferencedContent)
314                    throws Exception;
315    
316            /**
317             * @deprecated As of 7.0.0, replaced by
318             *             com.liferay.exportimport.content.processor.ExportImportContentProcessorr#replaceExportContentReferences(
319             *             PortletDataContext, StagedModel, String, boolean, boolean) in
320             *             the export-import-api module
321             */
322            @Deprecated
323            public String replaceExportContentReferences(
324                            PortletDataContext portletDataContext,
325                            StagedModel entityStagedModel, String content,
326                            boolean exportReferencedContent, boolean escapeContent)
327                    throws Exception;
328    
329            /**
330             * @deprecated As of 7.0.0, with no direct replacement
331             */
332            @Deprecated
333            public String replaceExportDLReferences(
334                            PortletDataContext portletDataContext,
335                            StagedModel entityStagedModel, Element entityElement,
336                            String content, boolean exportReferencedContent)
337                    throws Exception;
338    
339            /**
340             * @deprecated As of 7.0.0, with no direct replacement
341             */
342            @Deprecated
343            public String replaceExportDLReferences(
344                            PortletDataContext portletDataContext,
345                            StagedModel entityStagedModel, String content,
346                            boolean exportReferencedContent)
347                    throws Exception;
348    
349            /**
350             * @deprecated As of 7.0.0, with no direct replacement
351             */
352            @Deprecated
353            public String replaceExportLayoutReferences(
354                            PortletDataContext portletDataContext, String content)
355                    throws Exception;
356    
357            /**
358             * @deprecated As of 7.0.0, with no direct replacement
359             */
360            @Deprecated
361            public String replaceExportLayoutReferences(
362                            PortletDataContext portletDataContext, String content,
363                            boolean exportReferencedContent)
364                    throws Exception;
365    
366            /**
367             * @deprecated As of 7.0.0, with no direct replacement
368             */
369            @Deprecated
370            public String replaceExportLinksToLayouts(
371                            PortletDataContext portletDataContext,
372                            StagedModel entityStagedModel, Element entityElement,
373                            String content, boolean exportReferencedContent)
374                    throws Exception;
375    
376            /**
377             * @deprecated As of 7.0.0, with no direct replacement
378             */
379            @Deprecated
380            public String replaceExportLinksToLayouts(
381                            PortletDataContext portletDataContext,
382                            StagedModel entityStagedModel, String content)
383                    throws Exception;
384    
385            /**
386             * @deprecated As of 7.0.0, replaced by
387             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceImportContentReferences(
388             *             PortletDataContext, StagedModel, String) in the
389             *             export-import-api module
390             */
391            @Deprecated
392            public String replaceImportContentReferences(
393                            PortletDataContext portletDataContext, Element entityElement,
394                            String content, boolean importReferencedContent)
395                    throws Exception;
396    
397            /**
398             * @deprecated As of 7.0.0, replaced by
399             *             com.liferay.exportimport.content.processor.ExportImportContentProcessor#replaceImportContentReferences(
400             *             PortletDataContext, StagedModel, String) in the
401             *             export-import-api module
402             */
403            @Deprecated
404            public String replaceImportContentReferences(
405                            PortletDataContext portletDataContext,
406                            StagedModel entityStagedModel, String content)
407                    throws Exception;
408    
409            /**
410             * @deprecated As of 7.0.0, with no direct replacement
411             */
412            @Deprecated
413            public String replaceImportDLReferences(
414                            PortletDataContext portletDataContext, Element entityElement,
415                            String content, boolean importReferencedContent)
416                    throws Exception;
417    
418            /**
419             * @deprecated As of 7.0.0, with no direct replacement
420             */
421            @Deprecated
422            public String replaceImportDLReferences(
423                            PortletDataContext portletDataContext,
424                            StagedModel entityStagedModel, String content)
425                    throws Exception;
426    
427            /**
428             * @deprecated As of 7.0.0, with no direct replacement
429             */
430            @Deprecated
431            public String replaceImportLayoutReferences(
432                            PortletDataContext portletDataContext, String content)
433                    throws Exception;
434    
435            /**
436             * @deprecated As of 7.0.0, with no direct replacement
437             */
438            @Deprecated
439            public String replaceImportLayoutReferences(
440                            PortletDataContext portletDataContext, String content,
441                            boolean importReferencedContent)
442                    throws Exception;
443    
444            /**
445             * @deprecated As of 7.0.0, with no direct replacement
446             */
447            @Deprecated
448            public String replaceImportLinksToLayouts(
449                            PortletDataContext portletDataContext, String content)
450                    throws Exception;
451    
452            /**
453             * @deprecated As of 7.0.0, with no direct replacement
454             */
455            @Deprecated
456            public String replaceImportLinksToLayouts(
457                            PortletDataContext portletDataContext, String content,
458                            boolean importReferencedContent)
459                    throws Exception;
460    
461            /**
462             * @deprecated As of 7.0.0, see {@link
463             *             DefaultConfigurationPortletDataHandler#updateExportPortletPreferencesClassPKs(
464             *             PortletDataContext, Portlet, PortletPreferences, String,
465             *             String)}
466             */
467            @Deprecated
468            public void updateExportPortletPreferencesClassPKs(
469                            PortletDataContext portletDataContext, Portlet portlet,
470                            PortletPreferences portletPreferences, String key, String className)
471                    throws Exception;
472    
473            /**
474             * @deprecated As of 7.0.0, replaced by {@link
475             *             #updateExportPortletPreferencesClassPKs(PortletDataContext,
476             *             Portlet, PortletPreferences, String, String)}
477             */
478            @Deprecated
479            public void updateExportPortletPreferencesClassPKs(
480                            PortletDataContext portletDataContext, Portlet portlet,
481                            PortletPreferences portletPreferences, String key, String className,
482                            Element rootElement)
483                    throws Exception;
484    
485            /**
486             * @deprecated As of 7.0.0, see {@link
487             *             DefaultConfigurationPortletDataHandler#updateImportPortletPreferencesClassPKs(
488             *             PortletDataContext, PortletPreferences, String, Class, long)}
489             */
490            @Deprecated
491            public void updateImportPortletPreferencesClassPKs(
492                            PortletDataContext portletDataContext,
493                            PortletPreferences portletPreferences, String key, Class<?> clazz,
494                            long companyGroupId)
495                    throws Exception;
496    
497            /**
498             * @deprecated As of 7.0.0, replaced by {@link
499             *             #validateMissingReferences(PortletDataContext)}
500             */
501            @Deprecated
502            public MissingReferences validateMissingReferences(
503                            long userId, long groupId, Map<String, String[]> parameterMap,
504                            File file)
505                    throws Exception;
506    
507            public MissingReferences validateMissingReferences(
508                            final PortletDataContext portletDataContext)
509                    throws Exception;
510    
511            public void writeManifestSummary(
512                    Document document, ManifestSummary manifestSummary);
513    
514    }