001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.softwarecatalog.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.util.GetterUtil;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.impl.BaseModelImpl;
022    import com.liferay.portal.service.ServiceContext;
023    
024    import com.liferay.portlet.expando.model.ExpandoBridge;
025    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
026    import com.liferay.portlet.softwarecatalog.model.SCLicense;
027    import com.liferay.portlet.softwarecatalog.model.SCLicenseModel;
028    import com.liferay.portlet.softwarecatalog.model.SCLicenseSoap;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    import java.util.ArrayList;
037    import java.util.List;
038    
039    /**
040     * <p>
041     * This interface is a model that represents the SCLicense table in the
042     * database.
043     * </p>
044     *
045     * @author    Brian Wing Shun Chan
046     * @see       SCLicenseImpl
047     * @see       com.liferay.portlet.softwarecatalog.model.SCLicense
048     * @see       com.liferay.portlet.softwarecatalog.model.SCLicenseModel
049     * @generated
050     */
051    public class SCLicenseModelImpl extends BaseModelImpl<SCLicense>
052            implements SCLicenseModel {
053            public static final String TABLE_NAME = "SCLicense";
054            public static final Object[][] TABLE_COLUMNS = {
055                            { "licenseId", new Integer(Types.BIGINT) },
056                            { "name", new Integer(Types.VARCHAR) },
057                            { "url", new Integer(Types.VARCHAR) },
058                            { "openSource", new Integer(Types.BOOLEAN) },
059                            { "active_", new Integer(Types.BOOLEAN) },
060                            { "recommended", new Integer(Types.BOOLEAN) }
061                    };
062            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)";
063            public static final String TABLE_SQL_DROP = "drop table SCLicense";
064            public static final String ORDER_BY_JPQL = " ORDER BY scLicense.name ASC";
065            public static final String ORDER_BY_SQL = " ORDER BY SCLicense.name ASC";
066            public static final String DATA_SOURCE = "liferayDataSource";
067            public static final String SESSION_FACTORY = "liferaySessionFactory";
068            public static final String TX_MANAGER = "liferayTransactionManager";
069            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
071                            true);
072            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
073                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCLicense"),
074                            true);
075    
076            public static SCLicense toModel(SCLicenseSoap soapModel) {
077                    SCLicense model = new SCLicenseImpl();
078    
079                    model.setLicenseId(soapModel.getLicenseId());
080                    model.setName(soapModel.getName());
081                    model.setUrl(soapModel.getUrl());
082                    model.setOpenSource(soapModel.getOpenSource());
083                    model.setActive(soapModel.getActive());
084                    model.setRecommended(soapModel.getRecommended());
085    
086                    return model;
087            }
088    
089            public static List<SCLicense> toModels(SCLicenseSoap[] soapModels) {
090                    List<SCLicense> models = new ArrayList<SCLicense>(soapModels.length);
091    
092                    for (SCLicenseSoap soapModel : soapModels) {
093                            models.add(toModel(soapModel));
094                    }
095    
096                    return models;
097            }
098    
099            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME = "SCLicenses_SCProductEntries";
100            public static final Object[][] MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_COLUMNS =
101                    {
102                            { "licenseId", new Integer(Types.BIGINT) },
103                            { "productEntryId", new Integer(Types.BIGINT) }
104                    };
105            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_SQL_CREATE =
106                    "create table SCLicenses_SCProductEntries (licenseId LONG not null,productEntryId LONG not null,primary key (licenseId, productEntryId))";
107            public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
108                    GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109                                    "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
110                            true);
111            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
112                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCLicense"));
113    
114            public SCLicenseModelImpl() {
115            }
116    
117            public long getPrimaryKey() {
118                    return _licenseId;
119            }
120    
121            public void setPrimaryKey(long pk) {
122                    setLicenseId(pk);
123            }
124    
125            public Serializable getPrimaryKeyObj() {
126                    return new Long(_licenseId);
127            }
128    
129            public long getLicenseId() {
130                    return _licenseId;
131            }
132    
133            public void setLicenseId(long licenseId) {
134                    _licenseId = licenseId;
135            }
136    
137            public String getName() {
138                    if (_name == null) {
139                            return StringPool.BLANK;
140                    }
141                    else {
142                            return _name;
143                    }
144            }
145    
146            public void setName(String name) {
147                    _name = name;
148            }
149    
150            public String getUrl() {
151                    if (_url == null) {
152                            return StringPool.BLANK;
153                    }
154                    else {
155                            return _url;
156                    }
157            }
158    
159            public void setUrl(String url) {
160                    _url = url;
161            }
162    
163            public boolean getOpenSource() {
164                    return _openSource;
165            }
166    
167            public boolean isOpenSource() {
168                    return _openSource;
169            }
170    
171            public void setOpenSource(boolean openSource) {
172                    _openSource = openSource;
173            }
174    
175            public boolean getActive() {
176                    return _active;
177            }
178    
179            public boolean isActive() {
180                    return _active;
181            }
182    
183            public void setActive(boolean active) {
184                    _active = active;
185            }
186    
187            public boolean getRecommended() {
188                    return _recommended;
189            }
190    
191            public boolean isRecommended() {
192                    return _recommended;
193            }
194    
195            public void setRecommended(boolean recommended) {
196                    _recommended = recommended;
197            }
198    
199            public SCLicense toEscapedModel() {
200                    if (isEscapedModel()) {
201                            return (SCLicense)this;
202                    }
203                    else {
204                            return (SCLicense)Proxy.newProxyInstance(SCLicense.class.getClassLoader(),
205                                    new Class[] { SCLicense.class }, new AutoEscapeBeanHandler(this));
206                    }
207            }
208    
209            public ExpandoBridge getExpandoBridge() {
210                    if (_expandoBridge == null) {
211                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
212                                            SCLicense.class.getName(), getPrimaryKey());
213                    }
214    
215                    return _expandoBridge;
216            }
217    
218            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
219                    getExpandoBridge().setAttributes(serviceContext);
220            }
221    
222            public Object clone() {
223                    SCLicenseImpl clone = new SCLicenseImpl();
224    
225                    clone.setLicenseId(getLicenseId());
226                    clone.setName(getName());
227                    clone.setUrl(getUrl());
228                    clone.setOpenSource(getOpenSource());
229                    clone.setActive(getActive());
230                    clone.setRecommended(getRecommended());
231    
232                    return clone;
233            }
234    
235            public int compareTo(SCLicense scLicense) {
236                    int value = 0;
237    
238                    value = getName().compareTo(scLicense.getName());
239    
240                    if (value != 0) {
241                            return value;
242                    }
243    
244                    return 0;
245            }
246    
247            public boolean equals(Object obj) {
248                    if (obj == null) {
249                            return false;
250                    }
251    
252                    SCLicense scLicense = null;
253    
254                    try {
255                            scLicense = (SCLicense)obj;
256                    }
257                    catch (ClassCastException cce) {
258                            return false;
259                    }
260    
261                    long pk = scLicense.getPrimaryKey();
262    
263                    if (getPrimaryKey() == pk) {
264                            return true;
265                    }
266                    else {
267                            return false;
268                    }
269            }
270    
271            public int hashCode() {
272                    return (int)getPrimaryKey();
273            }
274    
275            public String toString() {
276                    StringBundler sb = new StringBundler(13);
277    
278                    sb.append("{licenseId=");
279                    sb.append(getLicenseId());
280                    sb.append(", name=");
281                    sb.append(getName());
282                    sb.append(", url=");
283                    sb.append(getUrl());
284                    sb.append(", openSource=");
285                    sb.append(getOpenSource());
286                    sb.append(", active=");
287                    sb.append(getActive());
288                    sb.append(", recommended=");
289                    sb.append(getRecommended());
290                    sb.append("}");
291    
292                    return sb.toString();
293            }
294    
295            public String toXmlString() {
296                    StringBundler sb = new StringBundler(22);
297    
298                    sb.append("<model><model-name>");
299                    sb.append("com.liferay.portlet.softwarecatalog.model.SCLicense");
300                    sb.append("</model-name>");
301    
302                    sb.append(
303                            "<column><column-name>licenseId</column-name><column-value><![CDATA[");
304                    sb.append(getLicenseId());
305                    sb.append("]]></column-value></column>");
306                    sb.append(
307                            "<column><column-name>name</column-name><column-value><![CDATA[");
308                    sb.append(getName());
309                    sb.append("]]></column-value></column>");
310                    sb.append(
311                            "<column><column-name>url</column-name><column-value><![CDATA[");
312                    sb.append(getUrl());
313                    sb.append("]]></column-value></column>");
314                    sb.append(
315                            "<column><column-name>openSource</column-name><column-value><![CDATA[");
316                    sb.append(getOpenSource());
317                    sb.append("]]></column-value></column>");
318                    sb.append(
319                            "<column><column-name>active</column-name><column-value><![CDATA[");
320                    sb.append(getActive());
321                    sb.append("]]></column-value></column>");
322                    sb.append(
323                            "<column><column-name>recommended</column-name><column-value><![CDATA[");
324                    sb.append(getRecommended());
325                    sb.append("]]></column-value></column>");
326    
327                    sb.append("</model>");
328    
329                    return sb.toString();
330            }
331    
332            private long _licenseId;
333            private String _name;
334            private String _url;
335            private boolean _openSource;
336            private boolean _active;
337            private boolean _recommended;
338            private transient ExpandoBridge _expandoBridge;
339    }