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