PageRenderTime 48ms CodeModel.GetById 34ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/portlets/hr-portlet/docroot/WEB-INF/src/com/liferay/hr/model/impl/HRExpenseAccountModelImpl.java

https://github.com/stevenjiancao/liferay-plugins
Java | 485 lines | 363 code | 91 blank | 31 comment | 45 complexity | f5e93727a10ac65d0b673d6d4bb27f43 MD5 | raw file
  1/**
  2 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
  3 *
  4 * This library is free software; you can redistribute it and/or modify it under
  5 * the terms of the GNU Lesser General Public License as published by the Free
  6 * Software Foundation; either version 2.1 of the License, or (at your option)
  7 * any later version.
  8 *
  9 * This library is distributed in the hope that it will be useful, but WITHOUT
 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 12 * details.
 13 */
 14
 15package com.liferay.hr.model.impl;
 16
 17import com.liferay.hr.model.HRExpenseAccount;
 18import com.liferay.hr.model.HRExpenseAccountModel;
 19
 20import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
 21import com.liferay.portal.kernel.exception.SystemException;
 22import com.liferay.portal.kernel.util.GetterUtil;
 23import com.liferay.portal.kernel.util.StringBundler;
 24import com.liferay.portal.kernel.util.StringPool;
 25import com.liferay.portal.model.CacheModel;
 26import com.liferay.portal.model.impl.BaseModelImpl;
 27import com.liferay.portal.service.ServiceContext;
 28import com.liferay.portal.util.PortalUtil;
 29
 30import com.liferay.portlet.expando.model.ExpandoBridge;
 31import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
 32
 33import java.io.Serializable;
 34
 35import java.lang.reflect.Proxy;
 36
 37import java.sql.Types;
 38
 39import java.util.Date;
 40
 41/**
 42 * The base model implementation for the HRExpenseAccount service. Represents a row in the "HRExpenseAccount" database table, with each column mapped to a property of this class.
 43 *
 44 * <p>
 45 * This implementation and its corresponding interface {@link com.liferay.hr.model.HRExpenseAccountModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link HRExpenseAccountImpl}.
 46 * </p>
 47 *
 48 * @author Wesley Gong
 49 * @see HRExpenseAccountImpl
 50 * @see com.liferay.hr.model.HRExpenseAccount
 51 * @see com.liferay.hr.model.HRExpenseAccountModel
 52 * @generated
 53 */
 54public class HRExpenseAccountModelImpl extends BaseModelImpl<HRExpenseAccount>
 55	implements HRExpenseAccountModel {
 56	/*
 57	 * NOTE FOR DEVELOPERS:
 58	 *
 59	 * Never modify or reference this class directly. All methods that expect a h r expense account model instance should use the {@link com.liferay.hr.model.HRExpenseAccount} interface instead.
 60	 */
 61	public static final String TABLE_NAME = "HRExpenseAccount";
 62	public static final Object[][] TABLE_COLUMNS = {
 63			{ "hrExpenseAccountId", Types.BIGINT },
 64			{ "groupId", Types.BIGINT },
 65			{ "companyId", Types.BIGINT },
 66			{ "userId", Types.BIGINT },
 67			{ "userName", Types.VARCHAR },
 68			{ "createDate", Types.TIMESTAMP },
 69			{ "modifiedDate", Types.TIMESTAMP },
 70			{ "name", Types.VARCHAR },
 71			{ "description", Types.VARCHAR }
 72		};
 73	public static final String TABLE_SQL_CREATE = "create table HRExpenseAccount (hrExpenseAccountId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,description STRING null)";
 74	public static final String TABLE_SQL_DROP = "drop table HRExpenseAccount";
 75	public static final String DATA_SOURCE = "liferayDataSource";
 76	public static final String SESSION_FACTORY = "liferaySessionFactory";
 77	public static final String TX_MANAGER = "liferayTransactionManager";
 78	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
 79				"value.object.entity.cache.enabled.com.liferay.hr.model.HRExpenseAccount"),
 80			true);
 81	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
 82				"value.object.finder.cache.enabled.com.liferay.hr.model.HRExpenseAccount"),
 83			true);
 84
 85	public Class<?> getModelClass() {
 86		return HRExpenseAccount.class;
 87	}
 88
 89	public String getModelClassName() {
 90		return HRExpenseAccount.class.getName();
 91	}
 92
 93	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
 94				"lock.expiration.time.com.liferay.hr.model.HRExpenseAccount"));
 95
 96	public HRExpenseAccountModelImpl() {
 97	}
 98
 99	public long getPrimaryKey() {
100		return _hrExpenseAccountId;
101	}
102
103	public void setPrimaryKey(long primaryKey) {
104		setHrExpenseAccountId(primaryKey);
105	}
106
107	public Serializable getPrimaryKeyObj() {
108		return new Long(_hrExpenseAccountId);
109	}
110
111	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
112		setPrimaryKey(((Long)primaryKeyObj).longValue());
113	}
114
115	public long getHrExpenseAccountId() {
116		return _hrExpenseAccountId;
117	}
118
119	public void setHrExpenseAccountId(long hrExpenseAccountId) {
120		_hrExpenseAccountId = hrExpenseAccountId;
121	}
122
123	public long getGroupId() {
124		return _groupId;
125	}
126
127	public void setGroupId(long groupId) {
128		if (!_setOriginalGroupId) {
129			_setOriginalGroupId = true;
130
131			_originalGroupId = _groupId;
132		}
133
134		_groupId = groupId;
135	}
136
137	public long getOriginalGroupId() {
138		return _originalGroupId;
139	}
140
141	public long getCompanyId() {
142		return _companyId;
143	}
144
145	public void setCompanyId(long companyId) {
146		_companyId = companyId;
147	}
148
149	public long getUserId() {
150		return _userId;
151	}
152
153	public void setUserId(long userId) {
154		_userId = userId;
155	}
156
157	public String getUserUuid() throws SystemException {
158		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
159	}
160
161	public void setUserUuid(String userUuid) {
162		_userUuid = userUuid;
163	}
164
165	public String getUserName() {
166		if (_userName == null) {
167			return StringPool.BLANK;
168		}
169		else {
170			return _userName;
171		}
172	}
173
174	public void setUserName(String userName) {
175		_userName = userName;
176	}
177
178	public Date getCreateDate() {
179		return _createDate;
180	}
181
182	public void setCreateDate(Date createDate) {
183		_createDate = createDate;
184	}
185
186	public Date getModifiedDate() {
187		return _modifiedDate;
188	}
189
190	public void setModifiedDate(Date modifiedDate) {
191		_modifiedDate = modifiedDate;
192	}
193
194	public String getName() {
195		if (_name == null) {
196			return StringPool.BLANK;
197		}
198		else {
199			return _name;
200		}
201	}
202
203	public void setName(String name) {
204		if (_originalName == null) {
205			_originalName = _name;
206		}
207
208		_name = name;
209	}
210
211	public String getOriginalName() {
212		return GetterUtil.getString(_originalName);
213	}
214
215	public String getDescription() {
216		if (_description == null) {
217			return StringPool.BLANK;
218		}
219		else {
220			return _description;
221		}
222	}
223
224	public void setDescription(String description) {
225		_description = description;
226	}
227
228	@Override
229	public HRExpenseAccount toEscapedModel() {
230		if (isEscapedModel()) {
231			return (HRExpenseAccount)this;
232		}
233		else {
234			if (_escapedModelProxy == null) {
235				_escapedModelProxy = (HRExpenseAccount)Proxy.newProxyInstance(_classLoader,
236						_escapedModelProxyInterfaces,
237						new AutoEscapeBeanHandler(this));
238			}
239
240			return _escapedModelProxy;
241		}
242	}
243
244	@Override
245	public ExpandoBridge getExpandoBridge() {
246		if (_expandoBridge == null) {
247			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
248					HRExpenseAccount.class.getName(), getPrimaryKey());
249		}
250
251		return _expandoBridge;
252	}
253
254	@Override
255	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
256		getExpandoBridge().setAttributes(serviceContext);
257	}
258
259	@Override
260	public Object clone() {
261		HRExpenseAccountImpl hrExpenseAccountImpl = new HRExpenseAccountImpl();
262
263		hrExpenseAccountImpl.setHrExpenseAccountId(getHrExpenseAccountId());
264		hrExpenseAccountImpl.setGroupId(getGroupId());
265		hrExpenseAccountImpl.setCompanyId(getCompanyId());
266		hrExpenseAccountImpl.setUserId(getUserId());
267		hrExpenseAccountImpl.setUserName(getUserName());
268		hrExpenseAccountImpl.setCreateDate(getCreateDate());
269		hrExpenseAccountImpl.setModifiedDate(getModifiedDate());
270		hrExpenseAccountImpl.setName(getName());
271		hrExpenseAccountImpl.setDescription(getDescription());
272
273		hrExpenseAccountImpl.resetOriginalValues();
274
275		return hrExpenseAccountImpl;
276	}
277
278	public int compareTo(HRExpenseAccount hrExpenseAccount) {
279		long primaryKey = hrExpenseAccount.getPrimaryKey();
280
281		if (getPrimaryKey() < primaryKey) {
282			return -1;
283		}
284		else if (getPrimaryKey() > primaryKey) {
285			return 1;
286		}
287		else {
288			return 0;
289		}
290	}
291
292	@Override
293	public boolean equals(Object obj) {
294		if (obj == null) {
295			return false;
296		}
297
298		HRExpenseAccount hrExpenseAccount = null;
299
300		try {
301			hrExpenseAccount = (HRExpenseAccount)obj;
302		}
303		catch (ClassCastException cce) {
304			return false;
305		}
306
307		long primaryKey = hrExpenseAccount.getPrimaryKey();
308
309		if (getPrimaryKey() == primaryKey) {
310			return true;
311		}
312		else {
313			return false;
314		}
315	}
316
317	@Override
318	public int hashCode() {
319		return (int)getPrimaryKey();
320	}
321
322	@Override
323	public void resetOriginalValues() {
324		HRExpenseAccountModelImpl hrExpenseAccountModelImpl = this;
325
326		hrExpenseAccountModelImpl._originalGroupId = hrExpenseAccountModelImpl._groupId;
327
328		hrExpenseAccountModelImpl._setOriginalGroupId = false;
329
330		hrExpenseAccountModelImpl._originalName = hrExpenseAccountModelImpl._name;
331	}
332
333	@Override
334	public CacheModel<HRExpenseAccount> toCacheModel() {
335		HRExpenseAccountCacheModel hrExpenseAccountCacheModel = new HRExpenseAccountCacheModel();
336
337		hrExpenseAccountCacheModel.hrExpenseAccountId = getHrExpenseAccountId();
338
339		hrExpenseAccountCacheModel.groupId = getGroupId();
340
341		hrExpenseAccountCacheModel.companyId = getCompanyId();
342
343		hrExpenseAccountCacheModel.userId = getUserId();
344
345		hrExpenseAccountCacheModel.userName = getUserName();
346
347		String userName = hrExpenseAccountCacheModel.userName;
348
349		if ((userName != null) && (userName.length() == 0)) {
350			hrExpenseAccountCacheModel.userName = null;
351		}
352
353		Date createDate = getCreateDate();
354
355		if (createDate != null) {
356			hrExpenseAccountCacheModel.createDate = createDate.getTime();
357		}
358		else {
359			hrExpenseAccountCacheModel.createDate = Long.MIN_VALUE;
360		}
361
362		Date modifiedDate = getModifiedDate();
363
364		if (modifiedDate != null) {
365			hrExpenseAccountCacheModel.modifiedDate = modifiedDate.getTime();
366		}
367		else {
368			hrExpenseAccountCacheModel.modifiedDate = Long.MIN_VALUE;
369		}
370
371		hrExpenseAccountCacheModel.name = getName();
372
373		String name = hrExpenseAccountCacheModel.name;
374
375		if ((name != null) && (name.length() == 0)) {
376			hrExpenseAccountCacheModel.name = null;
377		}
378
379		hrExpenseAccountCacheModel.description = getDescription();
380
381		String description = hrExpenseAccountCacheModel.description;
382
383		if ((description != null) && (description.length() == 0)) {
384			hrExpenseAccountCacheModel.description = null;
385		}
386
387		return hrExpenseAccountCacheModel;
388	}
389
390	@Override
391	public String toString() {
392		StringBundler sb = new StringBundler(19);
393
394		sb.append("{hrExpenseAccountId=");
395		sb.append(getHrExpenseAccountId());
396		sb.append(", groupId=");
397		sb.append(getGroupId());
398		sb.append(", companyId=");
399		sb.append(getCompanyId());
400		sb.append(", userId=");
401		sb.append(getUserId());
402		sb.append(", userName=");
403		sb.append(getUserName());
404		sb.append(", createDate=");
405		sb.append(getCreateDate());
406		sb.append(", modifiedDate=");
407		sb.append(getModifiedDate());
408		sb.append(", name=");
409		sb.append(getName());
410		sb.append(", description=");
411		sb.append(getDescription());
412		sb.append("}");
413
414		return sb.toString();
415	}
416
417	public String toXmlString() {
418		StringBundler sb = new StringBundler(31);
419
420		sb.append("<model><model-name>");
421		sb.append("com.liferay.hr.model.HRExpenseAccount");
422		sb.append("</model-name>");
423
424		sb.append(
425			"<column><column-name>hrExpenseAccountId</column-name><column-value><![CDATA[");
426		sb.append(getHrExpenseAccountId());
427		sb.append("]]></column-value></column>");
428		sb.append(
429			"<column><column-name>groupId</column-name><column-value><![CDATA[");
430		sb.append(getGroupId());
431		sb.append("]]></column-value></column>");
432		sb.append(
433			"<column><column-name>companyId</column-name><column-value><![CDATA[");
434		sb.append(getCompanyId());
435		sb.append("]]></column-value></column>");
436		sb.append(
437			"<column><column-name>userId</column-name><column-value><![CDATA[");
438		sb.append(getUserId());
439		sb.append("]]></column-value></column>");
440		sb.append(
441			"<column><column-name>userName</column-name><column-value><![CDATA[");
442		sb.append(getUserName());
443		sb.append("]]></column-value></column>");
444		sb.append(
445			"<column><column-name>createDate</column-name><column-value><![CDATA[");
446		sb.append(getCreateDate());
447		sb.append("]]></column-value></column>");
448		sb.append(
449			"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
450		sb.append(getModifiedDate());
451		sb.append("]]></column-value></column>");
452		sb.append(
453			"<column><column-name>name</column-name><column-value><![CDATA[");
454		sb.append(getName());
455		sb.append("]]></column-value></column>");
456		sb.append(
457			"<column><column-name>description</column-name><column-value><![CDATA[");
458		sb.append(getDescription());
459		sb.append("]]></column-value></column>");
460
461		sb.append("</model>");
462
463		return sb.toString();
464	}
465
466	private static ClassLoader _classLoader = HRExpenseAccount.class.getClassLoader();
467	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
468			HRExpenseAccount.class
469		};
470	private long _hrExpenseAccountId;
471	private long _groupId;
472	private long _originalGroupId;
473	private boolean _setOriginalGroupId;
474	private long _companyId;
475	private long _userId;
476	private String _userUuid;
477	private String _userName;
478	private Date _createDate;
479	private Date _modifiedDate;
480	private String _name;
481	private String _originalName;
482	private String _description;
483	private transient ExpandoBridge _expandoBridge;
484	private HRExpenseAccount _escapedModelProxy;
485}