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.util.KeyValuePair;
20  import com.liferay.portal.kernel.zip.ZipReader;
21  import com.liferay.portal.kernel.zip.ZipWriter;
22  import com.liferay.portlet.messageboards.model.MBMessage;
23  import com.liferay.portlet.ratings.model.RatingsEntry;
24  
25  import java.io.InputStream;
26  import java.io.Serializable;
27  
28  import java.util.Date;
29  import java.util.List;
30  import java.util.Map;
31  import java.util.Set;
32  
33  /**
34   * <a href="PortletDataContext.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * Holds context information that is used during exporting and importing portlet
38   * data.
39   * </p>
40   *
41   * @author Brian Wing Shun Chan
42   * @author Raymond Augé
43   */
44  public interface PortletDataContext extends Serializable {
45  
46      public static final String ROOT_PATH_GROUPS = "/groups/";
47  
48      public static final String ROOT_PATH_LAYOUTS = "/layouts/";
49  
50      public static final String ROOT_PATH_PORTLETS = "/portlets/";
51  
52      public void addAssetCategories(Class<?> classObj, long classPK)
53          throws SystemException;
54  
55      public void addAssetCategories(
56          String className, long classPK, long[] assetCategoryIds);
57  
58      public void addAssetTags(Class<?> classObj, long classPK)
59          throws SystemException;
60  
61      public void addAssetTags(
62          String className, long classPK, String[] assetTagNames);
63  
64      public void addComments(Class<?> classObj, long classPK)
65          throws SystemException;
66  
67      public void addComments(
68          String className, long classPK, List<MBMessage> messages);
69  
70      public void addPermissions(Class<?> classObj, long classPK)
71          throws PortalException, SystemException;
72  
73      public void addPermissions(String resourceName, long resourcePK)
74          throws PortalException, SystemException;
75  
76      public void addPermissions(
77          String resourceName, long resourcePK, List<KeyValuePair> permissions);
78  
79      public boolean addPrimaryKey(Class<?> classObj, String primaryKey);
80  
81      public void addRatingsEntries(Class<?> classObj, long classPK)
82          throws SystemException;
83  
84      public void addRatingsEntries(
85          String className, long classPK, List<RatingsEntry> ratingsEntries);
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 long[] getAssetCategoryIds(Class<?> classObj, long classPK);
103 
104     public Map<String, long[]> getAssetCategoryIdsMap();
105 
106     public Map<String, String[]> getAssetCategoryUuidsMap();
107 
108     public String[] getAssetTagNames(Class<?> classObj, long classPK);
109 
110     public String[] getAssetTagNames(String className, long classPK);
111 
112     public Map<String, String[]> getAssetTagNamesMap();
113 
114     public boolean getBooleanParameter(String namespace, String name);
115 
116     public ClassLoader getClassLoader();
117 
118     public Map<String, List<MBMessage>> getComments();
119 
120     public long getCompanyId();
121 
122     public String getDataStrategy();
123 
124     public Date getEndDate();
125 
126     public long getGroupId();
127 
128     public String getLayoutPath(long layoutId);
129 
130     public Map<?, ?> getNewPrimaryKeysMap(Class<?> classObj);
131 
132     public long getOldPlid();
133 
134     public Map<String, String[]> getParameterMap();
135 
136     public Map<String, List<KeyValuePair>> getPermissions();
137 
138     public long getPlid();
139 
140     public String getPortletPath(String portletId);
141 
142     public Set<String> getPrimaryKeys();
143 
144     public Map<String, List<RatingsEntry>> getRatingsEntries();
145 
146     public String getRootPath();
147 
148     public long getScopeGroupId();
149 
150     public long getScopeLayoutId();
151 
152     public long getSourceGroupId();
153 
154     public String getSourceLayoutPath(long layoutId);
155 
156     public String getSourcePortletPath(String portletId);
157 
158     public String getSourceRootPath();
159 
160     public Date getStartDate();
161 
162     public long getUserId(String userUuid) throws SystemException;
163 
164     public UserIdStrategy getUserIdStrategy() throws SystemException;
165 
166     public List<String> getZipEntries();
167 
168     public byte[] getZipEntryAsByteArray(String path);
169 
170     public InputStream getZipEntryAsInputStream(String path);
171 
172     public Object getZipEntryAsObject(String path);
173 
174     public String getZipEntryAsString(String path);
175 
176     public List<String> getZipFolderEntries();
177 
178     public List<String> getZipFolderEntries(String path);
179 
180     public ZipReader getZipReader();
181 
182     public ZipWriter getZipWriter();
183 
184     public boolean hasDateRange();
185 
186     public boolean hasNotUniquePerLayout(String dataKey);
187 
188     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
189 
190     public void importComments(
191             Class<?> classObj, long classPK, long newClassPK, long groupId)
192         throws PortalException, SystemException;
193 
194     public void importPermissions(
195             Class<?> classObj, long classPK, long newClassPK)
196         throws PortalException, SystemException;
197 
198     public void importPermissions(
199             String resourceObj, long resourcePK, long newResourcePK)
200         throws PortalException, SystemException;
201 
202     public void importRatingsEntries(
203             Class<?> classObj, long classPK, long newClassPK)
204         throws PortalException, SystemException;
205 
206     public boolean isPathNotProcessed(String path);
207 
208     public boolean isPrivateLayout();
209 
210     public boolean isWithinDateRange(Date modifiedDate);
211 
212     public void putNotUniquePerLayout(String dataKey);
213 
214     public void setClassLoader(ClassLoader classLoader);
215 
216     public void setGroupId(long groupId);
217 
218     public void setOldPlid(long oldPlid);
219 
220     public void setPlid(long plid);
221 
222     public void setPrivateLayout(boolean privateLayout);
223 
224     public void setScopeGroupId(long scopeGroupId);
225 
226     public void setScopeLayoutId(long scopeLayoutId);
227 
228     public void setSourceGroupId(long sourceGroupId);
229 
230     public String toXML(Object object);
231 
232 }