001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.lar;
016    
017    import com.liferay.portal.kernel.dao.orm.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 Set<StagedModelType> getDeletionSystemEventStagedModelTypes();
282    
283            public Date getEndDate();
284    
285            public Map<String, List<ExpandoColumn>> getExpandoColumns();
286    
287            public Element getExportDataElement(ClassedModel classedModel);
288    
289            /**
290             * @deprecated As of 7.0.0, replaced by {@link
291             *             #getExportDataElement(ClassedModel, String)}
292             */
293            @Deprecated
294            public Element getExportDataElement(
295                    ClassedModel classedModel, Class<?> modelClass);
296    
297            public Element getExportDataElement(
298                    ClassedModel classedModel, String modelClassSimpleName);
299    
300            public Element getExportDataGroupElement(
301                    Class<? extends StagedModel> clazz);
302    
303            public Element getExportDataRootElement();
304    
305            public long getGroupId();
306    
307            public Element getImportDataElement(StagedModel stagedModel);
308    
309            public Element getImportDataElement(
310                    String name, String attribute, String value);
311    
312            public Element getImportDataGroupElement(
313                    Class<? extends StagedModel> clazz);
314    
315            public Element getImportDataRootElement();
316    
317            public Element getImportDataStagedModelElement(StagedModel stagedModel);
318    
319            /**
320             * @deprecated As of 6.2.0, replaced by {@link
321             *             ExportImportPathUtil#getLayoutPath(PortletDataContext, long)}
322             */
323            public String getLayoutPath(long plid);
324    
325            public Map<String, Lock> getLocks();
326    
327            public ManifestSummary getManifestSummary();
328    
329            public Element getMissingReferencesElement();
330    
331            public List<Layout> getNewLayouts();
332    
333            public Map<?, ?> getNewPrimaryKeysMap(Class<?> clazz);
334    
335            public Map<?, ?> getNewPrimaryKeysMap(String className);
336    
337            /**
338             * @deprecated As of 7.0.0
339             */
340            @Deprecated
341            public long getOldPlid();
342    
343            public Map<String, String[]> getParameterMap();
344    
345            public Map<String, List<KeyValuePair>> getPermissions();
346    
347            public long getPlid();
348    
349            public String getRootPortletId();
350    
351            /**
352             * @deprecated As of 6.2.0, replaced by {@link
353             *             ExportImportPathUtil#getPortletPath(PortletDataContext,
354             *             String)}
355             */
356            public String getPortletPath(String portletId);
357    
358            public Set<String> getPrimaryKeys();
359    
360            public Map<String, List<RatingsEntry>> getRatingsEntries();
361    
362            public Element getReferenceDataElement(
363                    Element parentElement, Class<?> clazz, long classPK);
364    
365            public Element getReferenceDataElement(
366                    Element parentElement, Class<?> clazz, long groupId, String uuid);
367    
368            public Element getReferenceDataElement(
369                    StagedModel parentStagedModel, Class<?> clazz, long classPK);
370    
371            public Element getReferenceDataElement(
372                    StagedModel parentStagedModel, Class<?> clazz, long groupId,
373                    String uuid);
374    
375            /**
376             * @deprecated As of 7.0.0
377             */
378            @Deprecated
379            public List<Element> getReferenceDataElements(
380                    Element parentElement, Class<?> clazz);
381    
382            public List<Element> getReferenceDataElements(
383                    Element parentElement, Class<?> clazz, String referenceType);
384    
385            public List<Element> getReferenceDataElements(
386                    StagedModel parentStagedModel, Class<?> clazz);
387    
388            public List<Element> getReferenceDataElements(
389                    StagedModel parentStagedModel, Class<?> clazz, String referenceType);
390    
391            public Element getReferenceElement(
392                    Element parentElement, Class<?> clazz, long groupId, String uuid,
393                    String referenceType);
394    
395            public Element getReferenceElement(
396                    StagedModel parentStagedModel, Class<?> clazz, long classPK);
397    
398            public List<Element> getReferenceElements(
399                    StagedModel parentStagedModel, Class<?> clazz);
400    
401            /**
402             * @deprecated As of 6.2.0, replaced by {@link
403             *             ExportImportPathUtil#getRootPath(PortletDataContext)}
404             */
405            public String getRootPath();
406    
407            /**
408             * @deprecated As of 7.0.0
409             */
410            @Deprecated
411            public Set<String> getScopedPrimaryKeys();
412    
413            public long getScopeGroupId();
414    
415            public String getScopeLayoutUuid();
416    
417            public String getScopeType();
418    
419            public long getSourceCompanyGroupId();
420    
421            public long getSourceCompanyId();
422    
423            public long getSourceGroupId();
424    
425            /**
426             * @deprecated As of 6.2.0, replaced by {@link
427             *             ExportImportPathUtil#getSourceLayoutPath(PortletDataContext,
428             *             long)}
429             */
430            public String getSourceLayoutPath(long layoutId);
431    
432            /**
433             * @deprecated As of 6.2.0, replaced by {@link
434             *             ExportImportPathUtil#getSourcePortletPath(PortletDataContext,
435             *             String)}
436             */
437            public String getSourcePortletPath(String portletId);
438    
439            /**
440             * @deprecated As of 6.2.0, replaced by {@link
441             *             ExportImportPathUtil#getSourceRootPath(PortletDataContext)}
442             */
443            public String getSourceRootPath();
444    
445            public long getSourceUserPersonalSiteGroupId();
446    
447            public Date getStartDate();
448    
449            public long getUserId(String userUuid) throws SystemException;
450    
451            public UserIdStrategy getUserIdStrategy();
452    
453            public long getUserPersonalSiteGroupId();
454    
455            /**
456             * @deprecated As of 7.0.0
457             */
458            @Deprecated
459            public List<String> getZipEntries();
460    
461            public byte[] getZipEntryAsByteArray(String path);
462    
463            public InputStream getZipEntryAsInputStream(String path);
464    
465            public Object getZipEntryAsObject(Element element, String path);
466    
467            public Object getZipEntryAsObject(String path);
468    
469            public String getZipEntryAsString(String path);
470    
471            /**
472             * @deprecated As of 7.0.0
473             */
474            @Deprecated
475            public List<String> getZipFolderEntries();
476    
477            public List<String> getZipFolderEntries(String path);
478    
479            public ZipReader getZipReader();
480    
481            public ZipWriter getZipWriter();
482    
483            public boolean hasDateRange();
484    
485            public boolean hasNotUniquePerLayout(String dataKey);
486    
487            public boolean hasPrimaryKey(Class<?> clazz, String primaryKey);
488    
489            public boolean hasScopedPrimaryKey(Class<?> clazz, String primaryKey);
490    
491            public void importClassedModel(
492                            ClassedModel classedModel, ClassedModel newClassedModel)
493                    throws PortalException, SystemException;
494    
495            public void importClassedModel(
496                            ClassedModel classedModel, ClassedModel newClassedModel,
497                            Class<?> clazz)
498                    throws PortalException, SystemException;
499    
500            /**
501             * @deprecated As of 6.2.0, replaced by {@link
502             *             #importClassedModel(ClassedModel, ClassedModel, Class)}
503             */
504            public void importClassedModel(
505                            ClassedModel classedModel, ClassedModel newClassedModel,
506                            Class<?> clazz, String namespace)
507                    throws PortalException, SystemException;
508    
509            /**
510             * @deprecated As of 6.2.0, replaced by {@link
511             *             #importClassedModel(ClassedModel, ClassedModel)}
512             */
513            public void importClassedModel(
514                            ClassedModel classedModel, ClassedModel newClassedModel,
515                            String namespace)
516                    throws PortalException, SystemException;
517    
518            public void importComments(
519                            Class<?> clazz, long classPK, long newClassPK, long groupId)
520                    throws PortalException, SystemException;
521    
522            public void importLocks(Class<?> clazz, String key, String newKey)
523                    throws PortalException, SystemException;
524    
525            public void importPermissions(Class<?> clazz, long classPK, long newClassPK)
526                    throws PortalException, SystemException;
527    
528            public void importPermissions(
529                            String resourceName, long resourcePK, long newResourcePK)
530                    throws PortalException, SystemException;
531    
532            public void importPortalPermissions()
533                    throws PortalException, SystemException;
534    
535            public void importPortletPermissions(String resourceName)
536                    throws PortalException, SystemException;
537    
538            public void importRatingsEntries(
539                            Class<?> clazz, long classPK, long newClassPK)
540                    throws PortalException, SystemException;
541    
542            public boolean isCompanyStagedGroupedModel(
543                    StagedGroupedModel stagedGroupedModel);
544    
545            public boolean isDataStrategyMirror();
546    
547            public boolean isDataStrategyMirrorWithOverwriting();
548    
549            public boolean isInitialPublication();
550    
551            public boolean isMissingReference(Element referenceElement);
552    
553            public boolean isModelCounted(String className, long classPK);
554    
555            public boolean isPathExportedInScope(String path);
556    
557            /**
558             * @deprecated As of 7.0.0
559             */
560            @Deprecated
561            public boolean isPathNotExportedInScope(String path);
562    
563            public boolean isPathNotProcessed(String path);
564    
565            public boolean isPathProcessed(String path);
566    
567            public boolean isPerformDirectBinaryImport();
568    
569            public boolean isPrivateLayout();
570    
571            public boolean isStagedModelCounted(StagedModel stagedModel);
572    
573            public boolean isWithinDateRange(Date modifiedDate);
574    
575            public void putNotUniquePerLayout(String dataKey);
576    
577            public void setClassLoader(ClassLoader classLoader);
578    
579            public void setCompanyGroupId(long companyGroupId);
580    
581            public void setCompanyId(long companyId);
582    
583            public void setDataStrategy(String dataStrategy);
584    
585            public void setEndDate(Date endDate);
586    
587            public void setExportDataRootElement(Element exportDataRootElement);
588    
589            public void setGroupId(long groupId);
590    
591            public void setImportDataRootElement(Element importDataRootElement);
592    
593            public void setManifestSummary(ManifestSummary manifestSummary);
594    
595            public void setMissingReferencesElement(Element missingReferencesElement);
596    
597            public void setNewLayouts(List<Layout> newLayouts);
598    
599            public void setNewPrimaryKeysMaps(
600                    Map<String, Map<?, ?>> newPrimaryKeysMaps);
601    
602            public void setOldPlid(long oldPlid);
603    
604            public void setParameterMap(Map<String, String[]> parameterMap);
605    
606            public void setPlid(long plid);
607    
608            public void setPortetDataContextListener(
609                    PortletDataContextListener portletDataContextListener);
610    
611            public void setPrivateLayout(boolean privateLayout);
612    
613            public void setRootPortletId(String rootPortletId);
614    
615            public void setScopeGroupId(long scopeGroupId);
616    
617            public void setScopeLayoutUuid(String scopeLayoutUuid);
618    
619            public void setScopeType(String scopeType);
620    
621            public void setSourceCompanyGroupId(long sourceCompanyGroupId);
622    
623            public void setSourceCompanyId(long sourceCompanyId);
624    
625            public void setSourceGroupId(long sourceGroupId);
626    
627            public void setSourceUserPersonalSiteGroupId(
628                    long sourceUserPersonalSiteGroupId);
629    
630            public void setStartDate(Date startDate);
631    
632            public void setUserIdStrategy(UserIdStrategy userIdStrategy);
633    
634            public void setUserPersonalSiteGroupId(long userPersonalSiteGroupId);
635    
636            public void setZipReader(ZipReader zipReader);
637    
638            public void setZipWriter(ZipWriter zipWriter);
639    
640            public String toXML(Object object);
641    
642    }