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