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.portal.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 com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  /**
36   * <a href="UserIdMapperModelImpl.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be overwritten
40   * the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class is a model that represents the <code>UserIdMapper</code> table in
45   * the database.
46   * </p>
47   *
48   * @author Brian Wing Shun Chan
49   *
50   * @see com.liferay.portal.service.model.UserIdMapper
51   * @see com.liferay.portal.service.model.UserIdMapperModel
52   * @see com.liferay.portal.service.model.impl.UserIdMapperImpl
53   *
54   */
55  public class UserIdMapperModelImpl extends BaseModelImpl {
56      public static String TABLE_NAME = "UserIdMapper";
57      public static Object[][] TABLE_COLUMNS = {
58              { "userIdMapperId", new Integer(Types.BIGINT) },
59              { "userId", new Integer(Types.BIGINT) },
60              { "type_", new Integer(Types.VARCHAR) },
61              { "description", new Integer(Types.VARCHAR) },
62              { "externalUserId", new Integer(Types.VARCHAR) }
63          };
64      public static String TABLE_SQL_CREATE = "create table UserIdMapper (userIdMapperId LONG not null primary key,userId LONG,type_ VARCHAR(75) null,description VARCHAR(75) null,externalUserId VARCHAR(75) null)";
65      public static String TABLE_SQL_DROP = "drop table UserIdMapper";
66      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
67                  "xss.allow.com.liferay.portal.model.UserIdMapper"), XSS_ALLOW);
68      public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
69                  "xss.allow.com.liferay.portal.model.UserIdMapper.type"),
70              XSS_ALLOW_BY_MODEL);
71      public static boolean XSS_ALLOW_DESCRIPTION = GetterUtil.getBoolean(PropsUtil.get(
72                  "xss.allow.com.liferay.portal.model.UserIdMapper.description"),
73              XSS_ALLOW_BY_MODEL);
74      public static boolean XSS_ALLOW_EXTERNALUSERID = GetterUtil.getBoolean(PropsUtil.get(
75                  "xss.allow.com.liferay.portal.model.UserIdMapper.externalUserId"),
76              XSS_ALLOW_BY_MODEL);
77      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
78                  "lock.expiration.time.com.liferay.portal.model.UserIdMapperModel"));
79  
80      public UserIdMapperModelImpl() {
81      }
82  
83      public long getPrimaryKey() {
84          return _userIdMapperId;
85      }
86  
87      public void setPrimaryKey(long pk) {
88          setUserIdMapperId(pk);
89      }
90  
91      public Serializable getPrimaryKeyObj() {
92          return new Long(_userIdMapperId);
93      }
94  
95      public long getUserIdMapperId() {
96          return _userIdMapperId;
97      }
98  
99      public void setUserIdMapperId(long userIdMapperId) {
100         if (userIdMapperId != _userIdMapperId) {
101             _userIdMapperId = userIdMapperId;
102         }
103     }
104 
105     public long getUserId() {
106         return _userId;
107     }
108 
109     public void setUserId(long userId) {
110         if (userId != _userId) {
111             _userId = userId;
112         }
113     }
114 
115     public String getType() {
116         return GetterUtil.getString(_type);
117     }
118 
119     public void setType(String type) {
120         if (((type == null) && (_type != null)) ||
121                 ((type != null) && (_type == null)) ||
122                 ((type != null) && (_type != null) && !type.equals(_type))) {
123             if (!XSS_ALLOW_TYPE) {
124                 type = XSSUtil.strip(type);
125             }
126 
127             _type = type;
128         }
129     }
130 
131     public String getDescription() {
132         return GetterUtil.getString(_description);
133     }
134 
135     public void setDescription(String description) {
136         if (((description == null) && (_description != null)) ||
137                 ((description != null) && (_description == null)) ||
138                 ((description != null) && (_description != null) &&
139                 !description.equals(_description))) {
140             if (!XSS_ALLOW_DESCRIPTION) {
141                 description = XSSUtil.strip(description);
142             }
143 
144             _description = description;
145         }
146     }
147 
148     public String getExternalUserId() {
149         return GetterUtil.getString(_externalUserId);
150     }
151 
152     public void setExternalUserId(String externalUserId) {
153         if (((externalUserId == null) && (_externalUserId != null)) ||
154                 ((externalUserId != null) && (_externalUserId == null)) ||
155                 ((externalUserId != null) && (_externalUserId != null) &&
156                 !externalUserId.equals(_externalUserId))) {
157             if (!XSS_ALLOW_EXTERNALUSERID) {
158                 externalUserId = XSSUtil.strip(externalUserId);
159             }
160 
161             _externalUserId = externalUserId;
162         }
163     }
164 
165     public Object clone() {
166         UserIdMapperImpl clone = new UserIdMapperImpl();
167         clone.setUserIdMapperId(getUserIdMapperId());
168         clone.setUserId(getUserId());
169         clone.setType(getType());
170         clone.setDescription(getDescription());
171         clone.setExternalUserId(getExternalUserId());
172 
173         return clone;
174     }
175 
176     public int compareTo(Object obj) {
177         if (obj == null) {
178             return -1;
179         }
180 
181         UserIdMapperImpl userIdMapper = (UserIdMapperImpl)obj;
182         long pk = userIdMapper.getPrimaryKey();
183 
184         if (getPrimaryKey() < pk) {
185             return -1;
186         }
187         else if (getPrimaryKey() > pk) {
188             return 1;
189         }
190         else {
191             return 0;
192         }
193     }
194 
195     public boolean equals(Object obj) {
196         if (obj == null) {
197             return false;
198         }
199 
200         UserIdMapperImpl userIdMapper = null;
201 
202         try {
203             userIdMapper = (UserIdMapperImpl)obj;
204         }
205         catch (ClassCastException cce) {
206             return false;
207         }
208 
209         long pk = userIdMapper.getPrimaryKey();
210 
211         if (getPrimaryKey() == pk) {
212             return true;
213         }
214         else {
215             return false;
216         }
217     }
218 
219     public int hashCode() {
220         return (int)getPrimaryKey();
221     }
222 
223     private long _userIdMapperId;
224     private long _userId;
225     private String _type;
226     private String _description;
227     private String _externalUserId;
228 }