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.dao.orm.DynamicQuery;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.util.KeyValuePair;
021    import com.liferay.portal.kernel.xml.Element;
022    import com.liferay.portal.kernel.zip.ZipReader;
023    import com.liferay.portal.kernel.zip.ZipWriter;
024    import com.liferay.portal.model.ClassedModel;
025    import com.liferay.portal.model.Lock;
026    import com.liferay.portal.model.StagedModel;
027    import com.liferay.portal.service.ServiceContext;
028    import com.liferay.portlet.expando.model.ExpandoColumn;
029    import com.liferay.portlet.messageboards.model.MBMessage;
030    import com.liferay.portlet.ratings.model.RatingsEntry;
031    
032    import java.io.InputStream;
033    import java.io.Serializable;
034    
035    import java.util.Date;
036    import java.util.List;
037    import java.util.Map;
038    import java.util.Set;
039    
040    /**
041     * <p>
042     * Holds context information that is used during exporting and importing portlet
043     * data.
044     * </p>
045     *
046     * @author Brian Wing Shun Chan
047     * @author Raymond Augé
048     */
049    public interface PortletDataContext extends Serializable {
050    
051            /**
052             * @deprecated As of 6.2.0, replaced by {@link
053             *             ExportImportPathUtil#_PATH_PREFIX_GROUP}
054             */
055            public static final String ROOT_PATH_GROUPS = "/groups/";
056    
057            /**
058             * @deprecated As of 6.2.0, replaced by {@link
059             *             ExportImportPathUtil#_PATH_PREFIX_LAYOUT}
060             */
061            public static final String ROOT_PATH_LAYOUTS = "/layouts/";
062    
063            /**
064             * @deprecated As of 6.2.0, replaced by {@link
065             *             ExportImportPathUtil#_PATH_PREFIX_PORTLET}
066             */
067            public static final String ROOT_PATH_PORTLETS = "/portlets/";
068    
069            public void addAssetCategories(Class<?> clazz, long classPK)
070                    throws SystemException;
071    
072            public void addAssetCategories(
073                    String className, long classPK, long[] assetCategoryIds);
074    
075            public void addAssetTags(Class<?> clazz, long classPK)
076                    throws SystemException;
077    
078            public void addAssetTags(
079                    String className, long classPK, String[] assetTagNames);
080    
081            public void addClassedModel(
082                            Element element, String path, ClassedModel classedModel,
083                            String namespace)
084                    throws PortalException, SystemException;
085    
086            public void addComments(Class<?> clazz, long classPK)
087                    throws SystemException;
088    
089            public void addComments(
090                    String className, long classPK, List<MBMessage> messages);
091    
092            public void addDateRangeCriteria(
093                    DynamicQuery dynamicQuery, String modifiedDatePropertyName);
094    
095            public void addExpando(
096                            Element element, String path, ClassedModel classedModel)
097                    throws PortalException, SystemException;
098    
099            public void addLocks(Class<?> clazz, String key)
100                    throws PortalException, SystemException;
101    
102            public void addLocks(String className, String key, Lock lock);
103    
104            public void addPermissions(Class<?> clazz, long classPK)
105                    throws PortalException, SystemException;
106    
107            public void addPermissions(String resourceName, long resourcePK)
108                    throws PortalException, SystemException;
109    
110            public void addPermissions(
111                    String resourceName, long resourcePK, List<KeyValuePair> permissions);
112    
113            public boolean addPrimaryKey(Class<?> clazz, String primaryKey);
114    
115            public void addRatingsEntries(Class<?> clazz, long classPK)
116                    throws SystemException;
117    
118            public void addRatingsEntries(
119                    String className, long classPK, List<RatingsEntry> ratingsEntries);
120    
121            public Element addReferenceElement(
122                    Element element, ClassedModel referencedClassedModel);
123    
124            public void addZipEntry(String path, byte[] bytes) throws SystemException;
125    
126            public void addZipEntry(String path, InputStream is) throws SystemException;
127    
128            public void addZipEntry(String path, Object object) throws SystemException;
129    
130            public void addZipEntry(String path, String s) throws SystemException;
131    
132            public void addZipEntry(String name, StringBuilder sb)
133                    throws SystemException;
134    
135            public ServiceContext createServiceContext(
136                    Element element, ClassedModel classedModel, String namespace);
137    
138            public ServiceContext createServiceContext(
139                    StagedModel stagedModel, String namespace);
140    
141            public ServiceContext createServiceContext(
142                    String path, ClassedModel classedModel, String namespace);
143    
144            public Object fromXML(byte[] bytes);
145    
146            public Object fromXML(String xml);
147    
148            public long[] getAssetCategoryIds(Class<?> clazz, long classPK);
149    
150            public Map<String, long[]> getAssetCategoryIdsMap();
151    
152            public Map<String, String[]> getAssetCategoryUuidsMap();
153    
154            public Map<String, String[]> getAssetLinkUuidsMap();
155    
156            public String[] getAssetTagNames(Class<?> clazz, long classPK);
157    
158            public String[] getAssetTagNames(String className, long classPK);
159    
160            public Map<String, String[]> getAssetTagNamesMap();
161    
162            public boolean getBooleanParameter(String namespace, String name);
163    
164            public ClassLoader getClassLoader();
165    
166            public Map<String, List<MBMessage>> getComments();
167    
168            public long getCompanyGroupId();
169    
170            public long getCompanyId();
171    
172            public String getDataStrategy();
173    
174            public Date getEndDate();
175    
176            public Map<String, List<ExpandoColumn>> getExpandoColumns();
177    
178            public Element getExportDataGroupElement(
179                    Class<? extends StagedModel> clazz);
180    
181            public Element getExportDataRootElement();
182    
183            public Element getExportDataStagedModelElement(StagedModel stagedModel);
184    
185            public long getGroupId();
186    
187            public Element getImportDataGroupElement(
188                    Class<? extends StagedModel> clazz);
189    
190            public Element getImportDataRootElement();
191    
192            public Element getImportDataStagedModelElement(StagedModel stagedModel);
193    
194            public Element getImportDataStagedModelElement(
195                    String name, String attribute, String value);
196    
197            /**
198             * @deprecated As of 6.2.0, replaced by {@link
199             *             ExportImportPathUtil#getLayoutPath(PortletDataContext, long)}
200             */
201            public String getLayoutPath(long layoutId);
202    
203            public Map<String, Lock> getLocks();
204    
205            public Map<?, ?> getNewPrimaryKeysMap(Class<?> clazz);
206    
207            public Map<?, ?> getNewPrimaryKeysMap(String className);
208    
209            public long getOldPlid();
210    
211            public Map<String, String[]> getParameterMap();
212    
213            public Map<String, List<KeyValuePair>> getPermissions();
214    
215            public long getPlid();
216    
217            /**
218             * @deprecated As of 6.2.0, replaced by {@link
219             *             ExportImportPathUtil#getPortletPath(PortletDataContext,
220             *             String)}
221             */
222            public String getPortletPath(String portletId);
223    
224            public Set<String> getPrimaryKeys();
225    
226            public Map<String, List<RatingsEntry>> getRatingsEntries();
227    
228            public List<Element> getReferencedDataElements(
229                    StagedModel parentStagedModel, Class<? extends StagedModel> clazz);
230    
231            /**
232             * @deprecated As of 6.2.0, replaced by {@link
233             *             ExportImportPathUtil#getRootPath(PortletDataContext)}
234             */
235            public String getRootPath();
236    
237            public long getScopeGroupId();
238    
239            public String getScopeLayoutUuid();
240    
241            public String getScopeType();
242    
243            public long getSourceCompanyGroupId();
244    
245            public long getSourceGroupId();
246    
247            /**
248             * @deprecated As of 6.2.0, replaced by {@link
249             *             ExportImportPathUtil#getSourceLayoutPath(PortletDataContext,
250             *             long)}
251             */
252            public String getSourceLayoutPath(long layoutId);
253    
254            /**
255             * @deprecated As of 6.2.0, replaced by {@link
256             *             ExportImportPathUtil#getSourcePortletPath(
257             *             PortletDataContext, String)}
258             */
259            public String getSourcePortletPath(String portletId);
260    
261            /**
262             * @deprecated As of 6.2.0, replaced by {@link
263             *             ExportImportPathUtil#getSourceRootPath(PortletDataContext)}
264             */
265            public String getSourceRootPath();
266    
267            public Date getStartDate();
268    
269            public long getUserId(String userUuid) throws SystemException;
270    
271            public UserIdStrategy getUserIdStrategy();
272    
273            public List<String> getZipEntries();
274    
275            public byte[] getZipEntryAsByteArray(String path);
276    
277            public InputStream getZipEntryAsInputStream(String path);
278    
279            public Object getZipEntryAsObject(Element element, String path);
280    
281            public Object getZipEntryAsObject(String path);
282    
283            public String getZipEntryAsString(String path);
284    
285            public List<String> getZipFolderEntries();
286    
287            public List<String> getZipFolderEntries(String path);
288    
289            public ZipReader getZipReader();
290    
291            public ZipWriter getZipWriter();
292    
293            public boolean hasDateRange();
294    
295            public boolean hasNotUniquePerLayout(String dataKey);
296    
297            public boolean hasPrimaryKey(Class<?> clazz, String primaryKey);
298    
299            public void importClassedModel(
300                            ClassedModel classedModel, ClassedModel newClassedModel,
301                            String namespace)
302                    throws PortalException, SystemException;
303    
304            public void importComments(
305                            Class<?> clazz, long classPK, long newClassPK, long groupId)
306                    throws PortalException, SystemException;
307    
308            public void importLocks(Class<?> clazz, String key, String newKey)
309                    throws PortalException, SystemException;
310    
311            public void importPermissions(Class<?> clazz, long classPK, long newClassPK)
312                    throws PortalException, SystemException;
313    
314            public void importPermissions(
315                            String resourceObj, long resourcePK, long newResourcePK)
316                    throws PortalException, SystemException;
317    
318            public void importRatingsEntries(
319                            Class<?> clazz, long classPK, long newClassPK)
320                    throws PortalException, SystemException;
321    
322            public boolean isDataStrategyMirror();
323    
324            public boolean isDataStrategyMirrorWithOverwriting();
325    
326            public boolean isPathNotProcessed(String path);
327    
328            public boolean isPathProcessed(String path);
329    
330            public boolean isPerformDirectBinaryImport();
331    
332            public boolean isPrivateLayout();
333    
334            public boolean isWithinDateRange(Date modifiedDate);
335    
336            public void putNotUniquePerLayout(String dataKey);
337    
338            public void setClassLoader(ClassLoader classLoader);
339    
340            public void setExportDataRootElement(Element exportDataRootElement);
341    
342            public void setGroupId(long groupId);
343    
344            public void setImportDataRootElement(Element importDataRootElement);
345    
346            public void setOldPlid(long oldPlid);
347    
348            public void setPlid(long plid);
349    
350            public void setPortetDataContextListener(
351                    PortletDataContextListener portletDataContextListener);
352    
353            public void setPrivateLayout(boolean privateLayout);
354    
355            public void setScopeGroupId(long scopeGroupId);
356    
357            public void setScopeLayoutUuid(String scopeLayoutUuid);
358    
359            public void setScopeType(String scopeType);
360    
361            public void setSourceCompanyGroupId(long sourceCompanyGroupId);
362    
363            public void setSourceGroupId(long sourceGroupId);
364    
365            public void setStartDate(Date startDate);
366    
367            public String toXML(Object object);
368    
369    }