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