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