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