1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.Subscription;
29 import com.liferay.portal.model.SubscriptionSoap;
30 import com.liferay.portal.util.PortalUtil;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.ArrayList;
39 import java.util.Date;
40 import java.util.List;
41
42
62 public class SubscriptionModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "Subscription";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "subscriptionId", new Integer(Types.BIGINT) },
66
67
68 { "companyId", new Integer(Types.BIGINT) },
69
70
71 { "userId", new Integer(Types.BIGINT) },
72
73
74 { "userName", new Integer(Types.VARCHAR) },
75
76
77 { "createDate", new Integer(Types.TIMESTAMP) },
78
79
80 { "modifiedDate", new Integer(Types.TIMESTAMP) },
81
82
83 { "classNameId", new Integer(Types.BIGINT) },
84
85
86 { "classPK", new Integer(Types.BIGINT) },
87
88
89 { "frequency", new Integer(Types.VARCHAR) }
90 };
91 public static final String TABLE_SQL_CREATE = "create table Subscription (subscriptionId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,frequency VARCHAR(75) null)";
92 public static final String TABLE_SQL_DROP = "drop table Subscription";
93 public static final String DATA_SOURCE = "liferayDataSource";
94 public static final String SESSION_FACTORY = "liferaySessionFactory";
95 public static final String TX_MANAGER = "liferayTransactionManager";
96 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
97 "value.object.finder.cache.enabled.com.liferay.portal.model.Subscription"),
98 true);
99
100 public static Subscription toModel(SubscriptionSoap soapModel) {
101 Subscription model = new SubscriptionImpl();
102
103 model.setSubscriptionId(soapModel.getSubscriptionId());
104 model.setCompanyId(soapModel.getCompanyId());
105 model.setUserId(soapModel.getUserId());
106 model.setUserName(soapModel.getUserName());
107 model.setCreateDate(soapModel.getCreateDate());
108 model.setModifiedDate(soapModel.getModifiedDate());
109 model.setClassNameId(soapModel.getClassNameId());
110 model.setClassPK(soapModel.getClassPK());
111 model.setFrequency(soapModel.getFrequency());
112
113 return model;
114 }
115
116 public static List<Subscription> toModels(SubscriptionSoap[] soapModels) {
117 List<Subscription> models = new ArrayList<Subscription>(soapModels.length);
118
119 for (SubscriptionSoap soapModel : soapModels) {
120 models.add(toModel(soapModel));
121 }
122
123 return models;
124 }
125
126 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
127 "lock.expiration.time.com.liferay.portal.model.Subscription"));
128
129 public SubscriptionModelImpl() {
130 }
131
132 public long getPrimaryKey() {
133 return _subscriptionId;
134 }
135
136 public void setPrimaryKey(long pk) {
137 setSubscriptionId(pk);
138 }
139
140 public Serializable getPrimaryKeyObj() {
141 return new Long(_subscriptionId);
142 }
143
144 public long getSubscriptionId() {
145 return _subscriptionId;
146 }
147
148 public void setSubscriptionId(long subscriptionId) {
149 if (subscriptionId != _subscriptionId) {
150 _subscriptionId = subscriptionId;
151 }
152 }
153
154 public long getCompanyId() {
155 return _companyId;
156 }
157
158 public void setCompanyId(long companyId) {
159 if (companyId != _companyId) {
160 _companyId = companyId;
161 }
162 }
163
164 public long getUserId() {
165 return _userId;
166 }
167
168 public void setUserId(long userId) {
169 if (userId != _userId) {
170 _userId = userId;
171 }
172 }
173
174 public String getUserName() {
175 return GetterUtil.getString(_userName);
176 }
177
178 public void setUserName(String userName) {
179 if (((userName == null) && (_userName != null)) ||
180 ((userName != null) && (_userName == null)) ||
181 ((userName != null) && (_userName != null) &&
182 !userName.equals(_userName))) {
183 _userName = userName;
184 }
185 }
186
187 public Date getCreateDate() {
188 return _createDate;
189 }
190
191 public void setCreateDate(Date createDate) {
192 if (((createDate == null) && (_createDate != null)) ||
193 ((createDate != null) && (_createDate == null)) ||
194 ((createDate != null) && (_createDate != null) &&
195 !createDate.equals(_createDate))) {
196 _createDate = createDate;
197 }
198 }
199
200 public Date getModifiedDate() {
201 return _modifiedDate;
202 }
203
204 public void setModifiedDate(Date modifiedDate) {
205 if (((modifiedDate == null) && (_modifiedDate != null)) ||
206 ((modifiedDate != null) && (_modifiedDate == null)) ||
207 ((modifiedDate != null) && (_modifiedDate != null) &&
208 !modifiedDate.equals(_modifiedDate))) {
209 _modifiedDate = modifiedDate;
210 }
211 }
212
213 public String getClassName() {
214 return PortalUtil.getClassName(getClassNameId());
215 }
216
217 public long getClassNameId() {
218 return _classNameId;
219 }
220
221 public void setClassNameId(long classNameId) {
222 if (classNameId != _classNameId) {
223 _classNameId = classNameId;
224 }
225 }
226
227 public long getClassPK() {
228 return _classPK;
229 }
230
231 public void setClassPK(long classPK) {
232 if (classPK != _classPK) {
233 _classPK = classPK;
234 }
235 }
236
237 public String getFrequency() {
238 return GetterUtil.getString(_frequency);
239 }
240
241 public void setFrequency(String frequency) {
242 if (((frequency == null) && (_frequency != null)) ||
243 ((frequency != null) && (_frequency == null)) ||
244 ((frequency != null) && (_frequency != null) &&
245 !frequency.equals(_frequency))) {
246 _frequency = frequency;
247 }
248 }
249
250 public Subscription toEscapedModel() {
251 if (isEscapedModel()) {
252 return (Subscription)this;
253 }
254 else {
255 Subscription model = new SubscriptionImpl();
256
257 model.setEscapedModel(true);
258
259 model.setSubscriptionId(getSubscriptionId());
260 model.setCompanyId(getCompanyId());
261 model.setUserId(getUserId());
262 model.setUserName(HtmlUtil.escape(getUserName()));
263 model.setCreateDate(getCreateDate());
264 model.setModifiedDate(getModifiedDate());
265 model.setClassNameId(getClassNameId());
266 model.setClassPK(getClassPK());
267 model.setFrequency(HtmlUtil.escape(getFrequency()));
268
269 model = (Subscription)Proxy.newProxyInstance(Subscription.class.getClassLoader(),
270 new Class[] { Subscription.class },
271 new ReadOnlyBeanHandler(model));
272
273 return model;
274 }
275 }
276
277 public Object clone() {
278 SubscriptionImpl clone = new SubscriptionImpl();
279
280 clone.setSubscriptionId(getSubscriptionId());
281 clone.setCompanyId(getCompanyId());
282 clone.setUserId(getUserId());
283 clone.setUserName(getUserName());
284 clone.setCreateDate(getCreateDate());
285 clone.setModifiedDate(getModifiedDate());
286 clone.setClassNameId(getClassNameId());
287 clone.setClassPK(getClassPK());
288 clone.setFrequency(getFrequency());
289
290 return clone;
291 }
292
293 public int compareTo(Object obj) {
294 if (obj == null) {
295 return -1;
296 }
297
298 SubscriptionImpl subscription = (SubscriptionImpl)obj;
299
300 long pk = subscription.getPrimaryKey();
301
302 if (getPrimaryKey() < pk) {
303 return -1;
304 }
305 else if (getPrimaryKey() > pk) {
306 return 1;
307 }
308 else {
309 return 0;
310 }
311 }
312
313 public boolean equals(Object obj) {
314 if (obj == null) {
315 return false;
316 }
317
318 SubscriptionImpl subscription = null;
319
320 try {
321 subscription = (SubscriptionImpl)obj;
322 }
323 catch (ClassCastException cce) {
324 return false;
325 }
326
327 long pk = subscription.getPrimaryKey();
328
329 if (getPrimaryKey() == pk) {
330 return true;
331 }
332 else {
333 return false;
334 }
335 }
336
337 public int hashCode() {
338 return (int)getPrimaryKey();
339 }
340
341 private long _subscriptionId;
342 private long _companyId;
343 private long _userId;
344 private String _userName;
345 private Date _createDate;
346 private Date _modifiedDate;
347 private long _classNameId;
348 private long _classPK;
349 private String _frequency;
350 }