1
22
23 package com.liferay.portlet.ratings.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.ratings.model.RatingsStats;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38
58 public class RatingsStatsModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "RatingsStats";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "statsId", new Integer(Types.BIGINT) },
62
63
64 { "classNameId", new Integer(Types.BIGINT) },
65
66
67 { "classPK", new Integer(Types.BIGINT) },
68
69
70 { "totalEntries", new Integer(Types.INTEGER) },
71
72
73 { "totalScore", new Integer(Types.DOUBLE) },
74
75
76 { "averageScore", new Integer(Types.DOUBLE) }
77 };
78 public static final String TABLE_SQL_CREATE = "create table RatingsStats (statsId LONG not null primary key,classNameId LONG,classPK LONG,totalEntries INTEGER,totalScore DOUBLE,averageScore DOUBLE)";
79 public static final String TABLE_SQL_DROP = "drop table RatingsStats";
80 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
81 "value.object.finder.cache.enabled.com.liferay.portlet.ratings.model.RatingsStats"),
82 true);
83 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
84 "lock.expiration.time.com.liferay.portlet.ratings.model.RatingsStats"));
85
86 public RatingsStatsModelImpl() {
87 }
88
89 public long getPrimaryKey() {
90 return _statsId;
91 }
92
93 public void setPrimaryKey(long pk) {
94 setStatsId(pk);
95 }
96
97 public Serializable getPrimaryKeyObj() {
98 return new Long(_statsId);
99 }
100
101 public long getStatsId() {
102 return _statsId;
103 }
104
105 public void setStatsId(long statsId) {
106 if (statsId != _statsId) {
107 _statsId = statsId;
108 }
109 }
110
111 public long getClassNameId() {
112 return _classNameId;
113 }
114
115 public void setClassNameId(long classNameId) {
116 if (classNameId != _classNameId) {
117 _classNameId = classNameId;
118 }
119 }
120
121 public long getClassPK() {
122 return _classPK;
123 }
124
125 public void setClassPK(long classPK) {
126 if (classPK != _classPK) {
127 _classPK = classPK;
128 }
129 }
130
131 public int getTotalEntries() {
132 return _totalEntries;
133 }
134
135 public void setTotalEntries(int totalEntries) {
136 if (totalEntries != _totalEntries) {
137 _totalEntries = totalEntries;
138 }
139 }
140
141 public double getTotalScore() {
142 return _totalScore;
143 }
144
145 public void setTotalScore(double totalScore) {
146 if (totalScore != _totalScore) {
147 _totalScore = totalScore;
148 }
149 }
150
151 public double getAverageScore() {
152 return _averageScore;
153 }
154
155 public void setAverageScore(double averageScore) {
156 if (averageScore != _averageScore) {
157 _averageScore = averageScore;
158 }
159 }
160
161 public RatingsStats toEscapedModel() {
162 if (isEscapedModel()) {
163 return (RatingsStats)this;
164 }
165 else {
166 RatingsStats model = new RatingsStatsImpl();
167
168 model.setEscapedModel(true);
169
170 model.setStatsId(getStatsId());
171 model.setClassNameId(getClassNameId());
172 model.setClassPK(getClassPK());
173 model.setTotalEntries(getTotalEntries());
174 model.setTotalScore(getTotalScore());
175 model.setAverageScore(getAverageScore());
176
177 model = (RatingsStats)Proxy.newProxyInstance(RatingsStats.class.getClassLoader(),
178 new Class[] { RatingsStats.class },
179 new ReadOnlyBeanHandler(model));
180
181 return model;
182 }
183 }
184
185 public Object clone() {
186 RatingsStatsImpl clone = new RatingsStatsImpl();
187
188 clone.setStatsId(getStatsId());
189 clone.setClassNameId(getClassNameId());
190 clone.setClassPK(getClassPK());
191 clone.setTotalEntries(getTotalEntries());
192 clone.setTotalScore(getTotalScore());
193 clone.setAverageScore(getAverageScore());
194
195 return clone;
196 }
197
198 public int compareTo(Object obj) {
199 if (obj == null) {
200 return -1;
201 }
202
203 RatingsStatsImpl ratingsStats = (RatingsStatsImpl)obj;
204
205 long pk = ratingsStats.getPrimaryKey();
206
207 if (getPrimaryKey() < pk) {
208 return -1;
209 }
210 else if (getPrimaryKey() > pk) {
211 return 1;
212 }
213 else {
214 return 0;
215 }
216 }
217
218 public boolean equals(Object obj) {
219 if (obj == null) {
220 return false;
221 }
222
223 RatingsStatsImpl ratingsStats = null;
224
225 try {
226 ratingsStats = (RatingsStatsImpl)obj;
227 }
228 catch (ClassCastException cce) {
229 return false;
230 }
231
232 long pk = ratingsStats.getPrimaryKey();
233
234 if (getPrimaryKey() == pk) {
235 return true;
236 }
237 else {
238 return false;
239 }
240 }
241
242 public int hashCode() {
243 return (int)getPrimaryKey();
244 }
245
246 private long _statsId;
247 private long _classNameId;
248 private long _classPK;
249 private int _totalEntries;
250 private double _totalScore;
251 private double _averageScore;
252 }