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
30 import com.liferay.portlet.softwarecatalog.model.SCLicense;
31 import com.liferay.portlet.softwarecatalog.model.SCLicenseSoap;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.List;
41
42
62 public class SCLicenseModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "SCLicense";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "licenseId", new Integer(Types.BIGINT) },
66
67
68 { "name", new Integer(Types.VARCHAR) },
69
70
71 { "url", new Integer(Types.VARCHAR) },
72
73
74 { "openSource", new Integer(Types.BOOLEAN) },
75
76
77 { "active_", new Integer(Types.BOOLEAN) },
78
79
80 { "recommended", new Integer(Types.BOOLEAN) }
81 };
82 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)";
83 public static final String TABLE_SQL_DROP = "drop table SCLicense";
84 public static final String DATA_SOURCE = "liferayDataSource";
85 public static final String SESSION_FACTORY = "liferaySessionFactory";
86 public static final String TX_MANAGER = "liferayTransactionManager";
87 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
88 "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
89 true);
90
91 public static SCLicense toModel(SCLicenseSoap soapModel) {
92 SCLicense model = new SCLicenseImpl();
93
94 model.setLicenseId(soapModel.getLicenseId());
95 model.setName(soapModel.getName());
96 model.setUrl(soapModel.getUrl());
97 model.setOpenSource(soapModel.getOpenSource());
98 model.setActive(soapModel.getActive());
99 model.setRecommended(soapModel.getRecommended());
100
101 return model;
102 }
103
104 public static List<SCLicense> toModels(SCLicenseSoap[] soapModels) {
105 List<SCLicense> models = new ArrayList<SCLicense>(soapModels.length);
106
107 for (SCLicenseSoap soapModel : soapModels) {
108 models.add(toModel(soapModel));
109 }
110
111 return models;
112 }
113
114 public static final boolean CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115 "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
116 true);
117 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
118 "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCLicense"));
119
120 public SCLicenseModelImpl() {
121 }
122
123 public long getPrimaryKey() {
124 return _licenseId;
125 }
126
127 public void setPrimaryKey(long pk) {
128 setLicenseId(pk);
129 }
130
131 public Serializable getPrimaryKeyObj() {
132 return new Long(_licenseId);
133 }
134
135 public long getLicenseId() {
136 return _licenseId;
137 }
138
139 public void setLicenseId(long licenseId) {
140 if (licenseId != _licenseId) {
141 _licenseId = licenseId;
142 }
143 }
144
145 public String getName() {
146 return GetterUtil.getString(_name);
147 }
148
149 public void setName(String name) {
150 if (((name == null) && (_name != null)) ||
151 ((name != null) && (_name == null)) ||
152 ((name != null) && (_name != null) && !name.equals(_name))) {
153 _name = name;
154 }
155 }
156
157 public String getUrl() {
158 return GetterUtil.getString(_url);
159 }
160
161 public void setUrl(String url) {
162 if (((url == null) && (_url != null)) ||
163 ((url != null) && (_url == null)) ||
164 ((url != null) && (_url != null) && !url.equals(_url))) {
165 _url = url;
166 }
167 }
168
169 public boolean getOpenSource() {
170 return _openSource;
171 }
172
173 public boolean isOpenSource() {
174 return _openSource;
175 }
176
177 public void setOpenSource(boolean openSource) {
178 if (openSource != _openSource) {
179 _openSource = openSource;
180 }
181 }
182
183 public boolean getActive() {
184 return _active;
185 }
186
187 public boolean isActive() {
188 return _active;
189 }
190
191 public void setActive(boolean active) {
192 if (active != _active) {
193 _active = active;
194 }
195 }
196
197 public boolean getRecommended() {
198 return _recommended;
199 }
200
201 public boolean isRecommended() {
202 return _recommended;
203 }
204
205 public void setRecommended(boolean recommended) {
206 if (recommended != _recommended) {
207 _recommended = recommended;
208 }
209 }
210
211 public SCLicense toEscapedModel() {
212 if (isEscapedModel()) {
213 return (SCLicense)this;
214 }
215 else {
216 SCLicense model = new SCLicenseImpl();
217
218 model.setEscapedModel(true);
219
220 model.setLicenseId(getLicenseId());
221 model.setName(HtmlUtil.escape(getName()));
222 model.setUrl(HtmlUtil.escape(getUrl()));
223 model.setOpenSource(getOpenSource());
224 model.setActive(getActive());
225 model.setRecommended(getRecommended());
226
227 model = (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
228 new Class[] { SCLicense.class },
229 new ReadOnlyBeanHandler(model));
230
231 return model;
232 }
233 }
234
235 public Object clone() {
236 SCLicenseImpl clone = new SCLicenseImpl();
237
238 clone.setLicenseId(getLicenseId());
239 clone.setName(getName());
240 clone.setUrl(getUrl());
241 clone.setOpenSource(getOpenSource());
242 clone.setActive(getActive());
243 clone.setRecommended(getRecommended());
244
245 return clone;
246 }
247
248 public int compareTo(Object obj) {
249 if (obj == null) {
250 return -1;
251 }
252
253 SCLicenseImpl scLicense = (SCLicenseImpl)obj;
254
255 int value = 0;
256
257 value = getName().compareTo(scLicense.getName());
258
259 if (value != 0) {
260 return value;
261 }
262
263 return 0;
264 }
265
266 public boolean equals(Object obj) {
267 if (obj == null) {
268 return false;
269 }
270
271 SCLicenseImpl scLicense = null;
272
273 try {
274 scLicense = (SCLicenseImpl)obj;
275 }
276 catch (ClassCastException cce) {
277 return false;
278 }
279
280 long pk = scLicense.getPrimaryKey();
281
282 if (getPrimaryKey() == pk) {
283 return true;
284 }
285 else {
286 return false;
287 }
288 }
289
290 public int hashCode() {
291 return (int)getPrimaryKey();
292 }
293
294 private long _licenseId;
295 private String _name;
296 private String _url;
297 private boolean _openSource;
298 private boolean _active;
299 private boolean _recommended;
300 }