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.setNew(isNew());
219 model.setEscapedModel(true);
220
221 model.setLicenseId(getLicenseId());
222 model.setName(HtmlUtil.escape(getName()));
223 model.setUrl(HtmlUtil.escape(getUrl()));
224 model.setOpenSource(getOpenSource());
225 model.setActive(getActive());
226 model.setRecommended(getRecommended());
227
228 model = (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
229 new Class[] { SCLicense.class },
230 new ReadOnlyBeanHandler(model));
231
232 return model;
233 }
234 }
235
236 public Object clone() {
237 SCLicenseImpl clone = new SCLicenseImpl();
238
239 clone.setLicenseId(getLicenseId());
240 clone.setName(getName());
241 clone.setUrl(getUrl());
242 clone.setOpenSource(getOpenSource());
243 clone.setActive(getActive());
244 clone.setRecommended(getRecommended());
245
246 return clone;
247 }
248
249 public int compareTo(Object obj) {
250 if (obj == null) {
251 return -1;
252 }
253
254 SCLicenseImpl scLicense = (SCLicenseImpl)obj;
255
256 int value = 0;
257
258 value = getName().compareTo(scLicense.getName());
259
260 if (value != 0) {
261 return value;
262 }
263
264 return 0;
265 }
266
267 public boolean equals(Object obj) {
268 if (obj == null) {
269 return false;
270 }
271
272 SCLicenseImpl scLicense = null;
273
274 try {
275 scLicense = (SCLicenseImpl)obj;
276 }
277 catch (ClassCastException cce) {
278 return false;
279 }
280
281 long pk = scLicense.getPrimaryKey();
282
283 if (getPrimaryKey() == pk) {
284 return true;
285 }
286 else {
287 return false;
288 }
289 }
290
291 public int hashCode() {
292 return (int)getPrimaryKey();
293 }
294
295 private long _licenseId;
296 private String _name;
297 private String _url;
298 private boolean _openSource;
299 private boolean _active;
300 private boolean _recommended;
301 }