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