1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.model.impl;
24  
25  import com.liferay.portal.kernel.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.service.persistence.OrgGroupPermissionPK;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import java.io.Serializable;
31  
32  import java.sql.Types;
33  
34  /**
35   * <a href="OrgGroupPermissionModelImpl.java.html"><b><i>View Source</i></b></a>
36   *
37   * <p>
38   * ServiceBuilder generated this class. Modifications in this class will be overwritten
39   * the next time is generated.
40   * </p>
41   *
42   * <p>
43   * This class is a model that represents the <code>OrgGroupPermission</code> table
44   * in the database.
45   * </p>
46   *
47   * @author Brian Wing Shun Chan
48   *
49   * @see com.liferay.portal.service.model.OrgGroupPermission
50   * @see com.liferay.portal.service.model.OrgGroupPermissionModel
51   * @see com.liferay.portal.service.model.impl.OrgGroupPermissionImpl
52   *
53   */
54  public class OrgGroupPermissionModelImpl extends BaseModelImpl {
55      public static String TABLE_NAME = "OrgGroupPermission";
56      public static Object[][] TABLE_COLUMNS = {
57              { "organizationId", new Integer(Types.BIGINT) },
58              { "groupId", new Integer(Types.BIGINT) },
59              { "permissionId", new Integer(Types.BIGINT) }
60          };
61      public static String TABLE_SQL_CREATE = "create table OrgGroupPermission (organizationId LONG not null,groupId LONG not null,permissionId LONG not null,primary key (organizationId, groupId, permissionId))";
62      public static String TABLE_SQL_DROP = "drop table OrgGroupPermission";
63      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
64                  "xss.allow.com.liferay.portal.model.OrgGroupPermission"),
65              XSS_ALLOW);
66      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
67                  "lock.expiration.time.com.liferay.portal.model.OrgGroupPermissionModel"));
68  
69      public OrgGroupPermissionModelImpl() {
70      }
71  
72      public OrgGroupPermissionPK getPrimaryKey() {
73          return new OrgGroupPermissionPK(_organizationId, _groupId, _permissionId);
74      }
75  
76      public void setPrimaryKey(OrgGroupPermissionPK pk) {
77          setOrganizationId(pk.organizationId);
78          setGroupId(pk.groupId);
79          setPermissionId(pk.permissionId);
80      }
81  
82      public Serializable getPrimaryKeyObj() {
83          return new OrgGroupPermissionPK(_organizationId, _groupId, _permissionId);
84      }
85  
86      public long getOrganizationId() {
87          return _organizationId;
88      }
89  
90      public void setOrganizationId(long organizationId) {
91          if (organizationId != _organizationId) {
92              _organizationId = organizationId;
93          }
94      }
95  
96      public long getGroupId() {
97          return _groupId;
98      }
99  
100     public void setGroupId(long groupId) {
101         if (groupId != _groupId) {
102             _groupId = groupId;
103         }
104     }
105 
106     public long getPermissionId() {
107         return _permissionId;
108     }
109 
110     public void setPermissionId(long permissionId) {
111         if (permissionId != _permissionId) {
112             _permissionId = permissionId;
113         }
114     }
115 
116     public Object clone() {
117         OrgGroupPermissionImpl clone = new OrgGroupPermissionImpl();
118         clone.setOrganizationId(getOrganizationId());
119         clone.setGroupId(getGroupId());
120         clone.setPermissionId(getPermissionId());
121 
122         return clone;
123     }
124 
125     public int compareTo(Object obj) {
126         if (obj == null) {
127             return -1;
128         }
129 
130         OrgGroupPermissionImpl orgGroupPermission = (OrgGroupPermissionImpl)obj;
131         OrgGroupPermissionPK pk = orgGroupPermission.getPrimaryKey();
132 
133         return getPrimaryKey().compareTo(pk);
134     }
135 
136     public boolean equals(Object obj) {
137         if (obj == null) {
138             return false;
139         }
140 
141         OrgGroupPermissionImpl orgGroupPermission = null;
142 
143         try {
144             orgGroupPermission = (OrgGroupPermissionImpl)obj;
145         }
146         catch (ClassCastException cce) {
147             return false;
148         }
149 
150         OrgGroupPermissionPK pk = orgGroupPermission.getPrimaryKey();
151 
152         if (getPrimaryKey().equals(pk)) {
153             return true;
154         }
155         else {
156             return false;
157         }
158     }
159 
160     public int hashCode() {
161         return getPrimaryKey().hashCode();
162     }
163 
164     private long _organizationId;
165     private long _groupId;
166     private long _permissionId;
167 }