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