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     * The base model implementation for the OrgGroupRole service. Represents a row in the "OrgGroupRole" database table, with each column mapped to a property of this class.
032     *
033     * <p>
034     * This implementation and its corresponding interface {@link com.liferay.portal.model.OrgGroupRoleModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link OrgGroupRoleImpl}.
035     * </p>
036     *
037     * <p>
038     * Never modify or reference this class directly. All methods that expect a org group role model instance should use the {@link com.liferay.portal.model.OrgGroupRole} interface instead.
039     * </p>
040     *
041     * @author Brian Wing Shun Chan
042     * @see OrgGroupRoleImpl
043     * @see com.liferay.portal.model.OrgGroupRole
044     * @see com.liferay.portal.model.OrgGroupRoleModel
045     * @generated
046     */
047    public class OrgGroupRoleModelImpl extends BaseModelImpl<OrgGroupRole>
048            implements OrgGroupRoleModel {
049            public static final String TABLE_NAME = "OrgGroupRole";
050            public static final Object[][] TABLE_COLUMNS = {
051                            { "organizationId", new Integer(Types.BIGINT) },
052                            { "groupId", new Integer(Types.BIGINT) },
053                            { "roleId", new Integer(Types.BIGINT) }
054                    };
055            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))";
056            public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
057            public static final String DATA_SOURCE = "liferayDataSource";
058            public static final String SESSION_FACTORY = "liferaySessionFactory";
059            public static final String TX_MANAGER = "liferayTransactionManager";
060            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
061                                    "value.object.entity.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
062                            true);
063            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
064                                    "value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
065                            true);
066            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
067                                    "lock.expiration.time.com.liferay.portal.model.OrgGroupRole"));
068    
069            public OrgGroupRoleModelImpl() {
070            }
071    
072            public OrgGroupRolePK getPrimaryKey() {
073                    return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
074            }
075    
076            public void setPrimaryKey(OrgGroupRolePK pk) {
077                    setOrganizationId(pk.organizationId);
078                    setGroupId(pk.groupId);
079                    setRoleId(pk.roleId);
080            }
081    
082            public Serializable getPrimaryKeyObj() {
083                    return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
084            }
085    
086            public long getOrganizationId() {
087                    return _organizationId;
088            }
089    
090            public void setOrganizationId(long organizationId) {
091                    _organizationId = organizationId;
092            }
093    
094            public long getGroupId() {
095                    return _groupId;
096            }
097    
098            public void setGroupId(long groupId) {
099                    _groupId = groupId;
100            }
101    
102            public long getRoleId() {
103                    return _roleId;
104            }
105    
106            public void setRoleId(long roleId) {
107                    _roleId = roleId;
108            }
109    
110            public OrgGroupRole toEscapedModel() {
111                    if (isEscapedModel()) {
112                            return (OrgGroupRole)this;
113                    }
114                    else {
115                            return (OrgGroupRole)Proxy.newProxyInstance(OrgGroupRole.class.getClassLoader(),
116                                    new Class[] { OrgGroupRole.class },
117                                    new AutoEscapeBeanHandler(this));
118                    }
119            }
120    
121            public Object clone() {
122                    OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
123    
124                    clone.setOrganizationId(getOrganizationId());
125                    clone.setGroupId(getGroupId());
126                    clone.setRoleId(getRoleId());
127    
128                    return clone;
129            }
130    
131            public int compareTo(OrgGroupRole orgGroupRole) {
132                    OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
133    
134                    return getPrimaryKey().compareTo(pk);
135            }
136    
137            public boolean equals(Object obj) {
138                    if (obj == null) {
139                            return false;
140                    }
141    
142                    OrgGroupRole orgGroupRole = null;
143    
144                    try {
145                            orgGroupRole = (OrgGroupRole)obj;
146                    }
147                    catch (ClassCastException cce) {
148                            return false;
149                    }
150    
151                    OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
152    
153                    if (getPrimaryKey().equals(pk)) {
154                            return true;
155                    }
156                    else {
157                            return false;
158                    }
159            }
160    
161            public int hashCode() {
162                    return getPrimaryKey().hashCode();
163            }
164    
165            public String toString() {
166                    StringBundler sb = new StringBundler(7);
167    
168                    sb.append("{organizationId=");
169                    sb.append(getOrganizationId());
170                    sb.append(", groupId=");
171                    sb.append(getGroupId());
172                    sb.append(", roleId=");
173                    sb.append(getRoleId());
174                    sb.append("}");
175    
176                    return sb.toString();
177            }
178    
179            public String toXmlString() {
180                    StringBundler sb = new StringBundler(13);
181    
182                    sb.append("<model><model-name>");
183                    sb.append("com.liferay.portal.model.OrgGroupRole");
184                    sb.append("</model-name>");
185    
186                    sb.append(
187                            "<column><column-name>organizationId</column-name><column-value><![CDATA[");
188                    sb.append(getOrganizationId());
189                    sb.append("]]></column-value></column>");
190                    sb.append(
191                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
192                    sb.append(getGroupId());
193                    sb.append("]]></column-value></column>");
194                    sb.append(
195                            "<column><column-name>roleId</column-name><column-value><![CDATA[");
196                    sb.append(getRoleId());
197                    sb.append("]]></column-value></column>");
198    
199                    sb.append("</model>");
200    
201                    return sb.toString();
202            }
203    
204            private long _organizationId;
205            private long _groupId;
206            private long _roleId;
207    }