001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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    /**
023     * <p>
024     * This class is a wrapper for {@link PortletPreferences}.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see PortletPreferences
029     * @generated
030     */
031    public class PortletPreferencesWrapper implements PortletPreferences,
032            ModelWrapper<PortletPreferences> {
033            public PortletPreferencesWrapper(PortletPreferences portletPreferences) {
034                    _portletPreferences = portletPreferences;
035            }
036    
037            @Override
038            public Class<?> getModelClass() {
039                    return PortletPreferences.class;
040            }
041    
042            @Override
043            public String getModelClassName() {
044                    return PortletPreferences.class.getName();
045            }
046    
047            @Override
048            public Map<String, Object> getModelAttributes() {
049                    Map<String, Object> attributes = new HashMap<String, Object>();
050    
051                    attributes.put("portletPreferencesId", getPortletPreferencesId());
052                    attributes.put("ownerId", getOwnerId());
053                    attributes.put("ownerType", getOwnerType());
054                    attributes.put("plid", getPlid());
055                    attributes.put("portletId", getPortletId());
056                    attributes.put("preferences", getPreferences());
057    
058                    return attributes;
059            }
060    
061            @Override
062            public void setModelAttributes(Map<String, Object> attributes) {
063                    Long portletPreferencesId = (Long)attributes.get("portletPreferencesId");
064    
065                    if (portletPreferencesId != null) {
066                            setPortletPreferencesId(portletPreferencesId);
067                    }
068    
069                    Long ownerId = (Long)attributes.get("ownerId");
070    
071                    if (ownerId != null) {
072                            setOwnerId(ownerId);
073                    }
074    
075                    Integer ownerType = (Integer)attributes.get("ownerType");
076    
077                    if (ownerType != null) {
078                            setOwnerType(ownerType);
079                    }
080    
081                    Long plid = (Long)attributes.get("plid");
082    
083                    if (plid != null) {
084                            setPlid(plid);
085                    }
086    
087                    String portletId = (String)attributes.get("portletId");
088    
089                    if (portletId != null) {
090                            setPortletId(portletId);
091                    }
092    
093                    String preferences = (String)attributes.get("preferences");
094    
095                    if (preferences != null) {
096                            setPreferences(preferences);
097                    }
098            }
099    
100            /**
101            * Returns the primary key of this portlet preferences.
102            *
103            * @return the primary key of this portlet preferences
104            */
105            @Override
106            public long getPrimaryKey() {
107                    return _portletPreferences.getPrimaryKey();
108            }
109    
110            /**
111            * Sets the primary key of this portlet preferences.
112            *
113            * @param primaryKey the primary key of this portlet preferences
114            */
115            @Override
116            public void setPrimaryKey(long primaryKey) {
117                    _portletPreferences.setPrimaryKey(primaryKey);
118            }
119    
120            /**
121            * Returns the portlet preferences ID of this portlet preferences.
122            *
123            * @return the portlet preferences ID of this portlet preferences
124            */
125            @Override
126            public long getPortletPreferencesId() {
127                    return _portletPreferences.getPortletPreferencesId();
128            }
129    
130            /**
131            * Sets the portlet preferences ID of this portlet preferences.
132            *
133            * @param portletPreferencesId the portlet preferences ID of this portlet preferences
134            */
135            @Override
136            public void setPortletPreferencesId(long portletPreferencesId) {
137                    _portletPreferences.setPortletPreferencesId(portletPreferencesId);
138            }
139    
140            /**
141            * Returns the owner ID of this portlet preferences.
142            *
143            * @return the owner ID of this portlet preferences
144            */
145            @Override
146            public long getOwnerId() {
147                    return _portletPreferences.getOwnerId();
148            }
149    
150            /**
151            * Sets the owner ID of this portlet preferences.
152            *
153            * @param ownerId the owner ID of this portlet preferences
154            */
155            @Override
156            public void setOwnerId(long ownerId) {
157                    _portletPreferences.setOwnerId(ownerId);
158            }
159    
160            /**
161            * Returns the owner type of this portlet preferences.
162            *
163            * @return the owner type of this portlet preferences
164            */
165            @Override
166            public int getOwnerType() {
167                    return _portletPreferences.getOwnerType();
168            }
169    
170            /**
171            * Sets the owner type of this portlet preferences.
172            *
173            * @param ownerType the owner type of this portlet preferences
174            */
175            @Override
176            public void setOwnerType(int ownerType) {
177                    _portletPreferences.setOwnerType(ownerType);
178            }
179    
180            /**
181            * Returns the plid of this portlet preferences.
182            *
183            * @return the plid of this portlet preferences
184            */
185            @Override
186            public long getPlid() {
187                    return _portletPreferences.getPlid();
188            }
189    
190            /**
191            * Sets the plid of this portlet preferences.
192            *
193            * @param plid the plid of this portlet preferences
194            */
195            @Override
196            public void setPlid(long plid) {
197                    _portletPreferences.setPlid(plid);
198            }
199    
200            /**
201            * Returns the portlet ID of this portlet preferences.
202            *
203            * @return the portlet ID of this portlet preferences
204            */
205            @Override
206            public java.lang.String getPortletId() {
207                    return _portletPreferences.getPortletId();
208            }
209    
210            /**
211            * Sets the portlet ID of this portlet preferences.
212            *
213            * @param portletId the portlet ID of this portlet preferences
214            */
215            @Override
216            public void setPortletId(java.lang.String portletId) {
217                    _portletPreferences.setPortletId(portletId);
218            }
219    
220            /**
221            * Returns the preferences of this portlet preferences.
222            *
223            * @return the preferences of this portlet preferences
224            */
225            @Override
226            public java.lang.String getPreferences() {
227                    return _portletPreferences.getPreferences();
228            }
229    
230            /**
231            * Sets the preferences of this portlet preferences.
232            *
233            * @param preferences the preferences of this portlet preferences
234            */
235            @Override
236            public void setPreferences(java.lang.String preferences) {
237                    _portletPreferences.setPreferences(preferences);
238            }
239    
240            @Override
241            public boolean isNew() {
242                    return _portletPreferences.isNew();
243            }
244    
245            @Override
246            public void setNew(boolean n) {
247                    _portletPreferences.setNew(n);
248            }
249    
250            @Override
251            public boolean isCachedModel() {
252                    return _portletPreferences.isCachedModel();
253            }
254    
255            @Override
256            public void setCachedModel(boolean cachedModel) {
257                    _portletPreferences.setCachedModel(cachedModel);
258            }
259    
260            @Override
261            public boolean isEscapedModel() {
262                    return _portletPreferences.isEscapedModel();
263            }
264    
265            @Override
266            public java.io.Serializable getPrimaryKeyObj() {
267                    return _portletPreferences.getPrimaryKeyObj();
268            }
269    
270            @Override
271            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
272                    _portletPreferences.setPrimaryKeyObj(primaryKeyObj);
273            }
274    
275            @Override
276            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
277                    return _portletPreferences.getExpandoBridge();
278            }
279    
280            @Override
281            public void setExpandoBridgeAttributes(
282                    com.liferay.portal.model.BaseModel<?> baseModel) {
283                    _portletPreferences.setExpandoBridgeAttributes(baseModel);
284            }
285    
286            @Override
287            public void setExpandoBridgeAttributes(
288                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
289                    _portletPreferences.setExpandoBridgeAttributes(expandoBridge);
290            }
291    
292            @Override
293            public void setExpandoBridgeAttributes(
294                    com.liferay.portal.service.ServiceContext serviceContext) {
295                    _portletPreferences.setExpandoBridgeAttributes(serviceContext);
296            }
297    
298            @Override
299            public java.lang.Object clone() {
300                    return new PortletPreferencesWrapper((PortletPreferences)_portletPreferences.clone());
301            }
302    
303            @Override
304            public int compareTo(
305                    com.liferay.portal.model.PortletPreferences portletPreferences) {
306                    return _portletPreferences.compareTo(portletPreferences);
307            }
308    
309            @Override
310            public int hashCode() {
311                    return _portletPreferences.hashCode();
312            }
313    
314            @Override
315            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.PortletPreferences> toCacheModel() {
316                    return _portletPreferences.toCacheModel();
317            }
318    
319            @Override
320            public com.liferay.portal.model.PortletPreferences toEscapedModel() {
321                    return new PortletPreferencesWrapper(_portletPreferences.toEscapedModel());
322            }
323    
324            @Override
325            public com.liferay.portal.model.PortletPreferences toUnescapedModel() {
326                    return new PortletPreferencesWrapper(_portletPreferences.toUnescapedModel());
327            }
328    
329            @Override
330            public java.lang.String toString() {
331                    return _portletPreferences.toString();
332            }
333    
334            @Override
335            public java.lang.String toXmlString() {
336                    return _portletPreferences.toXmlString();
337            }
338    
339            @Override
340            public void persist()
341                    throws com.liferay.portal.kernel.exception.SystemException {
342                    _portletPreferences.persist();
343            }
344    
345            @Override
346            public boolean equals(Object obj) {
347                    if (this == obj) {
348                            return true;
349                    }
350    
351                    if (!(obj instanceof PortletPreferencesWrapper)) {
352                            return false;
353                    }
354    
355                    PortletPreferencesWrapper portletPreferencesWrapper = (PortletPreferencesWrapper)obj;
356    
357                    if (Validator.equals(_portletPreferences,
358                                            portletPreferencesWrapper._portletPreferences)) {
359                            return true;
360                    }
361    
362                    return false;
363            }
364    
365            /**
366             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
367             */
368            public PortletPreferences getWrappedPortletPreferences() {
369                    return _portletPreferences;
370            }
371    
372            @Override
373            public PortletPreferences getWrappedModel() {
374                    return _portletPreferences;
375            }
376    
377            @Override
378            public void resetOriginalValues() {
379                    _portletPreferences.resetOriginalValues();
380            }
381    
382            private PortletPreferences _portletPreferences;
383    }