1   /**
2    * Copyright (c) 2000-2008 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.Serializable;
34  
35  import java.util.Date;
36  import java.util.List;
37  import java.util.Map;
38  import java.util.Set;
39  
40  /**
41   * <a href="PortletDataContext.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * Holds context information that is used during exporting and importing portlet
45   * data.
46   * </p>
47   *
48   * @author Brian Wing Shun Chan
49   * @author Raymond Augé
50   *
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, 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 hasPrimaryKey(Class<?> classObj, String primaryKey);
163 
164     public void importComments(
165             Class<?> classObj, long classPK, long newClassPK, long groupId)
166         throws PortalException, SystemException;
167 
168     public void importRatingsEntries(
169             Class<?> classObj, long classPK, long newClassPK)
170         throws PortalException, SystemException;
171 
172     public boolean isPathNotProcessed(String path);
173 
174     public boolean isWithinDateRange(Date modifiedDate);
175 
176     public void setImportGroupId(long importGroupId);
177 
178     public void setOldPlid(long oldPlid);
179 
180     public void setPlid(long plid);
181 
182     public String toXML(Object object);
183 
184 }