001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.UserIdMapper;
023    import com.liferay.portal.model.UserIdMapperModel;
024    import com.liferay.portal.service.ServiceContext;
025    import com.liferay.portal.util.PortalUtil;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    /**
037     * <p>
038     * This interface is a model that represents the UserIdMapper table in the
039     * database.
040     * </p>
041     *
042     * @author    Brian Wing Shun Chan
043     * @see       UserIdMapperImpl
044     * @see       com.liferay.portal.model.UserIdMapper
045     * @see       com.liferay.portal.model.UserIdMapperModel
046     * @generated
047     */
048    public class UserIdMapperModelImpl extends BaseModelImpl<UserIdMapper>
049            implements UserIdMapperModel {
050            public static final String TABLE_NAME = "UserIdMapper";
051            public static final Object[][] TABLE_COLUMNS = {
052                            { "userIdMapperId", new Integer(Types.BIGINT) },
053                            { "userId", new Integer(Types.BIGINT) },
054                            { "type_", new Integer(Types.VARCHAR) },
055                            { "description", new Integer(Types.VARCHAR) },
056                            { "externalUserId", new Integer(Types.VARCHAR) }
057                    };
058            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)";
059            public static final String TABLE_SQL_DROP = "drop table UserIdMapper";
060            public static final String DATA_SOURCE = "liferayDataSource";
061            public static final String SESSION_FACTORY = "liferaySessionFactory";
062            public static final String TX_MANAGER = "liferayTransactionManager";
063            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
064                                    "value.object.entity.cache.enabled.com.liferay.portal.model.UserIdMapper"),
065                            true);
066            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
067                                    "value.object.finder.cache.enabled.com.liferay.portal.model.UserIdMapper"),
068                            true);
069            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
070                                    "lock.expiration.time.com.liferay.portal.model.UserIdMapper"));
071    
072            public UserIdMapperModelImpl() {
073            }
074    
075            public long getPrimaryKey() {
076                    return _userIdMapperId;
077            }
078    
079            public void setPrimaryKey(long pk) {
080                    setUserIdMapperId(pk);
081            }
082    
083            public Serializable getPrimaryKeyObj() {
084                    return new Long(_userIdMapperId);
085            }
086    
087            public long getUserIdMapperId() {
088                    return _userIdMapperId;
089            }
090    
091            public void setUserIdMapperId(long userIdMapperId) {
092                    _userIdMapperId = userIdMapperId;
093            }
094    
095            public long getUserId() {
096                    return _userId;
097            }
098    
099            public void setUserId(long userId) {
100                    _userId = userId;
101    
102                    if (!_setOriginalUserId) {
103                            _setOriginalUserId = true;
104    
105                            _originalUserId = userId;
106                    }
107            }
108    
109            public String getUserUuid() throws SystemException {
110                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
111            }
112    
113            public void setUserUuid(String userUuid) {
114                    _userUuid = userUuid;
115            }
116    
117            public long getOriginalUserId() {
118                    return _originalUserId;
119            }
120    
121            public String getType() {
122                    if (_type == null) {
123                            return StringPool.BLANK;
124                    }
125                    else {
126                            return _type;
127                    }
128            }
129    
130            public void setType(String type) {
131                    _type = type;
132    
133                    if (_originalType == null) {
134                            _originalType = type;
135                    }
136            }
137    
138            public String getOriginalType() {
139                    return GetterUtil.getString(_originalType);
140            }
141    
142            public String getDescription() {
143                    if (_description == null) {
144                            return StringPool.BLANK;
145                    }
146                    else {
147                            return _description;
148                    }
149            }
150    
151            public void setDescription(String description) {
152                    _description = description;
153            }
154    
155            public String getExternalUserId() {
156                    if (_externalUserId == null) {
157                            return StringPool.BLANK;
158                    }
159                    else {
160                            return _externalUserId;
161                    }
162            }
163    
164            public void setExternalUserId(String externalUserId) {
165                    _externalUserId = externalUserId;
166    
167                    if (_originalExternalUserId == null) {
168                            _originalExternalUserId = externalUserId;
169                    }
170            }
171    
172            public String getOriginalExternalUserId() {
173                    return GetterUtil.getString(_originalExternalUserId);
174            }
175    
176            public UserIdMapper toEscapedModel() {
177                    if (isEscapedModel()) {
178                            return (UserIdMapper)this;
179                    }
180                    else {
181                            return (UserIdMapper)Proxy.newProxyInstance(UserIdMapper.class.getClassLoader(),
182                                    new Class[] { UserIdMapper.class },
183                                    new AutoEscapeBeanHandler(this));
184                    }
185            }
186    
187            public ExpandoBridge getExpandoBridge() {
188                    if (_expandoBridge == null) {
189                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
190                                            UserIdMapper.class.getName(), getPrimaryKey());
191                    }
192    
193                    return _expandoBridge;
194            }
195    
196            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
197                    getExpandoBridge().setAttributes(serviceContext);
198            }
199    
200            public Object clone() {
201                    UserIdMapperImpl clone = new UserIdMapperImpl();
202    
203                    clone.setUserIdMapperId(getUserIdMapperId());
204                    clone.setUserId(getUserId());
205                    clone.setType(getType());
206                    clone.setDescription(getDescription());
207                    clone.setExternalUserId(getExternalUserId());
208    
209                    return clone;
210            }
211    
212            public int compareTo(UserIdMapper userIdMapper) {
213                    long pk = userIdMapper.getPrimaryKey();
214    
215                    if (getPrimaryKey() < pk) {
216                            return -1;
217                    }
218                    else if (getPrimaryKey() > pk) {
219                            return 1;
220                    }
221                    else {
222                            return 0;
223                    }
224            }
225    
226            public boolean equals(Object obj) {
227                    if (obj == null) {
228                            return false;
229                    }
230    
231                    UserIdMapper userIdMapper = null;
232    
233                    try {
234                            userIdMapper = (UserIdMapper)obj;
235                    }
236                    catch (ClassCastException cce) {
237                            return false;
238                    }
239    
240                    long pk = userIdMapper.getPrimaryKey();
241    
242                    if (getPrimaryKey() == pk) {
243                            return true;
244                    }
245                    else {
246                            return false;
247                    }
248            }
249    
250            public int hashCode() {
251                    return (int)getPrimaryKey();
252            }
253    
254            public String toString() {
255                    StringBundler sb = new StringBundler(11);
256    
257                    sb.append("{userIdMapperId=");
258                    sb.append(getUserIdMapperId());
259                    sb.append(", userId=");
260                    sb.append(getUserId());
261                    sb.append(", type=");
262                    sb.append(getType());
263                    sb.append(", description=");
264                    sb.append(getDescription());
265                    sb.append(", externalUserId=");
266                    sb.append(getExternalUserId());
267                    sb.append("}");
268    
269                    return sb.toString();
270            }
271    
272            public String toXmlString() {
273                    StringBundler sb = new StringBundler(19);
274    
275                    sb.append("<model><model-name>");
276                    sb.append("com.liferay.portal.model.UserIdMapper");
277                    sb.append("</model-name>");
278    
279                    sb.append(
280                            "<column><column-name>userIdMapperId</column-name><column-value><![CDATA[");
281                    sb.append(getUserIdMapperId());
282                    sb.append("]]></column-value></column>");
283                    sb.append(
284                            "<column><column-name>userId</column-name><column-value><![CDATA[");
285                    sb.append(getUserId());
286                    sb.append("]]></column-value></column>");
287                    sb.append(
288                            "<column><column-name>type</column-name><column-value><![CDATA[");
289                    sb.append(getType());
290                    sb.append("]]></column-value></column>");
291                    sb.append(
292                            "<column><column-name>description</column-name><column-value><![CDATA[");
293                    sb.append(getDescription());
294                    sb.append("]]></column-value></column>");
295                    sb.append(
296                            "<column><column-name>externalUserId</column-name><column-value><![CDATA[");
297                    sb.append(getExternalUserId());
298                    sb.append("]]></column-value></column>");
299    
300                    sb.append("</model>");
301    
302                    return sb.toString();
303            }
304    
305            private long _userIdMapperId;
306            private long _userId;
307            private String _userUuid;
308            private long _originalUserId;
309            private boolean _setOriginalUserId;
310            private String _type;
311            private String _originalType;
312            private String _description;
313            private String _externalUserId;
314            private String _originalExternalUserId;
315            private transient ExpandoBridge _expandoBridge;
316    }