--- /dev/null
+/**
+ * Copyright (c) 2000-2012 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.pentila.entSavoie.userProperties.model.impl;
+
+import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
+import com.liferay.portal.kernel.exception.SystemException;
+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 com.pentila.entSavoie.userProperties.model.UserRelationship;
+import com.pentila.entSavoie.userProperties.model.UserRelationshipModel;
+
+import java.io.Serializable;
+
+import java.sql.Types;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The base model implementation for the UserRelationship service. Represents a row in the "userProperties_UserRelationship" database table, with each column mapped to a property of this class.
+ *
+ * <p>
+ * This implementation and its corresponding interface {@link com.pentila.entSavoie.userProperties.model.UserRelationshipModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UserRelationshipImpl}.
+ * </p>
+ *
+ * @author Amblard Mathieu - Barma Igor
+ * @see UserRelationshipImpl
+ * @see com.pentila.entSavoie.userProperties.model.UserRelationship
+ * @see com.pentila.entSavoie.userProperties.model.UserRelationshipModel
+ * @generated
+ */
+public class UserRelationshipModelImpl extends BaseModelImpl<UserRelationship>
+ implements UserRelationshipModel {
+ /*
+ * NOTE FOR DEVELOPERS:
+ *
+ * Never modify or reference this class directly. All methods that expect a user relationship model instance should use the {@link com.pentila.entSavoie.userProperties.model.UserRelationship} interface instead.
+ */
+ public static final String TABLE_NAME = "userProperties_UserRelationship";
+ public static final Object[][] TABLE_COLUMNS = {
+ { "userRelationshipId", Types.BIGINT },
+ { "fromUserId", Types.BIGINT },
+ { "toUserId", Types.BIGINT },
+ { "toUserSconetId", Types.VARCHAR },
+ { "relationType", Types.VARCHAR }
+ };
+ public static final String TABLE_SQL_CREATE = "create table userProperties_UserRelationship (userRelationshipId LONG not null primary key,fromUserId LONG,toUserId LONG,toUserSconetId VARCHAR(150) null,relationType VARCHAR(150) null)";
+ public static final String TABLE_SQL_DROP = "drop table userProperties_UserRelationship";
+ 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.com.pentila.entSavoie.userProperties.model.UserRelationship"),
+ true);
+ public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
+ "value.object.finder.cache.enabled.com.pentila.entSavoie.userProperties.model.UserRelationship"),
+ true);
+ public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
+ "value.object.column.bitmask.enabled.com.pentila.entSavoie.userProperties.model.UserRelationship"),
+ true);
+ public static long FROMUSERID_COLUMN_BITMASK = 1L;
+ public static long RELATIONTYPE_COLUMN_BITMASK = 2L;
+ public static long TOUSERID_COLUMN_BITMASK = 4L;
+ public static long TOUSERSCONETID_COLUMN_BITMASK = 8L;
+ public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
+ "lock.expiration.time.com.pentila.entSavoie.userProperties.model.UserRelationship"));
+
+ public UserRelationshipModelImpl() {
+ }
+
+ public long getPrimaryKey() {
+ return _userRelationshipId;
+ }
+
+ public void setPrimaryKey(long primaryKey) {
+ setUserRelationshipId(primaryKey);
+ }
+
+ public Serializable getPrimaryKeyObj() {
+ return new Long(_userRelationshipId);
+ }
+
+ public void setPrimaryKeyObj(Serializable primaryKeyObj) {
+ setPrimaryKey(((Long)primaryKeyObj).longValue());
+ }
+
+ public Class<?> getModelClass() {
+ return UserRelationship.class;
+ }
+
+ public String getModelClassName() {
+ return UserRelationship.class.getName();
+ }
+
+ @Override
+ public Map<String, Object> getModelAttributes() {
+ Map<String, Object> attributes = new HashMap<String, Object>();
+
+ attributes.put("userRelationshipId", getUserRelationshipId());
+ attributes.put("fromUserId", getFromUserId());
+ attributes.put("toUserId", getToUserId());
+ attributes.put("toUserSconetId", getToUserSconetId());
+ attributes.put("relationType", getRelationType());
+
+ return attributes;
+ }
+
+ @Override
+ public void setModelAttributes(Map<String, Object> attributes) {
+ Long userRelationshipId = (Long)attributes.get("userRelationshipId");
+
+ if (userRelationshipId != null) {
+ setUserRelationshipId(userRelationshipId);
+ }
+
+ Long fromUserId = (Long)attributes.get("fromUserId");
+
+ if (fromUserId != null) {
+ setFromUserId(fromUserId);
+ }
+
+ Long toUserId = (Long)attributes.get("toUserId");
+
+ if (toUserId != null) {
+ setToUserId(toUserId);
+ }
+
+ String toUserSconetId = (String)attributes.get("toUserSconetId");
+
+ if (toUserSconetId != null) {
+ setToUserSconetId(toUserSconetId);
+ }
+
+ String relationType = (String)attributes.get("relationType");
+
+ if (relationType != null) {
+ setRelationType(relationType);
+ }
+ }
+
+ public long getUserRelationshipId() {
+ return _userRelationshipId;
+ }
+
+ public void setUserRelationshipId(long userRelationshipId) {
+ _userRelationshipId = userRelationshipId;
+ }
+
+ public long getFromUserId() {
+ return _fromUserId;
+ }
+
+ public void setFromUserId(long fromUserId) {
+ _columnBitmask |= FROMUSERID_COLUMN_BITMASK;
+
+ if (!_setOriginalFromUserId) {
+ _setOriginalFromUserId = true;
+
+ _originalFromUserId = _fromUserId;
+ }
+
+ _fromUserId = fromUserId;
+ }
+
+ public String getFromUserUuid() throws SystemException {
+ return PortalUtil.getUserValue(getFromUserId(), "uuid", _fromUserUuid);
+ }
+
+ public void setFromUserUuid(String fromUserUuid) {
+ _fromUserUuid = fromUserUuid;
+ }
+
+ public long getOriginalFromUserId() {
+ return _originalFromUserId;
+ }
+
+ public long getToUserId() {
+ return _toUserId;
+ }
+
+ public void setToUserId(long toUserId) {
+ _columnBitmask |= TOUSERID_COLUMN_BITMASK;
+
+ if (!_setOriginalToUserId) {
+ _setOriginalToUserId = true;
+
+ _originalToUserId = _toUserId;
+ }
+
+ _toUserId = toUserId;
+ }
+
+ public String getToUserUuid() throws SystemException {
+ return PortalUtil.getUserValue(getToUserId(), "uuid", _toUserUuid);
+ }
+
+ public void setToUserUuid(String toUserUuid) {
+ _toUserUuid = toUserUuid;
+ }
+
+ public long getOriginalToUserId() {
+ return _originalToUserId;
+ }
+
+ public String getToUserSconetId() {
+ if (_toUserSconetId == null) {
+ return StringPool.BLANK;
+ }
+ else {
+ return _toUserSconetId;
+ }
+ }
+
+ public void setToUserSconetId(String toUserSconetId) {
+ _columnBitmask |= TOUSERSCONETID_COLUMN_BITMASK;
+
+ if (_originalToUserSconetId == null) {
+ _originalToUserSconetId = _toUserSconetId;
+ }
+
+ _toUserSconetId = toUserSconetId;
+ }
+
+ public String getOriginalToUserSconetId() {
+ return GetterUtil.getString(_originalToUserSconetId);
+ }
+
+ public String getRelationType() {
+ if (_relationType == null) {
+ return StringPool.BLANK;
+ }
+ else {
+ return _relationType;
+ }
+ }
+
+ public void setRelationType(String relationType) {
+ _columnBitmask |= RELATIONTYPE_COLUMN_BITMASK;
+
+ if (_originalRelationType == null) {
+ _originalRelationType = _relationType;
+ }
+
+ _relationType = relationType;
+ }
+
+ public String getOriginalRelationType() {
+ return GetterUtil.getString(_originalRelationType);
+ }
+
+ public long getColumnBitmask() {
+ return _columnBitmask;
+ }
+
+ @Override
+ public ExpandoBridge getExpandoBridge() {
+ return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
+ UserRelationship.class.getName(), getPrimaryKey());
+ }
+
+ @Override
+ public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
+ ExpandoBridge expandoBridge = getExpandoBridge();
+
+ expandoBridge.setAttributes(serviceContext);
+ }
+
+ @Override
+ public UserRelationship toEscapedModel() {
+ if (_escapedModelProxy == null) {
+ _escapedModelProxy = (UserRelationship)ProxyUtil.newProxyInstance(_classLoader,
+ _escapedModelProxyInterfaces,
+ new AutoEscapeBeanHandler(this));
+ }
+
+ return _escapedModelProxy;
+ }
+
+ @Override
+ public Object clone() {
+ UserRelationshipImpl userRelationshipImpl = new UserRelationshipImpl();
+
+ userRelationshipImpl.setUserRelationshipId(getUserRelationshipId());
+ userRelationshipImpl.setFromUserId(getFromUserId());
+ userRelationshipImpl.setToUserId(getToUserId());
+ userRelationshipImpl.setToUserSconetId(getToUserSconetId());
+ userRelationshipImpl.setRelationType(getRelationType());
+
+ userRelationshipImpl.resetOriginalValues();
+
+ return userRelationshipImpl;
+ }
+
+ public int compareTo(UserRelationship userRelationship) {
+ long primaryKey = userRelationship.getPrimaryKey();
+
+ if (getPrimaryKey() < primaryKey) {
+ return -1;
+ }
+ else if (getPrimaryKey() > primaryKey) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ UserRelationship userRelationship = null;
+
+ try {
+ userRelationship = (UserRelationship)obj;
+ }
+ catch (ClassCastException cce) {
+ return false;
+ }
+
+ long primaryKey = userRelationship.getPrimaryKey();
+
+ if (getPrimaryKey() == primaryKey) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return (int)getPrimaryKey();
+ }
+
+ @Override
+ public void resetOriginalValues() {
+ UserRelationshipModelImpl userRelationshipModelImpl = this;
+
+ userRelationshipModelImpl._originalFromUserId = userRelationshipModelImpl._fromUserId;
+
+ userRelationshipModelImpl._setOriginalFromUserId = false;
+
+ userRelationshipModelImpl._originalToUserId = userRelationshipModelImpl._toUserId;
+
+ userRelationshipModelImpl._setOriginalToUserId = false;
+
+ userRelationshipModelImpl._originalToUserSconetId = userRelationshipModelImpl._toUserSconetId;
+
+ userRelationshipModelImpl._originalRelationType = userRelationshipModelImpl._relationType;
+
+ userRelationshipModelImpl._columnBitmask = 0;
+ }
+
+ @Override
+ public CacheModel<UserRelationship> toCacheModel() {
+ UserRelationshipCacheModel userRelationshipCacheModel = new UserRelationshipCacheModel();
+
+ userRelationshipCacheModel.userRelationshipId = getUserRelationshipId();
+
+ userRelationshipCacheModel.fromUserId = getFromUserId();
+
+ userRelationshipCacheModel.toUserId = getToUserId();
+
+ userRelationshipCacheModel.toUserSconetId = getToUserSconetId();
+
+ String toUserSconetId = userRelationshipCacheModel.toUserSconetId;
+
+ if ((toUserSconetId != null) && (toUserSconetId.length() == 0)) {
+ userRelationshipCacheModel.toUserSconetId = null;
+ }
+
+ userRelationshipCacheModel.relationType = getRelationType();
+
+ String relationType = userRelationshipCacheModel.relationType;
+
+ if ((relationType != null) && (relationType.length() == 0)) {
+ userRelationshipCacheModel.relationType = null;
+ }
+
+ return userRelationshipCacheModel;
+ }
+
+ @Override
+ public String toString() {
+ StringBundler sb = new StringBundler(11);
+
+ sb.append("{userRelationshipId=");
+ sb.append(getUserRelationshipId());
+ sb.append(", fromUserId=");
+ sb.append(getFromUserId());
+ sb.append(", toUserId=");
+ sb.append(getToUserId());
+ sb.append(", toUserSconetId=");
+ sb.append(getToUserSconetId());
+ sb.append(", relationType=");
+ sb.append(getRelationType());
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ public String toXmlString() {
+ StringBundler sb = new StringBundler(19);
+
+ sb.append("<model><model-name>");
+ sb.append("com.pentila.entSavoie.userProperties.model.UserRelationship");
+ sb.append("</model-name>");
+
+ sb.append(
+ "<column><column-name>userRelationshipId</column-name><column-value><![CDATA[");
+ sb.append(getUserRelationshipId());
+ sb.append("]]></column-value></column>");
+ sb.append(
+ "<column><column-name>fromUserId</column-name><column-value><![CDATA[");
+ sb.append(getFromUserId());
+ sb.append("]]></column-value></column>");
+ sb.append(
+ "<column><column-name>toUserId</column-name><column-value><![CDATA[");
+ sb.append(getToUserId());
+ sb.append("]]></column-value></column>");
+ sb.append(
+ "<column><column-name>toUserSconetId</column-name><column-value><![CDATA[");
+ sb.append(getToUserSconetId());
+ sb.append("]]></column-value></column>");
+ sb.append(
+ "<column><column-name>relationType</column-name><column-value><![CDATA[");
+ sb.append(getRelationType());
+ sb.append("]]></column-value></column>");
+
+ sb.append("</model>");
+
+ return sb.toString();
+ }
+
+ private static ClassLoader _classLoader = UserRelationship.class.getClassLoader();
+ private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
+ UserRelationship.class
+ };
+ private long _userRelationshipId;
+ private long _fromUserId;
+ private String _fromUserUuid;
+ private long _originalFromUserId;
+ private boolean _setOriginalFromUserId;
+ private long _toUserId;
+ private String _toUserUuid;
+ private long _originalToUserId;
+ private boolean _setOriginalToUserId;
+ private String _toUserSconetId;
+ private String _originalToUserSconetId;
+ private String _relationType;
+ private String _originalRelationType;
+ private long _columnBitmask;
+ private UserRelationship _escapedModelProxy;
+}
\ No newline at end of file