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