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