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