1
22
23 package com.liferay.portlet.ratings.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import java.io.Serializable;
30
31 import java.sql.Types;
32
33
53 public class RatingsStatsModelImpl extends BaseModelImpl {
54 public static String TABLE_NAME = "RatingsStats";
55 public static Object[][] TABLE_COLUMNS = {
56 { "statsId", new Integer(Types.BIGINT) },
57 { "classNameId", new Integer(Types.BIGINT) },
58 { "classPK", new Integer(Types.BIGINT) },
59 { "totalEntries", new Integer(Types.INTEGER) },
60 { "totalScore", new Integer(Types.DOUBLE) },
61 { "averageScore", new Integer(Types.DOUBLE) }
62 };
63 public static String TABLE_SQL_CREATE = "create table RatingsStats (statsId LONG not null primary key,classNameId LONG,classPK LONG,totalEntries INTEGER,totalScore DOUBLE,averageScore DOUBLE)";
64 public static String TABLE_SQL_DROP = "drop table RatingsStats";
65 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
66 "xss.allow.com.liferay.portlet.ratings.model.RatingsStats"),
67 XSS_ALLOW);
68 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
69 "lock.expiration.time.com.liferay.portlet.ratings.model.RatingsStatsModel"));
70
71 public RatingsStatsModelImpl() {
72 }
73
74 public long getPrimaryKey() {
75 return _statsId;
76 }
77
78 public void setPrimaryKey(long pk) {
79 setStatsId(pk);
80 }
81
82 public Serializable getPrimaryKeyObj() {
83 return new Long(_statsId);
84 }
85
86 public long getStatsId() {
87 return _statsId;
88 }
89
90 public void setStatsId(long statsId) {
91 if (statsId != _statsId) {
92 _statsId = statsId;
93 }
94 }
95
96 public long getClassNameId() {
97 return _classNameId;
98 }
99
100 public void setClassNameId(long classNameId) {
101 if (classNameId != _classNameId) {
102 _classNameId = classNameId;
103 }
104 }
105
106 public long getClassPK() {
107 return _classPK;
108 }
109
110 public void setClassPK(long classPK) {
111 if (classPK != _classPK) {
112 _classPK = classPK;
113 }
114 }
115
116 public int getTotalEntries() {
117 return _totalEntries;
118 }
119
120 public void setTotalEntries(int totalEntries) {
121 if (totalEntries != _totalEntries) {
122 _totalEntries = totalEntries;
123 }
124 }
125
126 public double getTotalScore() {
127 return _totalScore;
128 }
129
130 public void setTotalScore(double totalScore) {
131 if (totalScore != _totalScore) {
132 _totalScore = totalScore;
133 }
134 }
135
136 public double getAverageScore() {
137 return _averageScore;
138 }
139
140 public void setAverageScore(double averageScore) {
141 if (averageScore != _averageScore) {
142 _averageScore = averageScore;
143 }
144 }
145
146 public Object clone() {
147 RatingsStatsImpl clone = new RatingsStatsImpl();
148 clone.setStatsId(getStatsId());
149 clone.setClassNameId(getClassNameId());
150 clone.setClassPK(getClassPK());
151 clone.setTotalEntries(getTotalEntries());
152 clone.setTotalScore(getTotalScore());
153 clone.setAverageScore(getAverageScore());
154
155 return clone;
156 }
157
158 public int compareTo(Object obj) {
159 if (obj == null) {
160 return -1;
161 }
162
163 RatingsStatsImpl ratingsStats = (RatingsStatsImpl)obj;
164 long pk = ratingsStats.getPrimaryKey();
165
166 if (getPrimaryKey() < pk) {
167 return -1;
168 }
169 else if (getPrimaryKey() > pk) {
170 return 1;
171 }
172 else {
173 return 0;
174 }
175 }
176
177 public boolean equals(Object obj) {
178 if (obj == null) {
179 return false;
180 }
181
182 RatingsStatsImpl ratingsStats = null;
183
184 try {
185 ratingsStats = (RatingsStatsImpl)obj;
186 }
187 catch (ClassCastException cce) {
188 return false;
189 }
190
191 long pk = ratingsStats.getPrimaryKey();
192
193 if (getPrimaryKey() == pk) {
194 return true;
195 }
196 else {
197 return false;
198 }
199 }
200
201 public int hashCode() {
202 return (int)getPrimaryKey();
203 }
204
205 private long _statsId;
206 private long _classNameId;
207 private long _classPK;
208 private int _totalEntries;
209 private double _totalScore;
210 private double _averageScore;
211 }