001
014
015 package com.liferay.portal.model;
016
017 import com.liferay.portal.kernel.util.Validator;
018
019 import java.util.HashMap;
020 import java.util.Map;
021
022
031 public class PortletPreferencesWrapper implements PortletPreferences,
032 ModelWrapper<PortletPreferences> {
033 public PortletPreferencesWrapper(PortletPreferences portletPreferences) {
034 _portletPreferences = portletPreferences;
035 }
036
037 public Class<?> getModelClass() {
038 return PortletPreferences.class;
039 }
040
041 public String getModelClassName() {
042 return PortletPreferences.class.getName();
043 }
044
045 public Map<String, Object> getModelAttributes() {
046 Map<String, Object> attributes = new HashMap<String, Object>();
047
048 attributes.put("portletPreferencesId", getPortletPreferencesId());
049 attributes.put("ownerId", getOwnerId());
050 attributes.put("ownerType", getOwnerType());
051 attributes.put("plid", getPlid());
052 attributes.put("portletId", getPortletId());
053 attributes.put("preferences", getPreferences());
054
055 return attributes;
056 }
057
058 public void setModelAttributes(Map<String, Object> attributes) {
059 Long portletPreferencesId = (Long)attributes.get("portletPreferencesId");
060
061 if (portletPreferencesId != null) {
062 setPortletPreferencesId(portletPreferencesId);
063 }
064
065 Long ownerId = (Long)attributes.get("ownerId");
066
067 if (ownerId != null) {
068 setOwnerId(ownerId);
069 }
070
071 Integer ownerType = (Integer)attributes.get("ownerType");
072
073 if (ownerType != null) {
074 setOwnerType(ownerType);
075 }
076
077 Long plid = (Long)attributes.get("plid");
078
079 if (plid != null) {
080 setPlid(plid);
081 }
082
083 String portletId = (String)attributes.get("portletId");
084
085 if (portletId != null) {
086 setPortletId(portletId);
087 }
088
089 String preferences = (String)attributes.get("preferences");
090
091 if (preferences != null) {
092 setPreferences(preferences);
093 }
094 }
095
096
101 public long getPrimaryKey() {
102 return _portletPreferences.getPrimaryKey();
103 }
104
105
110 public void setPrimaryKey(long primaryKey) {
111 _portletPreferences.setPrimaryKey(primaryKey);
112 }
113
114
119 public long getPortletPreferencesId() {
120 return _portletPreferences.getPortletPreferencesId();
121 }
122
123
128 public void setPortletPreferencesId(long portletPreferencesId) {
129 _portletPreferences.setPortletPreferencesId(portletPreferencesId);
130 }
131
132
137 public long getOwnerId() {
138 return _portletPreferences.getOwnerId();
139 }
140
141
146 public void setOwnerId(long ownerId) {
147 _portletPreferences.setOwnerId(ownerId);
148 }
149
150
155 public int getOwnerType() {
156 return _portletPreferences.getOwnerType();
157 }
158
159
164 public void setOwnerType(int ownerType) {
165 _portletPreferences.setOwnerType(ownerType);
166 }
167
168
173 public long getPlid() {
174 return _portletPreferences.getPlid();
175 }
176
177
182 public void setPlid(long plid) {
183 _portletPreferences.setPlid(plid);
184 }
185
186
191 public java.lang.String getPortletId() {
192 return _portletPreferences.getPortletId();
193 }
194
195
200 public void setPortletId(java.lang.String portletId) {
201 _portletPreferences.setPortletId(portletId);
202 }
203
204
209 public java.lang.String getPreferences() {
210 return _portletPreferences.getPreferences();
211 }
212
213
218 public void setPreferences(java.lang.String preferences) {
219 _portletPreferences.setPreferences(preferences);
220 }
221
222 public boolean isNew() {
223 return _portletPreferences.isNew();
224 }
225
226 public void setNew(boolean n) {
227 _portletPreferences.setNew(n);
228 }
229
230 public boolean isCachedModel() {
231 return _portletPreferences.isCachedModel();
232 }
233
234 public void setCachedModel(boolean cachedModel) {
235 _portletPreferences.setCachedModel(cachedModel);
236 }
237
238 public boolean isEscapedModel() {
239 return _portletPreferences.isEscapedModel();
240 }
241
242 public java.io.Serializable getPrimaryKeyObj() {
243 return _portletPreferences.getPrimaryKeyObj();
244 }
245
246 public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
247 _portletPreferences.setPrimaryKeyObj(primaryKeyObj);
248 }
249
250 public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
251 return _portletPreferences.getExpandoBridge();
252 }
253
254 public void setExpandoBridgeAttributes(
255 com.liferay.portal.service.ServiceContext serviceContext) {
256 _portletPreferences.setExpandoBridgeAttributes(serviceContext);
257 }
258
259 @Override
260 public java.lang.Object clone() {
261 return new PortletPreferencesWrapper((PortletPreferences)_portletPreferences.clone());
262 }
263
264 public int compareTo(
265 com.liferay.portal.model.PortletPreferences portletPreferences) {
266 return _portletPreferences.compareTo(portletPreferences);
267 }
268
269 @Override
270 public int hashCode() {
271 return _portletPreferences.hashCode();
272 }
273
274 public com.liferay.portal.model.CacheModel<com.liferay.portal.model.PortletPreferences> toCacheModel() {
275 return _portletPreferences.toCacheModel();
276 }
277
278 public com.liferay.portal.model.PortletPreferences toEscapedModel() {
279 return new PortletPreferencesWrapper(_portletPreferences.toEscapedModel());
280 }
281
282 public com.liferay.portal.model.PortletPreferences toUnescapedModel() {
283 return new PortletPreferencesWrapper(_portletPreferences.toUnescapedModel());
284 }
285
286 @Override
287 public java.lang.String toString() {
288 return _portletPreferences.toString();
289 }
290
291 public java.lang.String toXmlString() {
292 return _portletPreferences.toXmlString();
293 }
294
295 public void persist()
296 throws com.liferay.portal.kernel.exception.SystemException {
297 _portletPreferences.persist();
298 }
299
300 @Override
301 public boolean equals(Object obj) {
302 if (this == obj) {
303 return true;
304 }
305
306 if (!(obj instanceof PortletPreferencesWrapper)) {
307 return false;
308 }
309
310 PortletPreferencesWrapper portletPreferencesWrapper = (PortletPreferencesWrapper)obj;
311
312 if (Validator.equals(_portletPreferences,
313 portletPreferencesWrapper._portletPreferences)) {
314 return true;
315 }
316
317 return false;
318 }
319
320
323 public PortletPreferences getWrappedPortletPreferences() {
324 return _portletPreferences;
325 }
326
327 public PortletPreferences getWrappedModel() {
328 return _portletPreferences;
329 }
330
331 public void resetOriginalValues() {
332 _portletPreferences.resetOriginalValues();
333 }
334
335 private PortletPreferences _portletPreferences;
336 }