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