1
22
23 package com.liferay.portlet.softwarecatalog.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29 import com.liferay.portal.service.ServiceContext;
30
31 import com.liferay.portlet.expando.model.ExpandoBridge;
32 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
33 import com.liferay.portlet.softwarecatalog.model.SCLicense;
34 import com.liferay.portlet.softwarecatalog.model.SCLicenseSoap;
35
36 import java.io.Serializable;
37
38 import java.lang.reflect.Proxy;
39
40 import java.sql.Types;
41
42 import java.util.ArrayList;
43 import java.util.List;
44
45
64 public class SCLicenseModelImpl extends BaseModelImpl<SCLicense> {
65 public static final String TABLE_NAME = "SCLicense";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "licenseId", new Integer(Types.BIGINT) },
68 { "name", new Integer(Types.VARCHAR) },
69 { "url", new Integer(Types.VARCHAR) },
70 { "openSource", new Integer(Types.BOOLEAN) },
71 { "active_", new Integer(Types.BOOLEAN) },
72 { "recommended", new Integer(Types.BOOLEAN) }
73 };
74 public static final String TABLE_SQL_CREATE = "create table SCLicense (licenseId LONG not null primary key,name VARCHAR(75) null,url STRING null,openSource BOOLEAN,active_ BOOLEAN,recommended BOOLEAN)";
75 public static final String TABLE_SQL_DROP = "drop table SCLicense";
76 public static final String DATA_SOURCE = "liferayDataSource";
77 public static final String SESSION_FACTORY = "liferaySessionFactory";
78 public static final String TX_MANAGER = "liferayTransactionManager";
79 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
80 "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
81 true);
82 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
83 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
84 true);
85
86 public static SCLicense toModel(SCLicenseSoap soapModel) {
87 SCLicense model = new SCLicenseImpl();
88
89 model.setLicenseId(soapModel.getLicenseId());
90 model.setName(soapModel.getName());
91 model.setUrl(soapModel.getUrl());
92 model.setOpenSource(soapModel.getOpenSource());
93 model.setActive(soapModel.getActive());
94 model.setRecommended(soapModel.getRecommended());
95
96 return model;
97 }
98
99 public static List<SCLicense> toModels(SCLicenseSoap[] soapModels) {
100 List<SCLicense> models = new ArrayList<SCLicense>(soapModels.length);
101
102 for (SCLicenseSoap soapModel : soapModels) {
103 models.add(toModel(soapModel));
104 }
105
106 return models;
107 }
108
109 public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
110 GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
111 "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
112 true);
113 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
114 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCLicense"));
115
116 public SCLicenseModelImpl() {
117 }
118
119 public long getPrimaryKey() {
120 return _licenseId;
121 }
122
123 public void setPrimaryKey(long pk) {
124 setLicenseId(pk);
125 }
126
127 public Serializable getPrimaryKeyObj() {
128 return new Long(_licenseId);
129 }
130
131 public long getLicenseId() {
132 return _licenseId;
133 }
134
135 public void setLicenseId(long licenseId) {
136 _licenseId = licenseId;
137 }
138
139 public String getName() {
140 return GetterUtil.getString(_name);
141 }
142
143 public void setName(String name) {
144 _name = name;
145 }
146
147 public String getUrl() {
148 return GetterUtil.getString(_url);
149 }
150
151 public void setUrl(String url) {
152 _url = url;
153 }
154
155 public boolean getOpenSource() {
156 return _openSource;
157 }
158
159 public boolean isOpenSource() {
160 return _openSource;
161 }
162
163 public void setOpenSource(boolean openSource) {
164 _openSource = openSource;
165 }
166
167 public boolean getActive() {
168 return _active;
169 }
170
171 public boolean isActive() {
172 return _active;
173 }
174
175 public void setActive(boolean active) {
176 _active = active;
177 }
178
179 public boolean getRecommended() {
180 return _recommended;
181 }
182
183 public boolean isRecommended() {
184 return _recommended;
185 }
186
187 public void setRecommended(boolean recommended) {
188 _recommended = recommended;
189 }
190
191 public SCLicense toEscapedModel() {
192 if (isEscapedModel()) {
193 return (SCLicense)this;
194 }
195 else {
196 SCLicense model = new SCLicenseImpl();
197
198 model.setNew(isNew());
199 model.setEscapedModel(true);
200
201 model.setLicenseId(getLicenseId());
202 model.setName(HtmlUtil.escape(getName()));
203 model.setUrl(HtmlUtil.escape(getUrl()));
204 model.setOpenSource(getOpenSource());
205 model.setActive(getActive());
206 model.setRecommended(getRecommended());
207
208 model = (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
209 new Class[] { SCLicense.class },
210 new ReadOnlyBeanHandler(model));
211
212 return model;
213 }
214 }
215
216 public ExpandoBridge getExpandoBridge() {
217 if (_expandoBridge == null) {
218 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(SCLicense.class.getName(),
219 getPrimaryKey());
220 }
221
222 return _expandoBridge;
223 }
224
225 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
226 getExpandoBridge().setAttributes(serviceContext);
227 }
228
229 public Object clone() {
230 SCLicenseImpl clone = new SCLicenseImpl();
231
232 clone.setLicenseId(getLicenseId());
233 clone.setName(getName());
234 clone.setUrl(getUrl());
235 clone.setOpenSource(getOpenSource());
236 clone.setActive(getActive());
237 clone.setRecommended(getRecommended());
238
239 return clone;
240 }
241
242 public int compareTo(SCLicense scLicense) {
243 int value = 0;
244
245 value = getName().compareTo(scLicense.getName());
246
247 if (value != 0) {
248 return value;
249 }
250
251 return 0;
252 }
253
254 public boolean equals(Object obj) {
255 if (obj == null) {
256 return false;
257 }
258
259 SCLicense scLicense = null;
260
261 try {
262 scLicense = (SCLicense)obj;
263 }
264 catch (ClassCastException cce) {
265 return false;
266 }
267
268 long pk = scLicense.getPrimaryKey();
269
270 if (getPrimaryKey() == pk) {
271 return true;
272 }
273 else {
274 return false;
275 }
276 }
277
278 public int hashCode() {
279 return (int)getPrimaryKey();
280 }
281
282 public String toString() {
283 StringBuilder sb = new StringBuilder();
284
285 sb.append("{licenseId=");
286 sb.append(getLicenseId());
287 sb.append(", name=");
288 sb.append(getName());
289 sb.append(", url=");
290 sb.append(getUrl());
291 sb.append(", openSource=");
292 sb.append(getOpenSource());
293 sb.append(", active=");
294 sb.append(getActive());
295 sb.append(", recommended=");
296 sb.append(getRecommended());
297 sb.append("}");
298
299 return sb.toString();
300 }
301
302 public String toXmlString() {
303 StringBuilder sb = new StringBuilder();
304
305 sb.append("<model><model-name>");
306 sb.append("com.liferay.portlet.softwarecatalog.model.SCLicense");
307 sb.append("</model-name>");
308
309 sb.append(
310 "<column><column-name>licenseId</column-name><column-value><![CDATA[");
311 sb.append(getLicenseId());
312 sb.append("]]></column-value></column>");
313 sb.append(
314 "<column><column-name>name</column-name><column-value><![CDATA[");
315 sb.append(getName());
316 sb.append("]]></column-value></column>");
317 sb.append(
318 "<column><column-name>url</column-name><column-value><![CDATA[");
319 sb.append(getUrl());
320 sb.append("]]></column-value></column>");
321 sb.append(
322 "<column><column-name>openSource</column-name><column-value><![CDATA[");
323 sb.append(getOpenSource());
324 sb.append("]]></column-value></column>");
325 sb.append(
326 "<column><column-name>active</column-name><column-value><![CDATA[");
327 sb.append(getActive());
328 sb.append("]]></column-value></column>");
329 sb.append(
330 "<column><column-name>recommended</column-name><column-value><![CDATA[");
331 sb.append(getRecommended());
332 sb.append("]]></column-value></column>");
333
334 sb.append("</model>");
335
336 return sb.toString();
337 }
338
339 private long _licenseId;
340 private String _name;
341 private String _url;
342 private boolean _openSource;
343 private boolean _active;
344 private boolean _recommended;
345 private transient ExpandoBridge _expandoBridge;
346 }