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.portlet.ratings.model;
016    
017    import com.liferay.portal.kernel.util.Validator;
018    import com.liferay.portal.model.ModelWrapper;
019    
020    import java.util.HashMap;
021    import java.util.Map;
022    
023    /**
024     * <p>
025     * This class is a wrapper for {@link RatingsStats}.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see RatingsStats
030     * @generated
031     */
032    public class RatingsStatsWrapper implements RatingsStats,
033            ModelWrapper<RatingsStats> {
034            public RatingsStatsWrapper(RatingsStats ratingsStats) {
035                    _ratingsStats = ratingsStats;
036            }
037    
038            @Override
039            public Class<?> getModelClass() {
040                    return RatingsStats.class;
041            }
042    
043            @Override
044            public String getModelClassName() {
045                    return RatingsStats.class.getName();
046            }
047    
048            @Override
049            public Map<String, Object> getModelAttributes() {
050                    Map<String, Object> attributes = new HashMap<String, Object>();
051    
052                    attributes.put("statsId", getStatsId());
053                    attributes.put("classNameId", getClassNameId());
054                    attributes.put("classPK", getClassPK());
055                    attributes.put("totalEntries", getTotalEntries());
056                    attributes.put("totalScore", getTotalScore());
057                    attributes.put("averageScore", getAverageScore());
058    
059                    return attributes;
060            }
061    
062            @Override
063            public void setModelAttributes(Map<String, Object> attributes) {
064                    Long statsId = (Long)attributes.get("statsId");
065    
066                    if (statsId != null) {
067                            setStatsId(statsId);
068                    }
069    
070                    Long classNameId = (Long)attributes.get("classNameId");
071    
072                    if (classNameId != null) {
073                            setClassNameId(classNameId);
074                    }
075    
076                    Long classPK = (Long)attributes.get("classPK");
077    
078                    if (classPK != null) {
079                            setClassPK(classPK);
080                    }
081    
082                    Integer totalEntries = (Integer)attributes.get("totalEntries");
083    
084                    if (totalEntries != null) {
085                            setTotalEntries(totalEntries);
086                    }
087    
088                    Double totalScore = (Double)attributes.get("totalScore");
089    
090                    if (totalScore != null) {
091                            setTotalScore(totalScore);
092                    }
093    
094                    Double averageScore = (Double)attributes.get("averageScore");
095    
096                    if (averageScore != null) {
097                            setAverageScore(averageScore);
098                    }
099            }
100    
101            /**
102            * Returns the primary key of this ratings stats.
103            *
104            * @return the primary key of this ratings stats
105            */
106            @Override
107            public long getPrimaryKey() {
108                    return _ratingsStats.getPrimaryKey();
109            }
110    
111            /**
112            * Sets the primary key of this ratings stats.
113            *
114            * @param primaryKey the primary key of this ratings stats
115            */
116            @Override
117            public void setPrimaryKey(long primaryKey) {
118                    _ratingsStats.setPrimaryKey(primaryKey);
119            }
120    
121            /**
122            * Returns the stats ID of this ratings stats.
123            *
124            * @return the stats ID of this ratings stats
125            */
126            @Override
127            public long getStatsId() {
128                    return _ratingsStats.getStatsId();
129            }
130    
131            /**
132            * Sets the stats ID of this ratings stats.
133            *
134            * @param statsId the stats ID of this ratings stats
135            */
136            @Override
137            public void setStatsId(long statsId) {
138                    _ratingsStats.setStatsId(statsId);
139            }
140    
141            /**
142            * Returns the fully qualified class name of this ratings stats.
143            *
144            * @return the fully qualified class name of this ratings stats
145            */
146            @Override
147            public java.lang.String getClassName() {
148                    return _ratingsStats.getClassName();
149            }
150    
151            @Override
152            public void setClassName(java.lang.String className) {
153                    _ratingsStats.setClassName(className);
154            }
155    
156            /**
157            * Returns the class name ID of this ratings stats.
158            *
159            * @return the class name ID of this ratings stats
160            */
161            @Override
162            public long getClassNameId() {
163                    return _ratingsStats.getClassNameId();
164            }
165    
166            /**
167            * Sets the class name ID of this ratings stats.
168            *
169            * @param classNameId the class name ID of this ratings stats
170            */
171            @Override
172            public void setClassNameId(long classNameId) {
173                    _ratingsStats.setClassNameId(classNameId);
174            }
175    
176            /**
177            * Returns the class p k of this ratings stats.
178            *
179            * @return the class p k of this ratings stats
180            */
181            @Override
182            public long getClassPK() {
183                    return _ratingsStats.getClassPK();
184            }
185    
186            /**
187            * Sets the class p k of this ratings stats.
188            *
189            * @param classPK the class p k of this ratings stats
190            */
191            @Override
192            public void setClassPK(long classPK) {
193                    _ratingsStats.setClassPK(classPK);
194            }
195    
196            /**
197            * Returns the total entries of this ratings stats.
198            *
199            * @return the total entries of this ratings stats
200            */
201            @Override
202            public int getTotalEntries() {
203                    return _ratingsStats.getTotalEntries();
204            }
205    
206            /**
207            * Sets the total entries of this ratings stats.
208            *
209            * @param totalEntries the total entries of this ratings stats
210            */
211            @Override
212            public void setTotalEntries(int totalEntries) {
213                    _ratingsStats.setTotalEntries(totalEntries);
214            }
215    
216            /**
217            * Returns the total score of this ratings stats.
218            *
219            * @return the total score of this ratings stats
220            */
221            @Override
222            public double getTotalScore() {
223                    return _ratingsStats.getTotalScore();
224            }
225    
226            /**
227            * Sets the total score of this ratings stats.
228            *
229            * @param totalScore the total score of this ratings stats
230            */
231            @Override
232            public void setTotalScore(double totalScore) {
233                    _ratingsStats.setTotalScore(totalScore);
234            }
235    
236            /**
237            * Returns the average score of this ratings stats.
238            *
239            * @return the average score of this ratings stats
240            */
241            @Override
242            public double getAverageScore() {
243                    return _ratingsStats.getAverageScore();
244            }
245    
246            /**
247            * Sets the average score of this ratings stats.
248            *
249            * @param averageScore the average score of this ratings stats
250            */
251            @Override
252            public void setAverageScore(double averageScore) {
253                    _ratingsStats.setAverageScore(averageScore);
254            }
255    
256            @Override
257            public boolean isNew() {
258                    return _ratingsStats.isNew();
259            }
260    
261            @Override
262            public void setNew(boolean n) {
263                    _ratingsStats.setNew(n);
264            }
265    
266            @Override
267            public boolean isCachedModel() {
268                    return _ratingsStats.isCachedModel();
269            }
270    
271            @Override
272            public void setCachedModel(boolean cachedModel) {
273                    _ratingsStats.setCachedModel(cachedModel);
274            }
275    
276            @Override
277            public boolean isEscapedModel() {
278                    return _ratingsStats.isEscapedModel();
279            }
280    
281            @Override
282            public java.io.Serializable getPrimaryKeyObj() {
283                    return _ratingsStats.getPrimaryKeyObj();
284            }
285    
286            @Override
287            public void setPrimaryKeyObj(java.io.Serializable primaryKeyObj) {
288                    _ratingsStats.setPrimaryKeyObj(primaryKeyObj);
289            }
290    
291            @Override
292            public com.liferay.portlet.expando.model.ExpandoBridge getExpandoBridge() {
293                    return _ratingsStats.getExpandoBridge();
294            }
295    
296            @Override
297            public void setExpandoBridgeAttributes(
298                    com.liferay.portal.model.BaseModel<?> baseModel) {
299                    _ratingsStats.setExpandoBridgeAttributes(baseModel);
300            }
301    
302            @Override
303            public void setExpandoBridgeAttributes(
304                    com.liferay.portlet.expando.model.ExpandoBridge expandoBridge) {
305                    _ratingsStats.setExpandoBridgeAttributes(expandoBridge);
306            }
307    
308            @Override
309            public void setExpandoBridgeAttributes(
310                    com.liferay.portal.service.ServiceContext serviceContext) {
311                    _ratingsStats.setExpandoBridgeAttributes(serviceContext);
312            }
313    
314            @Override
315            public java.lang.Object clone() {
316                    return new RatingsStatsWrapper((RatingsStats)_ratingsStats.clone());
317            }
318    
319            @Override
320            public int compareTo(
321                    com.liferay.portlet.ratings.model.RatingsStats ratingsStats) {
322                    return _ratingsStats.compareTo(ratingsStats);
323            }
324    
325            @Override
326            public int hashCode() {
327                    return _ratingsStats.hashCode();
328            }
329    
330            @Override
331            public com.liferay.portal.model.CacheModel<com.liferay.portlet.ratings.model.RatingsStats> toCacheModel() {
332                    return _ratingsStats.toCacheModel();
333            }
334    
335            @Override
336            public com.liferay.portlet.ratings.model.RatingsStats toEscapedModel() {
337                    return new RatingsStatsWrapper(_ratingsStats.toEscapedModel());
338            }
339    
340            @Override
341            public com.liferay.portlet.ratings.model.RatingsStats toUnescapedModel() {
342                    return new RatingsStatsWrapper(_ratingsStats.toUnescapedModel());
343            }
344    
345            @Override
346            public java.lang.String toString() {
347                    return _ratingsStats.toString();
348            }
349    
350            @Override
351            public java.lang.String toXmlString() {
352                    return _ratingsStats.toXmlString();
353            }
354    
355            @Override
356            public void persist()
357                    throws com.liferay.portal.kernel.exception.SystemException {
358                    _ratingsStats.persist();
359            }
360    
361            @Override
362            public boolean equals(Object obj) {
363                    if (this == obj) {
364                            return true;
365                    }
366    
367                    if (!(obj instanceof RatingsStatsWrapper)) {
368                            return false;
369                    }
370    
371                    RatingsStatsWrapper ratingsStatsWrapper = (RatingsStatsWrapper)obj;
372    
373                    if (Validator.equals(_ratingsStats, ratingsStatsWrapper._ratingsStats)) {
374                            return true;
375                    }
376    
377                    return false;
378            }
379    
380            /**
381             * @deprecated As of 6.1.0, replaced by {@link #getWrappedModel}
382             */
383            public RatingsStats getWrappedRatingsStats() {
384                    return _ratingsStats;
385            }
386    
387            @Override
388            public RatingsStats getWrappedModel() {
389                    return _ratingsStats;
390            }
391    
392            @Override
393            public void resetOriginalValues() {
394                    _ratingsStats.resetOriginalValues();
395            }
396    
397            private RatingsStats _ratingsStats;
398    }