PageRenderTime 492ms CodeModel.GetById 15ms RepoModel.GetById 0ms 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. package com.liferay.hr.model.impl;
  15. import com.liferay.hr.model.HRExpenseAccount;
  16. import com.liferay.hr.model.HRExpenseAccountModel;
  17. import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
  18. import com.liferay.portal.kernel.exception.SystemException;
  19. import com.liferay.portal.kernel.util.GetterUtil;
  20. import com.liferay.portal.kernel.util.StringBundler;
  21. import com.liferay.portal.kernel.util.StringPool;
  22. import com.liferay.portal.model.CacheModel;
  23. import com.liferay.portal.model.impl.BaseModelImpl;
  24. import com.liferay.portal.service.ServiceContext;
  25. import com.liferay.portal.util.PortalUtil;
  26. import com.liferay.portlet.expando.model.ExpandoBridge;
  27. import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
  28. import java.io.Serializable;
  29. import java.lang.reflect.Proxy;
  30. import java.sql.Types;
  31. import java.util.Date;
  32. /**
  33. * 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.
  34. *
  35. * <p>
  36. * 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}.
  37. * </p>
  38. *
  39. * @author Wesley Gong
  40. * @see HRExpenseAccountImpl
  41. * @see com.liferay.hr.model.HRExpenseAccount
  42. * @see com.liferay.hr.model.HRExpenseAccountModel
  43. * @generated
  44. */
  45. public class HRExpenseAccountModelImpl extends BaseModelImpl<HRExpenseAccount>
  46. implements HRExpenseAccountModel {
  47. /*
  48. * NOTE FOR DEVELOPERS:
  49. *
  50. * 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.
  51. */
  52. public static final String TABLE_NAME = "HRExpenseAccount";
  53. public static final Object[][] TABLE_COLUMNS = {
  54. { "hrExpenseAccountId", Types.BIGINT },
  55. { "groupId", Types.BIGINT },
  56. { "companyId", Types.BIGINT },
  57. { "userId", Types.BIGINT },
  58. { "userName", Types.VARCHAR },
  59. { "createDate", Types.TIMESTAMP },
  60. { "modifiedDate", Types.TIMESTAMP },
  61. { "name", Types.VARCHAR },
  62. { "description", Types.VARCHAR }
  63. };
  64. 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)";
  65. public static final String TABLE_SQL_DROP = "drop table HRExpenseAccount";
  66. public static final String DATA_SOURCE = "liferayDataSource";
  67. public static final String SESSION_FACTORY = "liferaySessionFactory";
  68. public static final String TX_MANAGER = "liferayTransactionManager";
  69. public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
  70. "value.object.entity.cache.enabled.com.liferay.hr.model.HRExpenseAccount"),
  71. true);
  72. public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
  73. "value.object.finder.cache.enabled.com.liferay.hr.model.HRExpenseAccount"),
  74. true);
  75. public Class<?> getModelClass() {
  76. return HRExpenseAccount.class;
  77. }
  78. public String getModelClassName() {
  79. return HRExpenseAccount.class.getName();
  80. }
  81. public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
  82. "lock.expiration.time.com.liferay.hr.model.HRExpenseAccount"));
  83. public HRExpenseAccountModelImpl() {
  84. }
  85. public long getPrimaryKey() {
  86. return _hrExpenseAccountId;
  87. }
  88. public void setPrimaryKey(long primaryKey) {
  89. setHrExpenseAccountId(primaryKey);
  90. }
  91. public Serializable getPrimaryKeyObj() {
  92. return new Long(_hrExpenseAccountId);
  93. }
  94. public void setPrimaryKeyObj(Serializable primaryKeyObj) {
  95. setPrimaryKey(((Long)primaryKeyObj).longValue());
  96. }
  97. public long getHrExpenseAccountId() {
  98. return _hrExpenseAccountId;
  99. }
  100. public void setHrExpenseAccountId(long hrExpenseAccountId) {
  101. _hrExpenseAccountId = hrExpenseAccountId;
  102. }
  103. public long getGroupId() {
  104. return _groupId;
  105. }
  106. public void setGroupId(long groupId) {
  107. if (!_setOriginalGroupId) {
  108. _setOriginalGroupId = true;
  109. _originalGroupId = _groupId;
  110. }
  111. _groupId = groupId;
  112. }
  113. public long getOriginalGroupId() {
  114. return _originalGroupId;
  115. }
  116. public long getCompanyId() {
  117. return _companyId;
  118. }
  119. public void setCompanyId(long companyId) {
  120. _companyId = companyId;
  121. }
  122. public long getUserId() {
  123. return _userId;
  124. }
  125. public void setUserId(long userId) {
  126. _userId = userId;
  127. }
  128. public String getUserUuid() throws SystemException {
  129. return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
  130. }
  131. public void setUserUuid(String userUuid) {
  132. _userUuid = userUuid;
  133. }
  134. public String getUserName() {
  135. if (_userName == null) {
  136. return StringPool.BLANK;
  137. }
  138. else {
  139. return _userName;
  140. }
  141. }
  142. public void setUserName(String userName) {
  143. _userName = userName;
  144. }
  145. public Date getCreateDate() {
  146. return _createDate;
  147. }
  148. public void setCreateDate(Date createDate) {
  149. _createDate = createDate;
  150. }
  151. public Date getModifiedDate() {
  152. return _modifiedDate;
  153. }
  154. public void setModifiedDate(Date modifiedDate) {
  155. _modifiedDate = modifiedDate;
  156. }
  157. public String getName() {
  158. if (_name == null) {
  159. return StringPool.BLANK;
  160. }
  161. else {
  162. return _name;
  163. }
  164. }
  165. public void setName(String name) {
  166. if (_originalName == null) {
  167. _originalName = _name;
  168. }
  169. _name = name;
  170. }
  171. public String getOriginalName() {
  172. return GetterUtil.getString(_originalName);
  173. }
  174. public String getDescription() {
  175. if (_description == null) {
  176. return StringPool.BLANK;
  177. }
  178. else {
  179. return _description;
  180. }
  181. }
  182. public void setDescription(String description) {
  183. _description = description;
  184. }
  185. @Override
  186. public HRExpenseAccount toEscapedModel() {
  187. if (isEscapedModel()) {
  188. return (HRExpenseAccount)this;
  189. }
  190. else {
  191. if (_escapedModelProxy == null) {
  192. _escapedModelProxy = (HRExpenseAccount)Proxy.newProxyInstance(_classLoader,
  193. _escapedModelProxyInterfaces,
  194. new AutoEscapeBeanHandler(this));
  195. }
  196. return _escapedModelProxy;
  197. }
  198. }
  199. @Override
  200. public ExpandoBridge getExpandoBridge() {
  201. if (_expandoBridge == null) {
  202. _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
  203. HRExpenseAccount.class.getName(), getPrimaryKey());
  204. }
  205. return _expandoBridge;
  206. }
  207. @Override
  208. public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
  209. getExpandoBridge().setAttributes(serviceContext);
  210. }
  211. @Override
  212. public Object clone() {
  213. HRExpenseAccountImpl hrExpenseAccountImpl = new HRExpenseAccountImpl();
  214. hrExpenseAccountImpl.setHrExpenseAccountId(getHrExpenseAccountId());
  215. hrExpenseAccountImpl.setGroupId(getGroupId());
  216. hrExpenseAccountImpl.setCompanyId(getCompanyId());
  217. hrExpenseAccountImpl.setUserId(getUserId());
  218. hrExpenseAccountImpl.setUserName(getUserName());
  219. hrExpenseAccountImpl.setCreateDate(getCreateDate());
  220. hrExpenseAccountImpl.setModifiedDate(getModifiedDate());
  221. hrExpenseAccountImpl.setName(getName());
  222. hrExpenseAccountImpl.setDescription(getDescription());
  223. hrExpenseAccountImpl.resetOriginalValues();
  224. return hrExpenseAccountImpl;
  225. }
  226. public int compareTo(HRExpenseAccount hrExpenseAccount) {
  227. long primaryKey = hrExpenseAccount.getPrimaryKey();
  228. if (getPrimaryKey() < primaryKey) {
  229. return -1;
  230. }
  231. else if (getPrimaryKey() > primaryKey) {
  232. return 1;
  233. }
  234. else {
  235. return 0;
  236. }
  237. }
  238. @Override
  239. public boolean equals(Object obj) {
  240. if (obj == null) {
  241. return false;
  242. }
  243. HRExpenseAccount hrExpenseAccount = null;
  244. try {
  245. hrExpenseAccount = (HRExpenseAccount)obj;
  246. }
  247. catch (ClassCastException cce) {
  248. return false;
  249. }
  250. long primaryKey = hrExpenseAccount.getPrimaryKey();
  251. if (getPrimaryKey() == primaryKey) {
  252. return true;
  253. }
  254. else {
  255. return false;
  256. }
  257. }
  258. @Override
  259. public int hashCode() {
  260. return (int)getPrimaryKey();
  261. }
  262. @Override
  263. public void resetOriginalValues() {
  264. HRExpenseAccountModelImpl hrExpenseAccountModelImpl = this;
  265. hrExpenseAccountModelImpl._originalGroupId = hrExpenseAccountModelImpl._groupId;
  266. hrExpenseAccountModelImpl._setOriginalGroupId = false;
  267. hrExpenseAccountModelImpl._originalName = hrExpenseAccountModelImpl._name;
  268. }
  269. @Override
  270. public CacheModel<HRExpenseAccount> toCacheModel() {
  271. HRExpenseAccountCacheModel hrExpenseAccountCacheModel = new HRExpenseAccountCacheModel();
  272. hrExpenseAccountCacheModel.hrExpenseAccountId = getHrExpenseAccountId();
  273. hrExpenseAccountCacheModel.groupId = getGroupId();
  274. hrExpenseAccountCacheModel.companyId = getCompanyId();
  275. hrExpenseAccountCacheModel.userId = getUserId();
  276. hrExpenseAccountCacheModel.userName = getUserName();
  277. String userName = hrExpenseAccountCacheModel.userName;
  278. if ((userName != null) && (userName.length() == 0)) {
  279. hrExpenseAccountCacheModel.userName = null;
  280. }
  281. Date createDate = getCreateDate();
  282. if (createDate != null) {
  283. hrExpenseAccountCacheModel.createDate = createDate.getTime();
  284. }
  285. else {
  286. hrExpenseAccountCacheModel.createDate = Long.MIN_VALUE;
  287. }
  288. Date modifiedDate = getModifiedDate();
  289. if (modifiedDate != null) {
  290. hrExpenseAccountCacheModel.modifiedDate = modifiedDate.getTime();
  291. }
  292. else {
  293. hrExpenseAccountCacheModel.modifiedDate = Long.MIN_VALUE;
  294. }
  295. hrExpenseAccountCacheModel.name = getName();
  296. String name = hrExpenseAccountCacheModel.name;
  297. if ((name != null) && (name.length() == 0)) {
  298. hrExpenseAccountCacheModel.name = null;
  299. }
  300. hrExpenseAccountCacheModel.description = getDescription();
  301. String description = hrExpenseAccountCacheModel.description;
  302. if ((description != null) && (description.length() == 0)) {
  303. hrExpenseAccountCacheModel.description = null;
  304. }
  305. return hrExpenseAccountCacheModel;
  306. }
  307. @Override
  308. public String toString() {
  309. StringBundler sb = new StringBundler(19);
  310. sb.append("{hrExpenseAccountId=");
  311. sb.append(getHrExpenseAccountId());
  312. sb.append(", groupId=");
  313. sb.append(getGroupId());
  314. sb.append(", companyId=");
  315. sb.append(getCompanyId());
  316. sb.append(", userId=");
  317. sb.append(getUserId());
  318. sb.append(", userName=");
  319. sb.append(getUserName());
  320. sb.append(", createDate=");
  321. sb.append(getCreateDate());
  322. sb.append(", modifiedDate=");
  323. sb.append(getModifiedDate());
  324. sb.append(", name=");
  325. sb.append(getName());
  326. sb.append(", description=");
  327. sb.append(getDescription());
  328. sb.append("}");
  329. return sb.toString();
  330. }
  331. public String toXmlString() {
  332. StringBundler sb = new StringBundler(31);
  333. sb.append("<model><model-name>");
  334. sb.append("com.liferay.hr.model.HRExpenseAccount");
  335. sb.append("</model-name>");
  336. sb.append(
  337. "<column><column-name>hrExpenseAccountId</column-name><column-value><![CDATA[");
  338. sb.append(getHrExpenseAccountId());
  339. sb.append("]]></column-value></column>");
  340. sb.append(
  341. "<column><column-name>groupId</column-name><column-value><![CDATA[");
  342. sb.append(getGroupId());
  343. sb.append("]]></column-value></column>");
  344. sb.append(
  345. "<column><column-name>companyId</column-name><column-value><![CDATA[");
  346. sb.append(getCompanyId());
  347. sb.append("]]></column-value></column>");
  348. sb.append(
  349. "<column><column-name>userId</column-name><column-value><![CDATA[");
  350. sb.append(getUserId());
  351. sb.append("]]></column-value></column>");
  352. sb.append(
  353. "<column><column-name>userName</column-name><column-value><![CDATA[");
  354. sb.append(getUserName());
  355. sb.append("]]></column-value></column>");
  356. sb.append(
  357. "<column><column-name>createDate</column-name><column-value><![CDATA[");
  358. sb.append(getCreateDate());
  359. sb.append("]]></column-value></column>");
  360. sb.append(
  361. "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
  362. sb.append(getModifiedDate());
  363. sb.append("]]></column-value></column>");
  364. sb.append(
  365. "<column><column-name>name</column-name><column-value><![CDATA[");
  366. sb.append(getName());
  367. sb.append("]]></column-value></column>");
  368. sb.append(
  369. "<column><column-name>description</column-name><column-value><![CDATA[");
  370. sb.append(getDescription());
  371. sb.append("]]></column-value></column>");
  372. sb.append("</model>");
  373. return sb.toString();
  374. }
  375. private static ClassLoader _classLoader = HRExpenseAccount.class.getClassLoader();
  376. private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
  377. HRExpenseAccount.class
  378. };
  379. private long _hrExpenseAccountId;
  380. private long _groupId;
  381. private long _originalGroupId;
  382. private boolean _setOriginalGroupId;
  383. private long _companyId;
  384. private long _userId;
  385. private String _userUuid;
  386. private String _userName;
  387. private Date _createDate;
  388. private Date _modifiedDate;
  389. private String _name;
  390. private String _originalName;
  391. private String _description;
  392. private transient ExpandoBridge _expandoBridge;
  393. private HRExpenseAccount _escapedModelProxy;
  394. }