1
19
20 package com.liferay.portal.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.UserIdMapper;
26 import com.liferay.portal.model.UserIdMapperSoap;
27
28 import java.io.Serializable;
29
30 import java.lang.reflect.Proxy;
31
32 import java.sql.Types;
33
34 import java.util.ArrayList;
35 import java.util.List;
36
37
57 public class UserIdMapperModelImpl extends BaseModelImpl {
58 public static final String TABLE_NAME = "UserIdMapper";
59 public static final Object[][] TABLE_COLUMNS = {
60 { "userIdMapperId", new Integer(Types.BIGINT) },
61
62
63 { "userId", new Integer(Types.BIGINT) },
64
65
66 { "type_", new Integer(Types.VARCHAR) },
67
68
69 { "description", new Integer(Types.VARCHAR) },
70
71
72 { "externalUserId", new Integer(Types.VARCHAR) }
73 };
74 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)";
75 public static final String TABLE_SQL_DROP = "drop table UserIdMapper";
76 public static final String DATA_SOURCE = "liferayDataSource";
77 public static final String SESSION_FACTORY = "liferaySessionFactory";
78 public static final String TX_MANAGER = "liferayTransactionManager";
79 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80 "value.object.finder.cache.enabled.com.liferay.portal.model.UserIdMapper"),
81 true);
82
83 public static UserIdMapper toModel(UserIdMapperSoap soapModel) {
84 UserIdMapper model = new UserIdMapperImpl();
85
86 model.setUserIdMapperId(soapModel.getUserIdMapperId());
87 model.setUserId(soapModel.getUserId());
88 model.setType(soapModel.getType());
89 model.setDescription(soapModel.getDescription());
90 model.setExternalUserId(soapModel.getExternalUserId());
91
92 return model;
93 }
94
95 public static List<UserIdMapper> toModels(UserIdMapperSoap[] soapModels) {
96 List<UserIdMapper> models = new ArrayList<UserIdMapper>(soapModels.length);
97
98 for (UserIdMapperSoap soapModel : soapModels) {
99 models.add(toModel(soapModel));
100 }
101
102 return models;
103 }
104
105 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
106 "lock.expiration.time.com.liferay.portal.model.UserIdMapper"));
107
108 public UserIdMapperModelImpl() {
109 }
110
111 public long getPrimaryKey() {
112 return _userIdMapperId;
113 }
114
115 public void setPrimaryKey(long pk) {
116 setUserIdMapperId(pk);
117 }
118
119 public Serializable getPrimaryKeyObj() {
120 return new Long(_userIdMapperId);
121 }
122
123 public long getUserIdMapperId() {
124 return _userIdMapperId;
125 }
126
127 public void setUserIdMapperId(long userIdMapperId) {
128 if (userIdMapperId != _userIdMapperId) {
129 _userIdMapperId = userIdMapperId;
130 }
131 }
132
133 public long getUserId() {
134 return _userId;
135 }
136
137 public void setUserId(long userId) {
138 if (userId != _userId) {
139 _userId = userId;
140 }
141 }
142
143 public String getType() {
144 return GetterUtil.getString(_type);
145 }
146
147 public void setType(String type) {
148 if (((type == null) && (_type != null)) ||
149 ((type != null) && (_type == null)) ||
150 ((type != null) && (_type != null) && !type.equals(_type))) {
151 _type = type;
152 }
153 }
154
155 public String getDescription() {
156 return GetterUtil.getString(_description);
157 }
158
159 public void setDescription(String description) {
160 if (((description == null) && (_description != null)) ||
161 ((description != null) && (_description == null)) ||
162 ((description != null) && (_description != null) &&
163 !description.equals(_description))) {
164 _description = description;
165 }
166 }
167
168 public String getExternalUserId() {
169 return GetterUtil.getString(_externalUserId);
170 }
171
172 public void setExternalUserId(String externalUserId) {
173 if (((externalUserId == null) && (_externalUserId != null)) ||
174 ((externalUserId != null) && (_externalUserId == null)) ||
175 ((externalUserId != null) && (_externalUserId != null) &&
176 !externalUserId.equals(_externalUserId))) {
177 _externalUserId = externalUserId;
178 }
179 }
180
181 public UserIdMapper toEscapedModel() {
182 if (isEscapedModel()) {
183 return (UserIdMapper)this;
184 }
185 else {
186 UserIdMapper model = new UserIdMapperImpl();
187
188 model.setNew(isNew());
189 model.setEscapedModel(true);
190
191 model.setUserIdMapperId(getUserIdMapperId());
192 model.setUserId(getUserId());
193 model.setType(HtmlUtil.escape(getType()));
194 model.setDescription(HtmlUtil.escape(getDescription()));
195 model.setExternalUserId(HtmlUtil.escape(getExternalUserId()));
196
197 model = (UserIdMapper)Proxy.newProxyInstance(UserIdMapper.class.getClassLoader(),
198 new Class[] { UserIdMapper.class },
199 new ReadOnlyBeanHandler(model));
200
201 return model;
202 }
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(Object obj) {
218 if (obj == null) {
219 return -1;
220 }
221
222 UserIdMapperImpl userIdMapper = (UserIdMapperImpl)obj;
223
224 long pk = userIdMapper.getPrimaryKey();
225
226 if (getPrimaryKey() < pk) {
227 return -1;
228 }
229 else if (getPrimaryKey() > pk) {
230 return 1;
231 }
232 else {
233 return 0;
234 }
235 }
236
237 public boolean equals(Object obj) {
238 if (obj == null) {
239 return false;
240 }
241
242 UserIdMapperImpl userIdMapper = null;
243
244 try {
245 userIdMapper = (UserIdMapperImpl)obj;
246 }
247 catch (ClassCastException cce) {
248 return false;
249 }
250
251 long pk = userIdMapper.getPrimaryKey();
252
253 if (getPrimaryKey() == pk) {
254 return true;
255 }
256 else {
257 return false;
258 }
259 }
260
261 public int hashCode() {
262 return (int)getPrimaryKey();
263 }
264
265 private long _userIdMapperId;
266 private long _userId;
267 private String _type;
268 private String _description;
269 private String _externalUserId;
270 }