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.OrgGroupRole;
28 import com.liferay.portal.model.OrgGroupRoleSoap;
29 import com.liferay.portal.service.persistence.OrgGroupRolePK;
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 OrgGroupRoleModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "OrgGroupRole";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "organizationId", 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 OrgGroupRole (organizationId LONG not null,groupId LONG not null,roleId LONG not null,primary key (organizationId, groupId, roleId))";
72 public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
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.OrgGroupRole"),
78 true);
79
80 public static OrgGroupRole toModel(OrgGroupRoleSoap soapModel) {
81 OrgGroupRole model = new OrgGroupRoleImpl();
82
83 model.setOrganizationId(soapModel.getOrganizationId());
84 model.setGroupId(soapModel.getGroupId());
85 model.setRoleId(soapModel.getRoleId());
86
87 return model;
88 }
89
90 public static List<OrgGroupRole> toModels(OrgGroupRoleSoap[] soapModels) {
91 List<OrgGroupRole> models = new ArrayList<OrgGroupRole>(soapModels.length);
92
93 for (OrgGroupRoleSoap 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.OrgGroupRole"));
102
103 public OrgGroupRoleModelImpl() {
104 }
105
106 public OrgGroupRolePK getPrimaryKey() {
107 return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
108 }
109
110 public void setPrimaryKey(OrgGroupRolePK pk) {
111 setOrganizationId(pk.organizationId);
112 setGroupId(pk.groupId);
113 setRoleId(pk.roleId);
114 }
115
116 public Serializable getPrimaryKeyObj() {
117 return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
118 }
119
120 public long getOrganizationId() {
121 return _organizationId;
122 }
123
124 public void setOrganizationId(long organizationId) {
125 if (organizationId != _organizationId) {
126 _organizationId = organizationId;
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 OrgGroupRole toEscapedModel() {
151 if (isEscapedModel()) {
152 return (OrgGroupRole)this;
153 }
154 else {
155 OrgGroupRole model = new OrgGroupRoleImpl();
156
157 model.setNew(isNew());
158 model.setEscapedModel(true);
159
160 model.setOrganizationId(getOrganizationId());
161 model.setGroupId(getGroupId());
162 model.setRoleId(getRoleId());
163
164 model = (OrgGroupRole)Proxy.newProxyInstance(OrgGroupRole.class.getClassLoader(),
165 new Class[] { OrgGroupRole.class },
166 new ReadOnlyBeanHandler(model));
167
168 return model;
169 }
170 }
171
172 public Object clone() {
173 OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
174
175 clone.setOrganizationId(getOrganizationId());
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 OrgGroupRoleImpl orgGroupRole = (OrgGroupRoleImpl)obj;
188
189 OrgGroupRolePK pk = orgGroupRole.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 OrgGroupRoleImpl orgGroupRole = null;
200
201 try {
202 orgGroupRole = (OrgGroupRoleImpl)obj;
203 }
204 catch (ClassCastException cce) {
205 return false;
206 }
207
208 OrgGroupRolePK pk = orgGroupRole.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 _organizationId;
223 private long _groupId;
224 private long _roleId;
225 }