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