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     * The base model implementation for the UserIdMapper service. Represents a row in the "UserIdMapper" database table, with each column mapped to a property of this class.
038     *
039     * <p>
040     * This implementation and its corresponding interface {@link com.liferay.portal.model.UserIdMapperModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UserIdMapperImpl}.
041     * </p>
042     *
043     * <p>
044     * Never modify or reference this class directly. All methods that expect a user id mapper model instance should use the {@link com.liferay.portal.model.UserIdMapper} interface instead.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see UserIdMapperImpl
049     * @see com.liferay.portal.model.UserIdMapper
050     * @see com.liferay.portal.model.UserIdMapperModel
051     * @generated
052     */
053    public class UserIdMapperModelImpl extends BaseModelImpl<UserIdMapper>
054            implements UserIdMapperModel {
055            public static final String TABLE_NAME = "UserIdMapper";
056            public static final Object[][] TABLE_COLUMNS = {
057                            { "userIdMapperId", new Integer(Types.BIGINT) },
058                            { "userId", new Integer(Types.BIGINT) },
059                            { "type_", new Integer(Types.VARCHAR) },
060                            { "description", new Integer(Types.VARCHAR) },
061                            { "externalUserId", new Integer(Types.VARCHAR) }
062                    };
063            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)";
064            public static final String TABLE_SQL_DROP = "drop table UserIdMapper";
065            public static final String DATA_SOURCE = "liferayDataSource";
066            public static final String SESSION_FACTORY = "liferaySessionFactory";
067            public static final String TX_MANAGER = "liferayTransactionManager";
068            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
069                                    "value.object.entity.cache.enabled.com.liferay.portal.model.UserIdMapper"),
070                            true);
071            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.finder.cache.enabled.com.liferay.portal.model.UserIdMapper"),
073                            true);
074            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
075                                    "lock.expiration.time.com.liferay.portal.model.UserIdMapper"));
076    
077            public UserIdMapperModelImpl() {
078            }
079    
080            public long getPrimaryKey() {
081                    return _userIdMapperId;
082            }
083    
084            public void setPrimaryKey(long pk) {
085                    setUserIdMapperId(pk);
086            }
087    
088            public Serializable getPrimaryKeyObj() {
089                    return new Long(_userIdMapperId);
090            }
091    
092            public long getUserIdMapperId() {
093                    return _userIdMapperId;
094            }
095    
096            public void setUserIdMapperId(long userIdMapperId) {
097                    _userIdMapperId = userIdMapperId;
098            }
099    
100            public long getUserId() {
101                    return _userId;
102            }
103    
104            public void setUserId(long userId) {
105                    _userId = userId;
106    
107                    if (!_setOriginalUserId) {
108                            _setOriginalUserId = true;
109    
110                            _originalUserId = userId;
111                    }
112            }
113    
114            public String getUserUuid() throws SystemException {
115                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
116            }
117    
118            public void setUserUuid(String userUuid) {
119                    _userUuid = userUuid;
120            }
121    
122            public long getOriginalUserId() {
123                    return _originalUserId;
124            }
125    
126            public String getType() {
127                    if (_type == null) {
128                            return StringPool.BLANK;
129                    }
130                    else {
131                            return _type;
132                    }
133            }
134    
135            public void setType(String type) {
136                    _type = type;
137    
138                    if (_originalType == null) {
139                            _originalType = type;
140                    }
141            }
142    
143            public String getOriginalType() {
144                    return GetterUtil.getString(_originalType);
145            }
146    
147            public String getDescription() {
148                    if (_description == null) {
149                            return StringPool.BLANK;
150                    }
151                    else {
152                            return _description;
153                    }
154            }
155    
156            public void setDescription(String description) {
157                    _description = description;
158            }
159    
160            public String getExternalUserId() {
161                    if (_externalUserId == null) {
162                            return StringPool.BLANK;
163                    }
164                    else {
165                            return _externalUserId;
166                    }
167            }
168    
169            public void setExternalUserId(String externalUserId) {
170                    _externalUserId = externalUserId;
171    
172                    if (_originalExternalUserId == null) {
173                            _originalExternalUserId = externalUserId;
174                    }
175            }
176    
177            public String getOriginalExternalUserId() {
178                    return GetterUtil.getString(_originalExternalUserId);
179            }
180    
181            public UserIdMapper toEscapedModel() {
182                    if (isEscapedModel()) {
183                            return (UserIdMapper)this;
184                    }
185                    else {
186                            return (UserIdMapper)Proxy.newProxyInstance(UserIdMapper.class.getClassLoader(),
187                                    new Class[] { UserIdMapper.class },
188                                    new AutoEscapeBeanHandler(this));
189                    }
190            }
191    
192            public ExpandoBridge getExpandoBridge() {
193                    if (_expandoBridge == null) {
194                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
195                                            UserIdMapper.class.getName(), getPrimaryKey());
196                    }
197    
198                    return _expandoBridge;
199            }
200    
201            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
202                    getExpandoBridge().setAttributes(serviceContext);
203            }
204    
205            public Object clone() {
206                    UserIdMapperImpl clone = new UserIdMapperImpl();
207    
208                    clone.setUserIdMapperId(getUserIdMapperId());
209                    clone.setUserId(getUserId());
210                    clone.setType(getType());
211                    clone.setDescription(getDescription());
212                    clone.setExternalUserId(getExternalUserId());
213    
214                    return clone;
215            }
216    
217            public int compareTo(UserIdMapper userIdMapper) {
218                    long pk = userIdMapper.getPrimaryKey();
219    
220                    if (getPrimaryKey() < pk) {
221                            return -1;
222                    }
223                    else if (getPrimaryKey() > pk) {
224                            return 1;
225                    }
226                    else {
227                            return 0;
228                    }
229            }
230    
231            public boolean equals(Object obj) {
232                    if (obj == null) {
233                            return false;
234                    }
235    
236                    UserIdMapper userIdMapper = null;
237    
238                    try {
239                            userIdMapper = (UserIdMapper)obj;
240                    }
241                    catch (ClassCastException cce) {
242                            return false;
243                    }
244    
245                    long pk = userIdMapper.getPrimaryKey();
246    
247                    if (getPrimaryKey() == pk) {
248                            return true;
249                    }
250                    else {
251                            return false;
252                    }
253            }
254    
255            public int hashCode() {
256                    return (int)getPrimaryKey();
257            }
258    
259            public String toString() {
260                    StringBundler sb = new StringBundler(11);
261    
262                    sb.append("{userIdMapperId=");
263                    sb.append(getUserIdMapperId());
264                    sb.append(", userId=");
265                    sb.append(getUserId());
266                    sb.append(", type=");
267                    sb.append(getType());
268                    sb.append(", description=");
269                    sb.append(getDescription());
270                    sb.append(", externalUserId=");
271                    sb.append(getExternalUserId());
272                    sb.append("}");
273    
274                    return sb.toString();
275            }
276    
277            public String toXmlString() {
278                    StringBundler sb = new StringBundler(19);
279    
280                    sb.append("<model><model-name>");
281                    sb.append("com.liferay.portal.model.UserIdMapper");
282                    sb.append("</model-name>");
283    
284                    sb.append(
285                            "<column><column-name>userIdMapperId</column-name><column-value><![CDATA[");
286                    sb.append(getUserIdMapperId());
287                    sb.append("]]></column-value></column>");
288                    sb.append(
289                            "<column><column-name>userId</column-name><column-value><![CDATA[");
290                    sb.append(getUserId());
291                    sb.append("]]></column-value></column>");
292                    sb.append(
293                            "<column><column-name>type</column-name><column-value><![CDATA[");
294                    sb.append(getType());
295                    sb.append("]]></column-value></column>");
296                    sb.append(
297                            "<column><column-name>description</column-name><column-value><![CDATA[");
298                    sb.append(getDescription());
299                    sb.append("]]></column-value></column>");
300                    sb.append(
301                            "<column><column-name>externalUserId</column-name><column-value><![CDATA[");
302                    sb.append(getExternalUserId());
303                    sb.append("]]></column-value></column>");
304    
305                    sb.append("</model>");
306    
307                    return sb.toString();
308            }
309    
310            private long _userIdMapperId;
311            private long _userId;
312            private String _userUuid;
313            private long _originalUserId;
314            private boolean _setOriginalUserId;
315            private String _type;
316            private String _originalType;
317            private String _description;
318            private String _externalUserId;
319            private String _originalExternalUserId;
320            private transient ExpandoBridge _expandoBridge;
321    }