1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.ResourceCode;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.util.Html;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38
58 public class ResourceCodeModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "ResourceCode";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "codeId", new Integer(Types.BIGINT) },
62
63
64 { "companyId", new Integer(Types.BIGINT) },
65
66
67 { "name", new Integer(Types.VARCHAR) },
68
69
70 { "scope", new Integer(Types.INTEGER) }
71 };
72 public static final String TABLE_SQL_CREATE = "create table ResourceCode (codeId LONG not null primary key,companyId LONG,name VARCHAR(300) null,scope INTEGER)";
73 public static final String TABLE_SQL_DROP = "drop table ResourceCode";
74 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
75 "value.object.finder.cache.enabled.com.liferay.portal.model.ResourceCode"),
76 true);
77 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
78 "lock.expiration.time.com.liferay.portal.model.ResourceCode"));
79
80 public ResourceCodeModelImpl() {
81 }
82
83 public long getPrimaryKey() {
84 return _codeId;
85 }
86
87 public void setPrimaryKey(long pk) {
88 setCodeId(pk);
89 }
90
91 public Serializable getPrimaryKeyObj() {
92 return new Long(_codeId);
93 }
94
95 public long getCodeId() {
96 return _codeId;
97 }
98
99 public void setCodeId(long codeId) {
100 if (codeId != _codeId) {
101 _codeId = codeId;
102 }
103 }
104
105 public long getCompanyId() {
106 return _companyId;
107 }
108
109 public void setCompanyId(long companyId) {
110 if (companyId != _companyId) {
111 _companyId = companyId;
112 }
113 }
114
115 public String getName() {
116 return GetterUtil.getString(_name);
117 }
118
119 public void setName(String name) {
120 if (((name == null) && (_name != null)) ||
121 ((name != null) && (_name == null)) ||
122 ((name != null) && (_name != null) && !name.equals(_name))) {
123 _name = name;
124 }
125 }
126
127 public int getScope() {
128 return _scope;
129 }
130
131 public void setScope(int scope) {
132 if (scope != _scope) {
133 _scope = scope;
134 }
135 }
136
137 public ResourceCode toEscapedModel() {
138 if (isEscapedModel()) {
139 return (ResourceCode)this;
140 }
141 else {
142 ResourceCode model = new ResourceCodeImpl();
143
144 model.setEscapedModel(true);
145
146 model.setCodeId(getCodeId());
147 model.setCompanyId(getCompanyId());
148 model.setName(Html.escape(getName()));
149 model.setScope(getScope());
150
151 model = (ResourceCode)Proxy.newProxyInstance(ResourceCode.class.getClassLoader(),
152 new Class[] { ResourceCode.class },
153 new ReadOnlyBeanHandler(model));
154
155 return model;
156 }
157 }
158
159 public Object clone() {
160 ResourceCodeImpl clone = new ResourceCodeImpl();
161
162 clone.setCodeId(getCodeId());
163 clone.setCompanyId(getCompanyId());
164 clone.setName(getName());
165 clone.setScope(getScope());
166
167 return clone;
168 }
169
170 public int compareTo(Object obj) {
171 if (obj == null) {
172 return -1;
173 }
174
175 ResourceCodeImpl resourceCode = (ResourceCodeImpl)obj;
176
177 long pk = resourceCode.getPrimaryKey();
178
179 if (getPrimaryKey() < pk) {
180 return -1;
181 }
182 else if (getPrimaryKey() > pk) {
183 return 1;
184 }
185 else {
186 return 0;
187 }
188 }
189
190 public boolean equals(Object obj) {
191 if (obj == null) {
192 return false;
193 }
194
195 ResourceCodeImpl resourceCode = null;
196
197 try {
198 resourceCode = (ResourceCodeImpl)obj;
199 }
200 catch (ClassCastException cce) {
201 return false;
202 }
203
204 long pk = resourceCode.getPrimaryKey();
205
206 if (getPrimaryKey() == pk) {
207 return true;
208 }
209 else {
210 return false;
211 }
212 }
213
214 public int hashCode() {
215 return (int)getPrimaryKey();
216 }
217
218 private long _codeId;
219 private long _companyId;
220 private String _name;
221 private int _scope;
222 }