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