1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.util.GetterUtil;
19  import com.liferay.portal.kernel.util.StringBundler;
20  import com.liferay.portal.model.OrgGroupRole;
21  import com.liferay.portal.model.OrgGroupRoleSoap;
22  import com.liferay.portal.service.persistence.OrgGroupRolePK;
23  
24  import java.io.Serializable;
25  
26  import java.lang.reflect.Proxy;
27  
28  import java.sql.Types;
29  
30  import java.util.ArrayList;
31  import java.util.List;
32  
33  /**
34   * <a href="OrgGroupRoleModelImpl.java.html"><b><i>View Source</i></b></a>
35   *
36   * <p>
37   * ServiceBuilder generated this class. Modifications in this class will be
38   * overwritten the next time is generated.
39   * </p>
40   *
41   * <p>
42   * This interface is a model that represents the OrgGroupRole table in the
43   * database.
44   * </p>
45   *
46   * @author    Brian Wing Shun Chan
47   * @see       OrgGroupRoleImpl
48   * @see       com.liferay.portal.model.OrgGroupRole
49   * @see       com.liferay.portal.model.OrgGroupRoleModel
50   * @generated
51   */
52  public class OrgGroupRoleModelImpl extends BaseModelImpl<OrgGroupRole> {
53      public static final String TABLE_NAME = "OrgGroupRole";
54      public static final Object[][] TABLE_COLUMNS = {
55              { "organizationId", new Integer(Types.BIGINT) },
56              { "groupId", new Integer(Types.BIGINT) },
57              { "roleId", new Integer(Types.BIGINT) }
58          };
59      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))";
60      public static final String TABLE_SQL_DROP = "drop table OrgGroupRole";
61      public static final String DATA_SOURCE = "liferayDataSource";
62      public static final String SESSION_FACTORY = "liferaySessionFactory";
63      public static final String TX_MANAGER = "liferayTransactionManager";
64      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
65                  "value.object.entity.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
66              true);
67      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
68                  "value.object.finder.cache.enabled.com.liferay.portal.model.OrgGroupRole"),
69              true);
70  
71      public static OrgGroupRole toModel(OrgGroupRoleSoap soapModel) {
72          OrgGroupRole model = new OrgGroupRoleImpl();
73  
74          model.setOrganizationId(soapModel.getOrganizationId());
75          model.setGroupId(soapModel.getGroupId());
76          model.setRoleId(soapModel.getRoleId());
77  
78          return model;
79      }
80  
81      public static List<OrgGroupRole> toModels(OrgGroupRoleSoap[] soapModels) {
82          List<OrgGroupRole> models = new ArrayList<OrgGroupRole>(soapModels.length);
83  
84          for (OrgGroupRoleSoap soapModel : soapModels) {
85              models.add(toModel(soapModel));
86          }
87  
88          return models;
89      }
90  
91      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
92                  "lock.expiration.time.com.liferay.portal.model.OrgGroupRole"));
93  
94      public OrgGroupRoleModelImpl() {
95      }
96  
97      public OrgGroupRolePK getPrimaryKey() {
98          return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
99      }
100 
101     public void setPrimaryKey(OrgGroupRolePK pk) {
102         setOrganizationId(pk.organizationId);
103         setGroupId(pk.groupId);
104         setRoleId(pk.roleId);
105     }
106 
107     public Serializable getPrimaryKeyObj() {
108         return new OrgGroupRolePK(_organizationId, _groupId, _roleId);
109     }
110 
111     public long getOrganizationId() {
112         return _organizationId;
113     }
114 
115     public void setOrganizationId(long organizationId) {
116         _organizationId = organizationId;
117     }
118 
119     public long getGroupId() {
120         return _groupId;
121     }
122 
123     public void setGroupId(long groupId) {
124         _groupId = groupId;
125     }
126 
127     public long getRoleId() {
128         return _roleId;
129     }
130 
131     public void setRoleId(long roleId) {
132         _roleId = roleId;
133     }
134 
135     public OrgGroupRole toEscapedModel() {
136         if (isEscapedModel()) {
137             return (OrgGroupRole)this;
138         }
139         else {
140             return (OrgGroupRole)Proxy.newProxyInstance(OrgGroupRole.class.getClassLoader(),
141                 new Class[] { OrgGroupRole.class },
142                 new AutoEscapeBeanHandler(this));
143         }
144     }
145 
146     public Object clone() {
147         OrgGroupRoleImpl clone = new OrgGroupRoleImpl();
148 
149         clone.setOrganizationId(getOrganizationId());
150         clone.setGroupId(getGroupId());
151         clone.setRoleId(getRoleId());
152 
153         return clone;
154     }
155 
156     public int compareTo(OrgGroupRole orgGroupRole) {
157         OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
158 
159         return getPrimaryKey().compareTo(pk);
160     }
161 
162     public boolean equals(Object obj) {
163         if (obj == null) {
164             return false;
165         }
166 
167         OrgGroupRole orgGroupRole = null;
168 
169         try {
170             orgGroupRole = (OrgGroupRole)obj;
171         }
172         catch (ClassCastException cce) {
173             return false;
174         }
175 
176         OrgGroupRolePK pk = orgGroupRole.getPrimaryKey();
177 
178         if (getPrimaryKey().equals(pk)) {
179             return true;
180         }
181         else {
182             return false;
183         }
184     }
185 
186     public int hashCode() {
187         return getPrimaryKey().hashCode();
188     }
189 
190     public String toString() {
191         StringBundler sb = new StringBundler(7);
192 
193         sb.append("{organizationId=");
194         sb.append(getOrganizationId());
195         sb.append(", groupId=");
196         sb.append(getGroupId());
197         sb.append(", roleId=");
198         sb.append(getRoleId());
199         sb.append("}");
200 
201         return sb.toString();
202     }
203 
204     public String toXmlString() {
205         StringBundler sb = new StringBundler(13);
206 
207         sb.append("<model><model-name>");
208         sb.append("com.liferay.portal.model.OrgGroupRole");
209         sb.append("</model-name>");
210 
211         sb.append(
212             "<column><column-name>organizationId</column-name><column-value><![CDATA[");
213         sb.append(getOrganizationId());
214         sb.append("]]></column-value></column>");
215         sb.append(
216             "<column><column-name>groupId</column-name><column-value><![CDATA[");
217         sb.append(getGroupId());
218         sb.append("]]></column-value></column>");
219         sb.append(
220             "<column><column-name>roleId</column-name><column-value><![CDATA[");
221         sb.append(getRoleId());
222         sb.append("]]></column-value></column>");
223 
224         sb.append("</model>");
225 
226         return sb.toString();
227     }
228 
229     private long _organizationId;
230     private long _groupId;
231     private long _roleId;
232 }