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