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