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> entries);
73  
74      public void addTagsEntries(Class<?> classObj, long classPK)
75          throws PortalException, SystemException;
76  
77      public void addTagsEntries(String className, long classPK, String[] values);
78  
79      public void addZipEntry(String path, byte[] bytes) throws SystemException;
80  
81      public void addZipEntry(String path, InputStream is) throws SystemException;
82  
83      public void addZipEntry(String path, Object object) throws SystemException;
84  
85      public void addZipEntry(String path, String s) throws SystemException;
86  
87      public void addZipEntry(String name, StringBuilder sb)
88          throws SystemException;
89  
90      public Object fromXML(byte[] bytes);
91  
92      public Object fromXML(String xml);
93  
94      public boolean getBooleanParameter(String namespace, String name);
95  
96      public ClassLoader getClassLoader();
97  
98      public Map<String, List<MBMessage>> getComments();
99  
100     public long getCompanyId();
101 
102     public String getDataStrategy();
103 
104     public Date getEndDate();
105 
106     public long getGroupId();
107 
108     public long getImportGroupId();
109 
110     public String getImportLayoutPath(long layoutId);
111 
112     public String getImportPortletPath(String portletId);
113 
114     public String getImportRootPath();
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 Date getStartDate();
135 
136     public Map<String, String[]> getTagsEntries();
137 
138     public String[] getTagsEntries(Class<?> classObj, long classPK);
139 
140     public String[] getTagsEntries(String className, long classPK);
141 
142     public long getUserId(String userUuid) throws SystemException;
143 
144     public UserIdStrategy getUserIdStrategy() throws SystemException;
145 
146     public Map<String, byte[]> getZipEntries();
147 
148     public byte[] getZipEntryAsByteArray(String path);
149 
150     public Object getZipEntryAsObject(String path);
151 
152     public String getZipEntryAsString(String path);
153 
154     public Map<String, List<ObjectValuePair<String, byte[]>>>
155         getZipFolderEntries();
156 
157     public List<ObjectValuePair<String, byte[]>> getZipFolderEntries(
158         String path);
159 
160     public ZipReader getZipReader();
161 
162     public ZipWriter getZipWriter();
163 
164     public boolean hasDateRange();
165 
166     public boolean hasNotUniquePerLayout(String portletId);
167 
168     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
169 
170     public void importComments(
171             Class<?> classObj, long classPK, long newClassPK, long groupId)
172         throws PortalException, SystemException;
173 
174     public void importRatingsEntries(
175             Class<?> classObj, long classPK, long newClassPK)
176         throws PortalException, SystemException;
177 
178     public boolean isPathNotProcessed(String path);
179 
180     public boolean isWithinDateRange(Date modifiedDate);
181 
182     public void putNotUniquePerLayout(String portletId);
183 
184     public void setClassLoader(ClassLoader classLoader);
185 
186     public void setImportGroupId(long importGroupId);
187 
188     public void setOldPlid(long oldPlid);
189 
190     public void setPlid(long plid);
191 
192     public String toXML(Object object);
193 
194 }