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