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.kernel.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  
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, Object primaryKey)
59          throws PortalException, SystemException;
60  
61      public void addComments(
62              String className, Object primaryKey, List messages)
63          throws PortalException, SystemException;
64  
65      public boolean addPrimaryKey(Class<?> classObj, Object primaryKey);
66  
67      public void addRatingsEntries(Class<?> classObj, Object primaryKey)
68          throws PortalException, SystemException;
69  
70      public void addRatingsEntries(
71              String className, Object primaryKey, List entries)
72          throws PortalException, SystemException;
73  
74      public void addTagsEntries(Class<?> classObj, Object classPK)
75          throws PortalException, SystemException;
76  
77      public void addTagsEntries(
78              String className, Object classPK, String[] values)
79          throws PortalException, SystemException;
80  
81      public void addZipEntry(String path, byte[] bytes) 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 Map<String, List> getComments();
97  
98      public long getCompanyId();
99  
100     public String getDataStrategy();
101 
102     public Date getEndDate();
103 
104     public long getGroupId();
105 
106     public long getImportGroupId();
107 
108     public String getImportLayoutPath(long layoutId);
109 
110     public String getImportPortletPath(String portletId);
111 
112     public String getImportRootPath();
113 
114     public String getLayoutPath(long layoutId);
115 
116     public Map getNewPrimaryKeysMap(Class<?> classObj);
117 
118     public long getOldPlid();
119 
120     public Map<String, String[]> getParameterMap();
121 
122     public long getPlid();
123 
124     public String getPortletPath(String portletId);
125 
126     public Set getPrimaryKeys();
127 
128     public Map<String, List> getRatingsEntries();
129 
130     public String getRootPath();
131 
132     public Date getStartDate();
133 
134     public Map<String, String[]> getTagsEntries();
135 
136     public String[] getTagsEntries(Class<?> classObj, Object primaryKey);
137 
138     public String[] getTagsEntries(String className, Object primaryKey);
139 
140     public long getUserId(String userUuid) throws SystemException;
141 
142     public UserIdStrategy getUserIdStrategy() throws SystemException;
143 
144     public Map<String, byte[]> getZipEntries();
145 
146     public byte[] getZipEntryAsByteArray(String path);
147 
148     public Object getZipEntryAsObject(String path);
149 
150     public String getZipEntryAsString(String path);
151 
152     public Map<String, List<ObjectValuePair<String, byte[]>>>
153         getZipFolderEntries();
154 
155     public List<ObjectValuePair<String, byte[]>> getZipFolderEntries(
156         String path);
157 
158     public ZipReader getZipReader();
159 
160     public ZipWriter getZipWriter();
161 
162     public boolean hasDateRange();
163 
164     public boolean hasPrimaryKey(Class<?> classObj, Object primaryKey);
165 
166     public void importComments(
167             Class<?> classObj, Object primaryKey, Object newPrimaryKey,
168             long groupId)
169         throws PortalException, SystemException;
170 
171     public void importRatingsEntries(
172             Class<?> classObj, Object primaryKey, Object newPrimaryKey)
173         throws PortalException, SystemException;
174 
175     public boolean isPathNotProcessed(String path);
176 
177     public boolean isWithinDateRange(Date modifiedDate);
178 
179     public void setImportGroupId(long importGroupId);
180 
181     public void setOldPlid(long oldPlid);
182 
183     public void setPlid(long plid);
184 
185     public String toXML(Object object);
186 
187 }