/**
* 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.portal.model.impl;
import aQute.bnd.annotation.ProviderType;
import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
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.LayoutBranch;
import com.liferay.portal.kernel.model.LayoutBranchModel;
import com.liferay.portal.kernel.model.LayoutBranchSoap;
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.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import java.io.Serializable;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The base model implementation for the LayoutBranch service. Represents a row in the "LayoutBranch" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link LayoutBranchModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link LayoutBranchImpl}.
* </p>
*
* @author Brian Wing Shun Chan
* @see LayoutBranchImpl
* @see LayoutBranch
* @see LayoutBranchModel
* @generated
*/
@JSON(strict = true)
@ProviderType
public class LayoutBranchModelImpl extends BaseModelImpl<LayoutBranch>
implements LayoutBranchModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a layout branch model instance should use the {@link LayoutBranch} interface instead.
*/
public static final String TABLE_NAME = "LayoutBranch";
public static final Object[][] TABLE_COLUMNS = {
{ "mvccVersion", Types.BIGINT },
{ "layoutBranchId", Types.BIGINT },
{ "groupId", Types.BIGINT },
{ "companyId", Types.BIGINT },
{ "userId", Types.BIGINT },
{ "userName", Types.VARCHAR },
{ "layoutSetBranchId", Types.BIGINT },
{ "plid", Types.BIGINT },
{ "name", Types.VARCHAR },
{ "description", Types.VARCHAR },
{ "master", Types.BOOLEAN }
};
public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
static {
TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
TABLE_COLUMNS_MAP.put("layoutBranchId", 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("layoutSetBranchId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("plid", Types.BIGINT);
TABLE_COLUMNS_MAP.put("name", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("description", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("master", Types.BOOLEAN);
}
public static final String TABLE_SQL_CREATE = "create table LayoutBranch (mvccVersion LONG default 0 not null,layoutBranchId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,layoutSetBranchId LONG,plid LONG,name VARCHAR(75) null,description STRING null,master BOOLEAN)";
public static final String TABLE_SQL_DROP = "drop table LayoutBranch";
public static final String ORDER_BY_JPQL = " ORDER BY layoutBranch.layoutBranchId ASC";
public static final String ORDER_BY_SQL = " ORDER BY LayoutBranch.layoutBranchId 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.portal.util.PropsUtil.get(
"value.object.entity.cache.enabled.com.liferay.portal.kernel.model.LayoutBranch"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.finder.cache.enabled.com.liferay.portal.kernel.model.LayoutBranch"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.column.bitmask.enabled.com.liferay.portal.kernel.model.LayoutBranch"),
true);
public static final long LAYOUTSETBRANCHID_COLUMN_BITMASK = 1L;
public static final long MASTER_COLUMN_BITMASK = 2L;
public static final long NAME_COLUMN_BITMASK = 4L;
public static final long PLID_COLUMN_BITMASK = 8L;
public static final long LAYOUTBRANCHID_COLUMN_BITMASK = 16L;
/**
* 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 LayoutBranch toModel(LayoutBranchSoap soapModel) {
if (soapModel == null) {
return null;
}
LayoutBranch model = new LayoutBranchImpl();
model.setMvccVersion(soapModel.getMvccVersion());
model.setLayoutBranchId(soapModel.getLayoutBranchId());
model.setGroupId(soapModel.getGroupId());
model.setCompanyId(soapModel.getCompanyId());
model.setUserId(soapModel.getUserId());
model.setUserName(soapModel.getUserName());
model.setLayoutSetBranchId(soapModel.getLayoutSetBranchId());
model.setPlid(soapModel.getPlid());
model.setName(soapModel.getName());
model.setDescription(soapModel.getDescription());
model.setMaster(soapModel.getMaster());
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<LayoutBranch> toModels(LayoutBranchSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<LayoutBranch> models = new ArrayList<LayoutBranch>(soapModels.length);
for (LayoutBranchSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
}
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
"lock.expiration.time.com.liferay.portal.kernel.model.LayoutBranch"));
public LayoutBranchModelImpl() {
}
@Override
public long getPrimaryKey() {
return _layoutBranchId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setLayoutBranchId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _layoutBranchId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class<?> getModelClass() {
return LayoutBranch.class;
}
@Override
public String getModelClassName() {
return LayoutBranch.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("mvccVersion", getMvccVersion());
attributes.put("layoutBranchId", getLayoutBranchId());
attributes.put("groupId", getGroupId());
attributes.put("companyId", getCompanyId());
attributes.put("userId", getUserId());
attributes.put("userName", getUserName());
attributes.put("layoutSetBranchId", getLayoutSetBranchId());
attributes.put("plid", getPlid());
attributes.put("name", getName());
attributes.put("description", getDescription());
attributes.put("master", getMaster());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long mvccVersion = (Long)attributes.get("mvccVersion");
if (mvccVersion != null) {
setMvccVersion(mvccVersion);
}
Long layoutBranchId = (Long)attributes.get("layoutBranchId");
if (layoutBranchId != null) {
setLayoutBranchId(layoutBranchId);
}
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);
}
Long layoutSetBranchId = (Long)attributes.get("layoutSetBranchId");
if (layoutSetBranchId != null) {
setLayoutSetBranchId(layoutSetBranchId);
}
Long plid = (Long)attributes.get("plid");
if (plid != null) {
setPlid(plid);
}
String name = (String)attributes.get("name");
if (name != null) {
setName(name);
}
String description = (String)attributes.get("description");
if (description != null) {
setDescription(description);
}
Boolean master = (Boolean)attributes.get("master");
if (master != null) {
setMaster(master);
}
}
@JSON
@Override
public long getMvccVersion() {
return _mvccVersion;
}
@Override
public void setMvccVersion(long mvccVersion) {
_mvccVersion = mvccVersion;
}
@JSON
@Override
public long getLayoutBranchId() {
return _layoutBranchId;
}
@Override
public void setLayoutBranchId(long layoutBranchId) {
_layoutBranchId = layoutBranchId;
}
@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 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 long getLayoutSetBranchId() {
return _layoutSetBranchId;
}
@Override
public void setLayoutSetBranchId(long layoutSetBranchId) {
_columnBitmask |= LAYOUTSETBRANCHID_COLUMN_BITMASK;
if (!_setOriginalLayoutSetBranchId) {
_setOriginalLayoutSetBranchId = true;
_originalLayoutSetBranchId = _layoutSetBranchId;
}
_layoutSetBranchId = layoutSetBranchId;
}
public long getOriginalLayoutSetBranchId() {
return _originalLayoutSetBranchId;
}
@JSON
@Override
public long getPlid() {
return _plid;
}
@Override
public void setPlid(long plid) {
_columnBitmask |= PLID_COLUMN_BITMASK;
if (!_setOriginalPlid) {
_setOriginalPlid = true;
_originalPlid = _plid;
}
_plid = plid;
}
public long getOriginalPlid() {
return _originalPlid;
}
@JSON
@Override
public String getName() {
if (_name == null) {
return StringPool.BLANK;
}
else {
return _name;
}
}
@Override
public void setName(String name) {
_columnBitmask |= NAME_COLUMN_BITMASK;
if (_originalName == null) {
_originalName = _name;
}
_name = name;
}
public String getOriginalName() {
return GetterUtil.getString(_originalName);
}
@JSON
@Override
public String getDescription() {
if (_description == null) {
return StringPool.BLANK;
}
else {
return _description;
}
}
@Override
public void setDescription(String description) {
_description = description;
}
@JSON
@Override
public boolean getMaster() {
return _master;
}
@JSON
@Override
public boolean isMaster() {
return _master;
}
@Override
public void setMaster(boolean master) {
_columnBitmask |= MASTER_COLUMN_BITMASK;
if (!_setOriginalMaster) {
_setOriginalMaster = true;
_originalMaster = _master;
}
_master = master;
}
public boolean getOriginalMaster() {
return _originalMaster;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
LayoutBranch.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public LayoutBranch toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (LayoutBranch)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
LayoutBranchImpl layoutBranchImpl = new LayoutBranchImpl();
layoutBranchImpl.setMvccVersion(getMvccVersion());
layoutBranchImpl.setLayoutBranchId(getLayoutBranchId());
layoutBranchImpl.setGroupId(getGroupId());
layoutBranchImpl.setCompanyId(getCompanyId());
layoutBranchImpl.setUserId(getUserId());
layoutBranchImpl.setUserName(getUserName());
layoutBranchImpl.setLayoutSetBranchId(getLayoutSetBranchId());
layoutBranchImpl.setPlid(getPlid());
layoutBranchImpl.setName(getName());
layoutBranchImpl.setDescription(getDescription());
layoutBranchImpl.setMaster(getMaster());
layoutBranchImpl.resetOriginalValues();
return layoutBranchImpl;
}
@Override
public int compareTo(LayoutBranch layoutBranch) {
long primaryKey = layoutBranch.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 LayoutBranch)) {
return false;
}
LayoutBranch layoutBranch = (LayoutBranch)obj;
long primaryKey = layoutBranch.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() {
LayoutBranchModelImpl layoutBranchModelImpl = this;
layoutBranchModelImpl._originalLayoutSetBranchId = layoutBranchModelImpl._layoutSetBranchId;
layoutBranchModelImpl._setOriginalLayoutSetBranchId = false;
layoutBranchModelImpl._originalPlid = layoutBranchModelImpl._plid;
layoutBranchModelImpl._setOriginalPlid = false;
layoutBranchModelImpl._originalName = layoutBranchModelImpl._name;
layoutBranchModelImpl._originalMaster = layoutBranchModelImpl._master;
layoutBranchModelImpl._setOriginalMaster = false;
layoutBranchModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<LayoutBranch> toCacheModel() {
LayoutBranchCacheModel layoutBranchCacheModel = new LayoutBranchCacheModel();
layoutBranchCacheModel.mvccVersion = getMvccVersion();
layoutBranchCacheModel.layoutBranchId = getLayoutBranchId();
layoutBranchCacheModel.groupId = getGroupId();
layoutBranchCacheModel.companyId = getCompanyId();
layoutBranchCacheModel.userId = getUserId();
layoutBranchCacheModel.userName = getUserName();
String userName = layoutBranchCacheModel.userName;
if ((userName != null) && (userName.length() == 0)) {
layoutBranchCacheModel.userName = null;
}
layoutBranchCacheModel.layoutSetBranchId = getLayoutSetBranchId();
layoutBranchCacheModel.plid = getPlid();
layoutBranchCacheModel.name = getName();
String name = layoutBranchCacheModel.name;
if ((name != null) && (name.length() == 0)) {
layoutBranchCacheModel.name = null;
}
layoutBranchCacheModel.description = getDescription();
String description = layoutBranchCacheModel.description;
if ((description != null) && (description.length() == 0)) {
layoutBranchCacheModel.description = null;
}
layoutBranchCacheModel.master = getMaster();
return layoutBranchCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(23);
sb.append("{mvccVersion=");
sb.append(getMvccVersion());
sb.append(", layoutBranchId=");
sb.append(getLayoutBranchId());
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(", layoutSetBranchId=");
sb.append(getLayoutSetBranchId());
sb.append(", plid=");
sb.append(getPlid());
sb.append(", name=");
sb.append(getName());
sb.append(", description=");
sb.append(getDescription());
sb.append(", master=");
sb.append(getMaster());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(37);
sb.append("<model><model-name>");
sb.append("com.liferay.portal.kernel.model.LayoutBranch");
sb.append("</model-name>");
sb.append(
"<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
sb.append(getMvccVersion());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>layoutBranchId</column-name><column-value><![CDATA[");
sb.append(getLayoutBranchId());
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>layoutSetBranchId</column-name><column-value><![CDATA[");
sb.append(getLayoutSetBranchId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>plid</column-name><column-value><![CDATA[");
sb.append(getPlid());
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>description</column-name><column-value><![CDATA[");
sb.append(getDescription());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>master</column-name><column-value><![CDATA[");
sb.append(getMaster());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private static final ClassLoader _classLoader = LayoutBranch.class.getClassLoader();
private static final Class<?>[] _escapedModelInterfaces = new Class[] {
LayoutBranch.class
};
private long _mvccVersion;
private long _layoutBranchId;
private long _groupId;
private long _companyId;
private long _userId;
private String _userName;
private long _layoutSetBranchId;
private long _originalLayoutSetBranchId;
private boolean _setOriginalLayoutSetBranchId;
private long _plid;
private long _originalPlid;
private boolean _setOriginalPlid;
private String _name;
private String _originalName;
private String _description;
private boolean _master;
private boolean _originalMaster;
private boolean _setOriginalMaster;
private long _columnBitmask;
private LayoutBranch _escapedModel;
}