001    /**
002     * Copyright (c) 2000-2013 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.LocaleException;
018    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
019    import com.liferay.portal.kernel.exception.SystemException;
020    import com.liferay.portal.kernel.json.JSON;
021    import com.liferay.portal.kernel.language.LanguageUtil;
022    import com.liferay.portal.kernel.util.GetterUtil;
023    import com.liferay.portal.kernel.util.LocaleUtil;
024    import com.liferay.portal.kernel.util.LocalizationUtil;
025    import com.liferay.portal.kernel.util.ProxyUtil;
026    import com.liferay.portal.kernel.util.StringBundler;
027    import com.liferay.portal.kernel.util.StringPool;
028    import com.liferay.portal.kernel.util.Validator;
029    import com.liferay.portal.model.CacheModel;
030    import com.liferay.portal.model.impl.BaseModelImpl;
031    import com.liferay.portal.service.ServiceContext;
032    import com.liferay.portal.util.PortalUtil;
033    
034    import com.liferay.portlet.expando.model.ExpandoBridge;
035    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
036    import com.liferay.portlet.journal.model.JournalTemplate;
037    import com.liferay.portlet.journal.model.JournalTemplateModel;
038    import com.liferay.portlet.journal.model.JournalTemplateSoap;
039    
040    import java.io.Serializable;
041    
042    import java.sql.Types;
043    
044    import java.util.ArrayList;
045    import java.util.Date;
046    import java.util.HashMap;
047    import java.util.List;
048    import java.util.Locale;
049    import java.util.Map;
050    
051    /**
052     * 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.
053     *
054     * <p>
055     * 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}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see JournalTemplateImpl
060     * @see com.liferay.portlet.journal.model.JournalTemplate
061     * @see com.liferay.portlet.journal.model.JournalTemplateModel
062     * @generated
063     */
064    @JSON(strict = true)
065    public class JournalTemplateModelImpl extends BaseModelImpl<JournalTemplate>
066            implements JournalTemplateModel {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * 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.
071             */
072            public static final String TABLE_NAME = "JournalTemplate";
073            public static final Object[][] TABLE_COLUMNS = {
074                            { "uuid_", Types.VARCHAR },
075                            { "id_", Types.BIGINT },
076                            { "groupId", Types.BIGINT },
077                            { "companyId", Types.BIGINT },
078                            { "userId", Types.BIGINT },
079                            { "userName", Types.VARCHAR },
080                            { "createDate", Types.TIMESTAMP },
081                            { "modifiedDate", Types.TIMESTAMP },
082                            { "templateId", Types.VARCHAR },
083                            { "structureId", Types.VARCHAR },
084                            { "name", Types.VARCHAR },
085                            { "description", Types.VARCHAR },
086                            { "xsl", Types.CLOB },
087                            { "langType", Types.VARCHAR },
088                            { "cacheable", Types.BOOLEAN },
089                            { "smallImage", Types.BOOLEAN },
090                            { "smallImageId", Types.BIGINT },
091                            { "smallImageURL", Types.VARCHAR }
092                    };
093            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 STRING null,description STRING null,xsl TEXT null,langType VARCHAR(75) null,cacheable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL STRING null)";
094            public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
095            public static final String ORDER_BY_JPQL = " ORDER BY journalTemplate.templateId ASC";
096            public static final String ORDER_BY_SQL = " ORDER BY JournalTemplate.templateId ASC";
097            public static final String DATA_SOURCE = "liferayDataSource";
098            public static final String SESSION_FACTORY = "liferaySessionFactory";
099            public static final String TX_MANAGER = "liferayTransactionManager";
100            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101                                    "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
102                            true);
103            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104                                    "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
105                            true);
106            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
107                                    "value.object.column.bitmask.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
108                            true);
109            public static long GROUPID_COLUMN_BITMASK = 1L;
110            public static long SMALLIMAGEID_COLUMN_BITMASK = 2L;
111            public static long STRUCTUREID_COLUMN_BITMASK = 4L;
112            public static long TEMPLATEID_COLUMN_BITMASK = 8L;
113            public static long UUID_COLUMN_BITMASK = 16L;
114    
115            /**
116             * Converts the soap model instance into a normal model instance.
117             *
118             * @param soapModel the soap model instance to convert
119             * @return the normal model instance
120             */
121            public static JournalTemplate toModel(JournalTemplateSoap soapModel) {
122                    if (soapModel == null) {
123                            return null;
124                    }
125    
126                    JournalTemplate model = new JournalTemplateImpl();
127    
128                    model.setUuid(soapModel.getUuid());
129                    model.setId(soapModel.getId());
130                    model.setGroupId(soapModel.getGroupId());
131                    model.setCompanyId(soapModel.getCompanyId());
132                    model.setUserId(soapModel.getUserId());
133                    model.setUserName(soapModel.getUserName());
134                    model.setCreateDate(soapModel.getCreateDate());
135                    model.setModifiedDate(soapModel.getModifiedDate());
136                    model.setTemplateId(soapModel.getTemplateId());
137                    model.setStructureId(soapModel.getStructureId());
138                    model.setName(soapModel.getName());
139                    model.setDescription(soapModel.getDescription());
140                    model.setXsl(soapModel.getXsl());
141                    model.setLangType(soapModel.getLangType());
142                    model.setCacheable(soapModel.getCacheable());
143                    model.setSmallImage(soapModel.getSmallImage());
144                    model.setSmallImageId(soapModel.getSmallImageId());
145                    model.setSmallImageURL(soapModel.getSmallImageURL());
146    
147                    return model;
148            }
149    
150            /**
151             * Converts the soap model instances into normal model instances.
152             *
153             * @param soapModels the soap model instances to convert
154             * @return the normal model instances
155             */
156            public static List<JournalTemplate> toModels(
157                    JournalTemplateSoap[] soapModels) {
158                    if (soapModels == null) {
159                            return null;
160                    }
161    
162                    List<JournalTemplate> models = new ArrayList<JournalTemplate>(soapModels.length);
163    
164                    for (JournalTemplateSoap soapModel : soapModels) {
165                            models.add(toModel(soapModel));
166                    }
167    
168                    return models;
169            }
170    
171            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
172                                    "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
173    
174            public JournalTemplateModelImpl() {
175            }
176    
177            public long getPrimaryKey() {
178                    return _id;
179            }
180    
181            public void setPrimaryKey(long primaryKey) {
182                    setId(primaryKey);
183            }
184    
185            public Serializable getPrimaryKeyObj() {
186                    return new Long(_id);
187            }
188    
189            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
190                    setPrimaryKey(((Long)primaryKeyObj).longValue());
191            }
192    
193            public Class<?> getModelClass() {
194                    return JournalTemplate.class;
195            }
196    
197            public String getModelClassName() {
198                    return JournalTemplate.class.getName();
199            }
200    
201            @Override
202            public Map<String, Object> getModelAttributes() {
203                    Map<String, Object> attributes = new HashMap<String, Object>();
204    
205                    attributes.put("uuid", getUuid());
206                    attributes.put("id", getId());
207                    attributes.put("groupId", getGroupId());
208                    attributes.put("companyId", getCompanyId());
209                    attributes.put("userId", getUserId());
210                    attributes.put("userName", getUserName());
211                    attributes.put("createDate", getCreateDate());
212                    attributes.put("modifiedDate", getModifiedDate());
213                    attributes.put("templateId", getTemplateId());
214                    attributes.put("structureId", getStructureId());
215                    attributes.put("name", getName());
216                    attributes.put("description", getDescription());
217                    attributes.put("xsl", getXsl());
218                    attributes.put("langType", getLangType());
219                    attributes.put("cacheable", getCacheable());
220                    attributes.put("smallImage", getSmallImage());
221                    attributes.put("smallImageId", getSmallImageId());
222                    attributes.put("smallImageURL", getSmallImageURL());
223    
224                    return attributes;
225            }
226    
227            @Override
228            public void setModelAttributes(Map<String, Object> attributes) {
229                    String uuid = (String)attributes.get("uuid");
230    
231                    if (uuid != null) {
232                            setUuid(uuid);
233                    }
234    
235                    Long id = (Long)attributes.get("id");
236    
237                    if (id != null) {
238                            setId(id);
239                    }
240    
241                    Long groupId = (Long)attributes.get("groupId");
242    
243                    if (groupId != null) {
244                            setGroupId(groupId);
245                    }
246    
247                    Long companyId = (Long)attributes.get("companyId");
248    
249                    if (companyId != null) {
250                            setCompanyId(companyId);
251                    }
252    
253                    Long userId = (Long)attributes.get("userId");
254    
255                    if (userId != null) {
256                            setUserId(userId);
257                    }
258    
259                    String userName = (String)attributes.get("userName");
260    
261                    if (userName != null) {
262                            setUserName(userName);
263                    }
264    
265                    Date createDate = (Date)attributes.get("createDate");
266    
267                    if (createDate != null) {
268                            setCreateDate(createDate);
269                    }
270    
271                    Date modifiedDate = (Date)attributes.get("modifiedDate");
272    
273                    if (modifiedDate != null) {
274                            setModifiedDate(modifiedDate);
275                    }
276    
277                    String templateId = (String)attributes.get("templateId");
278    
279                    if (templateId != null) {
280                            setTemplateId(templateId);
281                    }
282    
283                    String structureId = (String)attributes.get("structureId");
284    
285                    if (structureId != null) {
286                            setStructureId(structureId);
287                    }
288    
289                    String name = (String)attributes.get("name");
290    
291                    if (name != null) {
292                            setName(name);
293                    }
294    
295                    String description = (String)attributes.get("description");
296    
297                    if (description != null) {
298                            setDescription(description);
299                    }
300    
301                    String xsl = (String)attributes.get("xsl");
302    
303                    if (xsl != null) {
304                            setXsl(xsl);
305                    }
306    
307                    String langType = (String)attributes.get("langType");
308    
309                    if (langType != null) {
310                            setLangType(langType);
311                    }
312    
313                    Boolean cacheable = (Boolean)attributes.get("cacheable");
314    
315                    if (cacheable != null) {
316                            setCacheable(cacheable);
317                    }
318    
319                    Boolean smallImage = (Boolean)attributes.get("smallImage");
320    
321                    if (smallImage != null) {
322                            setSmallImage(smallImage);
323                    }
324    
325                    Long smallImageId = (Long)attributes.get("smallImageId");
326    
327                    if (smallImageId != null) {
328                            setSmallImageId(smallImageId);
329                    }
330    
331                    String smallImageURL = (String)attributes.get("smallImageURL");
332    
333                    if (smallImageURL != null) {
334                            setSmallImageURL(smallImageURL);
335                    }
336            }
337    
338            @JSON
339            public String getUuid() {
340                    if (_uuid == null) {
341                            return StringPool.BLANK;
342                    }
343                    else {
344                            return _uuid;
345                    }
346            }
347    
348            public void setUuid(String uuid) {
349                    if (_originalUuid == null) {
350                            _originalUuid = _uuid;
351                    }
352    
353                    _uuid = uuid;
354            }
355    
356            public String getOriginalUuid() {
357                    return GetterUtil.getString(_originalUuid);
358            }
359    
360            @JSON
361            public long getId() {
362                    return _id;
363            }
364    
365            public void setId(long id) {
366                    _id = id;
367            }
368    
369            @JSON
370            public long getGroupId() {
371                    return _groupId;
372            }
373    
374            public void setGroupId(long groupId) {
375                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
376    
377                    if (!_setOriginalGroupId) {
378                            _setOriginalGroupId = true;
379    
380                            _originalGroupId = _groupId;
381                    }
382    
383                    _groupId = groupId;
384            }
385    
386            public long getOriginalGroupId() {
387                    return _originalGroupId;
388            }
389    
390            @JSON
391            public long getCompanyId() {
392                    return _companyId;
393            }
394    
395            public void setCompanyId(long companyId) {
396                    _companyId = companyId;
397            }
398    
399            @JSON
400            public long getUserId() {
401                    return _userId;
402            }
403    
404            public void setUserId(long userId) {
405                    _userId = userId;
406            }
407    
408            public String getUserUuid() throws SystemException {
409                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
410            }
411    
412            public void setUserUuid(String userUuid) {
413                    _userUuid = userUuid;
414            }
415    
416            @JSON
417            public String getUserName() {
418                    if (_userName == null) {
419                            return StringPool.BLANK;
420                    }
421                    else {
422                            return _userName;
423                    }
424            }
425    
426            public void setUserName(String userName) {
427                    _userName = userName;
428            }
429    
430            @JSON
431            public Date getCreateDate() {
432                    return _createDate;
433            }
434    
435            public void setCreateDate(Date createDate) {
436                    _createDate = createDate;
437            }
438    
439            @JSON
440            public Date getModifiedDate() {
441                    return _modifiedDate;
442            }
443    
444            public void setModifiedDate(Date modifiedDate) {
445                    _modifiedDate = modifiedDate;
446            }
447    
448            @JSON
449            public String getTemplateId() {
450                    if (_templateId == null) {
451                            return StringPool.BLANK;
452                    }
453                    else {
454                            return _templateId;
455                    }
456            }
457    
458            public void setTemplateId(String templateId) {
459                    _columnBitmask = -1L;
460    
461                    if (_originalTemplateId == null) {
462                            _originalTemplateId = _templateId;
463                    }
464    
465                    _templateId = templateId;
466            }
467    
468            public String getOriginalTemplateId() {
469                    return GetterUtil.getString(_originalTemplateId);
470            }
471    
472            @JSON
473            public String getStructureId() {
474                    if (_structureId == null) {
475                            return StringPool.BLANK;
476                    }
477                    else {
478                            return _structureId;
479                    }
480            }
481    
482            public void setStructureId(String structureId) {
483                    _columnBitmask |= STRUCTUREID_COLUMN_BITMASK;
484    
485                    if (_originalStructureId == null) {
486                            _originalStructureId = _structureId;
487                    }
488    
489                    _structureId = structureId;
490            }
491    
492            public String getOriginalStructureId() {
493                    return GetterUtil.getString(_originalStructureId);
494            }
495    
496            @JSON
497            public String getName() {
498                    if (_name == null) {
499                            return StringPool.BLANK;
500                    }
501                    else {
502                            return _name;
503                    }
504            }
505    
506            public String getName(Locale locale) {
507                    String languageId = LocaleUtil.toLanguageId(locale);
508    
509                    return getName(languageId);
510            }
511    
512            public String getName(Locale locale, boolean useDefault) {
513                    String languageId = LocaleUtil.toLanguageId(locale);
514    
515                    return getName(languageId, useDefault);
516            }
517    
518            public String getName(String languageId) {
519                    return LocalizationUtil.getLocalization(getName(), languageId);
520            }
521    
522            public String getName(String languageId, boolean useDefault) {
523                    return LocalizationUtil.getLocalization(getName(), languageId,
524                            useDefault);
525            }
526    
527            public String getNameCurrentLanguageId() {
528                    return _nameCurrentLanguageId;
529            }
530    
531            @JSON
532            public String getNameCurrentValue() {
533                    Locale locale = getLocale(_nameCurrentLanguageId);
534    
535                    return getName(locale);
536            }
537    
538            public Map<Locale, String> getNameMap() {
539                    return LocalizationUtil.getLocalizationMap(getName());
540            }
541    
542            public void setName(String name) {
543                    _name = name;
544            }
545    
546            public void setName(String name, Locale locale) {
547                    setName(name, locale, LocaleUtil.getDefault());
548            }
549    
550            public void setName(String name, Locale locale, Locale defaultLocale) {
551                    String languageId = LocaleUtil.toLanguageId(locale);
552                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
553    
554                    if (Validator.isNotNull(name)) {
555                            setName(LocalizationUtil.updateLocalization(getName(), "Name",
556                                            name, languageId, defaultLanguageId));
557                    }
558                    else {
559                            setName(LocalizationUtil.removeLocalization(getName(), "Name",
560                                            languageId));
561                    }
562            }
563    
564            public void setNameCurrentLanguageId(String languageId) {
565                    _nameCurrentLanguageId = languageId;
566            }
567    
568            public void setNameMap(Map<Locale, String> nameMap) {
569                    setNameMap(nameMap, LocaleUtil.getDefault());
570            }
571    
572            public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
573                    if (nameMap == null) {
574                            return;
575                    }
576    
577                    Locale[] locales = LanguageUtil.getAvailableLocales();
578    
579                    for (Locale locale : locales) {
580                            String name = nameMap.get(locale);
581    
582                            setName(name, locale, defaultLocale);
583                    }
584            }
585    
586            @JSON
587            public String getDescription() {
588                    if (_description == null) {
589                            return StringPool.BLANK;
590                    }
591                    else {
592                            return _description;
593                    }
594            }
595    
596            public String getDescription(Locale locale) {
597                    String languageId = LocaleUtil.toLanguageId(locale);
598    
599                    return getDescription(languageId);
600            }
601    
602            public String getDescription(Locale locale, boolean useDefault) {
603                    String languageId = LocaleUtil.toLanguageId(locale);
604    
605                    return getDescription(languageId, useDefault);
606            }
607    
608            public String getDescription(String languageId) {
609                    return LocalizationUtil.getLocalization(getDescription(), languageId);
610            }
611    
612            public String getDescription(String languageId, boolean useDefault) {
613                    return LocalizationUtil.getLocalization(getDescription(), languageId,
614                            useDefault);
615            }
616    
617            public String getDescriptionCurrentLanguageId() {
618                    return _descriptionCurrentLanguageId;
619            }
620    
621            @JSON
622            public String getDescriptionCurrentValue() {
623                    Locale locale = getLocale(_descriptionCurrentLanguageId);
624    
625                    return getDescription(locale);
626            }
627    
628            public Map<Locale, String> getDescriptionMap() {
629                    return LocalizationUtil.getLocalizationMap(getDescription());
630            }
631    
632            public void setDescription(String description) {
633                    _description = description;
634            }
635    
636            public void setDescription(String description, Locale locale) {
637                    setDescription(description, locale, LocaleUtil.getDefault());
638            }
639    
640            public void setDescription(String description, Locale locale,
641                    Locale defaultLocale) {
642                    String languageId = LocaleUtil.toLanguageId(locale);
643                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
644    
645                    if (Validator.isNotNull(description)) {
646                            setDescription(LocalizationUtil.updateLocalization(
647                                            getDescription(), "Description", description, languageId,
648                                            defaultLanguageId));
649                    }
650                    else {
651                            setDescription(LocalizationUtil.removeLocalization(
652                                            getDescription(), "Description", languageId));
653                    }
654            }
655    
656            public void setDescriptionCurrentLanguageId(String languageId) {
657                    _descriptionCurrentLanguageId = languageId;
658            }
659    
660            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
661                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
662            }
663    
664            public void setDescriptionMap(Map<Locale, String> descriptionMap,
665                    Locale defaultLocale) {
666                    if (descriptionMap == null) {
667                            return;
668                    }
669    
670                    Locale[] locales = LanguageUtil.getAvailableLocales();
671    
672                    for (Locale locale : locales) {
673                            String description = descriptionMap.get(locale);
674    
675                            setDescription(description, locale, defaultLocale);
676                    }
677            }
678    
679            @JSON
680            public String getXsl() {
681                    if (_xsl == null) {
682                            return StringPool.BLANK;
683                    }
684                    else {
685                            return _xsl;
686                    }
687            }
688    
689            public void setXsl(String xsl) {
690                    _xsl = xsl;
691            }
692    
693            @JSON
694            public String getLangType() {
695                    if (_langType == null) {
696                            return StringPool.BLANK;
697                    }
698                    else {
699                            return _langType;
700                    }
701            }
702    
703            public void setLangType(String langType) {
704                    _langType = langType;
705            }
706    
707            @JSON
708            public boolean getCacheable() {
709                    return _cacheable;
710            }
711    
712            public boolean isCacheable() {
713                    return _cacheable;
714            }
715    
716            public void setCacheable(boolean cacheable) {
717                    _cacheable = cacheable;
718            }
719    
720            @JSON
721            public boolean getSmallImage() {
722                    return _smallImage;
723            }
724    
725            public boolean isSmallImage() {
726                    return _smallImage;
727            }
728    
729            public void setSmallImage(boolean smallImage) {
730                    _smallImage = smallImage;
731            }
732    
733            @JSON
734            public long getSmallImageId() {
735                    return _smallImageId;
736            }
737    
738            public void setSmallImageId(long smallImageId) {
739                    _columnBitmask |= SMALLIMAGEID_COLUMN_BITMASK;
740    
741                    if (!_setOriginalSmallImageId) {
742                            _setOriginalSmallImageId = true;
743    
744                            _originalSmallImageId = _smallImageId;
745                    }
746    
747                    _smallImageId = smallImageId;
748            }
749    
750            public long getOriginalSmallImageId() {
751                    return _originalSmallImageId;
752            }
753    
754            @JSON
755            public String getSmallImageURL() {
756                    if (_smallImageURL == null) {
757                            return StringPool.BLANK;
758                    }
759                    else {
760                            return _smallImageURL;
761                    }
762            }
763    
764            public void setSmallImageURL(String smallImageURL) {
765                    _smallImageURL = smallImageURL;
766            }
767    
768            public long getColumnBitmask() {
769                    return _columnBitmask;
770            }
771    
772            @Override
773            public ExpandoBridge getExpandoBridge() {
774                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
775                            JournalTemplate.class.getName(), getPrimaryKey());
776            }
777    
778            @Override
779            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
780                    ExpandoBridge expandoBridge = getExpandoBridge();
781    
782                    expandoBridge.setAttributes(serviceContext);
783            }
784    
785            @SuppressWarnings("unused")
786            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
787                    throws LocaleException {
788                    setName(getName(defaultImportLocale), defaultImportLocale,
789                            defaultImportLocale);
790                    setDescription(getDescription(defaultImportLocale),
791                            defaultImportLocale, defaultImportLocale);
792            }
793    
794            @Override
795            public JournalTemplate toEscapedModel() {
796                    if (_escapedModel == null) {
797                            _escapedModel = (JournalTemplate)ProxyUtil.newProxyInstance(_classLoader,
798                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
799                    }
800    
801                    return _escapedModel;
802            }
803    
804            public JournalTemplate toUnescapedModel() {
805                    return (JournalTemplate)this;
806            }
807    
808            @Override
809            public Object clone() {
810                    JournalTemplateImpl journalTemplateImpl = new JournalTemplateImpl();
811    
812                    journalTemplateImpl.setUuid(getUuid());
813                    journalTemplateImpl.setId(getId());
814                    journalTemplateImpl.setGroupId(getGroupId());
815                    journalTemplateImpl.setCompanyId(getCompanyId());
816                    journalTemplateImpl.setUserId(getUserId());
817                    journalTemplateImpl.setUserName(getUserName());
818                    journalTemplateImpl.setCreateDate(getCreateDate());
819                    journalTemplateImpl.setModifiedDate(getModifiedDate());
820                    journalTemplateImpl.setTemplateId(getTemplateId());
821                    journalTemplateImpl.setStructureId(getStructureId());
822                    journalTemplateImpl.setName(getName());
823                    journalTemplateImpl.setDescription(getDescription());
824                    journalTemplateImpl.setXsl(getXsl());
825                    journalTemplateImpl.setLangType(getLangType());
826                    journalTemplateImpl.setCacheable(getCacheable());
827                    journalTemplateImpl.setSmallImage(getSmallImage());
828                    journalTemplateImpl.setSmallImageId(getSmallImageId());
829                    journalTemplateImpl.setSmallImageURL(getSmallImageURL());
830    
831                    journalTemplateImpl.resetOriginalValues();
832    
833                    return journalTemplateImpl;
834            }
835    
836            public int compareTo(JournalTemplate journalTemplate) {
837                    int value = 0;
838    
839                    value = getTemplateId().compareTo(journalTemplate.getTemplateId());
840    
841                    if (value != 0) {
842                            return value;
843                    }
844    
845                    return 0;
846            }
847    
848            @Override
849            public boolean equals(Object obj) {
850                    if (this == obj) {
851                            return true;
852                    }
853    
854                    if (!(obj instanceof JournalTemplate)) {
855                            return false;
856                    }
857    
858                    JournalTemplate journalTemplate = (JournalTemplate)obj;
859    
860                    long primaryKey = journalTemplate.getPrimaryKey();
861    
862                    if (getPrimaryKey() == primaryKey) {
863                            return true;
864                    }
865                    else {
866                            return false;
867                    }
868            }
869    
870            @Override
871            public int hashCode() {
872                    return (int)getPrimaryKey();
873            }
874    
875            @Override
876            public void resetOriginalValues() {
877                    JournalTemplateModelImpl journalTemplateModelImpl = this;
878    
879                    journalTemplateModelImpl._originalUuid = journalTemplateModelImpl._uuid;
880    
881                    journalTemplateModelImpl._originalGroupId = journalTemplateModelImpl._groupId;
882    
883                    journalTemplateModelImpl._setOriginalGroupId = false;
884    
885                    journalTemplateModelImpl._originalTemplateId = journalTemplateModelImpl._templateId;
886    
887                    journalTemplateModelImpl._originalStructureId = journalTemplateModelImpl._structureId;
888    
889                    journalTemplateModelImpl._originalSmallImageId = journalTemplateModelImpl._smallImageId;
890    
891                    journalTemplateModelImpl._setOriginalSmallImageId = false;
892    
893                    journalTemplateModelImpl._columnBitmask = 0;
894            }
895    
896            @Override
897            public CacheModel<JournalTemplate> toCacheModel() {
898                    JournalTemplateCacheModel journalTemplateCacheModel = new JournalTemplateCacheModel();
899    
900                    journalTemplateCacheModel.uuid = getUuid();
901    
902                    String uuid = journalTemplateCacheModel.uuid;
903    
904                    if ((uuid != null) && (uuid.length() == 0)) {
905                            journalTemplateCacheModel.uuid = null;
906                    }
907    
908                    journalTemplateCacheModel.id = getId();
909    
910                    journalTemplateCacheModel.groupId = getGroupId();
911    
912                    journalTemplateCacheModel.companyId = getCompanyId();
913    
914                    journalTemplateCacheModel.userId = getUserId();
915    
916                    journalTemplateCacheModel.userName = getUserName();
917    
918                    String userName = journalTemplateCacheModel.userName;
919    
920                    if ((userName != null) && (userName.length() == 0)) {
921                            journalTemplateCacheModel.userName = null;
922                    }
923    
924                    Date createDate = getCreateDate();
925    
926                    if (createDate != null) {
927                            journalTemplateCacheModel.createDate = createDate.getTime();
928                    }
929                    else {
930                            journalTemplateCacheModel.createDate = Long.MIN_VALUE;
931                    }
932    
933                    Date modifiedDate = getModifiedDate();
934    
935                    if (modifiedDate != null) {
936                            journalTemplateCacheModel.modifiedDate = modifiedDate.getTime();
937                    }
938                    else {
939                            journalTemplateCacheModel.modifiedDate = Long.MIN_VALUE;
940                    }
941    
942                    journalTemplateCacheModel.templateId = getTemplateId();
943    
944                    String templateId = journalTemplateCacheModel.templateId;
945    
946                    if ((templateId != null) && (templateId.length() == 0)) {
947                            journalTemplateCacheModel.templateId = null;
948                    }
949    
950                    journalTemplateCacheModel.structureId = getStructureId();
951    
952                    String structureId = journalTemplateCacheModel.structureId;
953    
954                    if ((structureId != null) && (structureId.length() == 0)) {
955                            journalTemplateCacheModel.structureId = null;
956                    }
957    
958                    journalTemplateCacheModel.name = getName();
959    
960                    String name = journalTemplateCacheModel.name;
961    
962                    if ((name != null) && (name.length() == 0)) {
963                            journalTemplateCacheModel.name = null;
964                    }
965    
966                    journalTemplateCacheModel.description = getDescription();
967    
968                    String description = journalTemplateCacheModel.description;
969    
970                    if ((description != null) && (description.length() == 0)) {
971                            journalTemplateCacheModel.description = null;
972                    }
973    
974                    journalTemplateCacheModel.xsl = getXsl();
975    
976                    String xsl = journalTemplateCacheModel.xsl;
977    
978                    if ((xsl != null) && (xsl.length() == 0)) {
979                            journalTemplateCacheModel.xsl = null;
980                    }
981    
982                    journalTemplateCacheModel.langType = getLangType();
983    
984                    String langType = journalTemplateCacheModel.langType;
985    
986                    if ((langType != null) && (langType.length() == 0)) {
987                            journalTemplateCacheModel.langType = null;
988                    }
989    
990                    journalTemplateCacheModel.cacheable = getCacheable();
991    
992                    journalTemplateCacheModel.smallImage = getSmallImage();
993    
994                    journalTemplateCacheModel.smallImageId = getSmallImageId();
995    
996                    journalTemplateCacheModel.smallImageURL = getSmallImageURL();
997    
998                    String smallImageURL = journalTemplateCacheModel.smallImageURL;
999    
1000                    if ((smallImageURL != null) && (smallImageURL.length() == 0)) {
1001                            journalTemplateCacheModel.smallImageURL = null;
1002                    }
1003    
1004                    return journalTemplateCacheModel;
1005            }
1006    
1007            @Override
1008            public String toString() {
1009                    StringBundler sb = new StringBundler(37);
1010    
1011                    sb.append("{uuid=");
1012                    sb.append(getUuid());
1013                    sb.append(", id=");
1014                    sb.append(getId());
1015                    sb.append(", groupId=");
1016                    sb.append(getGroupId());
1017                    sb.append(", companyId=");
1018                    sb.append(getCompanyId());
1019                    sb.append(", userId=");
1020                    sb.append(getUserId());
1021                    sb.append(", userName=");
1022                    sb.append(getUserName());
1023                    sb.append(", createDate=");
1024                    sb.append(getCreateDate());
1025                    sb.append(", modifiedDate=");
1026                    sb.append(getModifiedDate());
1027                    sb.append(", templateId=");
1028                    sb.append(getTemplateId());
1029                    sb.append(", structureId=");
1030                    sb.append(getStructureId());
1031                    sb.append(", name=");
1032                    sb.append(getName());
1033                    sb.append(", description=");
1034                    sb.append(getDescription());
1035                    sb.append(", xsl=");
1036                    sb.append(getXsl());
1037                    sb.append(", langType=");
1038                    sb.append(getLangType());
1039                    sb.append(", cacheable=");
1040                    sb.append(getCacheable());
1041                    sb.append(", smallImage=");
1042                    sb.append(getSmallImage());
1043                    sb.append(", smallImageId=");
1044                    sb.append(getSmallImageId());
1045                    sb.append(", smallImageURL=");
1046                    sb.append(getSmallImageURL());
1047                    sb.append("}");
1048    
1049                    return sb.toString();
1050            }
1051    
1052            public String toXmlString() {
1053                    StringBundler sb = new StringBundler(58);
1054    
1055                    sb.append("<model><model-name>");
1056                    sb.append("com.liferay.portlet.journal.model.JournalTemplate");
1057                    sb.append("</model-name>");
1058    
1059                    sb.append(
1060                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1061                    sb.append(getUuid());
1062                    sb.append("]]></column-value></column>");
1063                    sb.append(
1064                            "<column><column-name>id</column-name><column-value><![CDATA[");
1065                    sb.append(getId());
1066                    sb.append("]]></column-value></column>");
1067                    sb.append(
1068                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1069                    sb.append(getGroupId());
1070                    sb.append("]]></column-value></column>");
1071                    sb.append(
1072                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1073                    sb.append(getCompanyId());
1074                    sb.append("]]></column-value></column>");
1075                    sb.append(
1076                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1077                    sb.append(getUserId());
1078                    sb.append("]]></column-value></column>");
1079                    sb.append(
1080                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1081                    sb.append(getUserName());
1082                    sb.append("]]></column-value></column>");
1083                    sb.append(
1084                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1085                    sb.append(getCreateDate());
1086                    sb.append("]]></column-value></column>");
1087                    sb.append(
1088                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1089                    sb.append(getModifiedDate());
1090                    sb.append("]]></column-value></column>");
1091                    sb.append(
1092                            "<column><column-name>templateId</column-name><column-value><![CDATA[");
1093                    sb.append(getTemplateId());
1094                    sb.append("]]></column-value></column>");
1095                    sb.append(
1096                            "<column><column-name>structureId</column-name><column-value><![CDATA[");
1097                    sb.append(getStructureId());
1098                    sb.append("]]></column-value></column>");
1099                    sb.append(
1100                            "<column><column-name>name</column-name><column-value><![CDATA[");
1101                    sb.append(getName());
1102                    sb.append("]]></column-value></column>");
1103                    sb.append(
1104                            "<column><column-name>description</column-name><column-value><![CDATA[");
1105                    sb.append(getDescription());
1106                    sb.append("]]></column-value></column>");
1107                    sb.append(
1108                            "<column><column-name>xsl</column-name><column-value><![CDATA[");
1109                    sb.append(getXsl());
1110                    sb.append("]]></column-value></column>");
1111                    sb.append(
1112                            "<column><column-name>langType</column-name><column-value><![CDATA[");
1113                    sb.append(getLangType());
1114                    sb.append("]]></column-value></column>");
1115                    sb.append(
1116                            "<column><column-name>cacheable</column-name><column-value><![CDATA[");
1117                    sb.append(getCacheable());
1118                    sb.append("]]></column-value></column>");
1119                    sb.append(
1120                            "<column><column-name>smallImage</column-name><column-value><![CDATA[");
1121                    sb.append(getSmallImage());
1122                    sb.append("]]></column-value></column>");
1123                    sb.append(
1124                            "<column><column-name>smallImageId</column-name><column-value><![CDATA[");
1125                    sb.append(getSmallImageId());
1126                    sb.append("]]></column-value></column>");
1127                    sb.append(
1128                            "<column><column-name>smallImageURL</column-name><column-value><![CDATA[");
1129                    sb.append(getSmallImageURL());
1130                    sb.append("]]></column-value></column>");
1131    
1132                    sb.append("</model>");
1133    
1134                    return sb.toString();
1135            }
1136    
1137            private static ClassLoader _classLoader = JournalTemplate.class.getClassLoader();
1138            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1139                            JournalTemplate.class
1140                    };
1141            private String _uuid;
1142            private String _originalUuid;
1143            private long _id;
1144            private long _groupId;
1145            private long _originalGroupId;
1146            private boolean _setOriginalGroupId;
1147            private long _companyId;
1148            private long _userId;
1149            private String _userUuid;
1150            private String _userName;
1151            private Date _createDate;
1152            private Date _modifiedDate;
1153            private String _templateId;
1154            private String _originalTemplateId;
1155            private String _structureId;
1156            private String _originalStructureId;
1157            private String _name;
1158            private String _nameCurrentLanguageId;
1159            private String _description;
1160            private String _descriptionCurrentLanguageId;
1161            private String _xsl;
1162            private String _langType;
1163            private boolean _cacheable;
1164            private boolean _smallImage;
1165            private long _smallImageId;
1166            private long _originalSmallImageId;
1167            private boolean _setOriginalSmallImageId;
1168            private String _smallImageURL;
1169            private long _columnBitmask;
1170            private JournalTemplate _escapedModel;
1171    }