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