1
22
23 package com.liferay.portlet.announcements.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29
30 import com.liferay.portlet.announcements.model.AnnouncementsFlag;
31 import com.liferay.portlet.announcements.model.AnnouncementsFlagSoap;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42
43
63 public class AnnouncementsFlagModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "AnnouncementsFlag";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "flagId", new Integer(Types.BIGINT) },
67
68
69 { "userId", new Integer(Types.BIGINT) },
70
71
72 { "createDate", new Integer(Types.TIMESTAMP) },
73
74
75 { "entryId", new Integer(Types.BIGINT) },
76
77
78 { "value", new Integer(Types.INTEGER) }
79 };
80 public static final String TABLE_SQL_CREATE = "create table AnnouncementsFlag (flagId LONG not null primary key,userId LONG,createDate DATE null,entryId LONG,value INTEGER)";
81 public static final String TABLE_SQL_DROP = "drop table AnnouncementsFlag";
82 public static final String DATA_SOURCE = "liferayDataSource";
83 public static final String SESSION_FACTORY = "liferaySessionFactory";
84 public static final String TX_MANAGER = "liferayTransactionManager";
85 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86 "value.object.finder.cache.enabled.com.liferay.portlet.announcements.model.AnnouncementsFlag"),
87 true);
88
89 public static AnnouncementsFlag toModel(AnnouncementsFlagSoap soapModel) {
90 AnnouncementsFlag model = new AnnouncementsFlagImpl();
91
92 model.setFlagId(soapModel.getFlagId());
93 model.setUserId(soapModel.getUserId());
94 model.setCreateDate(soapModel.getCreateDate());
95 model.setEntryId(soapModel.getEntryId());
96 model.setValue(soapModel.getValue());
97
98 return model;
99 }
100
101 public static List<AnnouncementsFlag> toModels(
102 AnnouncementsFlagSoap[] soapModels) {
103 List<AnnouncementsFlag> models = new ArrayList<AnnouncementsFlag>(soapModels.length);
104
105 for (AnnouncementsFlagSoap soapModel : soapModels) {
106 models.add(toModel(soapModel));
107 }
108
109 return models;
110 }
111
112 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
113 "lock.expiration.time.com.liferay.portlet.announcements.model.AnnouncementsFlag"));
114
115 public AnnouncementsFlagModelImpl() {
116 }
117
118 public long getPrimaryKey() {
119 return _flagId;
120 }
121
122 public void setPrimaryKey(long pk) {
123 setFlagId(pk);
124 }
125
126 public Serializable getPrimaryKeyObj() {
127 return new Long(_flagId);
128 }
129
130 public long getFlagId() {
131 return _flagId;
132 }
133
134 public void setFlagId(long flagId) {
135 if (flagId != _flagId) {
136 _flagId = flagId;
137 }
138 }
139
140 public long getUserId() {
141 return _userId;
142 }
143
144 public void setUserId(long userId) {
145 if (userId != _userId) {
146 _userId = userId;
147 }
148 }
149
150 public Date getCreateDate() {
151 return _createDate;
152 }
153
154 public void setCreateDate(Date createDate) {
155 if (((createDate == null) && (_createDate != null)) ||
156 ((createDate != null) && (_createDate == null)) ||
157 ((createDate != null) && (_createDate != null) &&
158 !createDate.equals(_createDate))) {
159 _createDate = createDate;
160 }
161 }
162
163 public long getEntryId() {
164 return _entryId;
165 }
166
167 public void setEntryId(long entryId) {
168 if (entryId != _entryId) {
169 _entryId = entryId;
170 }
171 }
172
173 public int getValue() {
174 return _value;
175 }
176
177 public void setValue(int value) {
178 if (value != _value) {
179 _value = value;
180 }
181 }
182
183 public AnnouncementsFlag toEscapedModel() {
184 if (isEscapedModel()) {
185 return (AnnouncementsFlag)this;
186 }
187 else {
188 AnnouncementsFlag model = new AnnouncementsFlagImpl();
189
190 model.setEscapedModel(true);
191
192 model.setFlagId(getFlagId());
193 model.setUserId(getUserId());
194 model.setCreateDate(getCreateDate());
195 model.setEntryId(getEntryId());
196 model.setValue(getValue());
197
198 model = (AnnouncementsFlag)Proxy.newProxyInstance(AnnouncementsFlag.class.getClassLoader(),
199 new Class[] { AnnouncementsFlag.class },
200 new ReadOnlyBeanHandler(model));
201
202 return model;
203 }
204 }
205
206 public Object clone() {
207 AnnouncementsFlagImpl clone = new AnnouncementsFlagImpl();
208
209 clone.setFlagId(getFlagId());
210 clone.setUserId(getUserId());
211 clone.setCreateDate(getCreateDate());
212 clone.setEntryId(getEntryId());
213 clone.setValue(getValue());
214
215 return clone;
216 }
217
218 public int compareTo(Object obj) {
219 if (obj == null) {
220 return -1;
221 }
222
223 AnnouncementsFlagImpl announcementsFlag = (AnnouncementsFlagImpl)obj;
224
225 int value = 0;
226
227 if (getUserId() < announcementsFlag.getUserId()) {
228 value = -1;
229 }
230 else if (getUserId() > announcementsFlag.getUserId()) {
231 value = 1;
232 }
233 else {
234 value = 0;
235 }
236
237 if (value != 0) {
238 return value;
239 }
240
241 value = DateUtil.compareTo(getCreateDate(),
242 announcementsFlag.getCreateDate());
243
244 if (value != 0) {
245 return value;
246 }
247
248 return 0;
249 }
250
251 public boolean equals(Object obj) {
252 if (obj == null) {
253 return false;
254 }
255
256 AnnouncementsFlagImpl announcementsFlag = null;
257
258 try {
259 announcementsFlag = (AnnouncementsFlagImpl)obj;
260 }
261 catch (ClassCastException cce) {
262 return false;
263 }
264
265 long pk = announcementsFlag.getPrimaryKey();
266
267 if (getPrimaryKey() == pk) {
268 return true;
269 }
270 else {
271 return false;
272 }
273 }
274
275 public int hashCode() {
276 return (int)getPrimaryKey();
277 }
278
279 private long _flagId;
280 private long _userId;
281 private Date _createDate;
282 private long _entryId;
283 private int _value;
284 }