001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.model.OrgGroupRole;
021    import com.liferay.portal.model.OrgGroupRoleModel;
022    import com.liferay.portal.service.persistence.OrgGroupRolePK;
023    
024    import java.io.Serializable;
025    
026    import java.lang.reflect.Proxy;
027    
028    import java.sql.Types;
029    
030    /**
031     * <p>
032     * This interface is a model that represents the OrgGroupRole table in the
033     * database.
034     * </p>
035     *
036     * @author    Brian Wing Shun Chan
037     * @see       OrgGroupRoleImpl
038     * @see       com.liferay.portal.model.OrgGroupRole
039     * @see       com.liferay.portal.model.OrgGroupRoleModel
040     * @generated
041     */
042    public class OrgGroupRoleModelImpl extends BaseModelImpl<OrgGroupRole>
043            implements OrgGroupRoleModel {
044            public static final String TABLE_NAME = "OrgGroupRole";
045            public static final Object[][] TABLE_COLUMNS = {
046                            { "organizationId", new Integer(Types.BIGINT) },
047                            { "groupId", new Integer(Types.BIGINT) },
048                            { "roleId", new Integer(Types.BIGINT) }
049                    };
050            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))";
051            public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
052            public static final String DATA_SOURCE = "liferayDataSource";
053            public static final String SESSION_FACTORY = "liferaySessionFactory";
054            public static final String TX_MANAGER = "liferayTransactionManager";
055            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
056                                    "value.object.entity.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
057                            true);
058            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
059                                    "value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
060                            true);
061            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
062                                    "lock.expiration.time.com.liferay.portal.model.OrgGroupRole"));
063    
064            public OrgGroupRoleModelImpl() {
065            }
066    
067            public OrgGroupRolePK getPrimaryKey() {
068                    return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
069            }
070    
071            public void setPrimaryKey(OrgGroupRolePK pk) {
072                    setOrganizationId(pk.organizationId);
073                    setGroupId(pk.groupId);
074                    setRoleId(pk.roleId);
075            }
076    
077            public Serializable getPrimaryKeyObj() {
078                    return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
079            }
080    
081            public long getOrganizationId() {
082                    return _organizationId;
083            }
084    
085            public void setOrganizationId(long organizationId) {
086                    _organizationId = organizationId;
087            }
088    
089            public long getGroupId() {
090                    return _groupId;
091            }
092    
093            public void setGroupId(long groupId) {
094                    _groupId = groupId;
095            }
096    
097            public long getRoleId() {
098                    return _roleId;
099            }
100    
101            public void setRoleId(long roleId) {
102                    _roleId = roleId;
103            }
104    
105            public OrgGroupRole toEscapedModel() {
106                    if (isEscapedModel()) {
107                            return (OrgGroupRole)this;
108                    }
109                    else {
110                            return (OrgGroupRole)Proxy.newProxyInstance(OrgGroupRole.class.getClassLoader(),
111                                    new Class[] { OrgGroupRole.class },
112                                    new AutoEscapeBeanHandler(this));
113                    }
114            }
115    
116            public Object clone() {
117                    OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
118    
119                    clone.setOrganizationId(getOrganizationId());
120                    clone.setGroupId(getGroupId());
121                    clone.setRoleId(getRoleId());
122    
123                    return clone;
124            }
125    
126            public int compareTo(OrgGroupRole orgGroupRole) {
127                    OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
128    
129                    return getPrimaryKey().compareTo(pk);
130            }
131    
132            public boolean equals(Object obj) {
133                    if (obj == null) {
134                            return false;
135                    }
136    
137                    OrgGroupRole orgGroupRole = null;
138    
139                    try {
140                            orgGroupRole = (OrgGroupRole)obj;
141                    }
142                    catch (ClassCastException cce) {
143                            return false;
144                    }
145    
146                    OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
147    
148                    if (getPrimaryKey().equals(pk)) {
149                            return true;
150                    }
151                    else {
152                            return false;
153                    }
154            }
155    
156            public int hashCode() {
157                    return getPrimaryKey().hashCode();
158            }
159    
160            public String toString() {
161                    StringBundler sb = new StringBundler(7);
162    
163                    sb.append("{organizationId=");
164                    sb.append(getOrganizationId());
165                    sb.append(", groupId=");
166                    sb.append(getGroupId());
167                    sb.append(", roleId=");
168                    sb.append(getRoleId());
169                    sb.append("}");
170    
171                    return sb.toString();
172            }
173    
174            public String toXmlString() {
175                    StringBundler sb = new StringBundler(13);
176    
177                    sb.append("<model><model-name>");
178                    sb.append("com.liferay.portal.model.OrgGroupRole");
179                    sb.append("</model-name>");
180    
181                    sb.append(
182                            "<column><column-name>organizationId</column-name><column-value><![CDATA[");
183                    sb.append(getOrganizationId());
184                    sb.append("]]></column-value></column>");
185                    sb.append(
186                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
187                    sb.append(getGroupId());
188                    sb.append("]]></column-value></column>");
189                    sb.append(
190                            "<column><column-name>roleId</column-name><column-value><![CDATA[");
191                    sb.append(getRoleId());
192                    sb.append("]]></column-value></column>");
193    
194                    sb.append("</model>");
195    
196                    return sb.toString();
197            }
198    
199            private long _organizationId;
200            private long _groupId;
201            private long _roleId;
202    }