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="MBMessageFlagModelImpl.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>MBMessageFlag</code> table in
43   * the database.
44   * </p>
45   *
46   * @author Brian Wing Shun Chan
47   *
48   * @see com.liferay.portlet.messageboards.service.model.MBMessageFlag
49   * @see com.liferay.portlet.messageboards.service.model.MBMessageFlagModel
50   * @see com.liferay.portlet.messageboards.service.model.impl.MBMessageFlagImpl
51   *
52   */
53  public class MBMessageFlagModelImpl extends BaseModelImpl {
54      public static String TABLE_NAME = "MBMessageFlag";
55      public static Object[][] TABLE_COLUMNS = {
56              { "messageFlagId", new Integer(Types.BIGINT) },
57              { "userId", new Integer(Types.BIGINT) },
58              { "messageId", new Integer(Types.BIGINT) },
59              { "flag", new Integer(Types.INTEGER) }
60          };
61      public static String TABLE_SQL_CREATE = "create table MBMessageFlag (messageFlagId LONG not null primary key,userId LONG,messageId LONG,flag INTEGER)";
62      public static String TABLE_SQL_DROP = "drop table MBMessageFlag";
63      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
64                  "xss.allow.com.liferay.portlet.messageboards.model.MBMessageFlag"),
65              XSS_ALLOW);
66      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
67                  "lock.expiration.time.com.liferay.portlet.messageboards.model.MBMessageFlagModel"));
68  
69      public MBMessageFlagModelImpl() {
70      }
71  
72      public long getPrimaryKey() {
73          return _messageFlagId;
74      }
75  
76      public void setPrimaryKey(long pk) {
77          setMessageFlagId(pk);
78      }
79  
80      public Serializable getPrimaryKeyObj() {
81          return new Long(_messageFlagId);
82      }
83  
84      public long getMessageFlagId() {
85          return _messageFlagId;
86      }
87  
88      public void setMessageFlagId(long messageFlagId) {
89          if (messageFlagId != _messageFlagId) {
90              _messageFlagId = messageFlagId;
91          }
92      }
93  
94      public long getUserId() {
95          return _userId;
96      }
97  
98      public void setUserId(long userId) {
99          if (userId != _userId) {
100             _userId = userId;
101         }
102     }
103 
104     public long getMessageId() {
105         return _messageId;
106     }
107 
108     public void setMessageId(long messageId) {
109         if (messageId != _messageId) {
110             _messageId = messageId;
111         }
112     }
113 
114     public int getFlag() {
115         return _flag;
116     }
117 
118     public void setFlag(int flag) {
119         if (flag != _flag) {
120             _flag = flag;
121         }
122     }
123 
124     public Object clone() {
125         MBMessageFlagImpl clone = new MBMessageFlagImpl();
126         clone.setMessageFlagId(getMessageFlagId());
127         clone.setUserId(getUserId());
128         clone.setMessageId(getMessageId());
129         clone.setFlag(getFlag());
130 
131         return clone;
132     }
133 
134     public int compareTo(Object obj) {
135         if (obj == null) {
136             return -1;
137         }
138 
139         MBMessageFlagImpl mbMessageFlag = (MBMessageFlagImpl)obj;
140         long pk = mbMessageFlag.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         MBMessageFlagImpl mbMessageFlag = null;
159 
160         try {
161             mbMessageFlag = (MBMessageFlagImpl)obj;
162         }
163         catch (ClassCastException cce) {
164             return false;
165         }
166 
167         long pk = mbMessageFlag.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 _messageFlagId;
182     private long _userId;
183     private long _messageId;
184     private int _flag;
185 }