1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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   */
53  public interface PortletDataContext extends Serializable {
54  
55      public static final String ROOT_PATH_GROUPS = "/groups/";
56  
57      public static final String ROOT_PATH_LAYOUTS = "/layouts/";
58  
59      public static final String ROOT_PATH_PORTLETS = "/portlets/";
60  
61      public void addComments(Class<?> classObj, long classPK)
62          throws SystemException;
63  
64      public void addComments(
65          String className, long classPK, List<MBMessage> messages);
66  
67      public boolean addPrimaryKey(Class<?> classObj, String primaryKey);
68  
69      public void addRatingsEntries(Class<?> classObj, long classPK)
70          throws SystemException;
71  
72      public void addRatingsEntries(
73          String className, long classPK, List<RatingsEntry> ratingsEntries);
74  
75      public void addTagsCategories(Class<?> classObj, long classPK)
76          throws PortalException, SystemException;
77  
78      public void addTagsCategories(
79              String className, long classPK, String[] tagsCategories);
80  
81      public void addTagsEntries(Class<?> classObj, long classPK)
82          throws PortalException, SystemException;
83  
84      public void addTagsEntries(
85          String className, long classPK, String[] tagsEntries);
86  
87      public void addZipEntry(String path, byte[] bytes) throws SystemException;
88  
89      public void addZipEntry(String path, InputStream is) throws SystemException;
90  
91      public void addZipEntry(String path, Object object) throws SystemException;
92  
93      public void addZipEntry(String path, String s) throws SystemException;
94  
95      public void addZipEntry(String name, StringBuilder sb)
96          throws SystemException;
97  
98      public Object fromXML(byte[] bytes);
99  
100     public Object fromXML(String xml);
101 
102     public boolean getBooleanParameter(String namespace, String name);
103 
104     public ClassLoader getClassLoader();
105 
106     public Map<String, List<MBMessage>> getComments();
107 
108     public long getCompanyId();
109 
110     public String getDataStrategy();
111 
112     public Date getEndDate();
113 
114     public long getGroupId();
115 
116     public String getLayoutPath(long layoutId);
117 
118     public Map<?, ?> getNewPrimaryKeysMap(Class<?> classObj);
119 
120     public long getOldPlid();
121 
122     public Map<String, String[]> getParameterMap();
123 
124     public long getPlid();
125 
126     public String getPortletPath(String portletId);
127 
128     public Set<String> getPrimaryKeys();
129 
130     public Map<String, List<RatingsEntry>> getRatingsEntries();
131 
132     public String getRootPath();
133 
134     public long getScopeGroupId();
135 
136     public long getScopeLayoutId();
137 
138     public long getSourceGroupId();
139 
140     public String getSourceLayoutPath(long layoutId);
141 
142     public String getSourcePortletPath(String portletId);
143 
144     public String getSourceRootPath();
145 
146     public Date getStartDate();
147 
148     public Map<String, String[]> getTagsCategories();
149 
150     public String[] getTagsCategories(Class<?> classObj, long classPK);
151 
152     public Map<String, String[]> getTagsEntries();
153 
154     public String[] getTagsEntries(Class<?> classObj, long classPK);
155 
156     public String[] getTagsEntries(String className, long classPK);
157 
158     public long getUserId(String userUuid) throws SystemException;
159 
160     public UserIdStrategy getUserIdStrategy() throws SystemException;
161 
162     public Map<String, byte[]> getZipEntries();
163 
164     public byte[] getZipEntryAsByteArray(String path);
165 
166     public Object getZipEntryAsObject(String path);
167 
168     public String getZipEntryAsString(String path);
169 
170     public Map<String, List<ObjectValuePair<String, byte[]>>>
171         getZipFolderEntries();
172 
173     public List<ObjectValuePair<String, byte[]>> getZipFolderEntries(
174         String path);
175 
176     public ZipReader getZipReader();
177 
178     public ZipWriter getZipWriter();
179 
180     public boolean hasDateRange();
181 
182     public boolean hasNotUniquePerLayout(String dataKey);
183 
184     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
185 
186     public void importComments(
187             Class<?> classObj, long classPK, long newClassPK, long groupId)
188         throws PortalException, SystemException;
189 
190     public void importRatingsEntries(
191             Class<?> classObj, long classPK, long newClassPK)
192         throws PortalException, SystemException;
193 
194     public boolean isPathNotProcessed(String path);
195 
196     public boolean isPrivateLayout();
197 
198     public boolean isWithinDateRange(Date modifiedDate);
199 
200     public void putNotUniquePerLayout(String dataKey);
201 
202     public void setClassLoader(ClassLoader classLoader);
203 
204     public void setGroupId(long groupId);
205 
206     public void setOldPlid(long oldPlid);
207 
208     public void setPlid(long plid);
209 
210     public void setPrivateLayout(boolean privateLayout);
211 
212     public void setScopeGroupId(long scopeGroupId);
213 
214     public void setScopeLayoutId(long scopeLayoutId);
215 
216     public void setSourceGroupId(long sourceGroupId);
217 
218     public String toXML(Object object);
219 
220 }