1
22
23 package com.liferay.portlet.messageboards.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 import java.util.Date;
34
35
55 public class MBStatsUserModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "MBStatsUser";
57 public static Object[][] TABLE_COLUMNS = {
58 { "statsUserId", new Integer(Types.BIGINT) },
59 { "groupId", new Integer(Types.BIGINT) },
60 { "userId", new Integer(Types.BIGINT) },
61 { "messageCount", new Integer(Types.INTEGER) },
62 { "lastPostDate", new Integer(Types.TIMESTAMP) }
63 };
64 public static String TABLE_SQL_CREATE = "create table MBStatsUser (statsUserId LONG not null primary key,groupId LONG,userId LONG,messageCount INTEGER,lastPostDate DATE null)";
65 public static String TABLE_SQL_DROP = "drop table MBStatsUser";
66 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
67 "xss.allow.com.liferay.portlet.messageboards.model.MBStatsUser"),
68 XSS_ALLOW);
69 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
70 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBStatsUserModel"));
71
72 public MBStatsUserModelImpl() {
73 }
74
75 public long getPrimaryKey() {
76 return _statsUserId;
77 }
78
79 public void setPrimaryKey(long pk) {
80 setStatsUserId(pk);
81 }
82
83 public Serializable getPrimaryKeyObj() {
84 return new Long(_statsUserId);
85 }
86
87 public long getStatsUserId() {
88 return _statsUserId;
89 }
90
91 public void setStatsUserId(long statsUserId) {
92 if (statsUserId != _statsUserId) {
93 _statsUserId = statsUserId;
94 }
95 }
96
97 public long getGroupId() {
98 return _groupId;
99 }
100
101 public void setGroupId(long groupId) {
102 if (groupId != _groupId) {
103 _groupId = groupId;
104 }
105 }
106
107 public long getUserId() {
108 return _userId;
109 }
110
111 public void setUserId(long userId) {
112 if (userId != _userId) {
113 _userId = userId;
114 }
115 }
116
117 public int getMessageCount() {
118 return _messageCount;
119 }
120
121 public void setMessageCount(int messageCount) {
122 if (messageCount != _messageCount) {
123 _messageCount = messageCount;
124 }
125 }
126
127 public Date getLastPostDate() {
128 return _lastPostDate;
129 }
130
131 public void setLastPostDate(Date lastPostDate) {
132 if (((lastPostDate == null) && (_lastPostDate != null)) ||
133 ((lastPostDate != null) && (_lastPostDate == null)) ||
134 ((lastPostDate != null) && (_lastPostDate != null) &&
135 !lastPostDate.equals(_lastPostDate))) {
136 _lastPostDate = lastPostDate;
137 }
138 }
139
140 public Object clone() {
141 MBStatsUserImpl clone = new MBStatsUserImpl();
142 clone.setStatsUserId(getStatsUserId());
143 clone.setGroupId(getGroupId());
144 clone.setUserId(getUserId());
145 clone.setMessageCount(getMessageCount());
146 clone.setLastPostDate(getLastPostDate());
147
148 return clone;
149 }
150
151 public int compareTo(Object obj) {
152 if (obj == null) {
153 return -1;
154 }
155
156 MBStatsUserImpl mbStatsUser = (MBStatsUserImpl)obj;
157 int value = 0;
158
159 if (getMessageCount() < mbStatsUser.getMessageCount()) {
160 value = -1;
161 }
162 else if (getMessageCount() > mbStatsUser.getMessageCount()) {
163 value = 1;
164 }
165 else {
166 value = 0;
167 }
168
169 value = value * -1;
170
171 if (value != 0) {
172 return value;
173 }
174
175 return 0;
176 }
177
178 public boolean equals(Object obj) {
179 if (obj == null) {
180 return false;
181 }
182
183 MBStatsUserImpl mbStatsUser = null;
184
185 try {
186 mbStatsUser = (MBStatsUserImpl)obj;
187 }
188 catch (ClassCastException cce) {
189 return false;
190 }
191
192 long pk = mbStatsUser.getPrimaryKey();
193
194 if (getPrimaryKey() == pk) {
195 return true;
196 }
197 else {
198 return false;
199 }
200 }
201
202 public int hashCode() {
203 return (int)getPrimaryKey();
204 }
205
206 private long _statsUserId;
207 private long _groupId;
208 private long _userId;
209 private int _messageCount;
210 private Date _lastPostDate;
211 }