1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.lar;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.kernel.zip.ZipReader;
20  import com.liferay.portal.kernel.zip.ZipWriter;
21  import com.liferay.portlet.messageboards.model.MBMessage;
22  import com.liferay.portlet.ratings.model.RatingsEntry;
23  
24  import java.io.InputStream;
25  import java.io.Serializable;
26  
27  import java.util.Date;
28  import java.util.List;
29  import java.util.Map;
30  import java.util.Set;
31  
32  /**
33   * <a href="PortletDataContext.java.html"><b><i>View Source</i></b></a>
34   *
35   * <p>
36   * Holds context information that is used during exporting and importing portlet
37   * data.
38   * </p>
39   *
40   * @author Brian Wing Shun Chan
41   * @author Raymond Augé
42   */
43  public interface PortletDataContext extends Serializable {
44  
45      public static final String ROOT_PATH_GROUPS = "/groups/";
46  
47      public static final String ROOT_PATH_LAYOUTS = "/layouts/";
48  
49      public static final String ROOT_PATH_PORTLETS = "/portlets/";
50  
51      public void addAssetCategories(Class<?> classObj, long classPK)
52          throws SystemException;
53  
54      public void addAssetCategories(
55          String className, long classPK, long[] assetCategoryIds);
56  
57      public void addAssetTags(Class<?> classObj, long classPK)
58          throws SystemException;
59  
60      public void addAssetTags(
61          String className, long classPK, String[] assetTagNames);
62  
63      public void addComments(Class<?> classObj, long classPK)
64          throws SystemException;
65  
66      public void addComments(
67          String className, long classPK, List<MBMessage> messages);
68  
69      public boolean addPrimaryKey(Class<?> classObj, String primaryKey);
70  
71      public void addRatingsEntries(Class<?> classObj, long classPK)
72          throws SystemException;
73  
74      public void addRatingsEntries(
75          String className, long classPK, List<RatingsEntry> ratingsEntries);
76  
77      public void addZipEntry(String path, byte[] bytes) throws SystemException;
78  
79      public void addZipEntry(String path, InputStream is) throws SystemException;
80  
81      public void addZipEntry(String path, Object object) throws SystemException;
82  
83      public void addZipEntry(String path, String s) throws SystemException;
84  
85      public void addZipEntry(String name, StringBuilder sb)
86          throws SystemException;
87  
88      public Object fromXML(byte[] bytes);
89  
90      public Object fromXML(String xml);
91  
92      public long[] getAssetCategoryIds(Class<?> classObj, long classPK);
93  
94      public Map<String, long[]> getAssetCategoryIdsMap();
95  
96      public Map<String, String[]> getAssetCategoryUuidsMap();
97  
98      public String[] getAssetTagNames(Class<?> classObj, long classPK);
99  
100     public String[] getAssetTagNames(String className, long classPK);
101 
102     public Map<String, String[]> getAssetTagNamesMap();
103 
104     public boolean getBooleanParameter(String namespace, String name);
105 
106     public ClassLoader getClassLoader();
107 
108     public Map<String, List<MBMessage>> getComments();
109 
110     public long getCompanyId();
111 
112     public String getDataStrategy();
113 
114     public Date getEndDate();
115 
116     public long getGroupId();
117 
118     public String getLayoutPath(long layoutId);
119 
120     public Map<?, ?> getNewPrimaryKeysMap(Class<?> classObj);
121 
122     public long getOldPlid();
123 
124     public Map<String, String[]> getParameterMap();
125 
126     public long getPlid();
127 
128     public String getPortletPath(String portletId);
129 
130     public Set<String> getPrimaryKeys();
131 
132     public Map<String, List<RatingsEntry>> getRatingsEntries();
133 
134     public String getRootPath();
135 
136     public long getScopeGroupId();
137 
138     public long getScopeLayoutId();
139 
140     public long getSourceGroupId();
141 
142     public String getSourceLayoutPath(long layoutId);
143 
144     public String getSourcePortletPath(String portletId);
145 
146     public String getSourceRootPath();
147 
148     public Date getStartDate();
149 
150     public long getUserId(String userUuid) throws SystemException;
151 
152     public UserIdStrategy getUserIdStrategy() throws SystemException;
153 
154     public List<String> getZipEntries();
155 
156     public byte[] getZipEntryAsByteArray(String path);
157 
158     public InputStream getZipEntryAsInputStream(String path);
159 
160     public Object getZipEntryAsObject(String path);
161 
162     public String getZipEntryAsString(String path);
163 
164     public List<String> getZipFolderEntries();
165 
166     public List<String> getZipFolderEntries(String path);
167 
168     public ZipReader getZipReader();
169 
170     public ZipWriter getZipWriter();
171 
172     public boolean hasDateRange();
173 
174     public boolean hasNotUniquePerLayout(String dataKey);
175 
176     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
177 
178     public void importComments(
179             Class<?> classObj, long classPK, long newClassPK, long groupId)
180         throws PortalException, SystemException;
181 
182     public void importRatingsEntries(
183             Class<?> classObj, long classPK, long newClassPK)
184         throws PortalException, SystemException;
185 
186     public boolean isPathNotProcessed(String path);
187 
188     public boolean isPrivateLayout();
189 
190     public boolean isWithinDateRange(Date modifiedDate);
191 
192     public void putNotUniquePerLayout(String dataKey);
193 
194     public void setClassLoader(ClassLoader classLoader);
195 
196     public void setGroupId(long groupId);
197 
198     public void setOldPlid(long oldPlid);
199 
200     public void setPlid(long plid);
201 
202     public void setPrivateLayout(boolean privateLayout);
203 
204     public void setScopeGroupId(long scopeGroupId);
205 
206     public void setScopeLayoutId(long scopeLayoutId);
207 
208     public void setSourceGroupId(long sourceGroupId);
209 
210     public String toXML(Object object);
211 
212 }