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.OrgGroupPermission;
026: import com.liferay.portal.service.persistence.OrgGroupPermissionPK;
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="OrgGroupPermissionModelImpl.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>OrgGroupPermission</code> table
045: * in the database.
046: * </p>
047: *
048: * @author Brian Wing Shun Chan
049: *
050: * @see com.liferay.portal.service.model.OrgGroupPermission
051: * @see com.liferay.portal.service.model.OrgGroupPermissionModel
052: * @see com.liferay.portal.service.model.impl.OrgGroupPermissionImpl
053: *
054: */
055: public class OrgGroupPermissionModelImpl extends BaseModelImpl {
056: public static final String TABLE_NAME = "OrgGroupPermission";
057: public static final Object[][] TABLE_COLUMNS = {
058: { "organizationId", new Integer(Types.BIGINT) },
059:
060: { "groupId", new Integer(Types.BIGINT) },
061:
062: { "permissionId", new Integer(Types.BIGINT) } };
063: public static final String TABLE_SQL_CREATE = "create table OrgGroupPermission (organizationId LONG not null,groupId LONG not null,permissionId LONG not null,primary key (organizationId, groupId, permissionId))";
064: public static final String TABLE_SQL_DROP = "drop table OrgGroupPermission";
065: public static final boolean CACHE_ENABLED = GetterUtil
066: .getBoolean(
067: PropsUtil
068: .get("value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupPermission"),
069: true);
070: public static final long LOCK_EXPIRATION_TIME = GetterUtil
071: .getLong(PropsUtil
072: .get("lock.expiration.time.com.liferay.portal.model.OrgGroupPermission"));
073:
074: public OrgGroupPermissionModelImpl() {
075: }
076:
077: public OrgGroupPermissionPK getPrimaryKey() {
078: return new OrgGroupPermissionPK(_organizationId, _groupId,
079: _permissionId);
080: }
081:
082: public void setPrimaryKey(OrgGroupPermissionPK pk) {
083: setOrganizationId(pk.organizationId);
084: setGroupId(pk.groupId);
085: setPermissionId(pk.permissionId);
086: }
087:
088: public Serializable getPrimaryKeyObj() {
089: return new OrgGroupPermissionPK(_organizationId, _groupId,
090: _permissionId);
091: }
092:
093: public long getOrganizationId() {
094: return _organizationId;
095: }
096:
097: public void setOrganizationId(long organizationId) {
098: if (organizationId != _organizationId) {
099: _organizationId = organizationId;
100: }
101: }
102:
103: public long getGroupId() {
104: return _groupId;
105: }
106:
107: public void setGroupId(long groupId) {
108: if (groupId != _groupId) {
109: _groupId = groupId;
110: }
111: }
112:
113: public long getPermissionId() {
114: return _permissionId;
115: }
116:
117: public void setPermissionId(long permissionId) {
118: if (permissionId != _permissionId) {
119: _permissionId = permissionId;
120: }
121: }
122:
123: public OrgGroupPermission toEscapedModel() {
124: if (isEscapedModel()) {
125: return (OrgGroupPermission) this ;
126: } else {
127: OrgGroupPermission model = new OrgGroupPermissionImpl();
128:
129: model.setEscapedModel(true);
130:
131: model.setOrganizationId(getOrganizationId());
132: model.setGroupId(getGroupId());
133: model.setPermissionId(getPermissionId());
134:
135: model = (OrgGroupPermission) Proxy.newProxyInstance(
136: OrgGroupPermission.class.getClassLoader(),
137: new Class[] { OrgGroupPermission.class },
138: new ReadOnlyBeanHandler(model));
139:
140: return model;
141: }
142: }
143:
144: public Object clone() {
145: OrgGroupPermissionImpl clone = new OrgGroupPermissionImpl();
146:
147: clone.setOrganizationId(getOrganizationId());
148: clone.setGroupId(getGroupId());
149: clone.setPermissionId(getPermissionId());
150:
151: return clone;
152: }
153:
154: public int compareTo(Object obj) {
155: if (obj == null) {
156: return -1;
157: }
158:
159: OrgGroupPermissionImpl orgGroupPermission = (OrgGroupPermissionImpl) obj;
160:
161: OrgGroupPermissionPK pk = orgGroupPermission.getPrimaryKey();
162:
163: return getPrimaryKey().compareTo(pk);
164: }
165:
166: public boolean equals(Object obj) {
167: if (obj == null) {
168: return false;
169: }
170:
171: OrgGroupPermissionImpl orgGroupPermission = null;
172:
173: try {
174: orgGroupPermission = (OrgGroupPermissionImpl) obj;
175: } catch (ClassCastException cce) {
176: return false;
177: }
178:
179: OrgGroupPermissionPK pk = orgGroupPermission.getPrimaryKey();
180:
181: if (getPrimaryKey().equals(pk)) {
182: return true;
183: } else {
184: return false;
185: }
186: }
187:
188: public int hashCode() {
189: return getPrimaryKey().hashCode();
190: }
191:
192: private long _organizationId;
193: private long _groupId;
194: private long _permissionId;
195: }
|