001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.repository.model.FileEntry;
020    import com.liferay.portal.kernel.util.DateRange;
021    import com.liferay.portal.kernel.xml.Document;
022    import com.liferay.portal.kernel.xml.Element;
023    import com.liferay.portal.model.Layout;
024    import com.liferay.portal.model.Portlet;
025    import com.liferay.portal.model.StagedModel;
026    import com.liferay.portal.theme.ThemeDisplay;
027    
028    import java.io.File;
029    
030    import java.util.Calendar;
031    import java.util.List;
032    import java.util.Map;
033    
034    import javax.portlet.PortletPreferences;
035    import javax.portlet.PortletRequest;
036    
037    /**
038     * @author Zsolt Berentey
039     */
040    public interface ExportImportHelper {
041    
042            public static final String DATA_HANDLER_COMPANY_SECURE_URL =
043                    "@data_handler_company_secure_url@";
044    
045            public static final String DATA_HANDLER_COMPANY_URL =
046                    "@data_handler_company_url@";
047    
048            public static final String DATA_HANDLER_GROUP_FRIENDLY_URL =
049                    "@data_handler_group_friendly_url@";
050    
051            public static final String DATA_HANDLER_PATH_CONTEXT =
052                    "@data_handler_path_context@";
053    
054            public static final String DATA_HANDLER_PRIVATE_GROUP_SERVLET_MAPPING =
055                    "@data_handler_private_group_servlet_mapping@";
056    
057            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_SECURE_URL =
058                    "@data_handler_private_layout_set_secure_url@";
059    
060            public static final String DATA_HANDLER_PRIVATE_LAYOUT_SET_URL =
061                    "@data_handler_private_layout_set_url@";
062    
063            public static final String DATA_HANDLER_PRIVATE_USER_SERVLET_MAPPING =
064                    "@data_handler_private_user_servlet_mapping@";
065    
066            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_SECURE_URL =
067                    "@data_handler_public_layout_set_secure_url@";
068    
069            public static final String DATA_HANDLER_PUBLIC_LAYOUT_SET_URL =
070                    "@data_handler_public_layout_set_url@";
071    
072            public static final String DATA_HANDLER_PUBLIC_SERVLET_MAPPING =
073                    "@data_handler_public_servlet_mapping@";
074    
075            public static final String TEMP_FOLDER_NAME =
076                    ExportImportHelper.class.getName();
077    
078            public Calendar getCalendar(
079                    PortletRequest portletRequest, String paramPrefix,
080                    boolean timeZoneSensitive);
081    
082            public DateRange getDateRange(
083                            PortletRequest portletRequest, long groupId, boolean privateLayout,
084                            long plid, String portletId, String defaultRange)
085                    throws Exception;
086    
087            public Layout getExportableLayout(ThemeDisplay themeDisplay)
088                    throws PortalException, SystemException;
089    
090            public String getExportableRootPortletId(long companyId, String portletId)
091                    throws Exception;
092    
093            public Map<Long, Boolean> getLayoutIdMap(PortletRequest portletRequest)
094                    throws Exception;
095    
096            public long[] getLayoutIds(List<Layout> layouts);
097    
098            public ManifestSummary getManifestSummary(
099                            long userId, long groupId, Map<String, String[]> parameterMap,
100                            File file)
101                    throws Exception;
102    
103            public ManifestSummary getManifestSummary(
104                            long userId, long groupId, Map<String, String[]> parameterMap,
105                            FileEntry fileEntry)
106                    throws Exception;
107    
108            public long getModelDeletionCount(
109                            final PortletDataContext portletDataContext,
110                            final StagedModelType stagedModelType)
111                    throws PortalException, SystemException;
112    
113            public FileEntry getTempFileEntry(
114                            long groupId, long userId, String folderName)
115                    throws PortalException, SystemException;
116    
117            public String replaceExportContentReferences(
118                            PortletDataContext portletDataContext,
119                            StagedModel entityStagedModel, Element entityElement,
120                            String content, boolean exportReferencedContent)
121                    throws Exception;
122    
123            public String replaceExportDLReferences(
124                            PortletDataContext portletDataContext,
125                            StagedModel entityStagedModel, Element entityElement,
126                            String content, boolean exportReferencedContent)
127                    throws Exception;
128    
129            public String replaceExportLayoutReferences(
130                            PortletDataContext portletDataContext, String content,
131                            boolean exportReferencedContent)
132                    throws Exception;
133    
134            public String replaceExportLinksToLayouts(
135                            PortletDataContext portletDataContext,
136                            StagedModel entityStagedModel, Element entityElement,
137                            String content, boolean exportReferencedContent)
138                    throws Exception;
139    
140            public String replaceImportContentReferences(
141                            PortletDataContext portletDataContext, Element entityElement,
142                            String content, boolean importReferencedContent)
143                    throws Exception;
144    
145            public String replaceImportDLReferences(
146                            PortletDataContext portletDataContext, Element entityElement,
147                            String content, boolean importReferencedContent)
148                    throws Exception;
149    
150            public String replaceImportLayoutReferences(
151                            PortletDataContext portletDataContext, String content,
152                            boolean importReferencedContent)
153                    throws Exception;
154    
155            public String replaceImportLinksToLayouts(
156                            PortletDataContext portletDataContext, String content,
157                            boolean importReferencedContent)
158                    throws Exception;
159    
160            public void updateExportPortletPreferencesClassPKs(
161                            PortletDataContext portletDataContext, Portlet portlet,
162                            PortletPreferences portletPreferences, String key, String className,
163                            Element rootElement)
164                    throws Exception;
165    
166            public void updateImportPortletPreferencesClassPKs(
167                            PortletDataContext portletDataContext,
168                            PortletPreferences portletPreferences, String key, Class<?> clazz,
169                            long companyGroupId)
170                    throws Exception;
171    
172            public MissingReferences validateMissingReferences(
173                            long userId, long groupId, Map<String, String[]> parameterMap,
174                            File file)
175                    throws Exception;
176    
177            public void writeManifestSummary(
178                    Document document, ManifestSummary manifestSummary);
179    
180    }