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