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.DateRange;
021    import com.liferay.portal.kernel.util.KeyValuePair;
022    import com.liferay.portal.kernel.xml.Element;
023    import com.liferay.portal.kernel.zip.ZipReader;
024    import com.liferay.portal.kernel.zip.ZipWriter;
025    import com.liferay.portal.model.ClassedModel;
026    import com.liferay.portal.model.Layout;
027    import com.liferay.portal.model.Lock;
028    import com.liferay.portal.model.StagedGroupedModel;
029    import com.liferay.portal.model.StagedModel;
030    import com.liferay.portal.service.ServiceContext;
031    import com.liferay.portlet.asset.model.AssetLink;
032    import com.liferay.portlet.expando.model.ExpandoColumn;
033    import com.liferay.portlet.messageboards.model.MBMessage;
034    import com.liferay.portlet.ratings.model.RatingsEntry;
035    
036    import java.io.InputStream;
037    import java.io.Serializable;
038    
039    import java.util.Date;
040    import java.util.List;
041    import java.util.Map;
042    import java.util.Set;
043    
044    /**
045     * <p>
046     * Holds context information that is used during exporting and importing portlet
047     * data.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @author Raymond Aug??
052     */
053    public interface PortletDataContext extends Serializable {
054    
055            public static final String REFERENCE_TYPE_CHILD = "child";
056    
057            public static final String REFERENCE_TYPE_DEPENDENCY = "dependency";
058    
059            public static final String REFERENCE_TYPE_DEPENDENCY_DISPOSABLE =
060                    "disposable_dependency";
061    
062            public static final String REFERENCE_TYPE_EMBEDDED = "embedded";
063    
064            public static final String REFERENCE_TYPE_PARENT = "parent";
065    
066            public static final String REFERENCE_TYPE_STRONG = "strong";
067    
068            public static final String REFERENCE_TYPE_WEAK = "weak";
069    
070            /**
071             * @deprecated As of 6.2.0, replaced by {@link
072             *             ExportImportPathUtil#PATH_PREFIX_GROUP}
073             */
074            public static final String ROOT_PATH_GROUPS = "/groups/";
075    
076            /**
077             * @deprecated As of 6.2.0, replaced by {@link
078             *             ExportImportPathUtil#PATH_PREFIX_LAYOUT}
079             */
080            public static final String ROOT_PATH_LAYOUTS = "/layouts/";
081    
082            /**
083             * @deprecated As of 6.2.0, replaced by {@link
084             *             ExportImportPathUtil#PATH_PREFIX_PORTLET}
085             */
086            public static final String ROOT_PATH_PORTLETS = "/portlets/";
087    
088            public void addAssetCategories(Class<?> clazz, long classPK)
089                    throws SystemException;
090    
091            public void addAssetCategories(
092                    String className, long classPK, long[] assetCategoryIds);
093    
094            public void addAssetTags(Class<?> clazz, long classPK)
095                    throws SystemException;
096    
097            public void addAssetTags(
098                    String className, long classPK, String[] assetTagNames);
099    
100            public void addClassedModel(
101                            Element element, String path, ClassedModel classedModel)
102                    throws PortalException, SystemException;
103    
104            public void addClassedModel(
105                            Element element, String path, ClassedModel classedModel,
106                            Class<?> clazz)
107                    throws PortalException, SystemException;
108    
109            /**
110             * @deprecated As of 6.2.0, replaced by {@link #addClassedModel(Element,
111             *             ClassedModel, Class)}
112             */
113            public void addClassedModel(
114                            Element element, String path, ClassedModel classedModel,
115                            Class<?> clazz, String namespace)
116                    throws PortalException, SystemException;
117    
118            /**
119             * @deprecated As of 6.2.0, replaced by {@link #addClassedModel(Element,
120             *             String, ClassedModel)}
121             */
122            public void addClassedModel(
123                            Element element, String path, ClassedModel classedModel,
124                            String namespace)
125                    throws PortalException, SystemException;
126    
127            public void addComments(Class<?> clazz, long classPK)
128                    throws SystemException;
129    
130            public void addComments(
131                    String className, long classPK, List<MBMessage> messages);
132    
133            public void addDateRangeCriteria(
134                    DynamicQuery dynamicQuery, String modifiedDatePropertyName);
135    
136            public void addDeletionSystemEventStagedModelTypes(
137                    StagedModelType... stagedModelTypes);
138    
139            public void addExpando(
140                            Element element, String path, ClassedModel classedModel)
141                    throws PortalException, SystemException;
142    
143            public void addLocks(Class<?> clazz, String key)
144                    throws PortalException, SystemException;
145    
146            public void addLocks(String className, String key, Lock lock);
147    
148            public void addPermissions(Class<?> clazz, long classPK)
149                    throws PortalException, SystemException;
150    
151            public void addPermissions(String resourceName, long resourcePK)
152                    throws PortalException, SystemException;
153    
154            public void addPermissions(
155                    String resourceName, long resourcePK, List<KeyValuePair> permissions);
156    
157            public void addPortalPermissions()
158                    throws PortalException, SystemException;
159    
160            public void addPortletPermissions(String resourceName)
161                    throws PortalException, SystemException;
162    
163            public boolean addPrimaryKey(Class<?> clazz, String primaryKey);
164    
165            public void addRatingsEntries(Class<?> clazz, long classPK)
166                    throws SystemException;
167    
168            public void addRatingsEntries(
169                    String className, long classPK, List<RatingsEntry> ratingsEntries);
170    
171            public Element addReferenceElement(
172                    ClassedModel referrerClassedModel, Element element,
173                    ClassedModel classedModel, Class<?> clazz, String referenceType,
174                    boolean missing);
175    
176            public Element addReferenceElement(
177                    ClassedModel referrerClassedModel, Element element,
178                    ClassedModel classedModel, String referenceType, boolean missing);
179    
180            public Element addReferenceElement(
181                    ClassedModel referrerClassedModel, Element element,
182                    ClassedModel classedModel, String binPath, String referenceType,
183                    boolean missing);
184    
185            public Element addReferenceElement(
186                    ClassedModel referrerClassedModel, Element element,
187                    ClassedModel classedModel, String className, String binPath,
188                    String referenceType, boolean missing);
189    
190            public boolean addScopedPrimaryKey(Class<?> clazz, String primaryKey);
191    
192            public void addZipEntry(String path, byte[] bytes) throws SystemException;
193    
194            public void addZipEntry(String path, InputStream is) throws SystemException;
195    
196            public void addZipEntry(String path, Object object) throws SystemException;
197    
198            public void addZipEntry(String path, String s) throws SystemException;
199    
200            public void addZipEntry(String name, StringBuilder sb)
201                    throws SystemException;
202    
203            public void clearScopedPrimaryKeys();
204    
205            public ServiceContext createServiceContext(
206                    Element element, ClassedModel classedModel);
207    
208            /**
209             * @deprecated As of 6.2.0, replaced by {@link
210             *             #createServiceContext(Element, ClassedModel)}
211             */
212            public ServiceContext createServiceContext(
213                    Element element, ClassedModel classedModel, String namespace);
214    
215            public ServiceContext createServiceContext(StagedModel stagedModel);
216    
217            public ServiceContext createServiceContext(
218                    StagedModel stagedModel, Class<?> clazz);
219    
220            public ServiceContext createServiceContext(
221                    String path, ClassedModel classedModel);
222    
223            /**
224             * @deprecated As of 6.2.0, replaced by {@link #createServiceContext(String,
225             *             ClassedModel)}
226             */
227            public ServiceContext createServiceContext(
228                    String path, ClassedModel classedModel, String namespace);
229    
230            public Object fromXML(byte[] bytes);
231    
232            public Object fromXML(String xml);
233    
234            public long[] getAssetCategoryIds(Class<?> clazz, long classPK);
235    
236            public Map<String, long[]> getAssetCategoryIdsMap();
237    
238            public Map<String, String[]> getAssetCategoryUuidsMap();
239    
240            public Map<String, List<AssetLink>> getAssetLinksMap();
241    
242            public String[] getAssetTagNames(Class<?> clazz, long classPK);
243    
244            public String[] getAssetTagNames(String className, long classPK);
245    
246            public Map<String, String[]> getAssetTagNamesMap();
247    
248            public boolean getBooleanParameter(String namespace, String name);
249    
250            public boolean getBooleanParameter(
251                    String namespace, String name, boolean useDefaultValue);
252    
253            public ClassLoader getClassLoader();
254    
255            public Map<String, List<MBMessage>> getComments();
256    
257            public long getCompanyGroupId();
258    
259            public long getCompanyId();
260    
261            public String getDataStrategy();
262    
263            public DateRange getDateRange();
264    
265            public Set<StagedModelType> getDeletionSystemEventStagedModelTypes();
266    
267            public Date getEndDate();
268    
269            public Map<String, List<ExpandoColumn>> getExpandoColumns();
270    
271            public Element getExportDataElement(ClassedModel classedModel);
272    
273            public Element getExportDataElement(
274                    ClassedModel classedModel, Class<?> modelClass);
275    
276            public Element getExportDataGroupElement(
277                    Class<? extends StagedModel> clazz);
278    
279            public Element getExportDataRootElement();
280    
281            public long getGroupId();
282    
283            public Element getImportDataElement(StagedModel stagedModel);
284    
285            public Element getImportDataElement(
286                    String name, String attribute, String value);
287    
288            public Element getImportDataGroupElement(
289                    Class<? extends StagedModel> clazz);
290    
291            public Element getImportDataRootElement();
292    
293            public Element getImportDataStagedModelElement(StagedModel stagedModel);
294    
295            /**
296             * @deprecated As of 6.2.0, replaced by {@link
297             *             ExportImportPathUtil#getLayoutPath(PortletDataContext, long)}
298             */
299            public String getLayoutPath(long plid);
300    
301            public Map<String, Lock> getLocks();
302    
303            public ManifestSummary getManifestSummary();
304    
305            public Element getMissingReferencesElement();
306    
307            public List<Layout> getNewLayouts();
308    
309            public Map<?, ?> getNewPrimaryKeysMap(Class<?> clazz);
310    
311            public Map<?, ?> getNewPrimaryKeysMap(String className);
312    
313            public long getOldPlid();
314    
315            public Map<String, String[]> getParameterMap();
316    
317            public Map<String, List<KeyValuePair>> getPermissions();
318    
319            public long getPlid();
320    
321            /**
322             * @deprecated As of 6.2.0, replaced by {@link
323             *             ExportImportPathUtil#getPortletPath(PortletDataContext,
324             *             String)}
325             */
326            public String getPortletPath(String portletId);
327    
328            public Set<String> getPrimaryKeys();
329    
330            public Map<String, List<RatingsEntry>> getRatingsEntries();
331    
332            public Element getReferenceDataElement(
333                    Element parentElement, Class<?> clazz, long classPK);
334    
335            public Element getReferenceDataElement(
336                    Element parentElement, Class<?> clazz, long groupId, String uuid);
337    
338            public Element getReferenceDataElement(
339                    StagedModel parentStagedModel, Class<?> clazz, long classPK);
340    
341            public Element getReferenceDataElement(
342                    StagedModel parentStagedModel, Class<?> clazz, long groupId,
343                    String uuid);
344    
345            public List<Element> getReferenceDataElements(
346                    Element parentElement, Class<?> clazz);
347    
348            public List<Element> getReferenceDataElements(
349                    Element parentElement, Class<?> clazz, String referenceType);
350    
351            public List<Element> getReferenceDataElements(
352                    StagedModel parentStagedModel, Class<?> clazz);
353    
354            public List<Element> getReferenceDataElements(
355                    StagedModel parentStagedModel, Class<?> clazz, String referenceType);
356    
357            public Element getReferenceElement(
358                    StagedModel parentStagedModel, Class<?> clazz, long classPK);
359    
360            public List<Element> getReferenceElements(
361                    StagedModel parentStagedModel, Class<?> clazz);
362    
363            /**
364             * @deprecated As of 6.2.0, replaced by {@link
365             *             ExportImportPathUtil#getRootPath(PortletDataContext)}
366             */
367            public String getRootPath();
368    
369            public Set<String> getScopedPrimaryKeys();
370    
371            public long getScopeGroupId();
372    
373            public String getScopeLayoutUuid();
374    
375            public String getScopeType();
376    
377            public long getSourceCompanyGroupId();
378    
379            public long getSourceCompanyId();
380    
381            public long getSourceGroupId();
382    
383            /**
384             * @deprecated As of 6.2.0, replaced by {@link
385             *             ExportImportPathUtil#getSourceLayoutPath(PortletDataContext,
386             *             long)}
387             */
388            public String getSourceLayoutPath(long layoutId);
389    
390            /**
391             * @deprecated As of 6.2.0, replaced by {@link
392             *             ExportImportPathUtil#getSourcePortletPath(
393             *             PortletDataContext, String)}
394             */
395            public String getSourcePortletPath(String portletId);
396    
397            /**
398             * @deprecated As of 6.2.0, replaced by {@link
399             *             ExportImportPathUtil#getSourceRootPath(PortletDataContext)}
400             */
401            public String getSourceRootPath();
402    
403            public long getSourceUserPersonalSiteGroupId();
404    
405            public Date getStartDate();
406    
407            public long getUserId(String userUuid) throws SystemException;
408    
409            public UserIdStrategy getUserIdStrategy();
410    
411            public long getUserPersonalSiteGroupId();
412    
413            public List<String> getZipEntries();
414    
415            public byte[] getZipEntryAsByteArray(String path);
416    
417            public InputStream getZipEntryAsInputStream(String path);
418    
419            public Object getZipEntryAsObject(Element element, String path);
420    
421            public Object getZipEntryAsObject(String path);
422    
423            public String getZipEntryAsString(String path);
424    
425            public List<String> getZipFolderEntries();
426    
427            public List<String> getZipFolderEntries(String path);
428    
429            public ZipReader getZipReader();
430    
431            public ZipWriter getZipWriter();
432    
433            public boolean hasDateRange();
434    
435            public boolean hasNotUniquePerLayout(String dataKey);
436    
437            public boolean hasPrimaryKey(Class<?> clazz, String primaryKey);
438    
439            public boolean hasScopedPrimaryKey(Class<?> clazz, String primaryKey);
440    
441            public void importClassedModel(
442                            ClassedModel classedModel, ClassedModel newClassedModel)
443                    throws PortalException, SystemException;
444    
445            public void importClassedModel(
446                            ClassedModel classedModel, ClassedModel newClassedModel,
447                            Class<?> clazz)
448                    throws PortalException, SystemException;
449    
450            /**
451             * @deprecated As of 6.2.0, replaced by {@link
452             *             #importClassedModel(ClassedModel, ClassedModel, Class)}
453             */
454            public void importClassedModel(
455                            ClassedModel classedModel, ClassedModel newClassedModel,
456                            Class<?> clazz, String namespace)
457                    throws PortalException, SystemException;
458    
459            /**
460             * @deprecated As of 6.2.0, replaced by {@link
461             *             #importClassedModel(ClassedModel, ClassedModel)}
462             */
463            public void importClassedModel(
464                            ClassedModel classedModel, ClassedModel newClassedModel,
465                            String namespace)
466                    throws PortalException, SystemException;
467    
468            public void importComments(
469                            Class<?> clazz, long classPK, long newClassPK, long groupId)
470                    throws PortalException, SystemException;
471    
472            public void importLocks(Class<?> clazz, String key, String newKey)
473                    throws PortalException, SystemException;
474    
475            public void importPermissions(Class<?> clazz, long classPK, long newClassPK)
476                    throws PortalException, SystemException;
477    
478            public void importPermissions(
479                            String resourceName, long resourcePK, long newResourcePK)
480                    throws PortalException, SystemException;
481    
482            public void importPortalPermissions()
483                    throws PortalException, SystemException;
484    
485            public void importPortletPermissions(String resourceName)
486                    throws PortalException, SystemException;
487    
488            public void importRatingsEntries(
489                            Class<?> clazz, long classPK, long newClassPK)
490                    throws PortalException, SystemException;
491    
492            public boolean isCompanyStagedGroupedModel(
493                    StagedGroupedModel stagedGroupedModel);
494    
495            public boolean isDataStrategyMirror();
496    
497            public boolean isDataStrategyMirrorWithOverwriting();
498    
499            public boolean isModelCounted(String className, long classPK);
500    
501            public boolean isPathExportedInScope(String path);
502    
503            public boolean isPathNotExportedInScope(String path);
504    
505            public boolean isPathNotProcessed(String path);
506    
507            public boolean isPathProcessed(String path);
508    
509            public boolean isPerformDirectBinaryImport();
510    
511            public boolean isPrivateLayout();
512    
513            public boolean isStagedModelCounted(StagedModel stagedModel);
514    
515            public boolean isWithinDateRange(Date modifiedDate);
516    
517            public void putNotUniquePerLayout(String dataKey);
518    
519            public void setClassLoader(ClassLoader classLoader);
520    
521            public void setCompanyGroupId(long companyGroupId);
522    
523            public void setCompanyId(long companyId);
524    
525            public void setDataStrategy(String dataStrategy);
526    
527            public void setEndDate(Date endDate);
528    
529            public void setExportDataRootElement(Element exportDataRootElement);
530    
531            public void setGroupId(long groupId);
532    
533            public void setImportDataRootElement(Element importDataRootElement);
534    
535            public void setManifestSummary(ManifestSummary manifestSummary);
536    
537            public void setMissingReferencesElement(Element missingReferencesElement);
538    
539            public void setNewLayouts(List<Layout> newLayouts);
540    
541            public void setOldPlid(long oldPlid);
542    
543            public void setParameterMap(Map<String, String[]> parameterMap);
544    
545            public void setPlid(long plid);
546    
547            public void setPortetDataContextListener(
548                    PortletDataContextListener portletDataContextListener);
549    
550            public void setPrivateLayout(boolean privateLayout);
551    
552            public void setScopeGroupId(long scopeGroupId);
553    
554            public void setScopeLayoutUuid(String scopeLayoutUuid);
555    
556            public void setScopeType(String scopeType);
557    
558            public void setSourceCompanyGroupId(long sourceCompanyGroupId);
559    
560            public void setSourceCompanyId(long sourceCompanyId);
561    
562            public void setSourceGroupId(long sourceGroupId);
563    
564            public void setSourceUserPersonalSiteGroupId(
565                    long sourceUserPersonalSiteGroupId);
566    
567            public void setStartDate(Date startDate);
568    
569            public void setUserIdStrategy(UserIdStrategy userIdStrategy);
570    
571            public void setUserPersonalSiteGroupId(long userPersonalSiteGroupId);
572    
573            public void setZipReader(ZipReader zipReader);
574    
575            public void setZipWriter(ZipWriter zipWriter);
576    
577            public String toXML(Object object);
578    
579    }