1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.lar;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.util.ObjectValuePair;
28  import com.liferay.portal.kernel.zip.ZipReader;
29  import com.liferay.portal.kernel.zip.ZipWriter;
30  import com.liferay.portlet.messageboards.model.MBMessage;
31  import com.liferay.portlet.ratings.model.RatingsEntry;
32  
33  import java.io.InputStream;
34  import java.io.Serializable;
35  
36  import java.util.Date;
37  import java.util.List;
38  import java.util.Map;
39  import java.util.Set;
40  
41  /**
42   * <a href="PortletDataContext.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * Holds context information that is used during exporting and importing portlet
46   * data.
47   * </p>
48   *
49   * @author Brian Wing Shun Chan
50   * @author Raymond Augé
51   */
52  public interface PortletDataContext extends Serializable {
53  
54      public static final String ROOT_PATH_GROUPS = "/groups/";
55  
56      public static final String ROOT_PATH_LAYOUTS = "/layouts/";
57  
58      public static final String ROOT_PATH_PORTLETS = "/portlets/";
59  
60      public void addComments(Class<?> classObj, long classPK)
61          throws SystemException;
62  
63      public void addComments(
64          String className, long classPK, List<MBMessage> messages);
65  
66      public boolean addPrimaryKey(Class<?> classObj, String primaryKey);
67  
68      public void addRatingsEntries(Class<?> classObj, long classPK)
69          throws SystemException;
70  
71      public void addRatingsEntries(
72          String className, long classPK, List<RatingsEntry> ratingsEntries);
73  
74      public void addTagsCategories(Class<?> classObj, long classPK)
75          throws PortalException, SystemException;
76  
77      public void addTagsCategories(
78              String className, long classPK, String[] tagsCategories);
79  
80      public void addTagsEntries(Class<?> classObj, long classPK)
81          throws PortalException, SystemException;
82  
83      public void addTagsEntries(
84          String className, long classPK, String[] tagsEntries);
85  
86      public void addZipEntry(String path, byte[] bytes) throws SystemException;
87  
88      public void addZipEntry(String path, InputStream is) throws SystemException;
89  
90      public void addZipEntry(String path, Object object) throws SystemException;
91  
92      public void addZipEntry(String path, String s) throws SystemException;
93  
94      public void addZipEntry(String name, StringBuilder sb)
95          throws SystemException;
96  
97      public Object fromXML(byte[] bytes);
98  
99      public Object fromXML(String xml);
100 
101     public boolean getBooleanParameter(String namespace, String name);
102 
103     public ClassLoader getClassLoader();
104 
105     public Map<String, List<MBMessage>> getComments();
106 
107     public long getCompanyId();
108 
109     public String getDataStrategy();
110 
111     public Date getEndDate();
112 
113     public long getGroupId();
114 
115     public String getLayoutPath(long layoutId);
116 
117     public Map<?, ?> getNewPrimaryKeysMap(Class<?> classObj);
118 
119     public long getOldPlid();
120 
121     public Map<String, String[]> getParameterMap();
122 
123     public long getPlid();
124 
125     public String getPortletPath(String portletId);
126 
127     public Set<String> getPrimaryKeys();
128 
129     public Map<String, List<RatingsEntry>> getRatingsEntries();
130 
131     public String getRootPath();
132 
133     public long getScopeGroupId();
134 
135     public long getScopeLayoutId();
136 
137     public long getSourceGroupId();
138 
139     public String getSourceLayoutPath(long layoutId);
140 
141     public String getSourcePortletPath(String portletId);
142 
143     public String getSourceRootPath();
144 
145     public Date getStartDate();
146 
147     public Map<String, String[]> getTagsCategories();
148 
149     public String[] getTagsCategories(Class<?> classObj, long classPK);
150 
151     public Map<String, String[]> getTagsEntries();
152 
153     public String[] getTagsEntries(Class<?> classObj, long classPK);
154 
155     public String[] getTagsEntries(String className, long classPK);
156 
157     public long getUserId(String userUuid) throws SystemException;
158 
159     public UserIdStrategy getUserIdStrategy() throws SystemException;
160 
161     public Map<String, byte[]> getZipEntries();
162 
163     public byte[] getZipEntryAsByteArray(String path);
164 
165     public Object getZipEntryAsObject(String path);
166 
167     public String getZipEntryAsString(String path);
168 
169     public Map<String, List<ObjectValuePair<String, byte[]>>>
170         getZipFolderEntries();
171 
172     public List<ObjectValuePair<String, byte[]>> getZipFolderEntries(
173         String path);
174 
175     public ZipReader getZipReader();
176 
177     public ZipWriter getZipWriter();
178 
179     public boolean hasDateRange();
180 
181     public boolean hasNotUniquePerLayout(String dataKey);
182 
183     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
184 
185     public void importComments(
186             Class<?> classObj, long classPK, long newClassPK, long groupId)
187         throws PortalException, SystemException;
188 
189     public void importRatingsEntries(
190             Class<?> classObj, long classPK, long newClassPK)
191         throws PortalException, SystemException;
192 
193     public boolean isPathNotProcessed(String path);
194 
195     public boolean isPrivateLayout();
196 
197     public boolean isWithinDateRange(Date modifiedDate);
198 
199     public void putNotUniquePerLayout(String dataKey);
200 
201     public void setClassLoader(ClassLoader classLoader);
202 
203     public void setGroupId(long groupId);
204 
205     public void setOldPlid(long oldPlid);
206 
207     public void setPlid(long plid);
208 
209     public void setPrivateLayout(boolean privateLayout);
210 
211     public void setScopeGroupId(long scopeGroupId);
212 
213     public void setScopeLayoutId(long scopeLayoutId);
214 
215     public void setSourceGroupId(long sourceGroupId);
216 
217     public String toXML(Object object);
218 
219 }