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