/** * 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.dossiermgt.model.impl; import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.json.JSON; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.ProxyUtil; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.model.CacheModel; import com.liferay.portal.model.impl.BaseModelImpl; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.util.PortalUtil; import com.liferay.portlet.expando.model.ExpandoBridge; import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil; import org.oep.dossiermgt.model.ProfileData; import org.oep.dossiermgt.model.ProfileDataModel; import org.oep.dossiermgt.model.ProfileDataSoap; import java.io.Serializable; import java.sql.Types; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * The base model implementation for the ProfileData service. Represents a row in the "oep_dossiermgt_profiledata" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link org.oep.dossiermgt.model.ProfileDataModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ProfileDataImpl}. * </p> * * @author trungdk * @see ProfileDataImpl * @see org.oep.dossiermgt.model.ProfileData * @see org.oep.dossiermgt.model.ProfileDataModel * @generated */ @JSON(strict = true) public class ProfileDataModelImpl extends BaseModelImpl<ProfileData> implements ProfileDataModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a profile data model instance should use the {@link org.oep.dossiermgt.model.ProfileData} interface instead. */ public static final String TABLE_NAME = "oep_dossiermgt_profiledata"; public static final Object[][] TABLE_COLUMNS = { { "profileDataId", Types.BIGINT }, { "userId", Types.BIGINT }, { "groupId", Types.BIGINT }, { "companyId", Types.BIGINT }, { "createDate", Types.TIMESTAMP }, { "modifiedDate", Types.TIMESTAMP }, { "fieldName", Types.VARCHAR }, { "fieldValue", Types.VARCHAR } }; public static final String TABLE_SQL_CREATE = "create table oep_dossiermgt_profiledata (profileDataId LONG not null primary key,userId LONG,groupId LONG,companyId LONG,createDate DATE null,modifiedDate DATE null,fieldName VARCHAR(30) null,fieldValue VARCHAR(200) null)"; public static final String TABLE_SQL_DROP = "drop table oep_dossiermgt_profiledata"; public static final String ORDER_BY_JPQL = " ORDER BY profileData.profileDataId ASC"; public static final String ORDER_BY_SQL = " ORDER BY oep_dossiermgt_profiledata.profileDataId ASC"; public static final String DATA_SOURCE = "liferayDataSource"; public static final String SESSION_FACTORY = "liferaySessionFactory"; public static final String TX_MANAGER = "liferayTransactionManager"; public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.entity.cache.enabled.org.oep.dossiermgt.model.ProfileData"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.finder.cache.enabled.org.oep.dossiermgt.model.ProfileData"), true); public static final boolean COLUMN_BITMASK_ENABLED = false; /** * Converts the soap model instance into a normal model instance. * * @param soapModel the soap model instance to convert * @return the normal model instance */ public static ProfileData toModel(ProfileDataSoap soapModel) { if (soapModel == null) { return null; } ProfileData model = new ProfileDataImpl(); model.setProfileDataId(soapModel.getProfileDataId()); model.setUserId(soapModel.getUserId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setFieldName(soapModel.getFieldName()); model.setFieldValue(soapModel.getFieldValue()); return model; } /** * Converts the soap model instances into normal model instances. * * @param soapModels the soap model instances to convert * @return the normal model instances */ public static List<ProfileData> toModels(ProfileDataSoap[] soapModels) { if (soapModels == null) { return null; } List<ProfileData> models = new ArrayList<ProfileData>(soapModels.length); for (ProfileDataSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( "lock.expiration.time.org.oep.dossiermgt.model.ProfileData")); public ProfileDataModelImpl() { } @Override public long getPrimaryKey() { return _profileDataId; } @Override public void setPrimaryKey(long primaryKey) { setProfileDataId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _profileDataId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return ProfileData.class; } @Override public String getModelClassName() { return ProfileData.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("profileDataId", getProfileDataId()); attributes.put("userId", getUserId()); attributes.put("groupId", getGroupId()); attributes.put("companyId", getCompanyId()); attributes.put("createDate", getCreateDate()); attributes.put("modifiedDate", getModifiedDate()); attributes.put("fieldName", getFieldName()); attributes.put("fieldValue", getFieldValue()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long profileDataId = (Long)attributes.get("profileDataId"); if (profileDataId != null) { setProfileDataId(profileDataId); } Long userId = (Long)attributes.get("userId"); if (userId != null) { setUserId(userId); } Long groupId = (Long)attributes.get("groupId"); if (groupId != null) { setGroupId(groupId); } Long companyId = (Long)attributes.get("companyId"); if (companyId != null) { setCompanyId(companyId); } Date createDate = (Date)attributes.get("createDate"); if (createDate != null) { setCreateDate(createDate); } Date modifiedDate = (Date)attributes.get("modifiedDate"); if (modifiedDate != null) { setModifiedDate(modifiedDate); } String fieldName = (String)attributes.get("fieldName"); if (fieldName != null) { setFieldName(fieldName); } String fieldValue = (String)attributes.get("fieldValue"); if (fieldValue != null) { setFieldValue(fieldValue); } } @JSON @Override public long getProfileDataId() { return _profileDataId; } @Override public void setProfileDataId(long profileDataId) { _profileDataId = profileDataId; } @JSON @Override public long getUserId() { return _userId; } @Override public void setUserId(long userId) { _userId = userId; } @Override public String getUserUuid() throws SystemException { return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid); } @Override public void setUserUuid(String userUuid) { _userUuid = userUuid; } @JSON @Override public long getGroupId() { return _groupId; } @Override public void setGroupId(long groupId) { _groupId = groupId; } @JSON @Override public long getCompanyId() { return _companyId; } @Override public void setCompanyId(long companyId) { _companyId = companyId; } @JSON @Override public Date getCreateDate() { return _createDate; } @Override public void setCreateDate(Date createDate) { _createDate = createDate; } @JSON @Override public Date getModifiedDate() { return _modifiedDate; } @Override public void setModifiedDate(Date modifiedDate) { _modifiedDate = modifiedDate; } @JSON @Override public String getFieldName() { if (_fieldName == null) { return StringPool.BLANK; } else { return _fieldName; } } @Override public void setFieldName(String fieldName) { _fieldName = fieldName; } @JSON @Override public String getFieldValue() { if (_fieldValue == null) { return StringPool.BLANK; } else { return _fieldValue; } } @Override public void setFieldValue(String fieldValue) { _fieldValue = fieldValue; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(), ProfileData.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public ProfileData toEscapedModel() { if (_escapedModel == null) { _escapedModel = (ProfileData)ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { ProfileDataImpl profileDataImpl = new ProfileDataImpl(); profileDataImpl.setProfileDataId(getProfileDataId()); profileDataImpl.setUserId(getUserId()); profileDataImpl.setGroupId(getGroupId()); profileDataImpl.setCompanyId(getCompanyId()); profileDataImpl.setCreateDate(getCreateDate()); profileDataImpl.setModifiedDate(getModifiedDate()); profileDataImpl.setFieldName(getFieldName()); profileDataImpl.setFieldValue(getFieldValue()); profileDataImpl.resetOriginalValues(); return profileDataImpl; } @Override public int compareTo(ProfileData profileData) { long primaryKey = profileData.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 ProfileData)) { return false; } ProfileData profileData = (ProfileData)obj; long primaryKey = profileData.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public void resetOriginalValues() { } @Override public CacheModel<ProfileData> toCacheModel() { ProfileDataCacheModel profileDataCacheModel = new ProfileDataCacheModel(); profileDataCacheModel.profileDataId = getProfileDataId(); profileDataCacheModel.userId = getUserId(); profileDataCacheModel.groupId = getGroupId(); profileDataCacheModel.companyId = getCompanyId(); Date createDate = getCreateDate(); if (createDate != null) { profileDataCacheModel.createDate = createDate.getTime(); } else { profileDataCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { profileDataCacheModel.modifiedDate = modifiedDate.getTime(); } else { profileDataCacheModel.modifiedDate = Long.MIN_VALUE; } profileDataCacheModel.fieldName = getFieldName(); String fieldName = profileDataCacheModel.fieldName; if ((fieldName != null) && (fieldName.length() == 0)) { profileDataCacheModel.fieldName = null; } profileDataCacheModel.fieldValue = getFieldValue(); String fieldValue = profileDataCacheModel.fieldValue; if ((fieldValue != null) && (fieldValue.length() == 0)) { profileDataCacheModel.fieldValue = null; } return profileDataCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(17); sb.append("{profileDataId="); sb.append(getProfileDataId()); sb.append(", userId="); sb.append(getUserId()); sb.append(", groupId="); sb.append(getGroupId()); sb.append(", companyId="); sb.append(getCompanyId()); sb.append(", createDate="); sb.append(getCreateDate()); sb.append(", modifiedDate="); sb.append(getModifiedDate()); sb.append(", fieldName="); sb.append(getFieldName()); sb.append(", fieldValue="); sb.append(getFieldValue()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(28); sb.append("<model><model-name>"); sb.append("org.oep.dossiermgt.model.ProfileData"); sb.append("</model-name>"); sb.append( "<column><column-name>profileDataId</column-name><column-value><![CDATA["); sb.append(getProfileDataId()); 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>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>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>fieldName</column-name><column-value><![CDATA["); sb.append(getFieldName()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>fieldValue</column-name><column-value><![CDATA["); sb.append(getFieldValue()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static ClassLoader _classLoader = ProfileData.class.getClassLoader(); private static Class<?>[] _escapedModelInterfaces = new Class[] { ProfileData.class }; private long _profileDataId; private long _userId; private String _userUuid; private long _groupId; private long _companyId; private Date _createDate; private Date _modifiedDate; private String _fieldName; private String _fieldValue; private ProfileData _escapedModel; }