001    /**
002     * Copyright (c) 2000-2012 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.DynamicQuery;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.util.KeyValuePair;
021    import com.liferay.portal.kernel.xml.Element;
022    import com.liferay.portal.kernel.zip.ZipReader;
023    import com.liferay.portal.kernel.zip.ZipWriter;
024    import com.liferay.portal.model.ClassedModel;
025    import com.liferay.portal.model.Lock;
026    import com.liferay.portal.service.ServiceContext;
027    import com.liferay.portlet.expando.model.ExpandoColumn;
028    import com.liferay.portlet.messageboards.model.MBMessage;
029    import com.liferay.portlet.ratings.model.RatingsEntry;
030    
031    import java.io.InputStream;
032    import java.io.Serializable;
033    
034    import java.util.Date;
035    import java.util.List;
036    import java.util.Map;
037    import java.util.Set;
038    
039    /**
040     * <p>
041     * Holds context information that is used during exporting and importing portlet
042     * data.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @author Raymond Augé
047     */
048    public interface PortletDataContext extends Serializable {
049    
050            public static final String ROOT_PATH_GROUPS = "/groups/";
051    
052            public static final String ROOT_PATH_LAYOUTS = "/layouts/";
053    
054            public static final String ROOT_PATH_PORTLETS = "/portlets/";
055    
056            public void addAssetCategories(Class<?> clazz, long classPK)
057                    throws SystemException;
058    
059            public void addAssetCategories(
060                    String className, long classPK, long[] assetCategoryIds);
061    
062            public void addAssetTags(Class<?> clazz, long classPK)
063                    throws SystemException;
064    
065            public void addAssetTags(
066                    String className, long classPK, String[] assetTagNames);
067    
068            public void addClassedModel(
069                            Element element, String path, ClassedModel classedModel,
070                            String namespace)
071                    throws PortalException, SystemException;
072    
073            public void addComments(Class<?> clazz, long classPK)
074                    throws SystemException;
075    
076            public void addComments(
077                    String className, long classPK, List<MBMessage> messages);
078    
079            public void addDateRangeCriteria(
080                    DynamicQuery dynamicQuery, String modifiedDatePropertyName);
081    
082            public void addExpando(
083                            Element element, String path, ClassedModel classedModel)
084                    throws PortalException, SystemException;
085    
086            public void addLocks(Class<?> clazz, String key)
087                    throws PortalException, SystemException;
088    
089            public void addLocks(String className, String key, Lock lock);
090    
091            public void addPermissions(Class<?> clazz, long classPK)
092                    throws PortalException, SystemException;
093    
094            public void addPermissions(String resourceName, long resourcePK)
095                    throws PortalException, SystemException;
096    
097            public void addPermissions(
098                    String resourceName, long resourcePK, List<KeyValuePair> permissions);
099    
100            public boolean addPrimaryKey(Class<?> clazz, String primaryKey);
101    
102            public void addRatingsEntries(Class<?> clazz, long classPK)
103                    throws SystemException;
104    
105            public void addRatingsEntries(
106                    String className, long classPK, List<RatingsEntry> ratingsEntries);
107    
108            public void addZipEntry(String path, byte[] bytes) throws SystemException;
109    
110            public void addZipEntry(String path, InputStream is) throws SystemException;
111    
112            public void addZipEntry(String path, Object object) throws SystemException;
113    
114            public void addZipEntry(String path, String s) throws SystemException;
115    
116            public void addZipEntry(String name, StringBuilder sb)
117                    throws SystemException;
118    
119            public ServiceContext createServiceContext(
120                    Element element, ClassedModel classedModel, String namespace);
121    
122            public ServiceContext createServiceContext(
123                    String path, ClassedModel classedModel, String namespace);
124    
125            public Object fromXML(byte[] bytes);
126    
127            public Object fromXML(String xml);
128    
129            public long[] getAssetCategoryIds(Class<?> clazz, long classPK);
130    
131            public Map<String, long[]> getAssetCategoryIdsMap();
132    
133            public Map<String, String[]> getAssetCategoryUuidsMap();
134    
135            public Map<String, String[]> getAssetLinkUuidsMap();
136    
137            public String[] getAssetTagNames(Class<?> clazz, long classPK);
138    
139            public String[] getAssetTagNames(String className, long classPK);
140    
141            public Map<String, String[]> getAssetTagNamesMap();
142    
143            public boolean getBooleanParameter(String namespace, String name);
144    
145            public ClassLoader getClassLoader();
146    
147            public Map<String, List<MBMessage>> getComments();
148    
149            public long getCompanyId();
150    
151            public String getDataStrategy();
152    
153            public Date getEndDate();
154    
155            public Map<String, List<ExpandoColumn>> getExpandoColumns();
156    
157            public long getGroupId();
158    
159            public String getLayoutPath(long layoutId);
160    
161            public Map<String, Lock> getLocks();
162    
163            public Map<?, ?> getNewPrimaryKeysMap(Class<?> clazz);
164    
165            public Map<?, ?> getNewPrimaryKeysMap(String className);
166    
167            public long getOldPlid();
168    
169            public Map<String, String[]> getParameterMap();
170    
171            public Map<String, List<KeyValuePair>> getPermissions();
172    
173            public long getPlid();
174    
175            public String getPortletPath(String portletId);
176    
177            public Set<String> getPrimaryKeys();
178    
179            public Map<String, List<RatingsEntry>> getRatingsEntries();
180    
181            public String getRootPath();
182    
183            public long getScopeGroupId();
184    
185            public String getScopeLayoutUuid();
186    
187            public String getScopeType();
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();
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 isPathProcessed(String path);
259    
260            public boolean isPerformDirectBinaryImport();
261    
262            public boolean isPrivateLayout();
263    
264            public boolean isWithinDateRange(Date modifiedDate);
265    
266            public void putNotUniquePerLayout(String dataKey);
267    
268            public void setClassLoader(ClassLoader classLoader);
269    
270            public void setGroupId(long groupId);
271    
272            public void setOldPlid(long oldPlid);
273    
274            public void setPlid(long plid);
275    
276            public void setPortetDataContextListener(
277                    PortletDataContextListener portletDataContextListener);
278    
279            public void setPrivateLayout(boolean privateLayout);
280    
281            public void setScopeGroupId(long scopeGroupId);
282    
283            public void setScopeLayoutUuid(String scopeLayoutUuid);
284    
285            public void setScopeType(String scopeType);
286    
287            public void setSourceGroupId(long sourceGroupId);
288    
289            public void setStartDate(Date startDate);
290    
291            public String toXML(Object object);
292    
293    }