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