/**
* Copyright (c) 2000-present 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.liferay.samplelar.model;
import aQute.bnd.annotation.ProviderType;
import com.liferay.exportimport.kernel.lar.StagedModelType;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.model.BaseModel;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.samplelar.service.ClpSerializer;
import com.liferay.samplelar.service.SampleLARBookingLocalServiceUtil;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @generated
*/
@ProviderType
public class SampleLARBookingClp extends BaseModelImpl<SampleLARBooking>
implements SampleLARBooking {
public SampleLARBookingClp() {
}
@Override
public Class<?> getModelClass() {
return SampleLARBooking.class;
}
@Override
public String getModelClassName() {
return SampleLARBooking.class.getName();
}
@Override
public long getPrimaryKey() {
return _sampleLARBookingId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setSampleLARBookingId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _sampleLARBookingId;
}
@Override
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("uuid", getUuid());
attributes.put("sampleLARBookingId", getSampleLARBookingId());
attributes.put("groupId", getGroupId());
attributes.put("companyId", getCompanyId());
attributes.put("userId", getUserId());
attributes.put("userName", getUserName());
attributes.put("createDate", getCreateDate());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("bookingNumber", getBookingNumber());
attributes.put("lastPublishDate", getLastPublishDate());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
String uuid = (String)attributes.get("uuid");
if (uuid != null) {
setUuid(uuid);
}
Long sampleLARBookingId = (Long)attributes.get("sampleLARBookingId");
if (sampleLARBookingId != null) {
setSampleLARBookingId(sampleLARBookingId);
}
Long groupId = (Long)attributes.get("groupId");
if (groupId != null) {
setGroupId(groupId);
}
Long companyId = (Long)attributes.get("companyId");
if (companyId != null) {
setCompanyId(companyId);
}
Long userId = (Long)attributes.get("userId");
if (userId != null) {
setUserId(userId);
}
String userName = (String)attributes.get("userName");
if (userName != null) {
setUserName(userName);
}
Date createDate = (Date)attributes.get("createDate");
if (createDate != null) {
setCreateDate(createDate);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
String bookingNumber = (String)attributes.get("bookingNumber");
if (bookingNumber != null) {
setBookingNumber(bookingNumber);
}
Date lastPublishDate = (Date)attributes.get("lastPublishDate");
if (lastPublishDate != null) {
setLastPublishDate(lastPublishDate);
}
_entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
_finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}
@Override
public String getUuid() {
return _uuid;
}
@Override
public void setUuid(String uuid) {
_uuid = uuid;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setUuid", String.class);
method.invoke(_sampleLARBookingRemoteModel, uuid);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getSampleLARBookingId() {
return _sampleLARBookingId;
}
@Override
public void setSampleLARBookingId(long sampleLARBookingId) {
_sampleLARBookingId = sampleLARBookingId;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setSampleLARBookingId",
long.class);
method.invoke(_sampleLARBookingRemoteModel, sampleLARBookingId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getGroupId() {
return _groupId;
}
@Override
public void setGroupId(long groupId) {
_groupId = groupId;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setGroupId", long.class);
method.invoke(_sampleLARBookingRemoteModel, groupId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getCompanyId() {
return _companyId;
}
@Override
public void setCompanyId(long companyId) {
_companyId = companyId;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setCompanyId", long.class);
method.invoke(_sampleLARBookingRemoteModel, companyId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getUserId() {
return _userId;
}
@Override
public void setUserId(long userId) {
_userId = userId;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setUserId", long.class);
method.invoke(_sampleLARBookingRemoteModel, userId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getUserUuid() {
try {
User user = UserLocalServiceUtil.getUserById(getUserId());
return user.getUuid();
}
catch (PortalException pe) {
return StringPool.BLANK;
}
}
@Override
public void setUserUuid(String userUuid) {
}
@Override
public String getUserName() {
return _userName;
}
@Override
public void setUserName(String userName) {
_userName = userName;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setUserName", String.class);
method.invoke(_sampleLARBookingRemoteModel, userName);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
_createDate = createDate;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setCreateDate", Date.class);
method.invoke(_sampleLARBookingRemoteModel, createDate);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setModifiedDate", Date.class);
method.invoke(_sampleLARBookingRemoteModel, modifiedDate);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getBookingNumber() {
return _bookingNumber;
}
@Override
public void setBookingNumber(String bookingNumber) {
_bookingNumber = bookingNumber;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setBookingNumber", String.class);
method.invoke(_sampleLARBookingRemoteModel, bookingNumber);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getLastPublishDate() {
return _lastPublishDate;
}
@Override
public void setLastPublishDate(Date lastPublishDate) {
_lastPublishDate = lastPublishDate;
if (_sampleLARBookingRemoteModel != null) {
try {
Class<?> clazz = _sampleLARBookingRemoteModel.getClass();
Method method = clazz.getMethod("setLastPublishDate", Date.class);
method.invoke(_sampleLARBookingRemoteModel, lastPublishDate);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public StagedModelType getStagedModelType() {
return new StagedModelType(PortalUtil.getClassNameId(
SampleLARBooking.class.getName()));
}
public BaseModel<?> getSampleLARBookingRemoteModel() {
return _sampleLARBookingRemoteModel;
}
public void setSampleLARBookingRemoteModel(
BaseModel<?> sampleLARBookingRemoteModel) {
_sampleLARBookingRemoteModel = sampleLARBookingRemoteModel;
}
public Object invokeOnRemoteModel(String methodName,
Class<?>[] parameterTypes, Object[] parameterValues)
throws Exception {
Object[] remoteParameterValues = new Object[parameterValues.length];
for (int i = 0; i < parameterValues.length; i++) {
if (parameterValues[i] != null) {
remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
}
}
Class<?> remoteModelClass = _sampleLARBookingRemoteModel.getClass();
ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();
Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
if (parameterTypes[i].isPrimitive()) {
remoteParameterTypes[i] = parameterTypes[i];
}
else {
String parameterTypeName = parameterTypes[i].getName();
remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
}
}
Method method = remoteModelClass.getMethod(methodName,
remoteParameterTypes);
Object returnValue = method.invoke(_sampleLARBookingRemoteModel,
remoteParameterValues);
if (returnValue != null) {
returnValue = ClpSerializer.translateOutput(returnValue);
}
return returnValue;
}
@Override
public void persist() {
if (this.isNew()) {
SampleLARBookingLocalServiceUtil.addSampleLARBooking(this);
}
else {
SampleLARBookingLocalServiceUtil.updateSampleLARBooking(this);
}
}
@Override
public SampleLARBooking toEscapedModel() {
return (SampleLARBooking)ProxyUtil.newProxyInstance(SampleLARBooking.class.getClassLoader(),
new Class[] { SampleLARBooking.class },
new AutoEscapeBeanHandler(this));
}
@Override
public Object clone() {
SampleLARBookingClp clone = new SampleLARBookingClp();
clone.setUuid(getUuid());
clone.setSampleLARBookingId(getSampleLARBookingId());
clone.setGroupId(getGroupId());
clone.setCompanyId(getCompanyId());
clone.setUserId(getUserId());
clone.setUserName(getUserName());
clone.setCreateDate(getCreateDate());
clone.setModifiedDate(getModifiedDate());
clone.setBookingNumber(getBookingNumber());
clone.setLastPublishDate(getLastPublishDate());
return clone;
}
@Override
public int compareTo(SampleLARBooking sampleLARBooking) {
int value = 0;
value = getBookingNumber().compareTo(sampleLARBooking.getBookingNumber());
if (value != 0) {
return value;
}
return 0;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SampleLARBookingClp)) {
return false;
}
SampleLARBookingClp sampleLARBooking = (SampleLARBookingClp)obj;
long primaryKey = sampleLARBooking.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
public Class<?> getClpSerializerClass() {
return _clpSerializerClass;
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public boolean isEntityCacheEnabled() {
return _entityCacheEnabled;
}
@Override
public boolean isFinderCacheEnabled() {
return _finderCacheEnabled;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(21);
sb.append("{uuid=");
sb.append(getUuid());
sb.append(", sampleLARBookingId=");
sb.append(getSampleLARBookingId());
sb.append(", groupId=");
sb.append(getGroupId());
sb.append(", companyId=");
sb.append(getCompanyId());
sb.append(", userId=");
sb.append(getUserId());
sb.append(", userName=");
sb.append(getUserName());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", bookingNumber=");
sb.append(getBookingNumber());
sb.append(", lastPublishDate=");
sb.append(getLastPublishDate());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(34);
sb.append("<model><model-name>");
sb.append("com.liferay.samplelar.model.SampleLARBooking");
sb.append("</model-name>");
sb.append(
"<column><column-name>uuid</column-name><column-value><![CDATA[");
sb.append(getUuid());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>sampleLARBookingId</column-name><column-value><![CDATA[");
sb.append(getSampleLARBookingId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>groupId</column-name><column-value><![CDATA[");
sb.append(getGroupId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>companyId</column-name><column-value><![CDATA[");
sb.append(getCompanyId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>userId</column-name><column-value><![CDATA[");
sb.append(getUserId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>userName</column-name><column-value><![CDATA[");
sb.append(getUserName());
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>modifiedDate</column-name><column-value><![CDATA[");
sb.append(getModifiedDate());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>bookingNumber</column-name><column-value><![CDATA[");
sb.append(getBookingNumber());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>lastPublishDate</column-name><column-value><![CDATA[");
sb.append(getLastPublishDate());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private String _uuid;
private long _sampleLARBookingId;
private long _groupId;
private long _companyId;
private long _userId;
private String _userName;
private Date _createDate;
private Date _modifiedDate;
private String _bookingNumber;
private Date _lastPublishDate;
private BaseModel<?> _sampleLARBookingRemoteModel;
private Class<?> _clpSerializerClass = com.liferay.samplelar.service.ClpSerializer.class;
private boolean _entityCacheEnabled;
private boolean _finderCacheEnabled;
}