/** * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.ese.ils.beta.model; import com.ese.ils.beta.service.ModuleLocalServiceUtil; import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.model.BaseModel; import com.liferay.portal.model.impl.BaseModelImpl; import com.liferay.portal.util.PortalUtil; import java.io.Serializable; import java.lang.reflect.Proxy; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * @author edik */ public class ModuleClp extends BaseModelImpl<Module> implements Module { public ModuleClp() { } public Class<?> getModelClass() { return Module.class; } public String getModelClassName() { return Module.class.getName(); } public long getPrimaryKey() { return _moduleId; } public void setPrimaryKey(long primaryKey) { setModuleId(primaryKey); } public Serializable getPrimaryKeyObj() { return new Long(_moduleId); } public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("moduleId", getModuleId()); attributes.put("lecturerUserId", getLecturerUserId()); attributes.put("createDate", getCreateDate()); attributes.put("moduleTitle", getModuleTitle()); attributes.put("additionalInfo", getAdditionalInfo()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long moduleId = (Long)attributes.get("moduleId"); if (moduleId != null) { setModuleId(moduleId); } Long lecturerUserId = (Long)attributes.get("lecturerUserId"); if (lecturerUserId != null) { setLecturerUserId(lecturerUserId); } Date createDate = (Date)attributes.get("createDate"); if (createDate != null) { setCreateDate(createDate); } String moduleTitle = (String)attributes.get("moduleTitle"); if (moduleTitle != null) { setModuleTitle(moduleTitle); } String additionalInfo = (String)attributes.get("additionalInfo"); if (additionalInfo != null) { setAdditionalInfo(additionalInfo); } } public long getModuleId() { return _moduleId; } public void setModuleId(long moduleId) { _moduleId = moduleId; } public long getLecturerUserId() { return _lecturerUserId; } public void setLecturerUserId(long lecturerUserId) { _lecturerUserId = lecturerUserId; } public String getLecturerUserUuid() throws SystemException { return PortalUtil.getUserValue(getLecturerUserId(), "uuid", _lecturerUserUuid); } public void setLecturerUserUuid(String lecturerUserUuid) { _lecturerUserUuid = lecturerUserUuid; } public Date getCreateDate() { return _createDate; } public void setCreateDate(Date createDate) { _createDate = createDate; } public String getModuleTitle() { return _moduleTitle; } public void setModuleTitle(String moduleTitle) { _moduleTitle = moduleTitle; } public String getAdditionalInfo() { return _additionalInfo; } public void setAdditionalInfo(String additionalInfo) { _additionalInfo = additionalInfo; } public BaseModel<?> getModuleRemoteModel() { return _moduleRemoteModel; } public void setModuleRemoteModel(BaseModel<?> moduleRemoteModel) { _moduleRemoteModel = moduleRemoteModel; } public void persist() throws SystemException { if (this.isNew()) { ModuleLocalServiceUtil.addModule(this); } else { ModuleLocalServiceUtil.updateModule(this); } } @Override public Module toEscapedModel() { return (Module)Proxy.newProxyInstance(Module.class.getClassLoader(), new Class[] { Module.class }, new AutoEscapeBeanHandler(this)); } @Override public Object clone() { ModuleClp clone = new ModuleClp(); clone.setModuleId(getModuleId()); clone.setLecturerUserId(getLecturerUserId()); clone.setCreateDate(getCreateDate()); clone.setModuleTitle(getModuleTitle()); clone.setAdditionalInfo(getAdditionalInfo()); return clone; } public int compareTo(Module module) { int value = 0; if (getModuleId() < module.getModuleId()) { value = -1; } else if (getModuleId() > module.getModuleId()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } ModuleClp module = null; try { module = (ModuleClp)obj; } catch (ClassCastException cce) { return false; } long primaryKey = module.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public String toString() { StringBundler sb = new StringBundler(11); sb.append("{moduleId="); sb.append(getModuleId()); sb.append(", lecturerUserId="); sb.append(getLecturerUserId()); sb.append(", createDate="); sb.append(getCreateDate()); sb.append(", moduleTitle="); sb.append(getModuleTitle()); sb.append(", additionalInfo="); sb.append(getAdditionalInfo()); sb.append("}"); return sb.toString(); } public String toXmlString() { StringBundler sb = new StringBundler(19); sb.append("<model><model-name>"); sb.append("com.ese.ils.beta.model.Module"); sb.append("</model-name>"); sb.append( "<column><column-name>moduleId</column-name><column-value><![CDATA["); sb.append(getModuleId()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>lecturerUserId</column-name><column-value><![CDATA["); sb.append(getLecturerUserId()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>createDate</column-name><column-value><![CDATA["); sb.append(getCreateDate()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>moduleTitle</column-name><column-value><![CDATA["); sb.append(getModuleTitle()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>additionalInfo</column-name><column-value><![CDATA["); sb.append(getAdditionalInfo()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private long _moduleId; private long _lecturerUserId; private String _lecturerUserUuid; private Date _createDate; private String _moduleTitle; private String _additionalInfo; private BaseModel<?> _moduleRemoteModel; }