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