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