1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.UserGroupRole;
28 import com.liferay.portal.service.persistence.UserGroupRolePK;
29 import com.liferay.portal.util.PropsUtil;
30
31 import java.io.Serializable;
32
33 import java.lang.reflect.Proxy;
34
35 import java.sql.Types;
36
37
57 public class UserGroupRoleModelImpl extends BaseModelImpl {
58 public static final String TABLE_NAME = "UserGroupRole";
59 public static final Object[][] TABLE_COLUMNS = {
60 { "userId", new Integer(Types.BIGINT) },
61
62
63 { "groupId", new Integer(Types.BIGINT) },
64
65
66 { "roleId", new Integer(Types.BIGINT) }
67 };
68 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))";
69 public static final String TABLE_SQL_DROP = "drop table UserGroupRole";
70 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
71 "value.object.finder.cache.enabled.com.liferay.portal.model.UserGroupRole"),
72 true);
73 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
74 "lock.expiration.time.com.liferay.portal.model.UserGroupRole"));
75
76 public UserGroupRoleModelImpl() {
77 }
78
79 public UserGroupRolePK getPrimaryKey() {
80 return new UserGroupRolePK(_userId, _groupId, _roleId);
81 }
82
83 public void setPrimaryKey(UserGroupRolePK pk) {
84 setUserId(pk.userId);
85 setGroupId(pk.groupId);
86 setRoleId(pk.roleId);
87 }
88
89 public Serializable getPrimaryKeyObj() {
90 return new UserGroupRolePK(_userId, _groupId, _roleId);
91 }
92
93 public long getUserId() {
94 return _userId;
95 }
96
97 public void setUserId(long userId) {
98 if (userId != _userId) {
99 _userId = userId;
100 }
101 }
102
103 public long getGroupId() {
104 return _groupId;
105 }
106
107 public void setGroupId(long groupId) {
108 if (groupId != _groupId) {
109 _groupId = groupId;
110 }
111 }
112
113 public long getRoleId() {
114 return _roleId;
115 }
116
117 public void setRoleId(long roleId) {
118 if (roleId != _roleId) {
119 _roleId = roleId;
120 }
121 }
122
123 public UserGroupRole toEscapedModel() {
124 if (isEscapedModel()) {
125 return (UserGroupRole)this;
126 }
127 else {
128 UserGroupRole model = new UserGroupRoleImpl();
129
130 model.setEscapedModel(true);
131
132 model.setUserId(getUserId());
133 model.setGroupId(getGroupId());
134 model.setRoleId(getRoleId());
135
136 model = (UserGroupRole)Proxy.newProxyInstance(UserGroupRole.class.getClassLoader(),
137 new Class[] { UserGroupRole.class },
138 new ReadOnlyBeanHandler(model));
139
140 return model;
141 }
142 }
143
144 public Object clone() {
145 UserGroupRoleImpl clone = new UserGroupRoleImpl();
146
147 clone.setUserId(getUserId());
148 clone.setGroupId(getGroupId());
149 clone.setRoleId(getRoleId());
150
151 return clone;
152 }
153
154 public int compareTo(Object obj) {
155 if (obj == null) {
156 return -1;
157 }
158
159 UserGroupRoleImpl userGroupRole = (UserGroupRoleImpl)obj;
160
161 UserGroupRolePK pk = userGroupRole.getPrimaryKey();
162
163 return getPrimaryKey().compareTo(pk);
164 }
165
166 public boolean equals(Object obj) {
167 if (obj == null) {
168 return false;
169 }
170
171 UserGroupRoleImpl userGroupRole = null;
172
173 try {
174 userGroupRole = (UserGroupRoleImpl)obj;
175 }
176 catch (ClassCastException cce) {
177 return false;
178 }
179
180 UserGroupRolePK pk = userGroupRole.getPrimaryKey();
181
182 if (getPrimaryKey().equals(pk)) {
183 return true;
184 }
185 else {
186 return false;
187 }
188 }
189
190 public int hashCode() {
191 return getPrimaryKey().hashCode();
192 }
193
194 private long _userId;
195 private long _groupId;
196 private long _roleId;
197 }