PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/stevenjiancao/liferay-plugins
Java | 501 lines | 380 code | 90 blank | 31 comment | 28 complexity | 5a552368394cb69aed3cd134eccbf577 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.HRUserProject;
  16. import com.liferay.hr.model.HRUserProjectModel;
  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 HRUserProject service. Represents a row in the "HRUserProject" 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.HRUserProjectModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link HRUserProjectImpl}.
  37. * </p>
  38. *
  39. * @author Wesley Gong
  40. * @see HRUserProjectImpl
  41. * @see com.liferay.hr.model.HRUserProject
  42. * @see com.liferay.hr.model.HRUserProjectModel
  43. * @generated
  44. */
  45. public class HRUserProjectModelImpl extends BaseModelImpl<HRUserProject>
  46. implements HRUserProjectModel {
  47. /*
  48. * NOTE FOR DEVELOPERS:
  49. *
  50. * Never modify or reference this class directly. All methods that expect a h r user project model instance should use the {@link com.liferay.hr.model.HRUserProject} interface instead.
  51. */
  52. public static final String TABLE_NAME = "HRUserProject";
  53. public static final Object[][] TABLE_COLUMNS = {
  54. { "hrUserProjectId", 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. { "hrProjectBillingRateId", Types.BIGINT },
  62. { "hrProjectId", Types.BIGINT },
  63. { "hrProjectRoleId", Types.BIGINT },
  64. { "hrUserId", Types.BIGINT },
  65. { "actualRate", Types.DOUBLE }
  66. };
  67. public static final String TABLE_SQL_CREATE = "create table HRUserProject (hrUserProjectId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,hrProjectBillingRateId LONG,hrProjectId LONG,hrProjectRoleId LONG,hrUserId LONG,actualRate DOUBLE)";
  68. public static final String TABLE_SQL_DROP = "drop table HRUserProject";
  69. public static final String DATA_SOURCE = "liferayDataSource";
  70. public static final String SESSION_FACTORY = "liferaySessionFactory";
  71. public static final String TX_MANAGER = "liferayTransactionManager";
  72. public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
  73. "value.object.entity.cache.enabled.com.liferay.hr.model.HRUserProject"),
  74. true);
  75. public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
  76. "value.object.finder.cache.enabled.com.liferay.hr.model.HRUserProject"),
  77. true);
  78. public Class<?> getModelClass() {
  79. return HRUserProject.class;
  80. }
  81. public String getModelClassName() {
  82. return HRUserProject.class.getName();
  83. }
  84. public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
  85. "lock.expiration.time.com.liferay.hr.model.HRUserProject"));
  86. public HRUserProjectModelImpl() {
  87. }
  88. public long getPrimaryKey() {
  89. return _hrUserProjectId;
  90. }
  91. public void setPrimaryKey(long primaryKey) {
  92. setHrUserProjectId(primaryKey);
  93. }
  94. public Serializable getPrimaryKeyObj() {
  95. return new Long(_hrUserProjectId);
  96. }
  97. public void setPrimaryKeyObj(Serializable primaryKeyObj) {
  98. setPrimaryKey(((Long)primaryKeyObj).longValue());
  99. }
  100. public long getHrUserProjectId() {
  101. return _hrUserProjectId;
  102. }
  103. public void setHrUserProjectId(long hrUserProjectId) {
  104. _hrUserProjectId = hrUserProjectId;
  105. }
  106. public long getGroupId() {
  107. return _groupId;
  108. }
  109. public void setGroupId(long groupId) {
  110. _groupId = groupId;
  111. }
  112. public long getCompanyId() {
  113. return _companyId;
  114. }
  115. public void setCompanyId(long companyId) {
  116. _companyId = companyId;
  117. }
  118. public long getUserId() {
  119. return _userId;
  120. }
  121. public void setUserId(long userId) {
  122. _userId = userId;
  123. }
  124. public String getUserUuid() throws SystemException {
  125. return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
  126. }
  127. public void setUserUuid(String userUuid) {
  128. _userUuid = userUuid;
  129. }
  130. public String getUserName() {
  131. if (_userName == null) {
  132. return StringPool.BLANK;
  133. }
  134. else {
  135. return _userName;
  136. }
  137. }
  138. public void setUserName(String userName) {
  139. _userName = userName;
  140. }
  141. public Date getCreateDate() {
  142. return _createDate;
  143. }
  144. public void setCreateDate(Date createDate) {
  145. _createDate = createDate;
  146. }
  147. public Date getModifiedDate() {
  148. return _modifiedDate;
  149. }
  150. public void setModifiedDate(Date modifiedDate) {
  151. _modifiedDate = modifiedDate;
  152. }
  153. public long getHrProjectBillingRateId() {
  154. return _hrProjectBillingRateId;
  155. }
  156. public void setHrProjectBillingRateId(long hrProjectBillingRateId) {
  157. _hrProjectBillingRateId = hrProjectBillingRateId;
  158. }
  159. public long getHrProjectId() {
  160. return _hrProjectId;
  161. }
  162. public void setHrProjectId(long hrProjectId) {
  163. _hrProjectId = hrProjectId;
  164. }
  165. public long getHrProjectRoleId() {
  166. return _hrProjectRoleId;
  167. }
  168. public void setHrProjectRoleId(long hrProjectRoleId) {
  169. _hrProjectRoleId = hrProjectRoleId;
  170. }
  171. public long getHrUserId() {
  172. return _hrUserId;
  173. }
  174. public void setHrUserId(long hrUserId) {
  175. _hrUserId = hrUserId;
  176. }
  177. public String getHrUserUuid() throws SystemException {
  178. return PortalUtil.getUserValue(getHrUserId(), "uuid", _hrUserUuid);
  179. }
  180. public void setHrUserUuid(String hrUserUuid) {
  181. _hrUserUuid = hrUserUuid;
  182. }
  183. public double getActualRate() {
  184. return _actualRate;
  185. }
  186. public void setActualRate(double actualRate) {
  187. _actualRate = actualRate;
  188. }
  189. @Override
  190. public HRUserProject toEscapedModel() {
  191. if (isEscapedModel()) {
  192. return (HRUserProject)this;
  193. }
  194. else {
  195. if (_escapedModelProxy == null) {
  196. _escapedModelProxy = (HRUserProject)Proxy.newProxyInstance(_classLoader,
  197. _escapedModelProxyInterfaces,
  198. new AutoEscapeBeanHandler(this));
  199. }
  200. return _escapedModelProxy;
  201. }
  202. }
  203. @Override
  204. public ExpandoBridge getExpandoBridge() {
  205. if (_expandoBridge == null) {
  206. _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
  207. HRUserProject.class.getName(), getPrimaryKey());
  208. }
  209. return _expandoBridge;
  210. }
  211. @Override
  212. public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
  213. getExpandoBridge().setAttributes(serviceContext);
  214. }
  215. @Override
  216. public Object clone() {
  217. HRUserProjectImpl hrUserProjectImpl = new HRUserProjectImpl();
  218. hrUserProjectImpl.setHrUserProjectId(getHrUserProjectId());
  219. hrUserProjectImpl.setGroupId(getGroupId());
  220. hrUserProjectImpl.setCompanyId(getCompanyId());
  221. hrUserProjectImpl.setUserId(getUserId());
  222. hrUserProjectImpl.setUserName(getUserName());
  223. hrUserProjectImpl.setCreateDate(getCreateDate());
  224. hrUserProjectImpl.setModifiedDate(getModifiedDate());
  225. hrUserProjectImpl.setHrProjectBillingRateId(getHrProjectBillingRateId());
  226. hrUserProjectImpl.setHrProjectId(getHrProjectId());
  227. hrUserProjectImpl.setHrProjectRoleId(getHrProjectRoleId());
  228. hrUserProjectImpl.setHrUserId(getHrUserId());
  229. hrUserProjectImpl.setActualRate(getActualRate());
  230. hrUserProjectImpl.resetOriginalValues();
  231. return hrUserProjectImpl;
  232. }
  233. public int compareTo(HRUserProject hrUserProject) {
  234. long primaryKey = hrUserProject.getPrimaryKey();
  235. if (getPrimaryKey() < primaryKey) {
  236. return -1;
  237. }
  238. else if (getPrimaryKey() > primaryKey) {
  239. return 1;
  240. }
  241. else {
  242. return 0;
  243. }
  244. }
  245. @Override
  246. public boolean equals(Object obj) {
  247. if (obj == null) {
  248. return false;
  249. }
  250. HRUserProject hrUserProject = null;
  251. try {
  252. hrUserProject = (HRUserProject)obj;
  253. }
  254. catch (ClassCastException cce) {
  255. return false;
  256. }
  257. long primaryKey = hrUserProject.getPrimaryKey();
  258. if (getPrimaryKey() == primaryKey) {
  259. return true;
  260. }
  261. else {
  262. return false;
  263. }
  264. }
  265. @Override
  266. public int hashCode() {
  267. return (int)getPrimaryKey();
  268. }
  269. @Override
  270. public void resetOriginalValues() {
  271. }
  272. @Override
  273. public CacheModel<HRUserProject> toCacheModel() {
  274. HRUserProjectCacheModel hrUserProjectCacheModel = new HRUserProjectCacheModel();
  275. hrUserProjectCacheModel.hrUserProjectId = getHrUserProjectId();
  276. hrUserProjectCacheModel.groupId = getGroupId();
  277. hrUserProjectCacheModel.companyId = getCompanyId();
  278. hrUserProjectCacheModel.userId = getUserId();
  279. hrUserProjectCacheModel.userName = getUserName();
  280. String userName = hrUserProjectCacheModel.userName;
  281. if ((userName != null) && (userName.length() == 0)) {
  282. hrUserProjectCacheModel.userName = null;
  283. }
  284. Date createDate = getCreateDate();
  285. if (createDate != null) {
  286. hrUserProjectCacheModel.createDate = createDate.getTime();
  287. }
  288. else {
  289. hrUserProjectCacheModel.createDate = Long.MIN_VALUE;
  290. }
  291. Date modifiedDate = getModifiedDate();
  292. if (modifiedDate != null) {
  293. hrUserProjectCacheModel.modifiedDate = modifiedDate.getTime();
  294. }
  295. else {
  296. hrUserProjectCacheModel.modifiedDate = Long.MIN_VALUE;
  297. }
  298. hrUserProjectCacheModel.hrProjectBillingRateId = getHrProjectBillingRateId();
  299. hrUserProjectCacheModel.hrProjectId = getHrProjectId();
  300. hrUserProjectCacheModel.hrProjectRoleId = getHrProjectRoleId();
  301. hrUserProjectCacheModel.hrUserId = getHrUserId();
  302. hrUserProjectCacheModel.actualRate = getActualRate();
  303. return hrUserProjectCacheModel;
  304. }
  305. @Override
  306. public String toString() {
  307. StringBundler sb = new StringBundler(25);
  308. sb.append("{hrUserProjectId=");
  309. sb.append(getHrUserProjectId());
  310. sb.append(", groupId=");
  311. sb.append(getGroupId());
  312. sb.append(", companyId=");
  313. sb.append(getCompanyId());
  314. sb.append(", userId=");
  315. sb.append(getUserId());
  316. sb.append(", userName=");
  317. sb.append(getUserName());
  318. sb.append(", createDate=");
  319. sb.append(getCreateDate());
  320. sb.append(", modifiedDate=");
  321. sb.append(getModifiedDate());
  322. sb.append(", hrProjectBillingRateId=");
  323. sb.append(getHrProjectBillingRateId());
  324. sb.append(", hrProjectId=");
  325. sb.append(getHrProjectId());
  326. sb.append(", hrProjectRoleId=");
  327. sb.append(getHrProjectRoleId());
  328. sb.append(", hrUserId=");
  329. sb.append(getHrUserId());
  330. sb.append(", actualRate=");
  331. sb.append(getActualRate());
  332. sb.append("}");
  333. return sb.toString();
  334. }
  335. public String toXmlString() {
  336. StringBundler sb = new StringBundler(40);
  337. sb.append("<model><model-name>");
  338. sb.append("com.liferay.hr.model.HRUserProject");
  339. sb.append("</model-name>");
  340. sb.append(
  341. "<column><column-name>hrUserProjectId</column-name><column-value><![CDATA[");
  342. sb.append(getHrUserProjectId());
  343. sb.append("]]></column-value></column>");
  344. sb.append(
  345. "<column><column-name>groupId</column-name><column-value><![CDATA[");
  346. sb.append(getGroupId());
  347. sb.append("]]></column-value></column>");
  348. sb.append(
  349. "<column><column-name>companyId</column-name><column-value><![CDATA[");
  350. sb.append(getCompanyId());
  351. sb.append("]]></column-value></column>");
  352. sb.append(
  353. "<column><column-name>userId</column-name><column-value><![CDATA[");
  354. sb.append(getUserId());
  355. sb.append("]]></column-value></column>");
  356. sb.append(
  357. "<column><column-name>userName</column-name><column-value><![CDATA[");
  358. sb.append(getUserName());
  359. sb.append("]]></column-value></column>");
  360. sb.append(
  361. "<column><column-name>createDate</column-name><column-value><![CDATA[");
  362. sb.append(getCreateDate());
  363. sb.append("]]></column-value></column>");
  364. sb.append(
  365. "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
  366. sb.append(getModifiedDate());
  367. sb.append("]]></column-value></column>");
  368. sb.append(
  369. "<column><column-name>hrProjectBillingRateId</column-name><column-value><![CDATA[");
  370. sb.append(getHrProjectBillingRateId());
  371. sb.append("]]></column-value></column>");
  372. sb.append(
  373. "<column><column-name>hrProjectId</column-name><column-value><![CDATA[");
  374. sb.append(getHrProjectId());
  375. sb.append("]]></column-value></column>");
  376. sb.append(
  377. "<column><column-name>hrProjectRoleId</column-name><column-value><![CDATA[");
  378. sb.append(getHrProjectRoleId());
  379. sb.append("]]></column-value></column>");
  380. sb.append(
  381. "<column><column-name>hrUserId</column-name><column-value><![CDATA[");
  382. sb.append(getHrUserId());
  383. sb.append("]]></column-value></column>");
  384. sb.append(
  385. "<column><column-name>actualRate</column-name><column-value><![CDATA[");
  386. sb.append(getActualRate());
  387. sb.append("]]></column-value></column>");
  388. sb.append("</model>");
  389. return sb.toString();
  390. }
  391. private static ClassLoader _classLoader = HRUserProject.class.getClassLoader();
  392. private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
  393. HRUserProject.class
  394. };
  395. private long _hrUserProjectId;
  396. private long _groupId;
  397. private long _companyId;
  398. private long _userId;
  399. private String _userUuid;
  400. private String _userName;
  401. private Date _createDate;
  402. private Date _modifiedDate;
  403. private long _hrProjectBillingRateId;
  404. private long _hrProjectId;
  405. private long _hrProjectRoleId;
  406. private long _hrUserId;
  407. private String _hrUserUuid;
  408. private double _actualRate;
  409. private transient ExpandoBridge _expandoBridge;
  410. private HRUserProject _escapedModelProxy;
  411. }