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            public static final String DATA_HANDLER_COMPANY_SECURE_URL =
046                    "@data_handler_company_secure_url@";
047    
048            public static final String DATA_HANDLER_COMPANY_URL =
049                    "@data_handler_company_url@";
050    
051            public static final String DATA_HANDLER_GROUP_FRIENDLY_URL =
052                    "@data_handler_group_friendly_url@";
053    
054            public static final String DATA_HANDLER_PATH_CONTEXT =
055                    "@data_handler_path_context@";
056    
057            public static final String DATA_HANDLER_PRIVATE_GROUP_SERVLET_MAPPING =
058                    "@data_handler_private_group_servlet_mapping@";
059    
060            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL =
061                    "@data_handler_private_layout_set_secure_url@";
062    
063            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_URL =
064                    "@data_handler_private_layout_set_url@";
065    
066            public static final String DATA_HANDLER_PRIVATE_USER_SERVLET_MAPPING =
067                    "@data_handler_private_user_servlet_mapping@";
068    
069            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL =
070                    "@data_handler_public_layout_set_secure_url@";
071    
072            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_URL =
073                    "@data_handler_public_layout_set_url@";
074    
075            public static final String DATA_HANDLER_PUBLIC_SERVLET_MAPPING =
076                    "@data_handler_public_servlet_mapping@";
077    
078            public static final String TEMP_FOLDER_NAME =
079                    ExportImportHelper.class.getName();
080    
081            public long[] getAllLayoutIds(long groupId, boolean privateLayout);
082    
083            public Map<Long, Boolean> getAllLayoutIdsMap(
084                    long groupId, boolean privateLayout);
085    
086            /**
087             * @deprecated As of 7.0.0, moved to {@link
088             *             ExportImportDateUtil#getCalendar(PortletRequest, String,
089             *             boolean)}
090             */
091            @Deprecated
092            public Calendar getCalendar(
093                    PortletRequest portletRequest, String paramPrefix,
094                    boolean timeZoneSensitive);
095    
096            /**
097             * @deprecated As of 7.0.0, moved to {@link
098             *             ExportImportDateUtil#getDateRange(PortletRequest, long,
099             *             boolean, long, String, String)}
100             */
101            @Deprecated
102            public DateRange getDateRange(
103                            PortletRequest portletRequest, long groupId, boolean privateLayout,
104                            long plid, String portletId, String defaultRange)
105                    throws Exception;
106    
107            public Layout getExportableLayout(ThemeDisplay themeDisplay)
108                    throws PortalException;
109    
110            public String getExportableRootPortletId(long companyId, String portletId)
111                    throws Exception;
112    
113            /**
114             * @deprecated As of 7.0.0, replaced by {@link
115             *             #getExportPortletControlsMap(long, String, Map)}
116             */
117            @Deprecated
118            public boolean[] getExportPortletControls(
119                            long companyId, String portletId,
120                            Map<String, String[]> parameterMap)
121                    throws Exception;
122    
123            /**
124             * @deprecated As of 7.0.0, replaced by {@link
125             *             #getExportPortletControlsMap(long, String, Map, String)}
126             */
127            @Deprecated
128            public boolean[] getExportPortletControls(
129                            long companyId, String portletId,
130                            Map<String, String[]> parameterMap, String type)
131                    throws Exception;
132    
133            public Map<String, Boolean> getExportPortletControlsMap(
134                            long companyId, String portletId,
135                            Map<String, String[]> parameterMap)
136                    throws Exception;
137    
138            public Map<String, Boolean> getExportPortletControlsMap(
139                            long companyId, String portletId,
140                            Map<String, String[]> parameterMap, String type)
141                    throws Exception;
142    
143            /**
144             * @deprecated As of 7.0.0, replaced by {@link
145             *             #getImportPortletControlsMap(long, String, Map, Element,
146             *             ManifestSummary)}
147             */
148            @Deprecated
149            public boolean[] getImportPortletControls(
150                            long companyId, String portletId,
151                            Map<String, String[]> parameterMap, Element portletDataElement)
152                    throws Exception;
153    
154            /**
155             * @deprecated As of 7.0.0, replaced by {@link
156             *             #getImportPortletControlsMap(long, String, Map, Element,
157             *             ManifestSummary)}
158             */
159            @Deprecated
160            public boolean[] getImportPortletControls(
161                            long companyId, String portletId,
162                            Map<String, String[]> parameterMap, Element portletDataElement,
163                            ManifestSummary manifestSummary)
164                    throws Exception;
165    
166            public Map<String, Boolean> getImportPortletControlsMap(
167                            long companyId, String portletId,
168                            Map<String, String[]> parameterMap, Element portletDataElement,
169                            ManifestSummary manifestSummary)
170                    throws Exception;
171    
172            public Map<Long, Boolean> getLayoutIdMap(PortletRequest portletRequest)
173                    throws PortalException;
174    
175            public long[] getLayoutIds(List<Layout> layouts);
176    
177            public long[] getLayoutIds(Map<Long, Boolean> layoutIdMap)
178                    throws PortalException;
179    
180            public long[] getLayoutIds(
181                            Map<Long, Boolean> layoutIdMap, long targetGroupId)
182                    throws PortalException;
183    
184            public long[] getLayoutIds(PortletRequest portletRequest)
185                    throws PortalException;
186    
187            public long[] getLayoutIds(
188                            PortletRequest portletRequest, long targetGroupId)
189                    throws PortalException;
190    
191            public ZipWriter getLayoutSetZipWriter(long groupId);
192    
193            /**
194             * @deprecated As of 7.0.0, replaced by {@link
195             *             #getManifestSummary(PortletDataContext)}
196             */
197            @Deprecated
198            public ManifestSummary getManifestSummary(
199                            long userId, long groupId, Map<String, String[]> parameterMap,
200                            File file)
201                    throws Exception;
202    
203            public ManifestSummary getManifestSummary(
204                            long userId, long groupId, Map<String, String[]> parameterMap,
205                            FileEntry fileEntry)
206                    throws Exception;
207    
208            public ManifestSummary getManifestSummary(
209                            PortletDataContext portletDataContext)
210                    throws Exception;
211    
212            public List<Layout> getMissingParentLayouts(Layout layout, long liveGroupId)
213                    throws PortalException;
214    
215            public long getModelDeletionCount(
216                            final PortletDataContext portletDataContext,
217                            final StagedModelType stagedModelType)
218                    throws PortalException;
219    
220            public ZipWriter getPortletZipWriter(String portletId);
221    
222            public String getSelectedLayoutsJSON(
223                    long groupId, boolean privateLayout, String selectedNodes);
224    
225            public FileEntry getTempFileEntry(
226                            long groupId, long userId, String folderName)
227                    throws PortalException;
228    
229            public UserIdStrategy getUserIdStrategy(long userId, String userIdStrategy)
230                    throws PortalException;
231    
232            public boolean isReferenceWithinExportScope(
233                    PortletDataContext portletDataContext, StagedModel stagedModel);
234    
235            /**
236             * @deprecated As of 7.0.0, replaced by {@link
237             *             #replaceExportContentReferences(PortletDataContext,
238             *             StagedModel, String, boolean)}
239             */
240            @Deprecated
241            public String replaceExportContentReferences(
242                            PortletDataContext portletDataContext,
243                            StagedModel entityStagedModel, Element entityElement,
244                            String content, boolean exportReferencedContent)
245                    throws Exception;
246    
247            public String replaceExportContentReferences(
248                            PortletDataContext portletDataContext,
249                            StagedModel entityStagedModel, String content,
250                            boolean exportReferencedContent)
251                    throws Exception;
252    
253            public String replaceExportContentReferences(
254                            PortletDataContext portletDataContext,
255                            StagedModel entityStagedModel, String content,
256                            boolean exportReferencedContent, boolean escapeContent)
257                    throws Exception;
258    
259            /**
260             * @deprecated As of 7.0.0, replaced by {@link
261             *             #replaceExportDLReferences(PortletDataContext, StagedModel,
262             *             String, boolean)}
263             */
264            @Deprecated
265            public String replaceExportDLReferences(
266                            PortletDataContext portletDataContext,
267                            StagedModel entityStagedModel, Element entityElement,
268                            String content, boolean exportReferencedContent)
269                    throws Exception;
270    
271            public String replaceExportDLReferences(
272                            PortletDataContext portletDataContext,
273                            StagedModel entityStagedModel, String content,
274                            boolean exportReferencedContent)
275                    throws Exception;
276    
277            public String replaceExportLayoutReferences(
278                            PortletDataContext portletDataContext, String content)
279                    throws Exception;
280    
281            /**
282             * @deprecated As of 7.0.0, replaced by {@link
283             *             #replaceExportLayoutReferences(PortletDataContext, String)}
284             */
285            @Deprecated
286            public String replaceExportLayoutReferences(
287                            PortletDataContext portletDataContext, String content,
288                            boolean exportReferencedContent)
289                    throws Exception;
290    
291            /**
292             * @deprecated As of 7.0.0, replaced by {@link
293             *             #replaceExportLinksToLayouts(PortletDataContext, StagedModel,
294             *             String)}
295             */
296            @Deprecated
297            public String replaceExportLinksToLayouts(
298                            PortletDataContext portletDataContext,
299                            StagedModel entityStagedModel, Element entityElement,
300                            String content, boolean exportReferencedContent)
301                    throws Exception;
302    
303            public String replaceExportLinksToLayouts(
304                            PortletDataContext portletDataContext,
305                            StagedModel entityStagedModel, String content)
306                    throws Exception;
307    
308            /**
309             * @deprecated As of 7.0.0, replaced by {@link
310             *             #replaceImportContentReferences(PortletDataContext,
311             *             StagedModel, String)}
312             */
313            @Deprecated
314            public String replaceImportContentReferences(
315                            PortletDataContext portletDataContext, Element entityElement,
316                            String content, boolean importReferencedContent)
317                    throws Exception;
318    
319            public String replaceImportContentReferences(
320                            PortletDataContext portletDataContext,
321                            StagedModel entityStagedModel, String content)
322                    throws Exception;
323    
324            /**
325             * @deprecated As of 7.0.0, replaced by {@link
326             *             #replaceImportDLReferences(PortletDataContext, StagedModel,
327             *             String)}
328             */
329            @Deprecated
330            public String replaceImportDLReferences(
331                            PortletDataContext portletDataContext, Element entityElement,
332                            String content, boolean importReferencedContent)
333                    throws Exception;
334    
335            public String replaceImportDLReferences(
336                            PortletDataContext portletDataContext,
337                            StagedModel entityStagedModel, String content)
338                    throws Exception;
339    
340            public String replaceImportLayoutReferences(
341                            PortletDataContext portletDataContext, String content)
342                    throws Exception;
343    
344            /**
345             * @deprecated As of 7.0.0, replaced by {@link
346             *             #replaceImportLayoutReferences(PortletDataContext, String)}
347             */
348            @Deprecated
349            public String replaceImportLayoutReferences(
350                            PortletDataContext portletDataContext, String content,
351                            boolean importReferencedContent)
352                    throws Exception;
353    
354            public String replaceImportLinksToLayouts(
355                            PortletDataContext portletDataContext, String content)
356                    throws Exception;
357    
358            /**
359             * @deprecated As of 7.0.0, replaced by {@link
360             *             #replaceImportLinksToLayouts(PortletDataContext, String)}
361             */
362            @Deprecated
363            public String replaceImportLinksToLayouts(
364                            PortletDataContext portletDataContext, String content,
365                            boolean importReferencedContent)
366                    throws Exception;
367    
368            public void updateExportPortletPreferencesClassPKs(
369                            PortletDataContext portletDataContext, Portlet portlet,
370                            PortletPreferences portletPreferences, String key, String className)
371                    throws Exception;
372    
373            /**
374             * @deprecated As of 7.0.0, replaced by {@link
375             *             #updateExportPortletPreferencesClassPKs(PortletDataContext,
376             *             Portlet, PortletPreferences, String, String)}
377             */
378            @Deprecated
379            public void updateExportPortletPreferencesClassPKs(
380                            PortletDataContext portletDataContext, Portlet portlet,
381                            PortletPreferences portletPreferences, String key, String className,
382                            Element rootElement)
383                    throws Exception;
384    
385            public void updateImportPortletPreferencesClassPKs(
386                            PortletDataContext portletDataContext,
387                            PortletPreferences portletPreferences, String key, Class<?> clazz,
388                            long companyGroupId)
389                    throws Exception;
390    
391            /**
392             * @deprecated As of 7.0.0, replaced by {@link
393             *             #validateMissingReferences(PortletDataContext)}
394             */
395            @Deprecated
396            public MissingReferences validateMissingReferences(
397                            long userId, long groupId, Map<String, String[]> parameterMap,
398                            File file)
399                    throws Exception;
400    
401            public MissingReferences validateMissingReferences(
402                            final PortletDataContext portletDataContext)
403                    throws Exception;
404    
405            public void writeManifestSummary(
406                    Document document, ManifestSummary manifestSummary);
407    
408    }