/**
* 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 org.oep.datamgt.model;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ProxyUtil;
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 org.oep.datamgt.service.ClpSerializer;
import org.oep.datamgt.service.DictCollectionLocalServiceUtil;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @author NQMINH
*/
public class DictCollectionClp extends BaseModelImpl<DictCollection>
implements DictCollection {
public DictCollectionClp() {
}
@Override
public Class<?> getModelClass() {
return DictCollection.class;
}
@Override
public String getModelClassName() {
return DictCollection.class.getName();
}
@Override
public long getPrimaryKey() {
return _dictCollectionId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setDictCollectionId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _dictCollectionId;
}
@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("dictCollectionId", getDictCollectionId());
attributes.put("companyId", getCompanyId());
attributes.put("groupId", getGroupId());
attributes.put("userId", getUserId());
attributes.put("createDate", getCreateDate());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("name", getName());
attributes.put("version", getVersion());
attributes.put("title", getTitle());
attributes.put("validatedFrom", getValidatedFrom());
attributes.put("validatedTo", getValidatedTo());
attributes.put("status", getStatus());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long dictCollectionId = (Long)attributes.get("dictCollectionId");
if (dictCollectionId != null) {
setDictCollectionId(dictCollectionId);
}
Long companyId = (Long)attributes.get("companyId");
if (companyId != null) {
setCompanyId(companyId);
}
Long groupId = (Long)attributes.get("groupId");
if (groupId != null) {
setGroupId(groupId);
}
Long userId = (Long)attributes.get("userId");
if (userId != null) {
setUserId(userId);
}
Date createDate = (Date)attributes.get("createDate");
if (createDate != null) {
setCreateDate(createDate);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
String name = (String)attributes.get("name");
if (name != null) {
setName(name);
}
String version = (String)attributes.get("version");
if (version != null) {
setVersion(version);
}
String title = (String)attributes.get("title");
if (title != null) {
setTitle(title);
}
Date validatedFrom = (Date)attributes.get("validatedFrom");
if (validatedFrom != null) {
setValidatedFrom(validatedFrom);
}
Date validatedTo = (Date)attributes.get("validatedTo");
if (validatedTo != null) {
setValidatedTo(validatedTo);
}
Integer status = (Integer)attributes.get("status");
if (status != null) {
setStatus(status);
}
}
@Override
public long getDictCollectionId() {
return _dictCollectionId;
}
@Override
public void setDictCollectionId(long dictCollectionId) {
_dictCollectionId = dictCollectionId;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setDictCollectionId",
long.class);
method.invoke(_dictCollectionRemoteModel, dictCollectionId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getCompanyId() {
return _companyId;
}
@Override
public void setCompanyId(long companyId) {
_companyId = companyId;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setCompanyId", long.class);
method.invoke(_dictCollectionRemoteModel, companyId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getGroupId() {
return _groupId;
}
@Override
public void setGroupId(long groupId) {
_groupId = groupId;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setGroupId", long.class);
method.invoke(_dictCollectionRemoteModel, groupId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public long getUserId() {
return _userId;
}
@Override
public void setUserId(long userId) {
_userId = userId;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setUserId", long.class);
method.invoke(_dictCollectionRemoteModel, userId);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getUserUuid() throws SystemException {
return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
}
@Override
public void setUserUuid(String userUuid) {
_userUuid = userUuid;
}
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
_createDate = createDate;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setCreateDate", Date.class);
method.invoke(_dictCollectionRemoteModel, createDate);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setModifiedDate", Date.class);
method.invoke(_dictCollectionRemoteModel, modifiedDate);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getName() {
return _name;
}
@Override
public void setName(String name) {
_name = name;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setName", String.class);
method.invoke(_dictCollectionRemoteModel, name);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getVersion() {
return _version;
}
@Override
public void setVersion(String version) {
_version = version;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setVersion", String.class);
method.invoke(_dictCollectionRemoteModel, version);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getTitle() {
return _title;
}
@Override
public void setTitle(String title) {
_title = title;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setTitle", String.class);
method.invoke(_dictCollectionRemoteModel, title);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getValidatedFrom() {
return _validatedFrom;
}
@Override
public void setValidatedFrom(Date validatedFrom) {
_validatedFrom = validatedFrom;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setValidatedFrom", Date.class);
method.invoke(_dictCollectionRemoteModel, validatedFrom);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public Date getValidatedTo() {
return _validatedTo;
}
@Override
public void setValidatedTo(Date validatedTo) {
_validatedTo = validatedTo;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setValidatedTo", Date.class);
method.invoke(_dictCollectionRemoteModel, validatedTo);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public int getStatus() {
return _status;
}
@Override
public void setStatus(int status) {
_status = status;
if (_dictCollectionRemoteModel != null) {
try {
Class<?> clazz = _dictCollectionRemoteModel.getClass();
Method method = clazz.getMethod("setStatus", int.class);
method.invoke(_dictCollectionRemoteModel, status);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
public BaseModel<?> getDictCollectionRemoteModel() {
return _dictCollectionRemoteModel;
}
public void setDictCollectionRemoteModel(
BaseModel<?> dictCollectionRemoteModel) {
_dictCollectionRemoteModel = dictCollectionRemoteModel;
}
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 = _dictCollectionRemoteModel.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(_dictCollectionRemoteModel,
remoteParameterValues);
if (returnValue != null) {
returnValue = ClpSerializer.translateOutput(returnValue);
}
return returnValue;
}
@Override
public void persist() throws SystemException {
if (this.isNew()) {
DictCollectionLocalServiceUtil.addDictCollection(this);
}
else {
DictCollectionLocalServiceUtil.updateDictCollection(this);
}
}
@Override
public DictCollection toEscapedModel() {
return (DictCollection)ProxyUtil.newProxyInstance(DictCollection.class.getClassLoader(),
new Class[] { DictCollection.class },
new AutoEscapeBeanHandler(this));
}
@Override
public Object clone() {
DictCollectionClp clone = new DictCollectionClp();
clone.setDictCollectionId(getDictCollectionId());
clone.setCompanyId(getCompanyId());
clone.setGroupId(getGroupId());
clone.setUserId(getUserId());
clone.setCreateDate(getCreateDate());
clone.setModifiedDate(getModifiedDate());
clone.setName(getName());
clone.setVersion(getVersion());
clone.setTitle(getTitle());
clone.setValidatedFrom(getValidatedFrom());
clone.setValidatedTo(getValidatedTo());
clone.setStatus(getStatus());
return clone;
}
@Override
public int compareTo(DictCollection dictCollection) {
long primaryKey = dictCollection.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
}
else if (getPrimaryKey() > primaryKey) {
return 1;
}
else {
return 0;
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof DictCollectionClp)) {
return false;
}
DictCollectionClp dictCollection = (DictCollectionClp)obj;
long primaryKey = dictCollection.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
public Class<?> getClpSerializerClass() {
return _clpSerializerClass;
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public String toString() {
StringBundler sb = new StringBundler(25);
sb.append("{dictCollectionId=");
sb.append(getDictCollectionId());
sb.append(", companyId=");
sb.append(getCompanyId());
sb.append(", groupId=");
sb.append(getGroupId());
sb.append(", userId=");
sb.append(getUserId());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", name=");
sb.append(getName());
sb.append(", version=");
sb.append(getVersion());
sb.append(", title=");
sb.append(getTitle());
sb.append(", validatedFrom=");
sb.append(getValidatedFrom());
sb.append(", validatedTo=");
sb.append(getValidatedTo());
sb.append(", status=");
sb.append(getStatus());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(40);
sb.append("<model><model-name>");
sb.append("org.oep.datamgt.model.DictCollection");
sb.append("</model-name>");
sb.append(
"<column><column-name>dictCollectionId</column-name><column-value><![CDATA[");
sb.append(getDictCollectionId());
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>groupId</column-name><column-value><![CDATA[");
sb.append(getGroupId());
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>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>name</column-name><column-value><![CDATA[");
sb.append(getName());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>version</column-name><column-value><![CDATA[");
sb.append(getVersion());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>title</column-name><column-value><![CDATA[");
sb.append(getTitle());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>validatedFrom</column-name><column-value><![CDATA[");
sb.append(getValidatedFrom());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>validatedTo</column-name><column-value><![CDATA[");
sb.append(getValidatedTo());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>status</column-name><column-value><![CDATA[");
sb.append(getStatus());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private long _dictCollectionId;
private long _companyId;
private long _groupId;
private long _userId;
private String _userUuid;
private Date _createDate;
private Date _modifiedDate;
private String _name;
private String _version;
private String _title;
private Date _validatedFrom;
private Date _validatedTo;
private int _status;
private BaseModel<?> _dictCollectionRemoteModel;
private Class<?> _clpSerializerClass = org.oep.datamgt.service.ClpSerializer.class;
}