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.journal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.impl.BaseModelImpl;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    import com.liferay.portlet.journal.model.JournalTemplate;
029    import com.liferay.portlet.journal.model.JournalTemplateModel;
030    import com.liferay.portlet.journal.model.JournalTemplateSoap;
031    
032    import java.io.Serializable;
033    
034    import java.lang.reflect.Proxy;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.List;
041    
042    /**
043     * The base model implementation for the JournalTemplate service. Represents a row in the "JournalTemplate" database table, with each column mapped to a property of this class.
044     *
045     * <p>
046     * This implementation and its corresponding interface {@link com.liferay.portlet.journal.model.JournalTemplateModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link JournalTemplateImpl}.
047     * </p>
048     *
049     * <p>
050     * Never modify or reference this class directly. All methods that expect a journal template model instance should use the {@link com.liferay.portlet.journal.model.JournalTemplate} interface instead.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see JournalTemplateImpl
055     * @see com.liferay.portlet.journal.model.JournalTemplate
056     * @see com.liferay.portlet.journal.model.JournalTemplateModel
057     * @generated
058     */
059    public class JournalTemplateModelImpl extends BaseModelImpl<JournalTemplate>
060            implements JournalTemplateModel {
061            public static final String TABLE_NAME = "JournalTemplate";
062            public static final Object[][] TABLE_COLUMNS = {
063                            { "uuid_", new Integer(Types.VARCHAR) },
064                            { "id_", new Integer(Types.BIGINT) },
065                            { "groupId", new Integer(Types.BIGINT) },
066                            { "companyId", new Integer(Types.BIGINT) },
067                            { "userId", new Integer(Types.BIGINT) },
068                            { "userName", new Integer(Types.VARCHAR) },
069                            { "createDate", new Integer(Types.TIMESTAMP) },
070                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
071                            { "templateId", new Integer(Types.VARCHAR) },
072                            { "structureId", new Integer(Types.VARCHAR) },
073                            { "name", new Integer(Types.VARCHAR) },
074                            { "description", new Integer(Types.VARCHAR) },
075                            { "xsl", new Integer(Types.CLOB) },
076                            { "langType", new Integer(Types.VARCHAR) },
077                            { "cacheable", new Integer(Types.BOOLEAN) },
078                            { "smallImage", new Integer(Types.BOOLEAN) },
079                            { "smallImageId", new Integer(Types.BIGINT) },
080                            { "smallImageURL", new Integer(Types.VARCHAR) }
081                    };
082            public static final String TABLE_SQL_CREATE = "create table JournalTemplate (uuid_ VARCHAR(75) null,id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,templateId VARCHAR(75) null,structureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsl TEXT null,langType VARCHAR(75) null,cacheable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL STRING null)";
083            public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
084            public static final String ORDER_BY_JPQL = " ORDER BY journalTemplate.templateId ASC";
085            public static final String ORDER_BY_SQL = " ORDER BY JournalTemplate.templateId ASC";
086            public static final String DATA_SOURCE = "liferayDataSource";
087            public static final String SESSION_FACTORY = "liferaySessionFactory";
088            public static final String TX_MANAGER = "liferayTransactionManager";
089            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
090                                    "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
091                            true);
092            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
094                            true);
095    
096            /**
097             * Converts the soap model instance into a normal model instance.
098             *
099             * @param soapModel the soap model instance to convert
100             * @return the normal model instance
101             */
102            public static JournalTemplate toModel(JournalTemplateSoap soapModel) {
103                    JournalTemplate model = new JournalTemplateImpl();
104    
105                    model.setUuid(soapModel.getUuid());
106                    model.setId(soapModel.getId());
107                    model.setGroupId(soapModel.getGroupId());
108                    model.setCompanyId(soapModel.getCompanyId());
109                    model.setUserId(soapModel.getUserId());
110                    model.setUserName(soapModel.getUserName());
111                    model.setCreateDate(soapModel.getCreateDate());
112                    model.setModifiedDate(soapModel.getModifiedDate());
113                    model.setTemplateId(soapModel.getTemplateId());
114                    model.setStructureId(soapModel.getStructureId());
115                    model.setName(soapModel.getName());
116                    model.setDescription(soapModel.getDescription());
117                    model.setXsl(soapModel.getXsl());
118                    model.setLangType(soapModel.getLangType());
119                    model.setCacheable(soapModel.getCacheable());
120                    model.setSmallImage(soapModel.getSmallImage());
121                    model.setSmallImageId(soapModel.getSmallImageId());
122                    model.setSmallImageURL(soapModel.getSmallImageURL());
123    
124                    return model;
125            }
126    
127            /**
128             * Converts the soap model instances into normal model instances.
129             *
130             * @param soapModels the soap model instances to convert
131             * @return the normal model instances
132             */
133            public static List<JournalTemplate> toModels(
134                    JournalTemplateSoap[] soapModels) {
135                    List<JournalTemplate> models = new ArrayList<JournalTemplate>(soapModels.length);
136    
137                    for (JournalTemplateSoap soapModel : soapModels) {
138                            models.add(toModel(soapModel));
139                    }
140    
141                    return models;
142            }
143    
144            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
145                                    "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
146    
147            public JournalTemplateModelImpl() {
148            }
149    
150            public long getPrimaryKey() {
151                    return _id;
152            }
153    
154            public void setPrimaryKey(long pk) {
155                    setId(pk);
156            }
157    
158            public Serializable getPrimaryKeyObj() {
159                    return new Long(_id);
160            }
161    
162            public String getUuid() {
163                    if (_uuid == null) {
164                            return StringPool.BLANK;
165                    }
166                    else {
167                            return _uuid;
168                    }
169            }
170    
171            public void setUuid(String uuid) {
172                    _uuid = uuid;
173    
174                    if (_originalUuid == null) {
175                            _originalUuid = uuid;
176                    }
177            }
178    
179            public String getOriginalUuid() {
180                    return GetterUtil.getString(_originalUuid);
181            }
182    
183            public long getId() {
184                    return _id;
185            }
186    
187            public void setId(long id) {
188                    _id = id;
189            }
190    
191            public long getGroupId() {
192                    return _groupId;
193            }
194    
195            public void setGroupId(long groupId) {
196                    _groupId = groupId;
197    
198                    if (!_setOriginalGroupId) {
199                            _setOriginalGroupId = true;
200    
201                            _originalGroupId = groupId;
202                    }
203            }
204    
205            public long getOriginalGroupId() {
206                    return _originalGroupId;
207            }
208    
209            public long getCompanyId() {
210                    return _companyId;
211            }
212    
213            public void setCompanyId(long companyId) {
214                    _companyId = companyId;
215            }
216    
217            public long getUserId() {
218                    return _userId;
219            }
220    
221            public void setUserId(long userId) {
222                    _userId = userId;
223            }
224    
225            public String getUserUuid() throws SystemException {
226                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
227            }
228    
229            public void setUserUuid(String userUuid) {
230                    _userUuid = userUuid;
231            }
232    
233            public String getUserName() {
234                    if (_userName == null) {
235                            return StringPool.BLANK;
236                    }
237                    else {
238                            return _userName;
239                    }
240            }
241    
242            public void setUserName(String userName) {
243                    _userName = userName;
244            }
245    
246            public Date getCreateDate() {
247                    return _createDate;
248            }
249    
250            public void setCreateDate(Date createDate) {
251                    _createDate = createDate;
252            }
253    
254            public Date getModifiedDate() {
255                    return _modifiedDate;
256            }
257    
258            public void setModifiedDate(Date modifiedDate) {
259                    _modifiedDate = modifiedDate;
260            }
261    
262            public String getTemplateId() {
263                    if (_templateId == null) {
264                            return StringPool.BLANK;
265                    }
266                    else {
267                            return _templateId;
268                    }
269            }
270    
271            public void setTemplateId(String templateId) {
272                    _templateId = templateId;
273    
274                    if (_originalTemplateId == null) {
275                            _originalTemplateId = templateId;
276                    }
277            }
278    
279            public String getOriginalTemplateId() {
280                    return GetterUtil.getString(_originalTemplateId);
281            }
282    
283            public String getStructureId() {
284                    if (_structureId == null) {
285                            return StringPool.BLANK;
286                    }
287                    else {
288                            return _structureId;
289                    }
290            }
291    
292            public void setStructureId(String structureId) {
293                    _structureId = structureId;
294            }
295    
296            public String getName() {
297                    if (_name == null) {
298                            return StringPool.BLANK;
299                    }
300                    else {
301                            return _name;
302                    }
303            }
304    
305            public void setName(String name) {
306                    _name = name;
307            }
308    
309            public String getDescription() {
310                    if (_description == null) {
311                            return StringPool.BLANK;
312                    }
313                    else {
314                            return _description;
315                    }
316            }
317    
318            public void setDescription(String description) {
319                    _description = description;
320            }
321    
322            public String getXsl() {
323                    if (_xsl == null) {
324                            return StringPool.BLANK;
325                    }
326                    else {
327                            return _xsl;
328                    }
329            }
330    
331            public void setXsl(String xsl) {
332                    _xsl = xsl;
333            }
334    
335            public String getLangType() {
336                    if (_langType == null) {
337                            return StringPool.BLANK;
338                    }
339                    else {
340                            return _langType;
341                    }
342            }
343    
344            public void setLangType(String langType) {
345                    _langType = langType;
346            }
347    
348            public boolean getCacheable() {
349                    return _cacheable;
350            }
351    
352            public boolean isCacheable() {
353                    return _cacheable;
354            }
355    
356            public void setCacheable(boolean cacheable) {
357                    _cacheable = cacheable;
358            }
359    
360            public boolean getSmallImage() {
361                    return _smallImage;
362            }
363    
364            public boolean isSmallImage() {
365                    return _smallImage;
366            }
367    
368            public void setSmallImage(boolean smallImage) {
369                    _smallImage = smallImage;
370            }
371    
372            public long getSmallImageId() {
373                    return _smallImageId;
374            }
375    
376            public void setSmallImageId(long smallImageId) {
377                    _smallImageId = smallImageId;
378    
379                    if (!_setOriginalSmallImageId) {
380                            _setOriginalSmallImageId = true;
381    
382                            _originalSmallImageId = smallImageId;
383                    }
384            }
385    
386            public long getOriginalSmallImageId() {
387                    return _originalSmallImageId;
388            }
389    
390            public String getSmallImageURL() {
391                    if (_smallImageURL == null) {
392                            return StringPool.BLANK;
393                    }
394                    else {
395                            return _smallImageURL;
396                    }
397            }
398    
399            public void setSmallImageURL(String smallImageURL) {
400                    _smallImageURL = smallImageURL;
401            }
402    
403            public JournalTemplate toEscapedModel() {
404                    if (isEscapedModel()) {
405                            return (JournalTemplate)this;
406                    }
407                    else {
408                            return (JournalTemplate)Proxy.newProxyInstance(JournalTemplate.class.getClassLoader(),
409                                    new Class[] { JournalTemplate.class },
410                                    new AutoEscapeBeanHandler(this));
411                    }
412            }
413    
414            public ExpandoBridge getExpandoBridge() {
415                    if (_expandoBridge == null) {
416                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
417                                            JournalTemplate.class.getName(), getPrimaryKey());
418                    }
419    
420                    return _expandoBridge;
421            }
422    
423            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
424                    getExpandoBridge().setAttributes(serviceContext);
425            }
426    
427            public Object clone() {
428                    JournalTemplateImpl clone = new JournalTemplateImpl();
429    
430                    clone.setUuid(getUuid());
431                    clone.setId(getId());
432                    clone.setGroupId(getGroupId());
433                    clone.setCompanyId(getCompanyId());
434                    clone.setUserId(getUserId());
435                    clone.setUserName(getUserName());
436                    clone.setCreateDate(getCreateDate());
437                    clone.setModifiedDate(getModifiedDate());
438                    clone.setTemplateId(getTemplateId());
439                    clone.setStructureId(getStructureId());
440                    clone.setName(getName());
441                    clone.setDescription(getDescription());
442                    clone.setXsl(getXsl());
443                    clone.setLangType(getLangType());
444                    clone.setCacheable(getCacheable());
445                    clone.setSmallImage(getSmallImage());
446                    clone.setSmallImageId(getSmallImageId());
447                    clone.setSmallImageURL(getSmallImageURL());
448    
449                    return clone;
450            }
451    
452            public int compareTo(JournalTemplate journalTemplate) {
453                    int value = 0;
454    
455                    value = getTemplateId().compareTo(journalTemplate.getTemplateId());
456    
457                    if (value != 0) {
458                            return value;
459                    }
460    
461                    return 0;
462            }
463    
464            public boolean equals(Object obj) {
465                    if (obj == null) {
466                            return false;
467                    }
468    
469                    JournalTemplate journalTemplate = null;
470    
471                    try {
472                            journalTemplate = (JournalTemplate)obj;
473                    }
474                    catch (ClassCastException cce) {
475                            return false;
476                    }
477    
478                    long pk = journalTemplate.getPrimaryKey();
479    
480                    if (getPrimaryKey() == pk) {
481                            return true;
482                    }
483                    else {
484                            return false;
485                    }
486            }
487    
488            public int hashCode() {
489                    return (int)getPrimaryKey();
490            }
491    
492            public String toString() {
493                    StringBundler sb = new StringBundler(37);
494    
495                    sb.append("{uuid=");
496                    sb.append(getUuid());
497                    sb.append(", id=");
498                    sb.append(getId());
499                    sb.append(", groupId=");
500                    sb.append(getGroupId());
501                    sb.append(", companyId=");
502                    sb.append(getCompanyId());
503                    sb.append(", userId=");
504                    sb.append(getUserId());
505                    sb.append(", userName=");
506                    sb.append(getUserName());
507                    sb.append(", createDate=");
508                    sb.append(getCreateDate());
509                    sb.append(", modifiedDate=");
510                    sb.append(getModifiedDate());
511                    sb.append(", templateId=");
512                    sb.append(getTemplateId());
513                    sb.append(", structureId=");
514                    sb.append(getStructureId());
515                    sb.append(", name=");
516                    sb.append(getName());
517                    sb.append(", description=");
518                    sb.append(getDescription());
519                    sb.append(", xsl=");
520                    sb.append(getXsl());
521                    sb.append(", langType=");
522                    sb.append(getLangType());
523                    sb.append(", cacheable=");
524                    sb.append(getCacheable());
525                    sb.append(", smallImage=");
526                    sb.append(getSmallImage());
527                    sb.append(", smallImageId=");
528                    sb.append(getSmallImageId());
529                    sb.append(", smallImageURL=");
530                    sb.append(getSmallImageURL());
531                    sb.append("}");
532    
533                    return sb.toString();
534            }
535    
536            public String toXmlString() {
537                    StringBundler sb = new StringBundler(58);
538    
539                    sb.append("<model><model-name>");
540                    sb.append("com.liferay.portlet.journal.model.JournalTemplate");
541                    sb.append("</model-name>");
542    
543                    sb.append(
544                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
545                    sb.append(getUuid());
546                    sb.append("]]></column-value></column>");
547                    sb.append(
548                            "<column><column-name>id</column-name><column-value><![CDATA[");
549                    sb.append(getId());
550                    sb.append("]]></column-value></column>");
551                    sb.append(
552                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
553                    sb.append(getGroupId());
554                    sb.append("]]></column-value></column>");
555                    sb.append(
556                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
557                    sb.append(getCompanyId());
558                    sb.append("]]></column-value></column>");
559                    sb.append(
560                            "<column><column-name>userId</column-name><column-value><![CDATA[");
561                    sb.append(getUserId());
562                    sb.append("]]></column-value></column>");
563                    sb.append(
564                            "<column><column-name>userName</column-name><column-value><![CDATA[");
565                    sb.append(getUserName());
566                    sb.append("]]></column-value></column>");
567                    sb.append(
568                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
569                    sb.append(getCreateDate());
570                    sb.append("]]></column-value></column>");
571                    sb.append(
572                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
573                    sb.append(getModifiedDate());
574                    sb.append("]]></column-value></column>");
575                    sb.append(
576                            "<column><column-name>templateId</column-name><column-value><![CDATA[");
577                    sb.append(getTemplateId());
578                    sb.append("]]></column-value></column>");
579                    sb.append(
580                            "<column><column-name>structureId</column-name><column-value><![CDATA[");
581                    sb.append(getStructureId());
582                    sb.append("]]></column-value></column>");
583                    sb.append(
584                            "<column><column-name>name</column-name><column-value><![CDATA[");
585                    sb.append(getName());
586                    sb.append("]]></column-value></column>");
587                    sb.append(
588                            "<column><column-name>description</column-name><column-value><![CDATA[");
589                    sb.append(getDescription());
590                    sb.append("]]></column-value></column>");
591                    sb.append(
592                            "<column><column-name>xsl</column-name><column-value><![CDATA[");
593                    sb.append(getXsl());
594                    sb.append("]]></column-value></column>");
595                    sb.append(
596                            "<column><column-name>langType</column-name><column-value><![CDATA[");
597                    sb.append(getLangType());
598                    sb.append("]]></column-value></column>");
599                    sb.append(
600                            "<column><column-name>cacheable</column-name><column-value><![CDATA[");
601                    sb.append(getCacheable());
602                    sb.append("]]></column-value></column>");
603                    sb.append(
604                            "<column><column-name>smallImage</column-name><column-value><![CDATA[");
605                    sb.append(getSmallImage());
606                    sb.append("]]></column-value></column>");
607                    sb.append(
608                            "<column><column-name>smallImageId</column-name><column-value><![CDATA[");
609                    sb.append(getSmallImageId());
610                    sb.append("]]></column-value></column>");
611                    sb.append(
612                            "<column><column-name>smallImageURL</column-name><column-value><![CDATA[");
613                    sb.append(getSmallImageURL());
614                    sb.append("]]></column-value></column>");
615    
616                    sb.append("</model>");
617    
618                    return sb.toString();
619            }
620    
621            private String _uuid;
622            private String _originalUuid;
623            private long _id;
624            private long _groupId;
625            private long _originalGroupId;
626            private boolean _setOriginalGroupId;
627            private long _companyId;
628            private long _userId;
629            private String _userUuid;
630            private String _userName;
631            private Date _createDate;
632            private Date _modifiedDate;
633            private String _templateId;
634            private String _originalTemplateId;
635            private String _structureId;
636            private String _name;
637            private String _description;
638            private String _xsl;
639            private String _langType;
640            private boolean _cacheable;
641            private boolean _smallImage;
642            private long _smallImageId;
643            private long _originalSmallImageId;
644            private boolean _setOriginalSmallImageId;
645            private String _smallImageURL;
646            private transient ExpandoBridge _expandoBridge;
647    }