1
14
15 package com.liferay.portlet.softwarecatalog.model.impl;
16
17 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18 import com.liferay.portal.kernel.util.GetterUtil;
19 import com.liferay.portal.kernel.util.StringBundler;
20 import com.liferay.portal.kernel.util.StringPool;
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 if (_name == null) {
144 return StringPool.BLANK;
145 }
146 else {
147 return _name;
148 }
149 }
150
151 public void setName(String name) {
152 _name = name;
153 }
154
155 public String getUrl() {
156 if (_url == null) {
157 return StringPool.BLANK;
158 }
159 else {
160 return _url;
161 }
162 }
163
164 public void setUrl(String url) {
165 _url = url;
166 }
167
168 public boolean getOpenSource() {
169 return _openSource;
170 }
171
172 public boolean isOpenSource() {
173 return _openSource;
174 }
175
176 public void setOpenSource(boolean openSource) {
177 _openSource = openSource;
178 }
179
180 public boolean getActive() {
181 return _active;
182 }
183
184 public boolean isActive() {
185 return _active;
186 }
187
188 public void setActive(boolean active) {
189 _active = active;
190 }
191
192 public boolean getRecommended() {
193 return _recommended;
194 }
195
196 public boolean isRecommended() {
197 return _recommended;
198 }
199
200 public void setRecommended(boolean recommended) {
201 _recommended = recommended;
202 }
203
204 public SCLicense toEscapedModel() {
205 if (isEscapedModel()) {
206 return (SCLicense)this;
207 }
208 else {
209 return (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
210 new Class[] { SCLicense.class }, new AutoEscapeBeanHandler(this));
211 }
212 }
213
214 public ExpandoBridge getExpandoBridge() {
215 if (_expandoBridge == null) {
216 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(SCLicense.class.getName(),
217 getPrimaryKey());
218 }
219
220 return _expandoBridge;
221 }
222
223 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
224 getExpandoBridge().setAttributes(serviceContext);
225 }
226
227 public Object clone() {
228 SCLicenseImpl clone = new SCLicenseImpl();
229
230 clone.setLicenseId(getLicenseId());
231 clone.setName(getName());
232 clone.setUrl(getUrl());
233 clone.setOpenSource(getOpenSource());
234 clone.setActive(getActive());
235 clone.setRecommended(getRecommended());
236
237 return clone;
238 }
239
240 public int compareTo(SCLicense scLicense) {
241 int value = 0;
242
243 value = getName().compareTo(scLicense.getName());
244
245 if (value != 0) {
246 return value;
247 }
248
249 return 0;
250 }
251
252 public boolean equals(Object obj) {
253 if (obj == null) {
254 return false;
255 }
256
257 SCLicense scLicense = null;
258
259 try {
260 scLicense = (SCLicense)obj;
261 }
262 catch (ClassCastException cce) {
263 return false;
264 }
265
266 long pk = scLicense.getPrimaryKey();
267
268 if (getPrimaryKey() == pk) {
269 return true;
270 }
271 else {
272 return false;
273 }
274 }
275
276 public int hashCode() {
277 return (int)getPrimaryKey();
278 }
279
280 public String toString() {
281 StringBundler sb = new StringBundler(13);
282
283 sb.append("{licenseId=");
284 sb.append(getLicenseId());
285 sb.append(", name=");
286 sb.append(getName());
287 sb.append(", url=");
288 sb.append(getUrl());
289 sb.append(", openSource=");
290 sb.append(getOpenSource());
291 sb.append(", active=");
292 sb.append(getActive());
293 sb.append(", recommended=");
294 sb.append(getRecommended());
295 sb.append("}");
296
297 return sb.toString();
298 }
299
300 public String toXmlString() {
301 StringBundler sb = new StringBundler(22);
302
303 sb.append("<model><model-name>");
304 sb.append("com.liferay.portlet.softwarecatalog.model.SCLicense");
305 sb.append("</model-name>");
306
307 sb.append(
308 "<column><column-name>licenseId</column-name><column-value><![CDATA[");
309 sb.append(getLicenseId());
310 sb.append("]]></column-value></column>");
311 sb.append(
312 "<column><column-name>name</column-name><column-value><![CDATA[");
313 sb.append(getName());
314 sb.append("]]></column-value></column>");
315 sb.append(
316 "<column><column-name>url</column-name><column-value><![CDATA[");
317 sb.append(getUrl());
318 sb.append("]]></column-value></column>");
319 sb.append(
320 "<column><column-name>openSource</column-name><column-value><![CDATA[");
321 sb.append(getOpenSource());
322 sb.append("]]></column-value></column>");
323 sb.append(
324 "<column><column-name>active</column-name><column-value><![CDATA[");
325 sb.append(getActive());
326 sb.append("]]></column-value></column>");
327 sb.append(
328 "<column><column-name>recommended</column-name><column-value><![CDATA[");
329 sb.append(getRecommended());
330 sb.append("]]></column-value></column>");
331
332 sb.append("</model>");
333
334 return sb.toString();
335 }
336
337 private long _licenseId;
338 private String _name;
339 private String _url;
340 private boolean _openSource;
341 private boolean _active;
342 private boolean _recommended;
343 private transient ExpandoBridge _expandoBridge;
344 }