001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.UserIdMapper;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="UserIdMapperModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>UserIdMapper</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.UserIdMapper
052: * @see com.liferay.portal.service.model.UserIdMapperModel
053: * @see com.liferay.portal.service.model.impl.UserIdMapperImpl
054: *
055: */
056: public class UserIdMapperModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "UserIdMapper";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "userIdMapperId", new Integer(Types.BIGINT) },
060:
061: { "userId", new Integer(Types.BIGINT) },
062:
063: { "type_", new Integer(Types.VARCHAR) },
064:
065: { "description", new Integer(Types.VARCHAR) },
066:
067: { "externalUserId", new Integer(Types.VARCHAR) } };
068: public static final 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)";
069: public static final String TABLE_SQL_DROP = "drop table UserIdMapper";
070: public static final boolean CACHE_ENABLED = GetterUtil
071: .getBoolean(
072: PropsUtil
073: .get("value.object.finder.cache.enabled.com.liferay.portal.model.UserIdMapper"),
074: true);
075: public static final long LOCK_EXPIRATION_TIME = GetterUtil
076: .getLong(PropsUtil
077: .get("lock.expiration.time.com.liferay.portal.model.UserIdMapper"));
078:
079: public UserIdMapperModelImpl() {
080: }
081:
082: public long getPrimaryKey() {
083: return _userIdMapperId;
084: }
085:
086: public void setPrimaryKey(long pk) {
087: setUserIdMapperId(pk);
088: }
089:
090: public Serializable getPrimaryKeyObj() {
091: return new Long(_userIdMapperId);
092: }
093:
094: public long getUserIdMapperId() {
095: return _userIdMapperId;
096: }
097:
098: public void setUserIdMapperId(long userIdMapperId) {
099: if (userIdMapperId != _userIdMapperId) {
100: _userIdMapperId = userIdMapperId;
101: }
102: }
103:
104: public long getUserId() {
105: return _userId;
106: }
107:
108: public void setUserId(long userId) {
109: if (userId != _userId) {
110: _userId = userId;
111: }
112: }
113:
114: public String getType() {
115: return GetterUtil.getString(_type);
116: }
117:
118: public void setType(String type) {
119: if (((type == null) && (_type != null))
120: || ((type != null) && (_type == null))
121: || ((type != null) && (_type != null) && !type
122: .equals(_type))) {
123: _type = type;
124: }
125: }
126:
127: public String getDescription() {
128: return GetterUtil.getString(_description);
129: }
130:
131: public void setDescription(String description) {
132: if (((description == null) && (_description != null))
133: || ((description != null) && (_description == null))
134: || ((description != null) && (_description != null) && !description
135: .equals(_description))) {
136: _description = description;
137: }
138: }
139:
140: public String getExternalUserId() {
141: return GetterUtil.getString(_externalUserId);
142: }
143:
144: public void setExternalUserId(String externalUserId) {
145: if (((externalUserId == null) && (_externalUserId != null))
146: || ((externalUserId != null) && (_externalUserId == null))
147: || ((externalUserId != null)
148: && (_externalUserId != null) && !externalUserId
149: .equals(_externalUserId))) {
150: _externalUserId = externalUserId;
151: }
152: }
153:
154: public UserIdMapper toEscapedModel() {
155: if (isEscapedModel()) {
156: return (UserIdMapper) this ;
157: } else {
158: UserIdMapper model = new UserIdMapperImpl();
159:
160: model.setEscapedModel(true);
161:
162: model.setUserIdMapperId(getUserIdMapperId());
163: model.setUserId(getUserId());
164: model.setType(Html.escape(getType()));
165: model.setDescription(Html.escape(getDescription()));
166: model.setExternalUserId(Html.escape(getExternalUserId()));
167:
168: model = (UserIdMapper) Proxy.newProxyInstance(
169: UserIdMapper.class.getClassLoader(),
170: new Class[] { UserIdMapper.class },
171: new ReadOnlyBeanHandler(model));
172:
173: return model;
174: }
175: }
176:
177: public Object clone() {
178: UserIdMapperImpl clone = new UserIdMapperImpl();
179:
180: clone.setUserIdMapperId(getUserIdMapperId());
181: clone.setUserId(getUserId());
182: clone.setType(getType());
183: clone.setDescription(getDescription());
184: clone.setExternalUserId(getExternalUserId());
185:
186: return clone;
187: }
188:
189: public int compareTo(Object obj) {
190: if (obj == null) {
191: return -1;
192: }
193:
194: UserIdMapperImpl userIdMapper = (UserIdMapperImpl) obj;
195:
196: long pk = userIdMapper.getPrimaryKey();
197:
198: if (getPrimaryKey() < pk) {
199: return -1;
200: } else if (getPrimaryKey() > pk) {
201: return 1;
202: } else {
203: return 0;
204: }
205: }
206:
207: public boolean equals(Object obj) {
208: if (obj == null) {
209: return false;
210: }
211:
212: UserIdMapperImpl userIdMapper = null;
213:
214: try {
215: userIdMapper = (UserIdMapperImpl) obj;
216: } catch (ClassCastException cce) {
217: return false;
218: }
219:
220: long pk = userIdMapper.getPrimaryKey();
221:
222: if (getPrimaryKey() == pk) {
223: return true;
224: } else {
225: return false;
226: }
227: }
228:
229: public int hashCode() {
230: return (int) getPrimaryKey();
231: }
232:
233: private long _userIdMapperId;
234: private long _userId;
235: private String _type;
236: private String _description;
237: private String _externalUserId;
238: }
|