001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.UserGroupGroupRole;
021    import com.liferay.portal.model.UserGroupGroupRoleModel;
022    import com.liferay.portal.model.UserGroupGroupRoleSoap;
023    import com.liferay.portal.service.persistence.UserGroupGroupRolePK;
024    
025    import java.io.Serializable;
026    
027    import java.lang.reflect.Proxy;
028    
029    import java.sql.Types;
030    
031    import java.util.ArrayList;
032    import java.util.List;
033    
034    /**
035     * The base model implementation for the UserGroupGroupRole service. Represents a row in the "UserGroupGroupRole" database table, with each column mapped to a property of this class.
036     *
037     * <p>
038     * This implementation and its corresponding interface {@link com.liferay.portal.model.UserGroupGroupRoleModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link UserGroupGroupRoleImpl}.
039     * </p>
040     *
041     * <p>
042     * Never modify or reference this class directly. All methods that expect a user group group role model instance should use the {@link com.liferay.portal.model.UserGroupGroupRole} interface instead.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @see UserGroupGroupRoleImpl
047     * @see com.liferay.portal.model.UserGroupGroupRole
048     * @see com.liferay.portal.model.UserGroupGroupRoleModel
049     * @generated
050     */
051    public class UserGroupGroupRoleModelImpl extends BaseModelImpl<UserGroupGroupRole>
052            implements UserGroupGroupRoleModel {
053            public static final String TABLE_NAME = "UserGroupGroupRole";
054            public static final Object[][] TABLE_COLUMNS = {
055                            { "userGroupId", new Integer(Types.BIGINT) },
056                            { "groupId", new Integer(Types.BIGINT) },
057                            { "roleId", new Integer(Types.BIGINT) }
058                    };
059            public static final String TABLE_SQL_CREATE = "create table UserGroupGroupRole (userGroupId LONG not null,groupId LONG not null,roleId LONG not null,primary key (userGroupId, groupId, roleId))";
060            public static final String TABLE_SQL_DROP = "drop table UserGroupGroupRole";
061            public static final String DATA_SOURCE = "liferayDataSource";
062            public static final String SESSION_FACTORY = "liferaySessionFactory";
063            public static final String TX_MANAGER = "liferayTransactionManager";
064            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
065                                    "value.object.entity.cache.enabled.com.liferay.portal.model.UserGroupGroupRole"),
066                            true);
067            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
068                                    "value.object.finder.cache.enabled.com.liferay.portal.model.UserGroupGroupRole"),
069                            true);
070    
071            /**
072             * Converts the soap model instance into a normal model instance.
073             *
074             * @param soapModel the soap model instance to convert
075             * @return the normal model instance
076             */
077            public static UserGroupGroupRole toModel(UserGroupGroupRoleSoap soapModel) {
078                    UserGroupGroupRole model = new UserGroupGroupRoleImpl();
079    
080                    model.setUserGroupId(soapModel.getUserGroupId());
081                    model.setGroupId(soapModel.getGroupId());
082                    model.setRoleId(soapModel.getRoleId());
083    
084                    return model;
085            }
086    
087            /**
088             * Converts the soap model instances into normal model instances.
089             *
090             * @param soapModels the soap model instances to convert
091             * @return the normal model instances
092             */
093            public static List<UserGroupGroupRole> toModels(
094                    UserGroupGroupRoleSoap[] soapModels) {
095                    List<UserGroupGroupRole> models = new ArrayList<UserGroupGroupRole>(soapModels.length);
096    
097                    for (UserGroupGroupRoleSoap soapModel : soapModels) {
098                            models.add(toModel(soapModel));
099                    }
100    
101                    return models;
102            }
103    
104            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
105                                    "lock.expiration.time.com.liferay.portal.model.UserGroupGroupRole"));
106    
107            public UserGroupGroupRoleModelImpl() {
108            }
109    
110            public UserGroupGroupRolePK getPrimaryKey() {
111                    return new UserGroupGroupRolePK(_userGroupId, _groupId, _roleId);
112            }
113    
114            public void setPrimaryKey(UserGroupGroupRolePK pk) {
115                    setUserGroupId(pk.userGroupId);
116                    setGroupId(pk.groupId);
117                    setRoleId(pk.roleId);
118            }
119    
120            public Serializable getPrimaryKeyObj() {
121                    return new UserGroupGroupRolePK(_userGroupId, _groupId, _roleId);
122            }
123    
124            public long getUserGroupId() {
125                    return _userGroupId;
126            }
127    
128            public void setUserGroupId(long userGroupId) {
129                    _userGroupId = userGroupId;
130            }
131    
132            public long getGroupId() {
133                    return _groupId;
134            }
135    
136            public void setGroupId(long groupId) {
137                    _groupId = groupId;
138            }
139    
140            public long getRoleId() {
141                    return _roleId;
142            }
143    
144            public void setRoleId(long roleId) {
145                    _roleId = roleId;
146            }
147    
148            public UserGroupGroupRole toEscapedModel() {
149                    if (isEscapedModel()) {
150                            return (UserGroupGroupRole)this;
151                    }
152                    else {
153                            return (UserGroupGroupRole)Proxy.newProxyInstance(UserGroupGroupRole.class.getClassLoader(),
154                                    new Class[] { UserGroupGroupRole.class },
155                                    new AutoEscapeBeanHandler(this));
156                    }
157            }
158    
159            public Object clone() {
160                    UserGroupGroupRoleImpl clone = new UserGroupGroupRoleImpl();
161    
162                    clone.setUserGroupId(getUserGroupId());
163                    clone.setGroupId(getGroupId());
164                    clone.setRoleId(getRoleId());
165    
166                    return clone;
167            }
168    
169            public int compareTo(UserGroupGroupRole userGroupGroupRole) {
170                    UserGroupGroupRolePK pk = userGroupGroupRole.getPrimaryKey();
171    
172                    return getPrimaryKey().compareTo(pk);
173            }
174    
175            public boolean equals(Object obj) {
176                    if (obj == null) {
177                            return false;
178                    }
179    
180                    UserGroupGroupRole userGroupGroupRole = null;
181    
182                    try {
183                            userGroupGroupRole = (UserGroupGroupRole)obj;
184                    }
185                    catch (ClassCastException cce) {
186                            return false;
187                    }
188    
189                    UserGroupGroupRolePK pk = userGroupGroupRole.getPrimaryKey();
190    
191                    if (getPrimaryKey().equals(pk)) {
192                            return true;
193                    }
194                    else {
195                            return false;
196                    }
197            }
198    
199            public int hashCode() {
200                    return getPrimaryKey().hashCode();
201            }
202    
203            public String toString() {
204                    StringBundler sb = new StringBundler(7);
205    
206                    sb.append("{userGroupId=");
207                    sb.append(getUserGroupId());
208                    sb.append(", groupId=");
209                    sb.append(getGroupId());
210                    sb.append(", roleId=");
211                    sb.append(getRoleId());
212                    sb.append("}");
213    
214                    return sb.toString();
215            }
216    
217            public String toXmlString() {
218                    StringBundler sb = new StringBundler(13);
219    
220                    sb.append("<model><model-name>");
221                    sb.append("com.liferay.portal.model.UserGroupGroupRole");
222                    sb.append("</model-name>");
223    
224                    sb.append(
225                            "<column><column-name>userGroupId</column-name><column-value><![CDATA[");
226                    sb.append(getUserGroupId());
227                    sb.append("]]></column-value></column>");
228                    sb.append(
229                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
230                    sb.append(getGroupId());
231                    sb.append("]]></column-value></column>");
232                    sb.append(
233                            "<column><column-name>roleId</column-name><column-value><![CDATA[");
234                    sb.append(getRoleId());
235                    sb.append("]]></column-value></column>");
236    
237                    sb.append("</model>");
238    
239                    return sb.toString();
240            }
241    
242            private long _userGroupId;
243            private long _groupId;
244            private long _roleId;
245    }