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.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.KeyValuePair;
020    import com.liferay.portal.kernel.xml.Element;
021    import com.liferay.portal.kernel.zip.ZipReader;
022    import com.liferay.portal.kernel.zip.ZipWriter;
023    import com.liferay.portal.model.ClassedModel;
024    import com.liferay.portal.model.Lock;
025    import com.liferay.portal.service.ServiceContext;
026    import com.liferay.portlet.expando.model.ExpandoColumn;
027    import com.liferay.portlet.messageboards.model.MBMessage;
028    import com.liferay.portlet.ratings.model.RatingsEntry;
029    
030    import java.io.InputStream;
031    import java.io.Serializable;
032    
033    import java.util.Date;
034    import java.util.List;
035    import java.util.Map;
036    import java.util.Set;
037    
038    /**
039     * <p>
040     * Holds context information that is used during exporting and importing portlet
041     * data.
042     * </p>
043     *
044     * @author Brian Wing Shun Chan
045     * @author Raymond Aug??
046     */
047    public interface PortletDataContext extends Serializable {
048    
049            public static final String ROOT_PATH_GROUPS = "/groups/";
050    
051            public static final String ROOT_PATH_LAYOUTS = "/layouts/";
052    
053            public static final String ROOT_PATH_PORTLETS = "/portlets/";
054    
055            public void addAssetCategories(Class<?> clazz, long classPK)
056                    throws SystemException;
057    
058            public void addAssetCategories(
059                    String className, long classPK, long[] assetCategoryIds);
060    
061            public void addAssetTags(Class<?> clazz, long classPK)
062                    throws SystemException;
063    
064            public void addAssetTags(
065                    String className, long classPK, String[] assetTagNames);
066    
067            public void addClassedModel(
068                            Element element, String path, ClassedModel classedModel,
069                            String namespace)
070                    throws PortalException, SystemException;
071    
072            public void addComments(Class<?> clazz, long classPK)
073                    throws SystemException;
074    
075            public void addComments(
076                    String className, long classPK, List<MBMessage> messages);
077    
078            public void addExpando(
079                            Element element, String path, ClassedModel classedModel)
080                    throws PortalException, SystemException;
081    
082            public void addLocks(Class<?> clazz, String key)
083                    throws PortalException, SystemException;
084    
085            public void addLocks(String className, String key, Lock lock);
086    
087            public void addPermissions(Class<?> clazz, long classPK)
088                    throws PortalException, SystemException;
089    
090            public void addPermissions(String resourceName, long resourcePK)
091                    throws PortalException, SystemException;
092    
093            public void addPermissions(
094                    String resourceName, long resourcePK, List<KeyValuePair> permissions);
095    
096            public boolean addPrimaryKey(Class<?> clazz, String primaryKey);
097    
098            public void addRatingsEntries(Class<?> clazz, long classPK)
099                    throws SystemException;
100    
101            public void addRatingsEntries(
102                    String className, long classPK, List<RatingsEntry> ratingsEntries);
103    
104            public void addZipEntry(String path, byte[] bytes) throws SystemException;
105    
106            public void addZipEntry(String path, InputStream is) throws SystemException;
107    
108            public void addZipEntry(String path, Object object) throws SystemException;
109    
110            public void addZipEntry(String path, String s) throws SystemException;
111    
112            public void addZipEntry(String name, StringBuilder sb)
113                    throws SystemException;
114    
115            public ServiceContext createServiceContext(
116                    Element element, ClassedModel classedModel, String namespace);
117    
118            public ServiceContext createServiceContext(
119                    String path, ClassedModel classedModel, String namespace);
120    
121            public Object fromXML(byte[] bytes);
122    
123            public Object fromXML(String xml);
124    
125            public long[] getAssetCategoryIds(Class<?> clazz, long classPK);
126    
127            public Map<String, long[]> getAssetCategoryIdsMap();
128    
129            public Map<String, String[]> getAssetCategoryUuidsMap();
130    
131            public Map<String, String[]> getAssetLinkUuidsMap();
132    
133            public String[] getAssetTagNames(Class<?> clazz, long classPK);
134    
135            public String[] getAssetTagNames(String className, long classPK);
136    
137            public Map<String, String[]> getAssetTagNamesMap();
138    
139            public boolean getBooleanParameter(String namespace, String name);
140    
141            public ClassLoader getClassLoader();
142    
143            public Map<String, List<MBMessage>> getComments();
144    
145            public long getCompanyGroupId();
146    
147            public long getCompanyId();
148    
149            public String getDataStrategy();
150    
151            public Date getEndDate();
152    
153            public Map<String, List<ExpandoColumn>> getExpandoColumns();
154    
155            public long getGroupId();
156    
157            public String getLayoutPath(long layoutId);
158    
159            public Map<String, Lock> getLocks();
160    
161            public Map<?, ?> getNewPrimaryKeysMap(Class<?> clazz);
162    
163            public Map<?, ?> getNewPrimaryKeysMap(String className);
164    
165            public long getOldPlid();
166    
167            public Map<String, String[]> getParameterMap();
168    
169            public Map<String, List<KeyValuePair>> getPermissions();
170    
171            public long getPlid();
172    
173            public String getPortletPath(String portletId);
174    
175            public Set<String> getPrimaryKeys();
176    
177            public Map<String, List<RatingsEntry>> getRatingsEntries();
178    
179            public String getRootPath();
180    
181            public long getScopeGroupId();
182    
183            public String getScopeLayoutUuid();
184    
185            public String getScopeType();
186    
187            public long getSourceCompanyGroupId();
188    
189            public long getSourceGroupId();
190    
191            public String getSourceLayoutPath(long layoutId);
192    
193            public String getSourcePortletPath(String portletId);
194    
195            public String getSourceRootPath();
196    
197            public Date getStartDate();
198    
199            public long getUserId(String userUuid) throws SystemException;
200    
201            public UserIdStrategy getUserIdStrategy() throws SystemException;
202    
203            public List<String> getZipEntries();
204    
205            public byte[] getZipEntryAsByteArray(String path);
206    
207            public InputStream getZipEntryAsInputStream(String path);
208    
209            public Object getZipEntryAsObject(Element element, String path);
210    
211            public Object getZipEntryAsObject(String path);
212    
213            public String getZipEntryAsString(String path);
214    
215            public List<String> getZipFolderEntries();
216    
217            public List<String> getZipFolderEntries(String path);
218    
219            public ZipReader getZipReader();
220    
221            public ZipWriter getZipWriter();
222    
223            public boolean hasDateRange();
224    
225            public boolean hasNotUniquePerLayout(String dataKey);
226    
227            public boolean hasPrimaryKey(Class<?> clazz, String primaryKey);
228    
229            public void importClassedModel(
230                            ClassedModel classedModel, ClassedModel newClassedModel,
231                            String namespace)
232                    throws PortalException, SystemException;
233    
234            public void importComments(
235                            Class<?> clazz, long classPK, long newClassPK, long groupId)
236                    throws PortalException, SystemException;
237    
238            public void importLocks(Class<?> clazz, String key, String newKey)
239                    throws PortalException, SystemException;
240    
241            public void importPermissions(Class<?> clazz, long classPK, long newClassPK)
242                    throws PortalException, SystemException;
243    
244            public void importPermissions(
245                            String resourceObj, long resourcePK, long newResourcePK)
246                    throws PortalException, SystemException;
247    
248            public void importRatingsEntries(
249                            Class<?> clazz, long classPK, long newClassPK)
250                    throws PortalException, SystemException;
251    
252            public boolean isDataStrategyMirror();
253    
254            public boolean isDataStrategyMirrorWithOverwriting();
255    
256            public boolean isPathNotProcessed(String path);
257    
258            public boolean isPerformDirectBinaryImport();
259    
260            public boolean isPrivateLayout();
261    
262            public boolean isWithinDateRange(Date modifiedDate);
263    
264            public void putNotUniquePerLayout(String dataKey);
265    
266            public void setClassLoader(ClassLoader classLoader);
267    
268            public void setGroupId(long groupId);
269    
270            public void setOldPlid(long oldPlid);
271    
272            public void setPlid(long plid);
273    
274            public void setPortetDataContextListener(
275                    PortletDataContextListener portletDataContextListener);
276    
277            public void setPrivateLayout(boolean privateLayout);
278    
279            public void setScopeGroupId(long scopeGroupId);
280    
281            public void setScopeLayoutUuid(String scopeLayoutUuid);
282    
283            public void setScopeType(String scopeType);
284    
285            public void setSourceCompanyGroupId(long sourceCompanyGroupId);
286    
287            public void setSourceGroupId(long sourceGroupId);
288    
289            public void setStartDate(Date startDate);
290    
291            public String toXML(Object object);
292    
293    }