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 com.liferay.portal.kernel.util.Validator;
018    
019    import java.util.HashMap;
020    import java.util.Map;
021    
022    /**
023     * <p>
024     * This class is a wrapper for {@link PortletPreferences}.
025     * </p>
026     *
027     * @author    Brian Wing Shun Chan
028     * @see       PortletPreferences
029     * @generated
030     */
031    public class PortletPreferencesWrapper implements PortletPreferences,
032            ModelWrapper<PortletPreferences> {
033            public PortletPreferencesWrapper(PortletPreferences portletPreferences) {
034                    _portletPreferences = portletPreferences;
035            }
036    
037            public Class<?> getModelClass() {
038                    return PortletPreferences.class;
039            }
040    
041            public String getModelClassName() {
042                    return PortletPreferences.class.getName();
043            }
044    
045            public Map<String, Object> getModelAttributes() {
046                    Map<String, Object> attributes = new HashMap<String, Object>();
047    
048                    attributes.put("portletPreferencesId", getPortletPreferencesId());
049                    attributes.put("ownerId", getOwnerId());
050                    attributes.put("ownerType", getOwnerType());
051                    attributes.put("plid", getPlid());
052                    attributes.put("portletId", getPortletId());
053                    attributes.put("preferences", getPreferences());
054    
055                    return attributes;
056            }
057    
058            public void setModelAttributes(Map<String, Object> attributes) {
059                    Long portletPreferencesId = (Long)attributes.get("portletPreferencesId");
060    
061                    if (portletPreferencesId != null) {
062                            setPortletPreferencesId(portletPreferencesId);
063                    }
064    
065                    Long ownerId = (Long)attributes.get("ownerId");
066    
067                    if (ownerId != null) {
068                            setOwnerId(ownerId);
069                    }
070    
071                    Integer ownerType = (Integer)attributes.get("ownerType");
072    
073                    if (ownerType != null) {
074                            setOwnerType(ownerType);
075                    }
076    
077                    Long plid = (Long)attributes.get("plid");
078    
079                    if (plid != null) {
080                            setPlid(plid);
081                    }
082    
083                    String portletId = (String)attributes.get("portletId");
084    
085                    if (portletId != null) {
086                            setPortletId(portletId);
087                    }
088    
089                    String preferences = (String)attributes.get("preferences");
090    
091                    if (preferences != null) {
092                            setPreferences(preferences);
093                    }
094            }
095    
096            /**
097            * Returns the primary key of this portlet preferences.
098            *
099            * @return the primary key of this portlet preferences
100            */
101            public long getPrimaryKey() {
102                    return _portletPreferences.getPrimaryKey();
103            }
104    
105            /**
106            * Sets the primary key of this portlet preferences.
107            *
108            * @param primaryKey the primary key of this portlet preferences
109            */
110            public void setPrimaryKey(long primaryKey) {
111                    _portletPreferences.setPrimaryKey(primaryKey);
112            }
113    
114            /**
115            * Returns the portlet preferences ID of this portlet preferences.
116            *
117            * @return the portlet preferences ID of this portlet preferences
118            */
119            public long getPortletPreferencesId() {
120                    return _portletPreferences.getPortletPreferencesId();
121            }
122    
123            /**
124            * Sets the portlet preferences ID of this portlet preferences.
125            *
126            * @param portletPreferencesId the portlet preferences ID of this portlet preferences
127            */
128            public void setPortletPreferencesId(long portletPreferencesId) {
129                    _portletPreferences.setPortletPreferencesId(portletPreferencesId);
130            }
131    
132            /**
133            * Returns the owner ID of this portlet preferences.
134            *
135            * @return the owner ID of this portlet preferences
136            */
137            public long getOwnerId() {
138                    return _portletPreferences.getOwnerId();
139            }
140    
141            /**
142            * Sets the owner ID of this portlet preferences.
143            *
144            * @param ownerId the owner ID of this portlet preferences
145            */
146            public void setOwnerId(long ownerId) {
147                    _portletPreferences.setOwnerId(ownerId);
148            }
149    
150            /**
151            * Returns the owner type of this portlet preferences.
152            *
153            * @return the owner type of this portlet preferences
154            */
155            public int getOwnerType() {
156                    return _portletPreferences.getOwnerType();
157            }
158    
159            /**
160            * Sets the owner type of this portlet preferences.
161            *
162            * @param ownerType the owner type of this portlet preferences
163            */
164            public void setOwnerType(int ownerType) {
165                    _portletPreferences.setOwnerType(ownerType);
166            }
167    
168            /**
169            * Returns the plid of this portlet preferences.
170            *
171            * @return the plid of this portlet preferences
172            */
173            public long getPlid() {
174                    return _portletPreferences.getPlid();
175            }
176    
177            /**
178            * Sets the plid of this portlet preferences.
179            *
180            * @param plid the plid of this portlet preferences
181            */
182            public void setPlid(long plid) {
183                    _portletPreferences.setPlid(plid);
184            }
185    
186            /**
187            * Returns the portlet ID of this portlet preferences.
188            *
189            * @return the portlet ID of this portlet preferences
190            */
191            public java.lang.String getPortletId() {
192                    return _portletPreferences.getPortletId();
193            }
194    
195            /**
196            * Sets the portlet ID of this portlet preferences.
197            *
198            * @param portletId the portlet ID of this portlet preferences
199            */
200            public void setPortletId(java.lang.String portletId) {
201                    _portletPreferences.setPortletId(portletId);
202            }
203    
204            /**
205            * Returns the preferences of this portlet preferences.
206            *
207            * @return the preferences of this portlet preferences
208            */
209            public java.lang.String getPreferences() {
210                    return _portletPreferences.getPreferences();
211            }
212    
213            /**
214            * Sets the preferences of this portlet preferences.
215            *
216            * @param preferences the preferences of this portlet preferences
217            */
218            public void setPreferences(java.lang.String preferences) {
219                    _portletPreferences.setPreferences(preferences);
220            }
221    
222            public boolean isNew() {
223                    return _portletPreferences.isNew();
224            }
225    
226            public void setNew(boolean n) {
227                    _portletPreferences.setNew(n);
228            }
229    
230            public boolean isCachedModel() {
231                    return _portletPreferences.isCachedModel();
232            }
233    
234            public void setCachedModel(boolean cachedModel) {
235                    _portletPreferences.setCachedModel(cachedModel);
236            }
237    
238            public boolean isEscapedModel() {
239                    return _portletPreferences.isEscapedModel();
240            }
241    
242            public java.io.Serializable getPrimaryKeyObj() {
243                    return _portletPreferences.getPrimaryKeyObj();
244            }
245    
246            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
247                    _portletPreferences.setPrimaryKeyObj(primaryKeyObj);
248            }
249    
250            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
251                    return _portletPreferences.getExpandoBridge();
252            }
253    
254            public void setExpandoBridgeAttributes(
255                    com.liferay.portal.service.ServiceContext serviceContext) {
256                    _portletPreferences.setExpandoBridgeAttributes(serviceContext);
257            }
258    
259            @Override
260            public java.lang.Object clone() {
261                    return new PortletPreferencesWrapper((PortletPreferences)_portletPreferences.clone());
262            }
263    
264            public int compareTo(
265                    com.liferay.portal.model.PortletPreferences portletPreferences) {
266                    return _portletPreferences.compareTo(portletPreferences);
267            }
268    
269            @Override
270            public int hashCode() {
271                    return _portletPreferences.hashCode();
272            }
273    
274            public com.liferay.portal.model.CacheModel<com.liferay.portal.model.PortletPreferences> toCacheModel() {
275                    return _portletPreferences.toCacheModel();
276            }
277    
278            public com.liferay.portal.model.PortletPreferences toEscapedModel() {
279                    return new PortletPreferencesWrapper(_portletPreferences.toEscapedModel());
280            }
281    
282            public com.liferay.portal.model.PortletPreferences toUnescapedModel() {
283                    return new PortletPreferencesWrapper(_portletPreferences.toUnescapedModel());
284            }
285    
286            @Override
287            public java.lang.String toString() {
288                    return _portletPreferences.toString();
289            }
290    
291            public java.lang.String toXmlString() {
292                    return _portletPreferences.toXmlString();
293            }
294    
295            public void persist()
296                    throws com.liferay.portal.kernel.exception.SystemException {
297                    _portletPreferences.persist();
298            }
299    
300            @Override
301            public boolean equals(Object obj) {
302                    if (this == obj) {
303                            return true;
304                    }
305    
306                    if (!(obj instanceof PortletPreferencesWrapper)) {
307                            return false;
308                    }
309    
310                    PortletPreferencesWrapper portletPreferencesWrapper = (PortletPreferencesWrapper)obj;
311    
312                    if (Validator.equals(_portletPreferences,
313                                            portletPreferencesWrapper._portletPreferences)) {
314                            return true;
315                    }
316    
317                    return false;
318            }
319    
320            /**
321             * @deprecated Renamed to {@link #getWrappedModel}
322             */
323            public PortletPreferences getWrappedPortletPreferences() {
324                    return _portletPreferences;
325            }
326    
327            public PortletPreferences getWrappedModel() {
328                    return _portletPreferences;
329            }
330    
331            public void resetOriginalValues() {
332                    _portletPreferences.resetOriginalValues();
333            }
334    
335            private PortletPreferences _portletPreferences;
336    }