1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.messageboards.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.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.expando.model.ExpandoBridge;
31  import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
32  import com.liferay.portlet.messageboards.model.MBMailingList;
33  import com.liferay.portlet.messageboards.model.MBMailingListSoap;
34  
35  import java.io.Serializable;
36  
37  import java.lang.reflect.Proxy;
38  
39  import java.sql.Types;
40  
41  import java.util.ArrayList;
42  import java.util.Date;
43  import java.util.List;
44  
45  /**
46   * <a href="MBMailingListModelImpl.java.html"><b><i>View Source</i></b></a>
47   *
48   * <p>
49   * ServiceBuilder generated this class. Modifications in this class will be
50   * overwritten the next time is generated.
51   * </p>
52   *
53   * <p>
54   * This class is a model that represents the <code>MBMailingList</code> table
55   * in the database.
56   * </p>
57   *
58   * @author Brian Wing Shun Chan
59   *
60   * @see com.liferay.portlet.messageboards.model.MBMailingList
61   * @see com.liferay.portlet.messageboards.model.MBMailingListModel
62   * @see com.liferay.portlet.messageboards.model.impl.MBMailingListImpl
63   *
64   */
65  public class MBMailingListModelImpl extends BaseModelImpl {
66      public static final String TABLE_NAME = "MBMailingList";
67      public static final Object[][] TABLE_COLUMNS = {
68              { "uuid_", new Integer(Types.VARCHAR) },
69              
70  
71              { "mailingListId", new Integer(Types.BIGINT) },
72              
73  
74              { "groupId", new Integer(Types.BIGINT) },
75              
76  
77              { "companyId", new Integer(Types.BIGINT) },
78              
79  
80              { "userId", new Integer(Types.BIGINT) },
81              
82  
83              { "userName", new Integer(Types.VARCHAR) },
84              
85  
86              { "createDate", new Integer(Types.TIMESTAMP) },
87              
88  
89              { "modifiedDate", new Integer(Types.TIMESTAMP) },
90              
91  
92              { "categoryId", new Integer(Types.BIGINT) },
93              
94  
95              { "emailAddress", new Integer(Types.VARCHAR) },
96              
97  
98              { "inProtocol", new Integer(Types.VARCHAR) },
99              
100 
101             { "inServerName", new Integer(Types.VARCHAR) },
102             
103 
104             { "inServerPort", new Integer(Types.INTEGER) },
105             
106 
107             { "inUseSSL", new Integer(Types.BOOLEAN) },
108             
109 
110             { "inUserName", new Integer(Types.VARCHAR) },
111             
112 
113             { "inPassword", new Integer(Types.VARCHAR) },
114             
115 
116             { "inReadInterval", new Integer(Types.INTEGER) },
117             
118 
119             { "outEmailAddress", new Integer(Types.VARCHAR) },
120             
121 
122             { "outCustom", new Integer(Types.BOOLEAN) },
123             
124 
125             { "outServerName", new Integer(Types.VARCHAR) },
126             
127 
128             { "outServerPort", new Integer(Types.INTEGER) },
129             
130 
131             { "outUseSSL", new Integer(Types.BOOLEAN) },
132             
133 
134             { "outUserName", new Integer(Types.VARCHAR) },
135             
136 
137             { "outPassword", new Integer(Types.VARCHAR) },
138             
139 
140             { "active_", new Integer(Types.BOOLEAN) }
141         };
142     public static final String TABLE_SQL_CREATE = "create table MBMailingList (uuid_ VARCHAR(75) null,mailingListId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,categoryId LONG,emailAddress VARCHAR(75) null,inProtocol VARCHAR(75) null,inServerName VARCHAR(75) null,inServerPort INTEGER,inUseSSL BOOLEAN,inUserName VARCHAR(75) null,inPassword VARCHAR(75) null,inReadInterval INTEGER,outEmailAddress VARCHAR(75) null,outCustom BOOLEAN,outServerName VARCHAR(75) null,outServerPort INTEGER,outUseSSL BOOLEAN,outUserName VARCHAR(75) null,outPassword VARCHAR(75) null,active_ BOOLEAN)";
143     public static final String TABLE_SQL_DROP = "drop table MBMailingList";
144     public static final String DATA_SOURCE = "liferayDataSource";
145     public static final String SESSION_FACTORY = "liferaySessionFactory";
146     public static final String TX_MANAGER = "liferayTransactionManager";
147     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
148                 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBMailingList"),
149             true);
150 
151     public static MBMailingList toModel(MBMailingListSoap soapModel) {
152         MBMailingList model = new MBMailingListImpl();
153 
154         model.setUuid(soapModel.getUuid());
155         model.setMailingListId(soapModel.getMailingListId());
156         model.setGroupId(soapModel.getGroupId());
157         model.setCompanyId(soapModel.getCompanyId());
158         model.setUserId(soapModel.getUserId());
159         model.setUserName(soapModel.getUserName());
160         model.setCreateDate(soapModel.getCreateDate());
161         model.setModifiedDate(soapModel.getModifiedDate());
162         model.setCategoryId(soapModel.getCategoryId());
163         model.setEmailAddress(soapModel.getEmailAddress());
164         model.setInProtocol(soapModel.getInProtocol());
165         model.setInServerName(soapModel.getInServerName());
166         model.setInServerPort(soapModel.getInServerPort());
167         model.setInUseSSL(soapModel.getInUseSSL());
168         model.setInUserName(soapModel.getInUserName());
169         model.setInPassword(soapModel.getInPassword());
170         model.setInReadInterval(soapModel.getInReadInterval());
171         model.setOutEmailAddress(soapModel.getOutEmailAddress());
172         model.setOutCustom(soapModel.getOutCustom());
173         model.setOutServerName(soapModel.getOutServerName());
174         model.setOutServerPort(soapModel.getOutServerPort());
175         model.setOutUseSSL(soapModel.getOutUseSSL());
176         model.setOutUserName(soapModel.getOutUserName());
177         model.setOutPassword(soapModel.getOutPassword());
178         model.setActive(soapModel.getActive());
179 
180         return model;
181     }
182 
183     public static List<MBMailingList> toModels(MBMailingListSoap[] soapModels) {
184         List<MBMailingList> models = new ArrayList<MBMailingList>(soapModels.length);
185 
186         for (MBMailingListSoap soapModel : soapModels) {
187             models.add(toModel(soapModel));
188         }
189 
190         return models;
191     }
192 
193     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
194                 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBMailingList"));
195 
196     public MBMailingListModelImpl() {
197     }
198 
199     public long getPrimaryKey() {
200         return _mailingListId;
201     }
202 
203     public void setPrimaryKey(long pk) {
204         setMailingListId(pk);
205     }
206 
207     public Serializable getPrimaryKeyObj() {
208         return new Long(_mailingListId);
209     }
210 
211     public String getUuid() {
212         return GetterUtil.getString(_uuid);
213     }
214 
215     public void setUuid(String uuid) {
216         if ((uuid != null) && (uuid != _uuid)) {
217             _uuid = uuid;
218         }
219     }
220 
221     public long getMailingListId() {
222         return _mailingListId;
223     }
224 
225     public void setMailingListId(long mailingListId) {
226         if (mailingListId != _mailingListId) {
227             _mailingListId = mailingListId;
228         }
229     }
230 
231     public long getGroupId() {
232         return _groupId;
233     }
234 
235     public void setGroupId(long groupId) {
236         if (groupId != _groupId) {
237             _groupId = groupId;
238         }
239     }
240 
241     public long getCompanyId() {
242         return _companyId;
243     }
244 
245     public void setCompanyId(long companyId) {
246         if (companyId != _companyId) {
247             _companyId = companyId;
248         }
249     }
250 
251     public long getUserId() {
252         return _userId;
253     }
254 
255     public void setUserId(long userId) {
256         if (userId != _userId) {
257             _userId = userId;
258         }
259     }
260 
261     public String getUserName() {
262         return GetterUtil.getString(_userName);
263     }
264 
265     public void setUserName(String userName) {
266         if (((userName == null) && (_userName != null)) ||
267                 ((userName != null) && (_userName == null)) ||
268                 ((userName != null) && (_userName != null) &&
269                 !userName.equals(_userName))) {
270             _userName = userName;
271         }
272     }
273 
274     public Date getCreateDate() {
275         return _createDate;
276     }
277 
278     public void setCreateDate(Date createDate) {
279         if (((createDate == null) && (_createDate != null)) ||
280                 ((createDate != null) && (_createDate == null)) ||
281                 ((createDate != null) && (_createDate != null) &&
282                 !createDate.equals(_createDate))) {
283             _createDate = createDate;
284         }
285     }
286 
287     public Date getModifiedDate() {
288         return _modifiedDate;
289     }
290 
291     public void setModifiedDate(Date modifiedDate) {
292         if (((modifiedDate == null) && (_modifiedDate != null)) ||
293                 ((modifiedDate != null) && (_modifiedDate == null)) ||
294                 ((modifiedDate != null) && (_modifiedDate != null) &&
295                 !modifiedDate.equals(_modifiedDate))) {
296             _modifiedDate = modifiedDate;
297         }
298     }
299 
300     public long getCategoryId() {
301         return _categoryId;
302     }
303 
304     public void setCategoryId(long categoryId) {
305         if (categoryId != _categoryId) {
306             _categoryId = categoryId;
307         }
308     }
309 
310     public String getEmailAddress() {
311         return GetterUtil.getString(_emailAddress);
312     }
313 
314     public void setEmailAddress(String emailAddress) {
315         if (((emailAddress == null) && (_emailAddress != null)) ||
316                 ((emailAddress != null) && (_emailAddress == null)) ||
317                 ((emailAddress != null) && (_emailAddress != null) &&
318                 !emailAddress.equals(_emailAddress))) {
319             _emailAddress = emailAddress;
320         }
321     }
322 
323     public String getInProtocol() {
324         return GetterUtil.getString(_inProtocol);
325     }
326 
327     public void setInProtocol(String inProtocol) {
328         if (((inProtocol == null) && (_inProtocol != null)) ||
329                 ((inProtocol != null) && (_inProtocol == null)) ||
330                 ((inProtocol != null) && (_inProtocol != null) &&
331                 !inProtocol.equals(_inProtocol))) {
332             _inProtocol = inProtocol;
333         }
334     }
335 
336     public String getInServerName() {
337         return GetterUtil.getString(_inServerName);
338     }
339 
340     public void setInServerName(String inServerName) {
341         if (((inServerName == null) && (_inServerName != null)) ||
342                 ((inServerName != null) && (_inServerName == null)) ||
343                 ((inServerName != null) && (_inServerName != null) &&
344                 !inServerName.equals(_inServerName))) {
345             _inServerName = inServerName;
346         }
347     }
348 
349     public int getInServerPort() {
350         return _inServerPort;
351     }
352 
353     public void setInServerPort(int inServerPort) {
354         if (inServerPort != _inServerPort) {
355             _inServerPort = inServerPort;
356         }
357     }
358 
359     public boolean getInUseSSL() {
360         return _inUseSSL;
361     }
362 
363     public boolean isInUseSSL() {
364         return _inUseSSL;
365     }
366 
367     public void setInUseSSL(boolean inUseSSL) {
368         if (inUseSSL != _inUseSSL) {
369             _inUseSSL = inUseSSL;
370         }
371     }
372 
373     public String getInUserName() {
374         return GetterUtil.getString(_inUserName);
375     }
376 
377     public void setInUserName(String inUserName) {
378         if (((inUserName == null) && (_inUserName != null)) ||
379                 ((inUserName != null) && (_inUserName == null)) ||
380                 ((inUserName != null) && (_inUserName != null) &&
381                 !inUserName.equals(_inUserName))) {
382             _inUserName = inUserName;
383         }
384     }
385 
386     public String getInPassword() {
387         return GetterUtil.getString(_inPassword);
388     }
389 
390     public void setInPassword(String inPassword) {
391         if (((inPassword == null) && (_inPassword != null)) ||
392                 ((inPassword != null) && (_inPassword == null)) ||
393                 ((inPassword != null) && (_inPassword != null) &&
394                 !inPassword.equals(_inPassword))) {
395             _inPassword = inPassword;
396         }
397     }
398 
399     public int getInReadInterval() {
400         return _inReadInterval;
401     }
402 
403     public void setInReadInterval(int inReadInterval) {
404         if (inReadInterval != _inReadInterval) {
405             _inReadInterval = inReadInterval;
406         }
407     }
408 
409     public String getOutEmailAddress() {
410         return GetterUtil.getString(_outEmailAddress);
411     }
412 
413     public void setOutEmailAddress(String outEmailAddress) {
414         if (((outEmailAddress == null) && (_outEmailAddress != null)) ||
415                 ((outEmailAddress != null) && (_outEmailAddress == null)) ||
416                 ((outEmailAddress != null) && (_outEmailAddress != null) &&
417                 !outEmailAddress.equals(_outEmailAddress))) {
418             _outEmailAddress = outEmailAddress;
419         }
420     }
421 
422     public boolean getOutCustom() {
423         return _outCustom;
424     }
425 
426     public boolean isOutCustom() {
427         return _outCustom;
428     }
429 
430     public void setOutCustom(boolean outCustom) {
431         if (outCustom != _outCustom) {
432             _outCustom = outCustom;
433         }
434     }
435 
436     public String getOutServerName() {
437         return GetterUtil.getString(_outServerName);
438     }
439 
440     public void setOutServerName(String outServerName) {
441         if (((outServerName == null) && (_outServerName != null)) ||
442                 ((outServerName != null) && (_outServerName == null)) ||
443                 ((outServerName != null) && (_outServerName != null) &&
444                 !outServerName.equals(_outServerName))) {
445             _outServerName = outServerName;
446         }
447     }
448 
449     public int getOutServerPort() {
450         return _outServerPort;
451     }
452 
453     public void setOutServerPort(int outServerPort) {
454         if (outServerPort != _outServerPort) {
455             _outServerPort = outServerPort;
456         }
457     }
458 
459     public boolean getOutUseSSL() {
460         return _outUseSSL;
461     }
462 
463     public boolean isOutUseSSL() {
464         return _outUseSSL;
465     }
466 
467     public void setOutUseSSL(boolean outUseSSL) {
468         if (outUseSSL != _outUseSSL) {
469             _outUseSSL = outUseSSL;
470         }
471     }
472 
473     public String getOutUserName() {
474         return GetterUtil.getString(_outUserName);
475     }
476 
477     public void setOutUserName(String outUserName) {
478         if (((outUserName == null) && (_outUserName != null)) ||
479                 ((outUserName != null) && (_outUserName == null)) ||
480                 ((outUserName != null) && (_outUserName != null) &&
481                 !outUserName.equals(_outUserName))) {
482             _outUserName = outUserName;
483         }
484     }
485 
486     public String getOutPassword() {
487         return GetterUtil.getString(_outPassword);
488     }
489 
490     public void setOutPassword(String outPassword) {
491         if (((outPassword == null) && (_outPassword != null)) ||
492                 ((outPassword != null) && (_outPassword == null)) ||
493                 ((outPassword != null) && (_outPassword != null) &&
494                 !outPassword.equals(_outPassword))) {
495             _outPassword = outPassword;
496         }
497     }
498 
499     public boolean getActive() {
500         return _active;
501     }
502 
503     public boolean isActive() {
504         return _active;
505     }
506 
507     public void setActive(boolean active) {
508         if (active != _active) {
509             _active = active;
510         }
511     }
512 
513     public MBMailingList toEscapedModel() {
514         if (isEscapedModel()) {
515             return (MBMailingList)this;
516         }
517         else {
518             MBMailingList model = new MBMailingListImpl();
519 
520             model.setNew(isNew());
521             model.setEscapedModel(true);
522 
523             model.setUuid(HtmlUtil.escape(getUuid()));
524             model.setMailingListId(getMailingListId());
525             model.setGroupId(getGroupId());
526             model.setCompanyId(getCompanyId());
527             model.setUserId(getUserId());
528             model.setUserName(HtmlUtil.escape(getUserName()));
529             model.setCreateDate(getCreateDate());
530             model.setModifiedDate(getModifiedDate());
531             model.setCategoryId(getCategoryId());
532             model.setEmailAddress(HtmlUtil.escape(getEmailAddress()));
533             model.setInProtocol(HtmlUtil.escape(getInProtocol()));
534             model.setInServerName(HtmlUtil.escape(getInServerName()));
535             model.setInServerPort(getInServerPort());
536             model.setInUseSSL(getInUseSSL());
537             model.setInUserName(HtmlUtil.escape(getInUserName()));
538             model.setInPassword(HtmlUtil.escape(getInPassword()));
539             model.setInReadInterval(getInReadInterval());
540             model.setOutEmailAddress(HtmlUtil.escape(getOutEmailAddress()));
541             model.setOutCustom(getOutCustom());
542             model.setOutServerName(HtmlUtil.escape(getOutServerName()));
543             model.setOutServerPort(getOutServerPort());
544             model.setOutUseSSL(getOutUseSSL());
545             model.setOutUserName(HtmlUtil.escape(getOutUserName()));
546             model.setOutPassword(HtmlUtil.escape(getOutPassword()));
547             model.setActive(getActive());
548 
549             model = (MBMailingList)Proxy.newProxyInstance(MBMailingList.class.getClassLoader(),
550                     new Class[] { MBMailingList.class },
551                     new ReadOnlyBeanHandler(model));
552 
553             return model;
554         }
555     }
556 
557     public ExpandoBridge getExpandoBridge() {
558         if (_expandoBridge == null) {
559             _expandoBridge = new ExpandoBridgeImpl(MBMailingList.class.getName(),
560                     getPrimaryKey());
561         }
562 
563         return _expandoBridge;
564     }
565 
566     public Object clone() {
567         MBMailingListImpl clone = new MBMailingListImpl();
568 
569         clone.setUuid(getUuid());
570         clone.setMailingListId(getMailingListId());
571         clone.setGroupId(getGroupId());
572         clone.setCompanyId(getCompanyId());
573         clone.setUserId(getUserId());
574         clone.setUserName(getUserName());
575         clone.setCreateDate(getCreateDate());
576         clone.setModifiedDate(getModifiedDate());
577         clone.setCategoryId(getCategoryId());
578         clone.setEmailAddress(getEmailAddress());
579         clone.setInProtocol(getInProtocol());
580         clone.setInServerName(getInServerName());
581         clone.setInServerPort(getInServerPort());
582         clone.setInUseSSL(getInUseSSL());
583         clone.setInUserName(getInUserName());
584         clone.setInPassword(getInPassword());
585         clone.setInReadInterval(getInReadInterval());
586         clone.setOutEmailAddress(getOutEmailAddress());
587         clone.setOutCustom(getOutCustom());
588         clone.setOutServerName(getOutServerName());
589         clone.setOutServerPort(getOutServerPort());
590         clone.setOutUseSSL(getOutUseSSL());
591         clone.setOutUserName(getOutUserName());
592         clone.setOutPassword(getOutPassword());
593         clone.setActive(getActive());
594 
595         return clone;
596     }
597 
598     public int compareTo(Object obj) {
599         if (obj == null) {
600             return -1;
601         }
602 
603         MBMailingListImpl mbMailingList = (MBMailingListImpl)obj;
604 
605         long pk = mbMailingList.getPrimaryKey();
606 
607         if (getPrimaryKey() < pk) {
608             return -1;
609         }
610         else if (getPrimaryKey() > pk) {
611             return 1;
612         }
613         else {
614             return 0;
615         }
616     }
617 
618     public boolean equals(Object obj) {
619         if (obj == null) {
620             return false;
621         }
622 
623         MBMailingListImpl mbMailingList = null;
624 
625         try {
626             mbMailingList = (MBMailingListImpl)obj;
627         }
628         catch (ClassCastException cce) {
629             return false;
630         }
631 
632         long pk = mbMailingList.getPrimaryKey();
633 
634         if (getPrimaryKey() == pk) {
635             return true;
636         }
637         else {
638             return false;
639         }
640     }
641 
642     public int hashCode() {
643         return (int)getPrimaryKey();
644     }
645 
646     private String _uuid;
647     private long _mailingListId;
648     private long _groupId;
649     private long _companyId;
650     private long _userId;
651     private String _userName;
652     private Date _createDate;
653     private Date _modifiedDate;
654     private long _categoryId;
655     private String _emailAddress;
656     private String _inProtocol;
657     private String _inServerName;
658     private int _inServerPort;
659     private boolean _inUseSSL;
660     private String _inUserName;
661     private String _inPassword;
662     private int _inReadInterval;
663     private String _outEmailAddress;
664     private boolean _outCustom;
665     private String _outServerName;
666     private int _outServerPort;
667     private boolean _outUseSSL;
668     private String _outUserName;
669     private String _outPassword;
670     private boolean _active;
671     private transient ExpandoBridge _expandoBridge;
672 }