001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.UserGroupRole;
026: import com.liferay.portal.service.persistence.UserGroupRolePK;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import java.io.Serializable;
030:
031: import java.lang.reflect.Proxy;
032:
033: import java.sql.Types;
034:
035: /**
036: * <a href="UserGroupRoleModelImpl.java.html"><b><i>View Source</i></b></a>
037: *
038: * <p>
039: * ServiceBuilder generated this class. Modifications in this class will be
040: * overwritten the next time is generated.
041: * </p>
042: *
043: * <p>
044: * This class is a model that represents the <code>UserGroupRole</code> table
045: * in the database.
046: * </p>
047: *
048: * @author Brian Wing Shun Chan
049: *
050: * @see com.liferay.portal.service.model.UserGroupRole
051: * @see com.liferay.portal.service.model.UserGroupRoleModel
052: * @see com.liferay.portal.service.model.impl.UserGroupRoleImpl
053: *
054: */
055: public class UserGroupRoleModelImpl extends BaseModelImpl {
056: public static final String TABLE_NAME = "UserGroupRole";
057: public static final Object[][] TABLE_COLUMNS = {
058: { "userId", new Integer(Types.BIGINT) },
059:
060: { "groupId", new Integer(Types.BIGINT) },
061:
062: { "roleId", new Integer(Types.BIGINT) } };
063: public static final String TABLE_SQL_CREATE = "create table UserGroupRole (userId LONG not null,groupId LONG not null,roleId LONG not null,primary key (userId, groupId, roleId))";
064: public static final String TABLE_SQL_DROP = "drop table UserGroupRole";
065: public static final boolean CACHE_ENABLED = GetterUtil
066: .getBoolean(
067: PropsUtil
068: .get("value.object.finder.cache.enabled.com.liferay.portal.model.UserGroupRole"),
069: true);
070: public static final long LOCK_EXPIRATION_TIME = GetterUtil
071: .getLong(PropsUtil
072: .get("lock.expiration.time.com.liferay.portal.model.UserGroupRole"));
073:
074: public UserGroupRoleModelImpl() {
075: }
076:
077: public UserGroupRolePK getPrimaryKey() {
078: return new UserGroupRolePK(_userId, _groupId, _roleId);
079: }
080:
081: public void setPrimaryKey(UserGroupRolePK pk) {
082: setUserId(pk.userId);
083: setGroupId(pk.groupId);
084: setRoleId(pk.roleId);
085: }
086:
087: public Serializable getPrimaryKeyObj() {
088: return new UserGroupRolePK(_userId, _groupId, _roleId);
089: }
090:
091: public long getUserId() {
092: return _userId;
093: }
094:
095: public void setUserId(long userId) {
096: if (userId != _userId) {
097: _userId = userId;
098: }
099: }
100:
101: public long getGroupId() {
102: return _groupId;
103: }
104:
105: public void setGroupId(long groupId) {
106: if (groupId != _groupId) {
107: _groupId = groupId;
108: }
109: }
110:
111: public long getRoleId() {
112: return _roleId;
113: }
114:
115: public void setRoleId(long roleId) {
116: if (roleId != _roleId) {
117: _roleId = roleId;
118: }
119: }
120:
121: public UserGroupRole toEscapedModel() {
122: if (isEscapedModel()) {
123: return (UserGroupRole) this ;
124: } else {
125: UserGroupRole model = new UserGroupRoleImpl();
126:
127: model.setEscapedModel(true);
128:
129: model.setUserId(getUserId());
130: model.setGroupId(getGroupId());
131: model.setRoleId(getRoleId());
132:
133: model = (UserGroupRole) Proxy.newProxyInstance(
134: UserGroupRole.class.getClassLoader(),
135: new Class[] { UserGroupRole.class },
136: new ReadOnlyBeanHandler(model));
137:
138: return model;
139: }
140: }
141:
142: public Object clone() {
143: UserGroupRoleImpl clone = new UserGroupRoleImpl();
144:
145: clone.setUserId(getUserId());
146: clone.setGroupId(getGroupId());
147: clone.setRoleId(getRoleId());
148:
149: return clone;
150: }
151:
152: public int compareTo(Object obj) {
153: if (obj == null) {
154: return -1;
155: }
156:
157: UserGroupRoleImpl userGroupRole = (UserGroupRoleImpl) obj;
158:
159: UserGroupRolePK pk = userGroupRole.getPrimaryKey();
160:
161: return getPrimaryKey().compareTo(pk);
162: }
163:
164: public boolean equals(Object obj) {
165: if (obj == null) {
166: return false;
167: }
168:
169: UserGroupRoleImpl userGroupRole = null;
170:
171: try {
172: userGroupRole = (UserGroupRoleImpl) obj;
173: } catch (ClassCastException cce) {
174: return false;
175: }
176:
177: UserGroupRolePK pk = userGroupRole.getPrimaryKey();
178:
179: if (getPrimaryKey().equals(pk)) {
180: return true;
181: } else {
182: return false;
183: }
184: }
185:
186: public int hashCode() {
187: return getPrimaryKey().hashCode();
188: }
189:
190: private long _userId;
191: private long _groupId;
192: private long _roleId;
193: }
|