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 ResourceCodeModelImpl extends BaseModelImpl {
56 public static String TABLE_NAME = "ResourceCode";
57 public static Object[][] TABLE_COLUMNS = {
58 { "codeId", new Integer(Types.BIGINT) },
59 { "companyId", new Integer(Types.BIGINT) },
60 { "name", new Integer(Types.VARCHAR) },
61 { "scope", new Integer(Types.INTEGER) }
62 };
63 public static String TABLE_SQL_CREATE = "create table ResourceCode (codeId LONG not null primary key,companyId LONG,name VARCHAR(300) null,scope INTEGER)";
64 public static String TABLE_SQL_DROP = "drop table ResourceCode";
65 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
66 "xss.allow.com.liferay.portal.model.ResourceCode"), XSS_ALLOW);
67 public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
68 "xss.allow.com.liferay.portal.model.ResourceCode.name"),
69 XSS_ALLOW_BY_MODEL);
70 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
71 "lock.expiration.time.com.liferay.portal.model.ResourceCodeModel"));
72
73 public ResourceCodeModelImpl() {
74 }
75
76 public long getPrimaryKey() {
77 return _codeId;
78 }
79
80 public void setPrimaryKey(long pk) {
81 setCodeId(pk);
82 }
83
84 public Serializable getPrimaryKeyObj() {
85 return new Long(_codeId);
86 }
87
88 public long getCodeId() {
89 return _codeId;
90 }
91
92 public void setCodeId(long codeId) {
93 if (codeId != _codeId) {
94 _codeId = codeId;
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 getName() {
109 return GetterUtil.getString(_name);
110 }
111
112 public void setName(String name) {
113 if (((name == null) && (_name != null)) ||
114 ((name != null) && (_name == null)) ||
115 ((name != null) && (_name != null) && !name.equals(_name))) {
116 if (!XSS_ALLOW_NAME) {
117 name = XSSUtil.strip(name);
118 }
119
120 _name = name;
121 }
122 }
123
124 public int getScope() {
125 return _scope;
126 }
127
128 public void setScope(int scope) {
129 if (scope != _scope) {
130 _scope = scope;
131 }
132 }
133
134 public Object clone() {
135 ResourceCodeImpl clone = new ResourceCodeImpl();
136 clone.setCodeId(getCodeId());
137 clone.setCompanyId(getCompanyId());
138 clone.setName(getName());
139 clone.setScope(getScope());
140
141 return clone;
142 }
143
144 public int compareTo(Object obj) {
145 if (obj == null) {
146 return -1;
147 }
148
149 ResourceCodeImpl resourceCode = (ResourceCodeImpl)obj;
150 long pk = resourceCode.getPrimaryKey();
151
152 if (getPrimaryKey() < pk) {
153 return -1;
154 }
155 else if (getPrimaryKey() > pk) {
156 return 1;
157 }
158 else {
159 return 0;
160 }
161 }
162
163 public boolean equals(Object obj) {
164 if (obj == null) {
165 return false;
166 }
167
168 ResourceCodeImpl resourceCode = null;
169
170 try {
171 resourceCode = (ResourceCodeImpl)obj;
172 }
173 catch (ClassCastException cce) {
174 return false;
175 }
176
177 long pk = resourceCode.getPrimaryKey();
178
179 if (getPrimaryKey() == pk) {
180 return true;
181 }
182 else {
183 return false;
184 }
185 }
186
187 public int hashCode() {
188 return (int)getPrimaryKey();
189 }
190
191 private long _codeId;
192 private long _companyId;
193 private String _name;
194 private int _scope;
195 }