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