Java tutorial
/** * 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.tahir.meeting.model.impl; import aQute.bnd.annotation.ProviderType; import com.liferay.expando.kernel.model.ExpandoBridge; import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil; 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.json.JSON; import com.liferay.portal.kernel.model.CacheModel; import com.liferay.portal.kernel.model.User; import com.liferay.portal.kernel.model.impl.BaseModelImpl; import com.liferay.portal.kernel.service.ServiceContext; 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.tahir.meeting.model.Himalaya; import com.tahir.meeting.model.HimalayaModel; import com.tahir.meeting.model.HimalayaSoap; 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 Himalaya service. Represents a row in the "meeting_Himalaya" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link HimalayaModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link HimalayaImpl}. * </p> * * @author Tahir Noor * @see HimalayaImpl * @see Himalaya * @see HimalayaModel * @generated */ @JSON(strict = true) @ProviderType public class HimalayaModelImpl extends BaseModelImpl<Himalaya> implements HimalayaModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a himalaya model instance should use the {@link Himalaya} interface instead. */ public static final String TABLE_NAME = "meeting_Himalaya"; public static final Object[][] TABLE_COLUMNS = { { "uuid_", Types.VARCHAR }, { "himalayaId", Types.BIGINT }, { "groupId", Types.BIGINT }, { "companyId", Types.BIGINT }, { "userId", Types.BIGINT }, { "userName", Types.VARCHAR }, { "createDate", Types.TIMESTAMP }, { "modifiedDate", Types.TIMESTAMP }, { "name", Types.VARCHAR }, { "designation", Types.VARCHAR }, { "comapany", Types.VARCHAR }, { "dob", Types.TIMESTAMP }, { "doj", Types.TIMESTAMP } }; public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>(); static { TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("himalayaId", Types.BIGINT); TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT); TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT); TABLE_COLUMNS_MAP.put("userId", Types.BIGINT); TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR); TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("designation", Types.VARCHAR); TABLE_COLUMNS_MAP.put("comapany", Types.VARCHAR); TABLE_COLUMNS_MAP.put("dob", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("doj", Types.TIMESTAMP); } public static final String TABLE_SQL_CREATE = "create table meeting_Himalaya (uuid_ VARCHAR(75) null,himalayaId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,designation VARCHAR(75) null,comapany VARCHAR(75) null,dob DATE null,doj DATE null)"; public static final String TABLE_SQL_DROP = "drop table meeting_Himalaya"; public static final String ORDER_BY_JPQL = " ORDER BY himalaya.himalayaId ASC"; public static final String ORDER_BY_SQL = " ORDER BY meeting_Himalaya.himalayaId 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.tahir.meeting.service.util.ServiceProps .get("value.object.entity.cache.enabled.com.tahir.meeting.model.Himalaya"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil .getBoolean(com.tahir.meeting.service.util.ServiceProps .get("value.object.finder.cache.enabled.com.tahir.meeting.model.Himalaya"), true); public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil .getBoolean(com.tahir.meeting.service.util.ServiceProps .get("value.object.column.bitmask.enabled.com.tahir.meeting.model.Himalaya"), true); public static final long COMPANYID_COLUMN_BITMASK = 1L; public static final long GROUPID_COLUMN_BITMASK = 2L; public static final long UUID_COLUMN_BITMASK = 4L; public static final long HIMALAYAID_COLUMN_BITMASK = 8L; /** * 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 Himalaya toModel(HimalayaSoap soapModel) { if (soapModel == null) { return null; } Himalaya model = new HimalayaImpl(); model.setUuid(soapModel.getUuid()); model.setHimalayaId(soapModel.getHimalayaId()); model.setGroupId(soapModel.getGroupId()); model.setCompanyId(soapModel.getCompanyId()); model.setUserId(soapModel.getUserId()); model.setUserName(soapModel.getUserName()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setName(soapModel.getName()); model.setDesignation(soapModel.getDesignation()); model.setComapany(soapModel.getComapany()); model.setDob(soapModel.getDob()); model.setDoj(soapModel.getDoj()); 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<Himalaya> toModels(HimalayaSoap[] soapModels) { if (soapModels == null) { return null; } List<Himalaya> models = new ArrayList<Himalaya>(soapModels.length); for (HimalayaSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.tahir.meeting.service.util.ServiceProps .get("lock.expiration.time.com.tahir.meeting.model.Himalaya")); public HimalayaModelImpl() { } @Override public long getPrimaryKey() { return _himalayaId; } @Override public void setPrimaryKey(long primaryKey) { setHimalayaId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _himalayaId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long) primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return Himalaya.class; } @Override public String getModelClassName() { return Himalaya.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("uuid", getUuid()); attributes.put("himalayaId", getHimalayaId()); 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("name", getName()); attributes.put("designation", getDesignation()); attributes.put("comapany", getComapany()); attributes.put("dob", getDob()); attributes.put("doj", getDoj()); 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 himalayaId = (Long) attributes.get("himalayaId"); if (himalayaId != null) { setHimalayaId(himalayaId); } 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 name = (String) attributes.get("name"); if (name != null) { setName(name); } String designation = (String) attributes.get("designation"); if (designation != null) { setDesignation(designation); } String comapany = (String) attributes.get("comapany"); if (comapany != null) { setComapany(comapany); } Date dob = (Date) attributes.get("dob"); if (dob != null) { setDob(dob); } Date doj = (Date) attributes.get("doj"); if (doj != null) { setDoj(doj); } } @JSON @Override public String getUuid() { if (_uuid == null) { return StringPool.BLANK; } else { return _uuid; } } @Override public void setUuid(String uuid) { if (_originalUuid == null) { _originalUuid = _uuid; } _uuid = uuid; } public String getOriginalUuid() { return GetterUtil.getString(_originalUuid); } @JSON @Override public long getHimalayaId() { return _himalayaId; } @Override public void setHimalayaId(long himalayaId) { _himalayaId = himalayaId; } @JSON @Override public long getGroupId() { return _groupId; } @Override public void setGroupId(long groupId) { _columnBitmask |= GROUPID_COLUMN_BITMASK; if (!_setOriginalGroupId) { _setOriginalGroupId = true; _originalGroupId = _groupId; } _groupId = groupId; } public long getOriginalGroupId() { return _originalGroupId; } @JSON @Override public long getCompanyId() { return _companyId; } @Override public void setCompanyId(long companyId) { _columnBitmask |= COMPANYID_COLUMN_BITMASK; if (!_setOriginalCompanyId) { _setOriginalCompanyId = true; _originalCompanyId = _companyId; } _companyId = companyId; } public long getOriginalCompanyId() { return _originalCompanyId; } @JSON @Override public long getUserId() { return _userId; } @Override public void setUserId(long userId) { _userId = userId; } @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) { } @JSON @Override public String getUserName() { if (_userName == null) { return StringPool.BLANK; } else { return _userName; } } @Override public void setUserName(String userName) { _userName = userName; } @JSON @Override public Date getCreateDate() { return _createDate; } @Override public void setCreateDate(Date createDate) { _createDate = createDate; } @JSON @Override public Date getModifiedDate() { return _modifiedDate; } public boolean hasSetModifiedDate() { return _setModifiedDate; } @Override public void setModifiedDate(Date modifiedDate) { _setModifiedDate = true; _modifiedDate = modifiedDate; } @JSON @Override public String getName() { if (_name == null) { return StringPool.BLANK; } else { return _name; } } @Override public void setName(String name) { _name = name; } @JSON @Override public String getDesignation() { if (_designation == null) { return StringPool.BLANK; } else { return _designation; } } @Override public void setDesignation(String designation) { _designation = designation; } @JSON @Override public String getComapany() { if (_comapany == null) { return StringPool.BLANK; } else { return _comapany; } } @Override public void setComapany(String comapany) { _comapany = comapany; } @JSON @Override public Date getDob() { return _dob; } @Override public void setDob(Date dob) { _dob = dob; } @JSON @Override public Date getDoj() { return _doj; } @Override public void setDoj(Date doj) { _doj = doj; } @Override public StagedModelType getStagedModelType() { return new StagedModelType(PortalUtil.getClassNameId(Himalaya.class.getName())); } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(), Himalaya.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public Himalaya toEscapedModel() { if (_escapedModel == null) { _escapedModel = (Himalaya) ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { HimalayaImpl himalayaImpl = new HimalayaImpl(); himalayaImpl.setUuid(getUuid()); himalayaImpl.setHimalayaId(getHimalayaId()); himalayaImpl.setGroupId(getGroupId()); himalayaImpl.setCompanyId(getCompanyId()); himalayaImpl.setUserId(getUserId()); himalayaImpl.setUserName(getUserName()); himalayaImpl.setCreateDate(getCreateDate()); himalayaImpl.setModifiedDate(getModifiedDate()); himalayaImpl.setName(getName()); himalayaImpl.setDesignation(getDesignation()); himalayaImpl.setComapany(getComapany()); himalayaImpl.setDob(getDob()); himalayaImpl.setDoj(getDoj()); himalayaImpl.resetOriginalValues(); return himalayaImpl; } @Override public int compareTo(Himalaya himalaya) { long primaryKey = himalaya.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 Himalaya)) { return false; } Himalaya himalaya = (Himalaya) obj; long primaryKey = himalaya.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int) getPrimaryKey(); } @Override public boolean isEntityCacheEnabled() { return ENTITY_CACHE_ENABLED; } @Override public boolean isFinderCacheEnabled() { return FINDER_CACHE_ENABLED; } @Override public void resetOriginalValues() { HimalayaModelImpl himalayaModelImpl = this; himalayaModelImpl._originalUuid = himalayaModelImpl._uuid; himalayaModelImpl._originalGroupId = himalayaModelImpl._groupId; himalayaModelImpl._setOriginalGroupId = false; himalayaModelImpl._originalCompanyId = himalayaModelImpl._companyId; himalayaModelImpl._setOriginalCompanyId = false; himalayaModelImpl._setModifiedDate = false; himalayaModelImpl._columnBitmask = 0; } @Override public CacheModel<Himalaya> toCacheModel() { HimalayaCacheModel himalayaCacheModel = new HimalayaCacheModel(); himalayaCacheModel.uuid = getUuid(); String uuid = himalayaCacheModel.uuid; if ((uuid != null) && (uuid.length() == 0)) { himalayaCacheModel.uuid = null; } himalayaCacheModel.himalayaId = getHimalayaId(); himalayaCacheModel.groupId = getGroupId(); himalayaCacheModel.companyId = getCompanyId(); himalayaCacheModel.userId = getUserId(); himalayaCacheModel.userName = getUserName(); String userName = himalayaCacheModel.userName; if ((userName != null) && (userName.length() == 0)) { himalayaCacheModel.userName = null; } Date createDate = getCreateDate(); if (createDate != null) { himalayaCacheModel.createDate = createDate.getTime(); } else { himalayaCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { himalayaCacheModel.modifiedDate = modifiedDate.getTime(); } else { himalayaCacheModel.modifiedDate = Long.MIN_VALUE; } himalayaCacheModel.name = getName(); String name = himalayaCacheModel.name; if ((name != null) && (name.length() == 0)) { himalayaCacheModel.name = null; } himalayaCacheModel.designation = getDesignation(); String designation = himalayaCacheModel.designation; if ((designation != null) && (designation.length() == 0)) { himalayaCacheModel.designation = null; } himalayaCacheModel.comapany = getComapany(); String comapany = himalayaCacheModel.comapany; if ((comapany != null) && (comapany.length() == 0)) { himalayaCacheModel.comapany = null; } Date dob = getDob(); if (dob != null) { himalayaCacheModel.dob = dob.getTime(); } else { himalayaCacheModel.dob = Long.MIN_VALUE; } Date doj = getDoj(); if (doj != null) { himalayaCacheModel.doj = doj.getTime(); } else { himalayaCacheModel.doj = Long.MIN_VALUE; } return himalayaCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(27); sb.append("{uuid="); sb.append(getUuid()); sb.append(", himalayaId="); sb.append(getHimalayaId()); 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(", name="); sb.append(getName()); sb.append(", designation="); sb.append(getDesignation()); sb.append(", comapany="); sb.append(getComapany()); sb.append(", dob="); sb.append(getDob()); sb.append(", doj="); sb.append(getDoj()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(43); sb.append("<model><model-name>"); sb.append("com.tahir.meeting.model.Himalaya"); 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>himalayaId</column-name><column-value><![CDATA["); sb.append(getHimalayaId()); 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>name</column-name><column-value><![CDATA["); sb.append(getName()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>designation</column-name><column-value><![CDATA["); sb.append(getDesignation()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>comapany</column-name><column-value><![CDATA["); sb.append(getComapany()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>dob</column-name><column-value><![CDATA["); sb.append(getDob()); sb.append("]]></column-value></column>"); sb.append("<column><column-name>doj</column-name><column-value><![CDATA["); sb.append(getDoj()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static final ClassLoader _classLoader = Himalaya.class.getClassLoader(); private static final Class<?>[] _escapedModelInterfaces = new Class[] { Himalaya.class }; private String _uuid; private String _originalUuid; private long _himalayaId; private long _groupId; private long _originalGroupId; private boolean _setOriginalGroupId; private long _companyId; private long _originalCompanyId; private boolean _setOriginalCompanyId; private long _userId; private String _userName; private Date _createDate; private Date _modifiedDate; private boolean _setModifiedDate; private String _name; private String _designation; private String _comapany; private Date _dob; private Date _doj; private long _columnBitmask; private Himalaya _escapedModel; }