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(BaseModel<?> baseModel) {
243                    _portletPreferences.setExpandoBridgeAttributes(baseModel);
244            }
245    
246            @Override
247            public void setExpandoBridgeAttributes(
248                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
249                    _portletPreferences.setExpandoBridgeAttributes(expandoBridge);
250            }
251    
252            @Override
253            public void setExpandoBridgeAttributes(
254                    com.liferay.portal.service.ServiceContext serviceContext) {
255                    _portletPreferences.setExpandoBridgeAttributes(serviceContext);
256            }
257    
258            /**
259            * Sets the mvcc version of this portlet preferences.
260            *
261            * @param mvccVersion the mvcc version of this portlet preferences
262            */
263            @Override
264            public void setMvccVersion(long mvccVersion) {
265                    _portletPreferences.setMvccVersion(mvccVersion);
266            }
267    
268            @Override
269            public void setNew(boolean n) {
270                    _portletPreferences.setNew(n);
271            }
272    
273            /**
274            * Sets the owner ID of this portlet preferences.
275            *
276            * @param ownerId the owner ID of this portlet preferences
277            */
278            @Override
279            public void setOwnerId(long ownerId) {
280                    _portletPreferences.setOwnerId(ownerId);
281            }
282    
283            /**
284            * Sets the owner type of this portlet preferences.
285            *
286            * @param ownerType the owner type of this portlet preferences
287            */
288            @Override
289            public void setOwnerType(int ownerType) {
290                    _portletPreferences.setOwnerType(ownerType);
291            }
292    
293            /**
294            * Sets the plid of this portlet preferences.
295            *
296            * @param plid the plid of this portlet preferences
297            */
298            @Override
299            public void setPlid(long plid) {
300                    _portletPreferences.setPlid(plid);
301            }
302    
303            /**
304            * Sets the portlet ID of this portlet preferences.
305            *
306            * @param portletId the portlet ID of this portlet preferences
307            */
308            @Override
309            public void setPortletId(java.lang.String portletId) {
310                    _portletPreferences.setPortletId(portletId);
311            }
312    
313            /**
314            * Sets the portlet preferences ID of this portlet preferences.
315            *
316            * @param portletPreferencesId the portlet preferences ID of this portlet preferences
317            */
318            @Override
319            public void setPortletPreferencesId(long portletPreferencesId) {
320                    _portletPreferences.setPortletPreferencesId(portletPreferencesId);
321            }
322    
323            /**
324            * Sets the preferences of this portlet preferences.
325            *
326            * @param preferences the preferences of this portlet preferences
327            */
328            @Override
329            public void setPreferences(java.lang.String preferences) {
330                    _portletPreferences.setPreferences(preferences);
331            }
332    
333            /**
334            * Sets the primary key of this portlet preferences.
335            *
336            * @param primaryKey the primary key of this portlet preferences
337            */
338            @Override
339            public void setPrimaryKey(long primaryKey) {
340                    _portletPreferences.setPrimaryKey(primaryKey);
341            }
342    
343            @Override
344            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
345                    _portletPreferences.setPrimaryKeyObj(primaryKeyObj);
346            }
347    
348            @Override
349            public CacheModel<com.liferay.portal.model.PortletPreferences> toCacheModel() {
350                    return _portletPreferences.toCacheModel();
351            }
352    
353            @Override
354            public com.liferay.portal.model.PortletPreferences toEscapedModel() {
355                    return new PortletPreferencesWrapper(_portletPreferences.toEscapedModel());
356            }
357    
358            @Override
359            public java.lang.String toString() {
360                    return _portletPreferences.toString();
361            }
362    
363            @Override
364            public com.liferay.portal.model.PortletPreferences toUnescapedModel() {
365                    return new PortletPreferencesWrapper(_portletPreferences.toUnescapedModel());
366            }
367    
368            @Override
369            public java.lang.String toXmlString() {
370                    return _portletPreferences.toXmlString();
371            }
372    
373            @Override
374            public boolean equals(Object obj) {
375                    if (this == obj) {
376                            return true;
377                    }
378    
379                    if (!(obj instanceof PortletPreferencesWrapper)) {
380                            return false;
381                    }
382    
383                    PortletPreferencesWrapper portletPreferencesWrapper = (PortletPreferencesWrapper)obj;
384    
385                    if (Validator.equals(_portletPreferences,
386                                            portletPreferencesWrapper._portletPreferences)) {
387                            return true;
388                    }
389    
390                    return false;
391            }
392    
393            /**
394             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
395             */
396            @Deprecated
397            public PortletPreferences getWrappedPortletPreferences() {
398                    return _portletPreferences;
399            }
400    
401            @Override
402            public PortletPreferences getWrappedModel() {
403                    return _portletPreferences;
404            }
405    
406            @Override
407            public boolean isEntityCacheEnabled() {
408                    return _portletPreferences.isEntityCacheEnabled();
409            }
410    
411            @Override
412            public boolean isFinderCacheEnabled() {
413                    return _portletPreferences.isFinderCacheEnabled();
414            }
415    
416            @Override
417            public void resetOriginalValues() {
418                    _portletPreferences.resetOriginalValues();
419            }
420    
421            private final PortletPreferences _portletPreferences;
422    }