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