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 String getSelectedLayoutsJSON(
114                            long groupId, boolean privateLayout, String selectedNodes)
115                    throws SystemException;
116    
117            public FileEntry getTempFileEntry(
118                            long groupId, long userId, String folderName)
119                    throws PortalException, SystemException;
120    
121            public String replaceExportContentReferences(
122                            PortletDataContext portletDataContext,
123                            StagedModel entityStagedModel, Element entityElement,
124                            String content, boolean exportReferencedContent)
125                    throws Exception;
126    
127            public String replaceExportDLReferences(
128                            PortletDataContext portletDataContext,
129                            StagedModel entityStagedModel, Element entityElement,
130                            String content, boolean exportReferencedContent)
131                    throws Exception;
132    
133            public String replaceExportLayoutReferences(
134                            PortletDataContext portletDataContext, String content,
135                            boolean exportReferencedContent)
136                    throws Exception;
137    
138            public String replaceExportLinksToLayouts(
139                            PortletDataContext portletDataContext,
140                            StagedModel entityStagedModel, Element entityElement,
141                            String content, boolean exportReferencedContent)
142                    throws Exception;
143    
144            public String replaceImportContentReferences(
145                            PortletDataContext portletDataContext, Element entityElement,
146                            String content, boolean importReferencedContent)
147                    throws Exception;
148    
149            public String replaceImportDLReferences(
150                            PortletDataContext portletDataContext, Element entityElement,
151                            String content, boolean importReferencedContent)
152                    throws Exception;
153    
154            public String replaceImportLayoutReferences(
155                            PortletDataContext portletDataContext, String content,
156                            boolean importReferencedContent)
157                    throws Exception;
158    
159            public String replaceImportLinksToLayouts(
160                            PortletDataContext portletDataContext, String content,
161                            boolean importReferencedContent)
162                    throws Exception;
163    
164            public void updateExportPortletPreferencesClassPKs(
165                            PortletDataContext portletDataContext, Portlet portlet,
166                            PortletPreferences portletPreferences, String key, String className,
167                            Element rootElement)
168                    throws Exception;
169    
170            public void updateImportPortletPreferencesClassPKs(
171                            PortletDataContext portletDataContext,
172                            PortletPreferences portletPreferences, String key, Class<?> clazz,
173                            long companyGroupId)
174                    throws Exception;
175    
176            public MissingReferences validateMissingReferences(
177                            long userId, long groupId, Map<String, String[]> parameterMap,
178                            File file)
179                    throws Exception;
180    
181            public void writeManifestSummary(
182                    Document document, ManifestSummary manifestSummary);
183    
184    }