1
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.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35
55 public class PermissionModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "Permission_";
57 public static Object[][] TABLE_COLUMNS = {
58 { "permissionId", new Integer(Types.BIGINT) },
59 { "companyId", new Integer(Types.BIGINT) },
60 { "actionId", new Integer(Types.VARCHAR) },
61 { "resourceId", new Integer(Types.BIGINT) }
62 };
63 public static String TABLE_SQL_CREATE = "create table Permission_ (permissionId LONG not null primary key,companyId LONG,actionId VARCHAR(75) null,resourceId LONG)";
64 public static String TABLE_SQL_DROP = "drop table Permission_";
65 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
66 "xss.allow.com.liferay.portal.model.Permission"), XSS_ALLOW);
67 public static boolean XSS_ALLOW_ACTIONID = GetterUtil.getBoolean(PropsUtil.get(
68 "xss.allow.com.liferay.portal.model.Permission.actionId"),
69 XSS_ALLOW_BY_MODEL);
70 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
71 "lock.expiration.time.com.liferay.portal.model.PermissionModel"));
72
73 public PermissionModelImpl() {
74 }
75
76 public long getPrimaryKey() {
77 return _permissionId;
78 }
79
80 public void setPrimaryKey(long pk) {
81 setPermissionId(pk);
82 }
83
84 public Serializable getPrimaryKeyObj() {
85 return new Long(_permissionId);
86 }
87
88 public long getPermissionId() {
89 return _permissionId;
90 }
91
92 public void setPermissionId(long permissionId) {
93 if (permissionId != _permissionId) {
94 _permissionId = permissionId;
95 }
96 }
97
98 public long getCompanyId() {
99 return _companyId;
100 }
101
102 public void setCompanyId(long companyId) {
103 if (companyId != _companyId) {
104 _companyId = companyId;
105 }
106 }
107
108 public String getActionId() {
109 return GetterUtil.getString(_actionId);
110 }
111
112 public void setActionId(String actionId) {
113 if (((actionId == null) && (_actionId != null)) ||
114 ((actionId != null) && (_actionId == null)) ||
115 ((actionId != null) && (_actionId != null) &&
116 !actionId.equals(_actionId))) {
117 if (!XSS_ALLOW_ACTIONID) {
118 actionId = XSSUtil.strip(actionId);
119 }
120
121 _actionId = actionId;
122 }
123 }
124
125 public long getResourceId() {
126 return _resourceId;
127 }
128
129 public void setResourceId(long resourceId) {
130 if (resourceId != _resourceId) {
131 _resourceId = resourceId;
132 }
133 }
134
135 public Object clone() {
136 PermissionImpl clone = new PermissionImpl();
137 clone.setPermissionId(getPermissionId());
138 clone.setCompanyId(getCompanyId());
139 clone.setActionId(getActionId());
140 clone.setResourceId(getResourceId());
141
142 return clone;
143 }
144
145 public int compareTo(Object obj) {
146 if (obj == null) {
147 return -1;
148 }
149
150 PermissionImpl permission = (PermissionImpl)obj;
151 long pk = permission.getPrimaryKey();
152
153 if (getPrimaryKey() < pk) {
154 return -1;
155 }
156 else if (getPrimaryKey() > pk) {
157 return 1;
158 }
159 else {
160 return 0;
161 }
162 }
163
164 public boolean equals(Object obj) {
165 if (obj == null) {
166 return false;
167 }
168
169 PermissionImpl permission = null;
170
171 try {
172 permission = (PermissionImpl)obj;
173 }
174 catch (ClassCastException cce) {
175 return false;
176 }
177
178 long pk = permission.getPrimaryKey();
179
180 if (getPrimaryKey() == pk) {
181 return true;
182 }
183 else {
184 return false;
185 }
186 }
187
188 public int hashCode() {
189 return (int)getPrimaryKey();
190 }
191
192 private long _permissionId;
193 private long _companyId;
194 private String _actionId;
195 private long _resourceId;
196 }