001    /**
002     * Copyright (c) 2000-2011 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                    if (!_setOriginalUserId) {
106                            _setOriginalUserId = true;
107    
108                            _originalUserId = _userId;
109                    }
110    
111                    _userId = userId;
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                    if (_originalType == null) {
137                            _originalType = _type;
138                    }
139    
140                    _type = type;
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                    if (_originalExternalUserId == null) {
171                            _originalExternalUserId = _externalUserId;
172                    }
173    
174                    _externalUserId = externalUserId;
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 userIdMapperImpl = new UserIdMapperImpl();
207    
208                    userIdMapperImpl.setUserIdMapperId(getUserIdMapperId());
209    
210                    userIdMapperImpl.setUserId(getUserId());
211    
212                    UserIdMapperModelImpl userIdMapperModelImpl = userIdMapperImpl;
213    
214                    userIdMapperModelImpl._originalUserId = userIdMapperModelImpl._userId;
215    
216                    userIdMapperModelImpl._setOriginalUserId = false;
217                    userIdMapperImpl.setType(getType());
218    
219                    userIdMapperModelImpl._originalType = userIdMapperModelImpl._type;
220    
221                    userIdMapperImpl.setDescription(getDescription());
222    
223                    userIdMapperImpl.setExternalUserId(getExternalUserId());
224    
225                    userIdMapperModelImpl._originalExternalUserId = userIdMapperModelImpl._externalUserId;
226    
227                    return userIdMapperImpl;
228            }
229    
230            public int compareTo(UserIdMapper userIdMapper) {
231                    long pk = userIdMapper.getPrimaryKey();
232    
233                    if (getPrimaryKey() < pk) {
234                            return -1;
235                    }
236                    else if (getPrimaryKey() > pk) {
237                            return 1;
238                    }
239                    else {
240                            return 0;
241                    }
242            }
243    
244            public boolean equals(Object obj) {
245                    if (obj == null) {
246                            return false;
247                    }
248    
249                    UserIdMapper userIdMapper = null;
250    
251                    try {
252                            userIdMapper = (UserIdMapper)obj;
253                    }
254                    catch (ClassCastException cce) {
255                            return false;
256                    }
257    
258                    long pk = userIdMapper.getPrimaryKey();
259    
260                    if (getPrimaryKey() == pk) {
261                            return true;
262                    }
263                    else {
264                            return false;
265                    }
266            }
267    
268            public int hashCode() {
269                    return (int)getPrimaryKey();
270            }
271    
272            public String toString() {
273                    StringBundler sb = new StringBundler(11);
274    
275                    sb.append("{userIdMapperId=");
276                    sb.append(getUserIdMapperId());
277                    sb.append(", userId=");
278                    sb.append(getUserId());
279                    sb.append(", type=");
280                    sb.append(getType());
281                    sb.append(", description=");
282                    sb.append(getDescription());
283                    sb.append(", externalUserId=");
284                    sb.append(getExternalUserId());
285                    sb.append("}");
286    
287                    return sb.toString();
288            }
289    
290            public String toXmlString() {
291                    StringBundler sb = new StringBundler(19);
292    
293                    sb.append("<model><model-name>");
294                    sb.append("com.liferay.portal.model.UserIdMapper");
295                    sb.append("</model-name>");
296    
297                    sb.append(
298                            "<column><column-name>userIdMapperId</column-name><column-value><![CDATA[");
299                    sb.append(getUserIdMapperId());
300                    sb.append("]]></column-value></column>");
301                    sb.append(
302                            "<column><column-name>userId</column-name><column-value><![CDATA[");
303                    sb.append(getUserId());
304                    sb.append("]]></column-value></column>");
305                    sb.append(
306                            "<column><column-name>type</column-name><column-value><![CDATA[");
307                    sb.append(getType());
308                    sb.append("]]></column-value></column>");
309                    sb.append(
310                            "<column><column-name>description</column-name><column-value><![CDATA[");
311                    sb.append(getDescription());
312                    sb.append("]]></column-value></column>");
313                    sb.append(
314                            "<column><column-name>externalUserId</column-name><column-value><![CDATA[");
315                    sb.append(getExternalUserId());
316                    sb.append("]]></column-value></column>");
317    
318                    sb.append("</model>");
319    
320                    return sb.toString();
321            }
322    
323            private long _userIdMapperId;
324            private long _userId;
325            private String _userUuid;
326            private long _originalUserId;
327            private boolean _setOriginalUserId;
328            private String _type;
329            private String _originalType;
330            private String _description;
331            private String _externalUserId;
332            private String _originalExternalUserId;
333            private transient ExpandoBridge _expandoBridge;
334    }