001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.OrgGroupRole;
026: import com.liferay.portal.service.persistence.OrgGroupRolePK;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import java.io.Serializable;
030:
031: import java.lang.reflect.Proxy;
032:
033: import java.sql.Types;
034:
035: /**
036: * <a href="OrgGroupRoleModelImpl.java.html"><b><i>View Source</i></b></a>
037: *
038: * <p>
039: * ServiceBuilder generated this class. Modifications in this class will be
040: * overwritten the next time is generated.
041: * </p>
042: *
043: * <p>
044: * This class is a model that represents the <code>OrgGroupRole</code> table
045: * in the database.
046: * </p>
047: *
048: * @author Brian Wing Shun Chan
049: *
050: * @see com.liferay.portal.service.model.OrgGroupRole
051: * @see com.liferay.portal.service.model.OrgGroupRoleModel
052: * @see com.liferay.portal.service.model.impl.OrgGroupRoleImpl
053: *
054: */
055: public class OrgGroupRoleModelImpl extends BaseModelImpl {
056: public static final String TABLE_NAME = "OrgGroupRole";
057: public static final Object[][] TABLE_COLUMNS = {
058: { "organizationId", new Integer(Types.BIGINT) },
059:
060: { "groupId", new Integer(Types.BIGINT) },
061:
062: { "roleId", new Integer(Types.BIGINT) } };
063: 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))";
064: public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
065: public static final boolean CACHE_ENABLED = GetterUtil
066: .getBoolean(
067: PropsUtil
068: .get("value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
069: true);
070: public static final long LOCK_EXPIRATION_TIME = GetterUtil
071: .getLong(PropsUtil
072: .get("lock.expiration.time.com.liferay.portal.model.OrgGroupRole"));
073:
074: public OrgGroupRoleModelImpl() {
075: }
076:
077: public OrgGroupRolePK getPrimaryKey() {
078: return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
079: }
080:
081: public void setPrimaryKey(OrgGroupRolePK pk) {
082: setOrganizationId(pk.organizationId);
083: setGroupId(pk.groupId);
084: setRoleId(pk.roleId);
085: }
086:
087: public Serializable getPrimaryKeyObj() {
088: return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
089: }
090:
091: public long getOrganizationId() {
092: return _organizationId;
093: }
094:
095: public void setOrganizationId(long organizationId) {
096: if (organizationId != _organizationId) {
097: _organizationId = organizationId;
098: }
099: }
100:
101: public long getGroupId() {
102: return _groupId;
103: }
104:
105: public void setGroupId(long groupId) {
106: if (groupId != _groupId) {
107: _groupId = groupId;
108: }
109: }
110:
111: public long getRoleId() {
112: return _roleId;
113: }
114:
115: public void setRoleId(long roleId) {
116: if (roleId != _roleId) {
117: _roleId = roleId;
118: }
119: }
120:
121: public OrgGroupRole toEscapedModel() {
122: if (isEscapedModel()) {
123: return (OrgGroupRole) this ;
124: } else {
125: OrgGroupRole model = new OrgGroupRoleImpl();
126:
127: model.setEscapedModel(true);
128:
129: model.setOrganizationId(getOrganizationId());
130: model.setGroupId(getGroupId());
131: model.setRoleId(getRoleId());
132:
133: model = (OrgGroupRole) Proxy.newProxyInstance(
134: OrgGroupRole.class.getClassLoader(),
135: new Class[] { OrgGroupRole.class },
136: new ReadOnlyBeanHandler(model));
137:
138: return model;
139: }
140: }
141:
142: public Object clone() {
143: OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
144:
145: clone.setOrganizationId(getOrganizationId());
146: clone.setGroupId(getGroupId());
147: clone.setRoleId(getRoleId());
148:
149: return clone;
150: }
151:
152: public int compareTo(Object obj) {
153: if (obj == null) {
154: return -1;
155: }
156:
157: OrgGroupRoleImpl orgGroupRole = (OrgGroupRoleImpl) obj;
158:
159: OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
160:
161: return getPrimaryKey().compareTo(pk);
162: }
163:
164: public boolean equals(Object obj) {
165: if (obj == null) {
166: return false;
167: }
168:
169: OrgGroupRoleImpl orgGroupRole = null;
170:
171: try {
172: orgGroupRole = (OrgGroupRoleImpl) obj;
173: } catch (ClassCastException cce) {
174: return false;
175: }
176:
177: OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
178:
179: if (getPrimaryKey().equals(pk)) {
180: return true;
181: } else {
182: return false;
183: }
184: }
185:
186: public int hashCode() {
187: return getPrimaryKey().hashCode();
188: }
189:
190: private long _organizationId;
191: private long _groupId;
192: private long _roleId;
193: }
|