001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.Validator;
020    
021    import java.util.HashMap;
022    import java.util.Map;
023    
024    /**
025     * <p>
026     * This class is a wrapper for {@link PortletPreferences}.
027     * </p>
028     *
029     * @author Brian Wing Shun Chan
030     * @see PortletPreferences
031     * @generated
032     */
033    @ProviderType
034    public class PortletPreferencesWrapper implements PortletPreferences,
035            ModelWrapper<PortletPreferences> {
036            public PortletPreferencesWrapper(PortletPreferences portletPreferences) {
037                    _portletPreferences = portletPreferences;
038            }
039    
040            @Override
041            public Class<?> getModelClass() {
042                    return PortletPreferences.class;
043            }
044    
045            @Override
046            public String getModelClassName() {
047                    return PortletPreferences.class.getName();
048            }
049    
050            @Override
051            public Map<String, Object> getModelAttributes() {
052                    Map<String, Object> attributes = new HashMap<String, Object>();
053    
054                    attributes.put("mvccVersion", getMvccVersion());
055                    attributes.put("portletPreferencesId", getPortletPreferencesId());
056                    attributes.put("ownerId", getOwnerId());
057                    attributes.put("ownerType", getOwnerType());
058                    attributes.put("plid", getPlid());
059                    attributes.put("portletId", getPortletId());
060                    attributes.put("preferences", getPreferences());
061    
062                    return attributes;
063            }
064    
065            @Override
066            public void setModelAttributes(Map<String, Object> attributes) {
067                    Long mvccVersion = (Long)attributes.get("mvccVersion");
068    
069                    if (mvccVersion != null) {
070                            setMvccVersion(mvccVersion);
071                    }
072    
073                    Long portletPreferencesId = (Long)attributes.get("portletPreferencesId");
074    
075                    if (portletPreferencesId != null) {
076                            setPortletPreferencesId(portletPreferencesId);
077                    }
078    
079                    Long ownerId = (Long)attributes.get("ownerId");
080    
081                    if (ownerId != null) {
082                            setOwnerId(ownerId);
083                    }
084    
085                    Integer ownerType = (Integer)attributes.get("ownerType");
086    
087                    if (ownerType != null) {
088                            setOwnerType(ownerType);
089                    }
090    
091                    Long plid = (Long)attributes.get("plid");
092    
093                    if (plid != null) {
094                            setPlid(plid);
095                    }
096    
097                    String portletId = (String)attributes.get("portletId");
098    
099                    if (portletId != null) {
100                            setPortletId(portletId);
101                    }
102    
103                    String preferences = (String)attributes.get("preferences");
104    
105                    if (preferences != null) {
106                            setPreferences(preferences);
107                    }
108            }
109    
110            @Override
111            public java.lang.Object clone() {
112                    return new PortletPreferencesWrapper((PortletPreferences)_portletPreferences.clone());
113            }
114    
115            @Override
116            public int compareTo(
117                    com.liferay.portal.model.PortletPreferences portletPreferences) {
118                    return _portletPreferences.compareTo(portletPreferences);
119            }
120    
121            @Override
122            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
123                    return _portletPreferences.getExpandoBridge();
124            }
125    
126            /**
127            * Returns the mvcc version of this portlet preferences.
128            *
129            * @return the mvcc version of this portlet preferences
130            */
131            @Override
132            public long getMvccVersion() {
133                    return _portletPreferences.getMvccVersion();
134            }
135    
136            /**
137            * Returns the owner ID of this portlet preferences.
138            *
139            * @return the owner ID of this portlet preferences
140            */
141            @Override
142            public long getOwnerId() {
143                    return _portletPreferences.getOwnerId();
144            }
145    
146            /**
147            * Returns the owner type of this portlet preferences.
148            *
149            * @return the owner type of this portlet preferences
150            */
151            @Override
152            public int getOwnerType() {
153                    return _portletPreferences.getOwnerType();
154            }
155    
156            /**
157            * Returns the plid of this portlet preferences.
158            *
159            * @return the plid of this portlet preferences
160            */
161            @Override
162            public long getPlid() {
163                    return _portletPreferences.getPlid();
164            }
165    
166            /**
167            * Returns the portlet ID of this portlet preferences.
168            *
169            * @return the portlet ID of this portlet preferences
170            */
171            @Override
172            public java.lang.String getPortletId() {
173                    return _portletPreferences.getPortletId();
174            }
175    
176            /**
177            * Returns the portlet preferences ID of this portlet preferences.
178            *
179            * @return the portlet preferences ID of this portlet preferences
180            */
181            @Override
182            public long getPortletPreferencesId() {
183                    return _portletPreferences.getPortletPreferencesId();
184            }
185    
186            /**
187            * Returns the preferences of this portlet preferences.
188            *
189            * @return the preferences of this portlet preferences
190            */
191            @Override
192            public java.lang.String getPreferences() {
193                    return _portletPreferences.getPreferences();
194            }
195    
196            /**
197            * Returns the primary key of this portlet preferences.
198            *
199            * @return the primary key of this portlet preferences
200            */
201            @Override
202            public long getPrimaryKey() {
203                    return _portletPreferences.getPrimaryKey();
204            }
205    
206            @Override
207            public java.io.Serializable getPrimaryKeyObj() {
208                    return _portletPreferences.getPrimaryKeyObj();
209            }
210    
211            @Override
212            public int hashCode() {
213                    return _portletPreferences.hashCode();
214            }
215    
216            @Override
217            public boolean isCachedModel() {
218                    return _portletPreferences.isCachedModel();
219            }
220    
221            @Override
222            public boolean isEscapedModel() {
223                    return _portletPreferences.isEscapedModel();
224            }
225    
226            @Override
227            public boolean isNew() {
228                    return _portletPreferences.isNew();
229            }
230    
231            @Override
232            public void persist() {
233                    _portletPreferences.persist();
234            }
235    
236            @Override
237            public void setCachedModel(boolean cachedModel) {
238                    _portletPreferences.setCachedModel(cachedModel);
239            }
240    
241            @Override
242            public void setExpandoBridgeAttributes(
243                    com.liferay.portal.model.BaseModel<?> baseModel) {
244                    _portletPreferences.setExpandoBridgeAttributes(baseModel);
245            }
246    
247            @Override
248            public void setExpandoBridgeAttributes(
249                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
250                    _portletPreferences.setExpandoBridgeAttributes(expandoBridge);
251            }
252    
253            @Override
254            public void setExpandoBridgeAttributes(
255                    com.liferay.portal.service.ServiceContext serviceContext) {
256                    _portletPreferences.setExpandoBridgeAttributes(serviceContext);
257            }
258    
259            /**
260            * Sets the mvcc version of this portlet preferences.
261            *
262            * @param mvccVersion the mvcc version of this portlet preferences
263            */
264            @Override
265            public void setMvccVersion(long mvccVersion) {
266                    _portletPreferences.setMvccVersion(mvccVersion);
267            }
268    
269            @Override
270            public void setNew(boolean n) {
271                    _portletPreferences.setNew(n);
272            }
273    
274            /**
275            * Sets the owner ID of this portlet preferences.
276            *
277            * @param ownerId the owner ID of this portlet preferences
278            */
279            @Override
280            public void setOwnerId(long ownerId) {
281                    _portletPreferences.setOwnerId(ownerId);
282            }
283    
284            /**
285            * Sets the owner type of this portlet preferences.
286            *
287            * @param ownerType the owner type of this portlet preferences
288            */
289            @Override
290            public void setOwnerType(int ownerType) {
291                    _portletPreferences.setOwnerType(ownerType);
292            }
293    
294            /**
295            * Sets the plid of this portlet preferences.
296            *
297            * @param plid the plid of this portlet preferences
298            */
299            @Override
300            public void setPlid(long plid) {
301                    _portletPreferences.setPlid(plid);
302            }
303    
304            /**
305            * Sets the portlet ID of this portlet preferences.
306            *
307            * @param portletId the portlet ID of this portlet preferences
308            */
309            @Override
310            public void setPortletId(java.lang.String portletId) {
311                    _portletPreferences.setPortletId(portletId);
312            }
313    
314            /**
315            * Sets the portlet preferences ID of this portlet preferences.
316            *
317            * @param portletPreferencesId the portlet preferences ID of this portlet preferences
318            */
319            @Override
320            public void setPortletPreferencesId(long portletPreferencesId) {
321                    _portletPreferences.setPortletPreferencesId(portletPreferencesId);
322            }
323    
324            /**
325            * Sets the preferences of this portlet preferences.
326            *
327            * @param preferences the preferences of this portlet preferences
328            */
329            @Override
330            public void setPreferences(java.lang.String preferences) {
331                    _portletPreferences.setPreferences(preferences);
332            }
333    
334            /**
335            * Sets the primary key of this portlet preferences.
336            *
337            * @param primaryKey the primary key of this portlet preferences
338            */
339            @Override
340            public void setPrimaryKey(long primaryKey) {
341                    _portletPreferences.setPrimaryKey(primaryKey);
342            }
343    
344            @Override
345            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
346                    _portletPreferences.setPrimaryKeyObj(primaryKeyObj);
347            }
348    
349            @Override
350            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.PortletPreferences> toCacheModel() {
351                    return _portletPreferences.toCacheModel();
352            }
353    
354            @Override
355            public com.liferay.portal.model.PortletPreferences toEscapedModel() {
356                    return new PortletPreferencesWrapper(_portletPreferences.toEscapedModel());
357            }
358    
359            @Override
360            public java.lang.String toString() {
361                    return _portletPreferences.toString();
362            }
363    
364            @Override
365            public com.liferay.portal.model.PortletPreferences toUnescapedModel() {
366                    return new PortletPreferencesWrapper(_portletPreferences.toUnescapedModel());
367            }
368    
369            @Override
370            public java.lang.String toXmlString() {
371                    return _portletPreferences.toXmlString();
372            }
373    
374            @Override
375            public boolean equals(Object obj) {
376                    if (this == obj) {
377                            return true;
378                    }
379    
380                    if (!(obj instanceof PortletPreferencesWrapper)) {
381                            return false;
382                    }
383    
384                    PortletPreferencesWrapper portletPreferencesWrapper = (PortletPreferencesWrapper)obj;
385    
386                    if (Validator.equals(_portletPreferences,
387                                            portletPreferencesWrapper._portletPreferences)) {
388                            return true;
389                    }
390    
391                    return false;
392            }
393    
394            /**
395             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
396             */
397            @Deprecated
398            public PortletPreferences getWrappedPortletPreferences() {
399                    return _portletPreferences;
400            }
401    
402            @Override
403            public PortletPreferences getWrappedModel() {
404                    return _portletPreferences;
405            }
406    
407            @Override
408            public boolean isEntityCacheEnabled() {
409                    return _portletPreferences.isEntityCacheEnabled();
410            }
411    
412            @Override
413            public boolean isFinderCacheEnabled() {
414                    return _portletPreferences.isFinderCacheEnabled();
415            }
416    
417            @Override
418            public void resetOriginalValues() {
419                    _portletPreferences.resetOriginalValues();
420            }
421    
422            private final PortletPreferences _portletPreferences;
423    }