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