1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import java.io.Serializable;
30  
31  import java.sql.Types;
32  
33  /**
34   * <a href="MBDiscussionModelImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be overwritten
38   * the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This class is a model that represents the <code>MBDiscussion</code> table in
43   * the database.
44   * </p>
45   *
46   * @author Brian Wing Shun Chan
47   *
48   * @see com.liferay.portlet.messageboards.service.model.MBDiscussion
49   * @see com.liferay.portlet.messageboards.service.model.MBDiscussionModel
50   * @see com.liferay.portlet.messageboards.service.model.impl.MBDiscussionImpl
51   *
52   */
53  public class MBDiscussionModelImpl extends BaseModelImpl {
54      public static String TABLE_NAME = "MBDiscussion";
55      public static Object[][] TABLE_COLUMNS = {
56              { "discussionId", new Integer(Types.BIGINT) },
57              { "classNameId", new Integer(Types.BIGINT) },
58              { "classPK", new Integer(Types.BIGINT) },
59              { "threadId", new Integer(Types.BIGINT) }
60          };
61      public static String TABLE_SQL_CREATE = "create table MBDiscussion (discussionId LONG not null primary key,classNameId LONG,classPK LONG,threadId LONG)";
62      public static String TABLE_SQL_DROP = "drop table MBDiscussion";
63      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
64                  "xss.allow.com.liferay.portlet.messageboards.model.MBDiscussion"),
65              XSS_ALLOW);
66      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
67                  "lock.expiration.time.com.liferay.portlet.messageboards.model.MBDiscussionModel"));
68  
69      public MBDiscussionModelImpl() {
70      }
71  
72      public long getPrimaryKey() {
73          return _discussionId;
74      }
75  
76      public void setPrimaryKey(long pk) {
77          setDiscussionId(pk);
78      }
79  
80      public Serializable getPrimaryKeyObj() {
81          return new Long(_discussionId);
82      }
83  
84      public long getDiscussionId() {
85          return _discussionId;
86      }
87  
88      public void setDiscussionId(long discussionId) {
89          if (discussionId != _discussionId) {
90              _discussionId = discussionId;
91          }
92      }
93  
94      public long getClassNameId() {
95          return _classNameId;
96      }
97  
98      public void setClassNameId(long classNameId) {
99          if (classNameId != _classNameId) {
100             _classNameId = classNameId;
101         }
102     }
103 
104     public long getClassPK() {
105         return _classPK;
106     }
107 
108     public void setClassPK(long classPK) {
109         if (classPK != _classPK) {
110             _classPK = classPK;
111         }
112     }
113 
114     public long getThreadId() {
115         return _threadId;
116     }
117 
118     public void setThreadId(long threadId) {
119         if (threadId != _threadId) {
120             _threadId = threadId;
121         }
122     }
123 
124     public Object clone() {
125         MBDiscussionImpl clone = new MBDiscussionImpl();
126         clone.setDiscussionId(getDiscussionId());
127         clone.setClassNameId(getClassNameId());
128         clone.setClassPK(getClassPK());
129         clone.setThreadId(getThreadId());
130 
131         return clone;
132     }
133 
134     public int compareTo(Object obj) {
135         if (obj == null) {
136             return -1;
137         }
138 
139         MBDiscussionImpl mbDiscussion = (MBDiscussionImpl)obj;
140         long pk = mbDiscussion.getPrimaryKey();
141 
142         if (getPrimaryKey() < pk) {
143             return -1;
144         }
145         else if (getPrimaryKey() > pk) {
146             return 1;
147         }
148         else {
149             return 0;
150         }
151     }
152 
153     public boolean equals(Object obj) {
154         if (obj == null) {
155             return false;
156         }
157 
158         MBDiscussionImpl mbDiscussion = null;
159 
160         try {
161             mbDiscussion = (MBDiscussionImpl)obj;
162         }
163         catch (ClassCastException cce) {
164             return false;
165         }
166 
167         long pk = mbDiscussion.getPrimaryKey();
168 
169         if (getPrimaryKey() == pk) {
170             return true;
171         }
172         else {
173             return false;
174         }
175     }
176 
177     public int hashCode() {
178         return (int)getPrimaryKey();
179     }
180 
181     private long _discussionId;
182     private long _classNameId;
183     private long _classPK;
184     private long _threadId;
185 }