1
19
20 package com.liferay.portal.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.model.OrgGroupRole;
25 import com.liferay.portal.model.OrgGroupRoleSoap;
26 import com.liferay.portal.service.persistence.OrgGroupRolePK;
27
28 import java.io.Serializable;
29
30 import java.lang.reflect.Proxy;
31
32 import java.sql.Types;
33
34 import java.util.ArrayList;
35 import java.util.List;
36
37
57 public class OrgGroupRoleModelImpl extends BaseModelImpl {
58 public static final String TABLE_NAME = "OrgGroupRole";
59 public static final Object[][] TABLE_COLUMNS = {
60 { "organizationId", 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 OrgGroupRole (organizationId LONG not null,groupId LONG not null,roleId LONG not null,primary key (organizationId, groupId, roleId))";
69 public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
70 public static final String DATA_SOURCE = "liferayDataSource";
71 public static final String SESSION_FACTORY = "liferaySessionFactory";
72 public static final String TX_MANAGER = "liferayTransactionManager";
73 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
74 "value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
75 true);
76
77 public static OrgGroupRole toModel(OrgGroupRoleSoap soapModel) {
78 OrgGroupRole model = new OrgGroupRoleImpl();
79
80 model.setOrganizationId(soapModel.getOrganizationId());
81 model.setGroupId(soapModel.getGroupId());
82 model.setRoleId(soapModel.getRoleId());
83
84 return model;
85 }
86
87 public static List<OrgGroupRole> toModels(OrgGroupRoleSoap[] soapModels) {
88 List<OrgGroupRole> models = new ArrayList<OrgGroupRole>(soapModels.length);
89
90 for (OrgGroupRoleSoap soapModel : soapModels) {
91 models.add(toModel(soapModel));
92 }
93
94 return models;
95 }
96
97 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
98 "lock.expiration.time.com.liferay.portal.model.OrgGroupRole"));
99
100 public OrgGroupRoleModelImpl() {
101 }
102
103 public OrgGroupRolePK getPrimaryKey() {
104 return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
105 }
106
107 public void setPrimaryKey(OrgGroupRolePK pk) {
108 setOrganizationId(pk.organizationId);
109 setGroupId(pk.groupId);
110 setRoleId(pk.roleId);
111 }
112
113 public Serializable getPrimaryKeyObj() {
114 return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
115 }
116
117 public long getOrganizationId() {
118 return _organizationId;
119 }
120
121 public void setOrganizationId(long organizationId) {
122 if (organizationId != _organizationId) {
123 _organizationId = organizationId;
124 }
125 }
126
127 public long getGroupId() {
128 return _groupId;
129 }
130
131 public void setGroupId(long groupId) {
132 if (groupId != _groupId) {
133 _groupId = groupId;
134 }
135 }
136
137 public long getRoleId() {
138 return _roleId;
139 }
140
141 public void setRoleId(long roleId) {
142 if (roleId != _roleId) {
143 _roleId = roleId;
144 }
145 }
146
147 public OrgGroupRole toEscapedModel() {
148 if (isEscapedModel()) {
149 return (OrgGroupRole)this;
150 }
151 else {
152 OrgGroupRole model = new OrgGroupRoleImpl();
153
154 model.setNew(isNew());
155 model.setEscapedModel(true);
156
157 model.setOrganizationId(getOrganizationId());
158 model.setGroupId(getGroupId());
159 model.setRoleId(getRoleId());
160
161 model = (OrgGroupRole)Proxy.newProxyInstance(OrgGroupRole.class.getClassLoader(),
162 new Class[] { OrgGroupRole.class },
163 new ReadOnlyBeanHandler(model));
164
165 return model;
166 }
167 }
168
169 public Object clone() {
170 OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
171
172 clone.setOrganizationId(getOrganizationId());
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 OrgGroupRoleImpl orgGroupRole = (OrgGroupRoleImpl)obj;
185
186 OrgGroupRolePK pk = orgGroupRole.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 OrgGroupRoleImpl orgGroupRole = null;
197
198 try {
199 orgGroupRole = (OrgGroupRoleImpl)obj;
200 }
201 catch (ClassCastException cce) {
202 return false;
203 }
204
205 OrgGroupRolePK pk = orgGroupRole.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 _organizationId;
220 private long _groupId;
221 private long _roleId;
222 }