001    /**
002     * Copyright (c) 2000-2012 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.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 addCompanyReference(Class<?> clazz, String key);
079    
080            public void addExpando(
081                            Element element, String path, ClassedModel classedModel)
082                    throws PortalException, SystemException;
083    
084            public void addLocks(Class<?> clazz, String key)
085                    throws PortalException, SystemException;
086    
087            public void addLocks(String className, String key, Lock lock);
088    
089            public void addPermissions(Class<?> clazz, long classPK)
090                    throws PortalException, SystemException;
091    
092            public void addPermissions(String resourceName, long resourcePK)
093                    throws PortalException, SystemException;
094    
095            public void addPermissions(
096                    String resourceName, long resourcePK, List<KeyValuePair> permissions);
097    
098            public boolean addPrimaryKey(Class<?> clazz, String primaryKey);
099    
100            public void addRatingsEntries(Class<?> clazz, long classPK)
101                    throws SystemException;
102    
103            public void addRatingsEntries(
104                    String className, long classPK, List<RatingsEntry> ratingsEntries);
105    
106            public void addZipEntry(String path, byte[] bytes) throws SystemException;
107    
108            public void addZipEntry(String path, InputStream is) throws SystemException;
109    
110            public void addZipEntry(String path, Object object) throws SystemException;
111    
112            public void addZipEntry(String path, String s) throws SystemException;
113    
114            public void addZipEntry(String name, StringBuilder sb)
115                    throws SystemException;
116    
117            public ServiceContext createServiceContext(
118                    Element element, ClassedModel classedModel, String namespace);
119    
120            public ServiceContext createServiceContext(
121                    String path, ClassedModel classedModel, String namespace);
122    
123            public Object fromXML(byte[] bytes);
124    
125            public Object fromXML(String xml);
126    
127            public long[] getAssetCategoryIds(Class<?> clazz, long classPK);
128    
129            public Map<String, long[]> getAssetCategoryIdsMap();
130    
131            public Map<String, String[]> getAssetCategoryUuidsMap();
132    
133            public Map<String, String[]> getAssetLinkUuidsMap();
134    
135            public String[] getAssetTagNames(Class<?> clazz, long classPK);
136    
137            public String[] getAssetTagNames(String className, long classPK);
138    
139            public Map<String, String[]> getAssetTagNamesMap();
140    
141            public boolean getBooleanParameter(String namespace, String name);
142    
143            public ClassLoader getClassLoader();
144    
145            public Map<String, List<MBMessage>> getComments();
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 getSourceGroupId();
188    
189            public String getSourceLayoutPath(long layoutId);
190    
191            public String getSourcePortletPath(String portletId);
192    
193            public String getSourceRootPath();
194    
195            public Date getStartDate();
196    
197            public long getUserId(String userUuid) throws SystemException;
198    
199            public UserIdStrategy getUserIdStrategy() throws SystemException;
200    
201            public List<String> getZipEntries();
202    
203            public byte[] getZipEntryAsByteArray(String path);
204    
205            public InputStream getZipEntryAsInputStream(String path);
206    
207            public Object getZipEntryAsObject(String path);
208    
209            public String getZipEntryAsString(String path);
210    
211            public List<String> getZipFolderEntries();
212    
213            public List<String> getZipFolderEntries(String path);
214    
215            public ZipReader getZipReader();
216    
217            public ZipWriter getZipWriter();
218    
219            public boolean hasDateRange();
220    
221            public boolean hasNotUniquePerLayout(String dataKey);
222    
223            public boolean hasPrimaryKey(Class<?> clazz, String primaryKey);
224    
225            public void importClassedModel(
226                            ClassedModel classedModel, ClassedModel newClassedModel,
227                            String namespace)
228                    throws PortalException, SystemException;
229    
230            public void importComments(
231                            Class<?> clazz, long classPK, long newClassPK, long groupId)
232                    throws PortalException, SystemException;
233    
234            public void importLocks(Class<?> clazz, String key, String newKey)
235                    throws PortalException, SystemException;
236    
237            public void importPermissions(Class<?> clazz, long classPK, long newClassPK)
238                    throws PortalException, SystemException;
239    
240            public void importPermissions(
241                            String resourceObj, long resourcePK, long newResourcePK)
242                    throws PortalException, SystemException;
243    
244            public void importRatingsEntries(
245                            Class<?> clazz, long classPK, long newClassPK)
246                    throws PortalException, SystemException;
247    
248            public boolean isCompanyReference(Class<?> clazz, String key);
249    
250            public boolean isDataStrategyMirror();
251    
252            public boolean isDataStrategyMirrorWithOverwriting();
253    
254            public boolean isPathNotProcessed(String path);
255    
256            public boolean isPerformDirectBinaryImport();
257    
258            public boolean isPrivateLayout();
259    
260            public boolean isWithinDateRange(Date modifiedDate);
261    
262            public void putNotUniquePerLayout(String dataKey);
263    
264            public void setClassLoader(ClassLoader classLoader);
265    
266            public void setGroupId(long groupId);
267    
268            public void setOldPlid(long oldPlid);
269    
270            public void setPlid(long plid);
271    
272            public void setPortetDataContextListener(
273                    PortletDataContextListener portletDataContextListener);
274    
275            public void setPrivateLayout(boolean privateLayout);
276    
277            public void setScopeGroupId(long scopeGroupId);
278    
279            public void setScopeLayoutUuid(String scopeLayoutUuid);
280    
281            public void setScopeType(String scopeType);
282    
283            public void setSourceGroupId(long sourceGroupId);
284    
285            public void setStartDate(Date startDate);
286    
287            public String toXML(Object object);
288    
289    }