1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.lar;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.kernel.util.ObjectValuePair;
25  import com.liferay.portal.kernel.zip.ZipReader;
26  import com.liferay.portal.kernel.zip.ZipWriter;
27  import com.liferay.portlet.messageboards.model.MBMessage;
28  import com.liferay.portlet.ratings.model.RatingsEntry;
29  
30  import java.io.InputStream;
31  import java.io.Serializable;
32  
33  import java.util.Date;
34  import java.util.List;
35  import java.util.Map;
36  import java.util.Set;
37  
38  /**
39   * <a href="PortletDataContext.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * Holds context information that is used during exporting and importing portlet
43   * data.
44   * </p>
45   *
46   * @author Brian Wing Shun Chan
47   * @author Raymond Augé
48   *
49   */
50  public interface PortletDataContext extends Serializable {
51  
52      public static final String ROOT_PATH_GROUPS = "/groups/";
53  
54      public static final String ROOT_PATH_LAYOUTS = "/layouts/";
55  
56      public static final String ROOT_PATH_PORTLETS = "/portlets/";
57  
58      public void addComments(Class<?> classObj, long classPK)
59          throws SystemException;
60  
61      public void addComments(
62          String className, long classPK, List<MBMessage> messages);
63  
64      public boolean addPrimaryKey(Class<?> classObj, String primaryKey);
65  
66      public void addRatingsEntries(Class<?> classObj, long classPK)
67          throws SystemException;
68  
69      public void addRatingsEntries(
70          String className, long classPK, List<RatingsEntry> entries);
71  
72      public void addTagsEntries(Class<?> classObj, long classPK)
73          throws PortalException, SystemException;
74  
75      public void addTagsEntries(String className, long classPK, String[] values);
76  
77      public void addZipEntry(String path, byte[] bytes) throws SystemException;
78  
79      public void addZipEntry(String path, InputStream is) throws SystemException;
80  
81      public void addZipEntry(String path, Object object) throws SystemException;
82  
83      public void addZipEntry(String path, String s) throws SystemException;
84  
85      public void addZipEntry(String name, StringBuilder sb)
86          throws SystemException;
87  
88      public Object fromXML(byte[] bytes);
89  
90      public Object fromXML(String xml);
91  
92      public boolean getBooleanParameter(String namespace, String name);
93  
94      public Map<String, List<MBMessage>> getComments();
95  
96      public long getCompanyId();
97  
98      public String getDataStrategy();
99  
100     public Date getEndDate();
101 
102     public long getGroupId();
103 
104     public long getImportGroupId();
105 
106     public String getImportLayoutPath(long layoutId);
107 
108     public String getImportPortletPath(String portletId);
109 
110     public String getImportRootPath();
111 
112     public String getLayoutPath(long layoutId);
113 
114     public Map<?, ?> getNewPrimaryKeysMap(Class<?> classObj);
115 
116     public long getOldPlid();
117 
118     public Map<String, String[]> getParameterMap();
119 
120     public long getPlid();
121 
122     public String getPortletPath(String portletId);
123 
124     public Set<String> getPrimaryKeys();
125 
126     public Map<String, List<RatingsEntry>> getRatingsEntries();
127 
128     public String getRootPath();
129 
130     public Date getStartDate();
131 
132     public Map<String, String[]> getTagsEntries();
133 
134     public String[] getTagsEntries(Class<?> classObj, long classPK);
135 
136     public String[] getTagsEntries(String className, long classPK);
137 
138     public long getUserId(String userUuid) throws SystemException;
139 
140     public UserIdStrategy getUserIdStrategy() throws SystemException;
141 
142     public Map<String, byte[]> getZipEntries();
143 
144     public byte[] getZipEntryAsByteArray(String path);
145 
146     public Object getZipEntryAsObject(String path);
147 
148     public String getZipEntryAsString(String path);
149 
150     public Map<String, List<ObjectValuePair<String, byte[]>>>
151         getZipFolderEntries();
152 
153     public List<ObjectValuePair<String, byte[]>> getZipFolderEntries(
154         String path);
155 
156     public ZipReader getZipReader();
157 
158     public ZipWriter getZipWriter();
159 
160     public boolean hasDateRange();
161 
162     public boolean hasNotUniquePerLayout(String portletId);
163 
164     public boolean hasPrimaryKey(Class<?> classObj, String primaryKey);
165 
166     public void importComments(
167             Class<?> classObj, long classPK, long newClassPK, long groupId)
168         throws PortalException, SystemException;
169 
170     public void importRatingsEntries(
171             Class<?> classObj, long classPK, long newClassPK)
172         throws PortalException, SystemException;
173 
174     public boolean isPathNotProcessed(String path);
175 
176     public boolean isWithinDateRange(Date modifiedDate);
177 
178     public void putNotUniquePerLayout(String portletId);
179 
180     public void setImportGroupId(long importGroupId);
181 
182     public void setOldPlid(long oldPlid);
183 
184     public void setPlid(long plid);
185 
186     public String toXML(Object object);
187 
188 }