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.dynamicdatalists.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.dynamicdatalists.model.DDLRecordSet;
035    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSetModel;
036    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSetSoap;
037    import com.liferay.portlet.expando.model.ExpandoBridge;
038    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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 DDLRecordSet service. Represents a row in the "DDLRecordSet" 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.dynamicdatalists.model.DDLRecordSetModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DDLRecordSetImpl}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see DDLRecordSetImpl
060     * @see com.liferay.portlet.dynamicdatalists.model.DDLRecordSet
061     * @see com.liferay.portlet.dynamicdatalists.model.DDLRecordSetModel
062     * @generated
063     */
064    @JSON(strict = true)
065    public class DDLRecordSetModelImpl extends BaseModelImpl<DDLRecordSet>
066            implements DDLRecordSetModel {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. All methods that expect a d d l record set model instance should use the {@link com.liferay.portlet.dynamicdatalists.model.DDLRecordSet} interface instead.
071             */
072            public static final String TABLE_NAME = "DDLRecordSet";
073            public static final Object[][] TABLE_COLUMNS = {
074                            { "uuid_", Types.VARCHAR },
075                            { "recordSetId", 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                            { "DDMStructureId", Types.BIGINT },
083                            { "recordSetKey", Types.VARCHAR },
084                            { "name", Types.VARCHAR },
085                            { "description", Types.VARCHAR },
086                            { "minDisplayRows", Types.INTEGER },
087                            { "scope", Types.INTEGER }
088                    };
089            public static final String TABLE_SQL_CREATE = "create table DDLRecordSet (uuid_ VARCHAR(75) null,recordSetId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,DDMStructureId LONG,recordSetKey VARCHAR(75) null,name STRING null,description STRING null,minDisplayRows INTEGER,scope INTEGER)";
090            public static final String TABLE_SQL_DROP = "drop table DDLRecordSet";
091            public static final String DATA_SOURCE = "liferayDataSource";
092            public static final String SESSION_FACTORY = "liferaySessionFactory";
093            public static final String TX_MANAGER = "liferayTransactionManager";
094            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
095                                    "value.object.entity.cache.enabled.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet"),
096                            true);
097            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
098                                    "value.object.finder.cache.enabled.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet"),
099                            true);
100            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101                                    "value.object.column.bitmask.enabled.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet"),
102                            true);
103            public static long GROUPID_COLUMN_BITMASK = 1L;
104            public static long RECORDSETKEY_COLUMN_BITMASK = 2L;
105            public static long UUID_COLUMN_BITMASK = 4L;
106    
107            /**
108             * Converts the soap model instance into a normal model instance.
109             *
110             * @param soapModel the soap model instance to convert
111             * @return the normal model instance
112             */
113            public static DDLRecordSet toModel(DDLRecordSetSoap soapModel) {
114                    if (soapModel == null) {
115                            return null;
116                    }
117    
118                    DDLRecordSet model = new DDLRecordSetImpl();
119    
120                    model.setUuid(soapModel.getUuid());
121                    model.setRecordSetId(soapModel.getRecordSetId());
122                    model.setGroupId(soapModel.getGroupId());
123                    model.setCompanyId(soapModel.getCompanyId());
124                    model.setUserId(soapModel.getUserId());
125                    model.setUserName(soapModel.getUserName());
126                    model.setCreateDate(soapModel.getCreateDate());
127                    model.setModifiedDate(soapModel.getModifiedDate());
128                    model.setDDMStructureId(soapModel.getDDMStructureId());
129                    model.setRecordSetKey(soapModel.getRecordSetKey());
130                    model.setName(soapModel.getName());
131                    model.setDescription(soapModel.getDescription());
132                    model.setMinDisplayRows(soapModel.getMinDisplayRows());
133                    model.setScope(soapModel.getScope());
134    
135                    return model;
136            }
137    
138            /**
139             * Converts the soap model instances into normal model instances.
140             *
141             * @param soapModels the soap model instances to convert
142             * @return the normal model instances
143             */
144            public static List<DDLRecordSet> toModels(DDLRecordSetSoap[] soapModels) {
145                    if (soapModels == null) {
146                            return null;
147                    }
148    
149                    List<DDLRecordSet> models = new ArrayList<DDLRecordSet>(soapModels.length);
150    
151                    for (DDLRecordSetSoap soapModel : soapModels) {
152                            models.add(toModel(soapModel));
153                    }
154    
155                    return models;
156            }
157    
158            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
159                                    "lock.expiration.time.com.liferay.portlet.dynamicdatalists.model.DDLRecordSet"));
160    
161            public DDLRecordSetModelImpl() {
162            }
163    
164            public long getPrimaryKey() {
165                    return _recordSetId;
166            }
167    
168            public void setPrimaryKey(long primaryKey) {
169                    setRecordSetId(primaryKey);
170            }
171    
172            public Serializable getPrimaryKeyObj() {
173                    return new Long(_recordSetId);
174            }
175    
176            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
177                    setPrimaryKey(((Long)primaryKeyObj).longValue());
178            }
179    
180            public Class<?> getModelClass() {
181                    return DDLRecordSet.class;
182            }
183    
184            public String getModelClassName() {
185                    return DDLRecordSet.class.getName();
186            }
187    
188            @Override
189            public Map<String, Object> getModelAttributes() {
190                    Map<String, Object> attributes = new HashMap<String, Object>();
191    
192                    attributes.put("uuid", getUuid());
193                    attributes.put("recordSetId", getRecordSetId());
194                    attributes.put("groupId", getGroupId());
195                    attributes.put("companyId", getCompanyId());
196                    attributes.put("userId", getUserId());
197                    attributes.put("userName", getUserName());
198                    attributes.put("createDate", getCreateDate());
199                    attributes.put("modifiedDate", getModifiedDate());
200                    attributes.put("DDMStructureId", getDDMStructureId());
201                    attributes.put("recordSetKey", getRecordSetKey());
202                    attributes.put("name", getName());
203                    attributes.put("description", getDescription());
204                    attributes.put("minDisplayRows", getMinDisplayRows());
205                    attributes.put("scope", getScope());
206    
207                    return attributes;
208            }
209    
210            @Override
211            public void setModelAttributes(Map<String, Object> attributes) {
212                    String uuid = (String)attributes.get("uuid");
213    
214                    if (uuid != null) {
215                            setUuid(uuid);
216                    }
217    
218                    Long recordSetId = (Long)attributes.get("recordSetId");
219    
220                    if (recordSetId != null) {
221                            setRecordSetId(recordSetId);
222                    }
223    
224                    Long groupId = (Long)attributes.get("groupId");
225    
226                    if (groupId != null) {
227                            setGroupId(groupId);
228                    }
229    
230                    Long companyId = (Long)attributes.get("companyId");
231    
232                    if (companyId != null) {
233                            setCompanyId(companyId);
234                    }
235    
236                    Long userId = (Long)attributes.get("userId");
237    
238                    if (userId != null) {
239                            setUserId(userId);
240                    }
241    
242                    String userName = (String)attributes.get("userName");
243    
244                    if (userName != null) {
245                            setUserName(userName);
246                    }
247    
248                    Date createDate = (Date)attributes.get("createDate");
249    
250                    if (createDate != null) {
251                            setCreateDate(createDate);
252                    }
253    
254                    Date modifiedDate = (Date)attributes.get("modifiedDate");
255    
256                    if (modifiedDate != null) {
257                            setModifiedDate(modifiedDate);
258                    }
259    
260                    Long DDMStructureId = (Long)attributes.get("DDMStructureId");
261    
262                    if (DDMStructureId != null) {
263                            setDDMStructureId(DDMStructureId);
264                    }
265    
266                    String recordSetKey = (String)attributes.get("recordSetKey");
267    
268                    if (recordSetKey != null) {
269                            setRecordSetKey(recordSetKey);
270                    }
271    
272                    String name = (String)attributes.get("name");
273    
274                    if (name != null) {
275                            setName(name);
276                    }
277    
278                    String description = (String)attributes.get("description");
279    
280                    if (description != null) {
281                            setDescription(description);
282                    }
283    
284                    Integer minDisplayRows = (Integer)attributes.get("minDisplayRows");
285    
286                    if (minDisplayRows != null) {
287                            setMinDisplayRows(minDisplayRows);
288                    }
289    
290                    Integer scope = (Integer)attributes.get("scope");
291    
292                    if (scope != null) {
293                            setScope(scope);
294                    }
295            }
296    
297            @JSON
298            public String getUuid() {
299                    if (_uuid == null) {
300                            return StringPool.BLANK;
301                    }
302                    else {
303                            return _uuid;
304                    }
305            }
306    
307            public void setUuid(String uuid) {
308                    if (_originalUuid == null) {
309                            _originalUuid = _uuid;
310                    }
311    
312                    _uuid = uuid;
313            }
314    
315            public String getOriginalUuid() {
316                    return GetterUtil.getString(_originalUuid);
317            }
318    
319            @JSON
320            public long getRecordSetId() {
321                    return _recordSetId;
322            }
323    
324            public void setRecordSetId(long recordSetId) {
325                    _recordSetId = recordSetId;
326            }
327    
328            @JSON
329            public long getGroupId() {
330                    return _groupId;
331            }
332    
333            public void setGroupId(long groupId) {
334                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
335    
336                    if (!_setOriginalGroupId) {
337                            _setOriginalGroupId = true;
338    
339                            _originalGroupId = _groupId;
340                    }
341    
342                    _groupId = groupId;
343            }
344    
345            public long getOriginalGroupId() {
346                    return _originalGroupId;
347            }
348    
349            @JSON
350            public long getCompanyId() {
351                    return _companyId;
352            }
353    
354            public void setCompanyId(long companyId) {
355                    _companyId = companyId;
356            }
357    
358            @JSON
359            public long getUserId() {
360                    return _userId;
361            }
362    
363            public void setUserId(long userId) {
364                    _userId = userId;
365            }
366    
367            public String getUserUuid() throws SystemException {
368                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
369            }
370    
371            public void setUserUuid(String userUuid) {
372                    _userUuid = userUuid;
373            }
374    
375            @JSON
376            public String getUserName() {
377                    if (_userName == null) {
378                            return StringPool.BLANK;
379                    }
380                    else {
381                            return _userName;
382                    }
383            }
384    
385            public void setUserName(String userName) {
386                    _userName = userName;
387            }
388    
389            @JSON
390            public Date getCreateDate() {
391                    return _createDate;
392            }
393    
394            public void setCreateDate(Date createDate) {
395                    _createDate = createDate;
396            }
397    
398            @JSON
399            public Date getModifiedDate() {
400                    return _modifiedDate;
401            }
402    
403            public void setModifiedDate(Date modifiedDate) {
404                    _modifiedDate = modifiedDate;
405            }
406    
407            @JSON
408            public long getDDMStructureId() {
409                    return _DDMStructureId;
410            }
411    
412            public void setDDMStructureId(long DDMStructureId) {
413                    _DDMStructureId = DDMStructureId;
414            }
415    
416            @JSON
417            public String getRecordSetKey() {
418                    if (_recordSetKey == null) {
419                            return StringPool.BLANK;
420                    }
421                    else {
422                            return _recordSetKey;
423                    }
424            }
425    
426            public void setRecordSetKey(String recordSetKey) {
427                    _columnBitmask |= RECORDSETKEY_COLUMN_BITMASK;
428    
429                    if (_originalRecordSetKey == null) {
430                            _originalRecordSetKey = _recordSetKey;
431                    }
432    
433                    _recordSetKey = recordSetKey;
434            }
435    
436            public String getOriginalRecordSetKey() {
437                    return GetterUtil.getString(_originalRecordSetKey);
438            }
439    
440            @JSON
441            public String getName() {
442                    if (_name == null) {
443                            return StringPool.BLANK;
444                    }
445                    else {
446                            return _name;
447                    }
448            }
449    
450            public String getName(Locale locale) {
451                    String languageId = LocaleUtil.toLanguageId(locale);
452    
453                    return getName(languageId);
454            }
455    
456            public String getName(Locale locale, boolean useDefault) {
457                    String languageId = LocaleUtil.toLanguageId(locale);
458    
459                    return getName(languageId, useDefault);
460            }
461    
462            public String getName(String languageId) {
463                    return LocalizationUtil.getLocalization(getName(), languageId);
464            }
465    
466            public String getName(String languageId, boolean useDefault) {
467                    return LocalizationUtil.getLocalization(getName(), languageId,
468                            useDefault);
469            }
470    
471            public String getNameCurrentLanguageId() {
472                    return _nameCurrentLanguageId;
473            }
474    
475            @JSON
476            public String getNameCurrentValue() {
477                    Locale locale = getLocale(_nameCurrentLanguageId);
478    
479                    return getName(locale);
480            }
481    
482            public Map<Locale, String> getNameMap() {
483                    return LocalizationUtil.getLocalizationMap(getName());
484            }
485    
486            public void setName(String name) {
487                    _name = name;
488            }
489    
490            public void setName(String name, Locale locale) {
491                    setName(name, locale, LocaleUtil.getDefault());
492            }
493    
494            public void setName(String name, Locale locale, Locale defaultLocale) {
495                    String languageId = LocaleUtil.toLanguageId(locale);
496                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
497    
498                    if (Validator.isNotNull(name)) {
499                            setName(LocalizationUtil.updateLocalization(getName(), "Name",
500                                            name, languageId, defaultLanguageId));
501                    }
502                    else {
503                            setName(LocalizationUtil.removeLocalization(getName(), "Name",
504                                            languageId));
505                    }
506            }
507    
508            public void setNameCurrentLanguageId(String languageId) {
509                    _nameCurrentLanguageId = languageId;
510            }
511    
512            public void setNameMap(Map<Locale, String> nameMap) {
513                    setNameMap(nameMap, LocaleUtil.getDefault());
514            }
515    
516            public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
517                    if (nameMap == null) {
518                            return;
519                    }
520    
521                    Locale[] locales = LanguageUtil.getAvailableLocales();
522    
523                    for (Locale locale : locales) {
524                            String name = nameMap.get(locale);
525    
526                            setName(name, locale, defaultLocale);
527                    }
528            }
529    
530            @JSON
531            public String getDescription() {
532                    if (_description == null) {
533                            return StringPool.BLANK;
534                    }
535                    else {
536                            return _description;
537                    }
538            }
539    
540            public String getDescription(Locale locale) {
541                    String languageId = LocaleUtil.toLanguageId(locale);
542    
543                    return getDescription(languageId);
544            }
545    
546            public String getDescription(Locale locale, boolean useDefault) {
547                    String languageId = LocaleUtil.toLanguageId(locale);
548    
549                    return getDescription(languageId, useDefault);
550            }
551    
552            public String getDescription(String languageId) {
553                    return LocalizationUtil.getLocalization(getDescription(), languageId);
554            }
555    
556            public String getDescription(String languageId, boolean useDefault) {
557                    return LocalizationUtil.getLocalization(getDescription(), languageId,
558                            useDefault);
559            }
560    
561            public String getDescriptionCurrentLanguageId() {
562                    return _descriptionCurrentLanguageId;
563            }
564    
565            @JSON
566            public String getDescriptionCurrentValue() {
567                    Locale locale = getLocale(_descriptionCurrentLanguageId);
568    
569                    return getDescription(locale);
570            }
571    
572            public Map<Locale, String> getDescriptionMap() {
573                    return LocalizationUtil.getLocalizationMap(getDescription());
574            }
575    
576            public void setDescription(String description) {
577                    _description = description;
578            }
579    
580            public void setDescription(String description, Locale locale) {
581                    setDescription(description, locale, LocaleUtil.getDefault());
582            }
583    
584            public void setDescription(String description, Locale locale,
585                    Locale defaultLocale) {
586                    String languageId = LocaleUtil.toLanguageId(locale);
587                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
588    
589                    if (Validator.isNotNull(description)) {
590                            setDescription(LocalizationUtil.updateLocalization(
591                                            getDescription(), "Description", description, languageId,
592                                            defaultLanguageId));
593                    }
594                    else {
595                            setDescription(LocalizationUtil.removeLocalization(
596                                            getDescription(), "Description", languageId));
597                    }
598            }
599    
600            public void setDescriptionCurrentLanguageId(String languageId) {
601                    _descriptionCurrentLanguageId = languageId;
602            }
603    
604            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
605                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
606            }
607    
608            public void setDescriptionMap(Map<Locale, String> descriptionMap,
609                    Locale defaultLocale) {
610                    if (descriptionMap == null) {
611                            return;
612                    }
613    
614                    Locale[] locales = LanguageUtil.getAvailableLocales();
615    
616                    for (Locale locale : locales) {
617                            String description = descriptionMap.get(locale);
618    
619                            setDescription(description, locale, defaultLocale);
620                    }
621            }
622    
623            @JSON
624            public int getMinDisplayRows() {
625                    return _minDisplayRows;
626            }
627    
628            public void setMinDisplayRows(int minDisplayRows) {
629                    _minDisplayRows = minDisplayRows;
630            }
631    
632            @JSON
633            public int getScope() {
634                    return _scope;
635            }
636    
637            public void setScope(int scope) {
638                    _scope = scope;
639            }
640    
641            public long getColumnBitmask() {
642                    return _columnBitmask;
643            }
644    
645            @Override
646            public ExpandoBridge getExpandoBridge() {
647                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
648                            DDLRecordSet.class.getName(), getPrimaryKey());
649            }
650    
651            @Override
652            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
653                    ExpandoBridge expandoBridge = getExpandoBridge();
654    
655                    expandoBridge.setAttributes(serviceContext);
656            }
657    
658            @SuppressWarnings("unused")
659            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
660                    throws LocaleException {
661                    setName(getName(defaultImportLocale), defaultImportLocale,
662                            defaultImportLocale);
663                    setDescription(getDescription(defaultImportLocale),
664                            defaultImportLocale, defaultImportLocale);
665            }
666    
667            @Override
668            public DDLRecordSet toEscapedModel() {
669                    if (_escapedModel == null) {
670                            _escapedModel = (DDLRecordSet)ProxyUtil.newProxyInstance(_classLoader,
671                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
672                    }
673    
674                    return _escapedModel;
675            }
676    
677            public DDLRecordSet toUnescapedModel() {
678                    return (DDLRecordSet)this;
679            }
680    
681            @Override
682            public Object clone() {
683                    DDLRecordSetImpl ddlRecordSetImpl = new DDLRecordSetImpl();
684    
685                    ddlRecordSetImpl.setUuid(getUuid());
686                    ddlRecordSetImpl.setRecordSetId(getRecordSetId());
687                    ddlRecordSetImpl.setGroupId(getGroupId());
688                    ddlRecordSetImpl.setCompanyId(getCompanyId());
689                    ddlRecordSetImpl.setUserId(getUserId());
690                    ddlRecordSetImpl.setUserName(getUserName());
691                    ddlRecordSetImpl.setCreateDate(getCreateDate());
692                    ddlRecordSetImpl.setModifiedDate(getModifiedDate());
693                    ddlRecordSetImpl.setDDMStructureId(getDDMStructureId());
694                    ddlRecordSetImpl.setRecordSetKey(getRecordSetKey());
695                    ddlRecordSetImpl.setName(getName());
696                    ddlRecordSetImpl.setDescription(getDescription());
697                    ddlRecordSetImpl.setMinDisplayRows(getMinDisplayRows());
698                    ddlRecordSetImpl.setScope(getScope());
699    
700                    ddlRecordSetImpl.resetOriginalValues();
701    
702                    return ddlRecordSetImpl;
703            }
704    
705            public int compareTo(DDLRecordSet ddlRecordSet) {
706                    long primaryKey = ddlRecordSet.getPrimaryKey();
707    
708                    if (getPrimaryKey() < primaryKey) {
709                            return -1;
710                    }
711                    else if (getPrimaryKey() > primaryKey) {
712                            return 1;
713                    }
714                    else {
715                            return 0;
716                    }
717            }
718    
719            @Override
720            public boolean equals(Object obj) {
721                    if (this == obj) {
722                            return true;
723                    }
724    
725                    if (!(obj instanceof DDLRecordSet)) {
726                            return false;
727                    }
728    
729                    DDLRecordSet ddlRecordSet = (DDLRecordSet)obj;
730    
731                    long primaryKey = ddlRecordSet.getPrimaryKey();
732    
733                    if (getPrimaryKey() == primaryKey) {
734                            return true;
735                    }
736                    else {
737                            return false;
738                    }
739            }
740    
741            @Override
742            public int hashCode() {
743                    return (int)getPrimaryKey();
744            }
745    
746            @Override
747            public void resetOriginalValues() {
748                    DDLRecordSetModelImpl ddlRecordSetModelImpl = this;
749    
750                    ddlRecordSetModelImpl._originalUuid = ddlRecordSetModelImpl._uuid;
751    
752                    ddlRecordSetModelImpl._originalGroupId = ddlRecordSetModelImpl._groupId;
753    
754                    ddlRecordSetModelImpl._setOriginalGroupId = false;
755    
756                    ddlRecordSetModelImpl._originalRecordSetKey = ddlRecordSetModelImpl._recordSetKey;
757    
758                    ddlRecordSetModelImpl._columnBitmask = 0;
759            }
760    
761            @Override
762            public CacheModel<DDLRecordSet> toCacheModel() {
763                    DDLRecordSetCacheModel ddlRecordSetCacheModel = new DDLRecordSetCacheModel();
764    
765                    ddlRecordSetCacheModel.uuid = getUuid();
766    
767                    String uuid = ddlRecordSetCacheModel.uuid;
768    
769                    if ((uuid != null) && (uuid.length() == 0)) {
770                            ddlRecordSetCacheModel.uuid = null;
771                    }
772    
773                    ddlRecordSetCacheModel.recordSetId = getRecordSetId();
774    
775                    ddlRecordSetCacheModel.groupId = getGroupId();
776    
777                    ddlRecordSetCacheModel.companyId = getCompanyId();
778    
779                    ddlRecordSetCacheModel.userId = getUserId();
780    
781                    ddlRecordSetCacheModel.userName = getUserName();
782    
783                    String userName = ddlRecordSetCacheModel.userName;
784    
785                    if ((userName != null) && (userName.length() == 0)) {
786                            ddlRecordSetCacheModel.userName = null;
787                    }
788    
789                    Date createDate = getCreateDate();
790    
791                    if (createDate != null) {
792                            ddlRecordSetCacheModel.createDate = createDate.getTime();
793                    }
794                    else {
795                            ddlRecordSetCacheModel.createDate = Long.MIN_VALUE;
796                    }
797    
798                    Date modifiedDate = getModifiedDate();
799    
800                    if (modifiedDate != null) {
801                            ddlRecordSetCacheModel.modifiedDate = modifiedDate.getTime();
802                    }
803                    else {
804                            ddlRecordSetCacheModel.modifiedDate = Long.MIN_VALUE;
805                    }
806    
807                    ddlRecordSetCacheModel.DDMStructureId = getDDMStructureId();
808    
809                    ddlRecordSetCacheModel.recordSetKey = getRecordSetKey();
810    
811                    String recordSetKey = ddlRecordSetCacheModel.recordSetKey;
812    
813                    if ((recordSetKey != null) && (recordSetKey.length() == 0)) {
814                            ddlRecordSetCacheModel.recordSetKey = null;
815                    }
816    
817                    ddlRecordSetCacheModel.name = getName();
818    
819                    String name = ddlRecordSetCacheModel.name;
820    
821                    if ((name != null) && (name.length() == 0)) {
822                            ddlRecordSetCacheModel.name = null;
823                    }
824    
825                    ddlRecordSetCacheModel.description = getDescription();
826    
827                    String description = ddlRecordSetCacheModel.description;
828    
829                    if ((description != null) && (description.length() == 0)) {
830                            ddlRecordSetCacheModel.description = null;
831                    }
832    
833                    ddlRecordSetCacheModel.minDisplayRows = getMinDisplayRows();
834    
835                    ddlRecordSetCacheModel.scope = getScope();
836    
837                    return ddlRecordSetCacheModel;
838            }
839    
840            @Override
841            public String toString() {
842                    StringBundler sb = new StringBundler(29);
843    
844                    sb.append("{uuid=");
845                    sb.append(getUuid());
846                    sb.append(", recordSetId=");
847                    sb.append(getRecordSetId());
848                    sb.append(", groupId=");
849                    sb.append(getGroupId());
850                    sb.append(", companyId=");
851                    sb.append(getCompanyId());
852                    sb.append(", userId=");
853                    sb.append(getUserId());
854                    sb.append(", userName=");
855                    sb.append(getUserName());
856                    sb.append(", createDate=");
857                    sb.append(getCreateDate());
858                    sb.append(", modifiedDate=");
859                    sb.append(getModifiedDate());
860                    sb.append(", DDMStructureId=");
861                    sb.append(getDDMStructureId());
862                    sb.append(", recordSetKey=");
863                    sb.append(getRecordSetKey());
864                    sb.append(", name=");
865                    sb.append(getName());
866                    sb.append(", description=");
867                    sb.append(getDescription());
868                    sb.append(", minDisplayRows=");
869                    sb.append(getMinDisplayRows());
870                    sb.append(", scope=");
871                    sb.append(getScope());
872                    sb.append("}");
873    
874                    return sb.toString();
875            }
876    
877            public String toXmlString() {
878                    StringBundler sb = new StringBundler(46);
879    
880                    sb.append("<model><model-name>");
881                    sb.append("com.liferay.portlet.dynamicdatalists.model.DDLRecordSet");
882                    sb.append("</model-name>");
883    
884                    sb.append(
885                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
886                    sb.append(getUuid());
887                    sb.append("]]></column-value></column>");
888                    sb.append(
889                            "<column><column-name>recordSetId</column-name><column-value><![CDATA[");
890                    sb.append(getRecordSetId());
891                    sb.append("]]></column-value></column>");
892                    sb.append(
893                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
894                    sb.append(getGroupId());
895                    sb.append("]]></column-value></column>");
896                    sb.append(
897                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
898                    sb.append(getCompanyId());
899                    sb.append("]]></column-value></column>");
900                    sb.append(
901                            "<column><column-name>userId</column-name><column-value><![CDATA[");
902                    sb.append(getUserId());
903                    sb.append("]]></column-value></column>");
904                    sb.append(
905                            "<column><column-name>userName</column-name><column-value><![CDATA[");
906                    sb.append(getUserName());
907                    sb.append("]]></column-value></column>");
908                    sb.append(
909                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
910                    sb.append(getCreateDate());
911                    sb.append("]]></column-value></column>");
912                    sb.append(
913                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
914                    sb.append(getModifiedDate());
915                    sb.append("]]></column-value></column>");
916                    sb.append(
917                            "<column><column-name>DDMStructureId</column-name><column-value><![CDATA[");
918                    sb.append(getDDMStructureId());
919                    sb.append("]]></column-value></column>");
920                    sb.append(
921                            "<column><column-name>recordSetKey</column-name><column-value><![CDATA[");
922                    sb.append(getRecordSetKey());
923                    sb.append("]]></column-value></column>");
924                    sb.append(
925                            "<column><column-name>name</column-name><column-value><![CDATA[");
926                    sb.append(getName());
927                    sb.append("]]></column-value></column>");
928                    sb.append(
929                            "<column><column-name>description</column-name><column-value><![CDATA[");
930                    sb.append(getDescription());
931                    sb.append("]]></column-value></column>");
932                    sb.append(
933                            "<column><column-name>minDisplayRows</column-name><column-value><![CDATA[");
934                    sb.append(getMinDisplayRows());
935                    sb.append("]]></column-value></column>");
936                    sb.append(
937                            "<column><column-name>scope</column-name><column-value><![CDATA[");
938                    sb.append(getScope());
939                    sb.append("]]></column-value></column>");
940    
941                    sb.append("</model>");
942    
943                    return sb.toString();
944            }
945    
946            private static ClassLoader _classLoader = DDLRecordSet.class.getClassLoader();
947            private static Class<?>[] _escapedModelInterfaces = new Class[] {
948                            DDLRecordSet.class
949                    };
950            private String _uuid;
951            private String _originalUuid;
952            private long _recordSetId;
953            private long _groupId;
954            private long _originalGroupId;
955            private boolean _setOriginalGroupId;
956            private long _companyId;
957            private long _userId;
958            private String _userUuid;
959            private String _userName;
960            private Date _createDate;
961            private Date _modifiedDate;
962            private long _DDMStructureId;
963            private String _recordSetKey;
964            private String _originalRecordSetKey;
965            private String _name;
966            private String _nameCurrentLanguageId;
967            private String _description;
968            private String _descriptionCurrentLanguageId;
969            private int _minDisplayRows;
970            private int _scope;
971            private long _columnBitmask;
972            private DDLRecordSet _escapedModel;
973    }