001    /**
002     * Copyright (c) 2000-present 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.trash.model.impl;
016    
017    import com.liferay.portal.kernel.util.UnicodeProperties;
018    
019    /**
020     * @author Alexander Chow
021     */
022    public class TrashVersionImpl extends TrashVersionBaseImpl {
023    
024            @Override
025            public String getTypeSettings() {
026                    if (_typeSettingsProperties == null) {
027                            return super.getTypeSettings();
028                    }
029                    else {
030                            return _typeSettingsProperties.toString();
031                    }
032            }
033    
034            @Override
035            public UnicodeProperties getTypeSettingsProperties() {
036                    if (_typeSettingsProperties == null) {
037                            _typeSettingsProperties = new UnicodeProperties(true);
038    
039                            _typeSettingsProperties.fastLoad(super.getTypeSettings());
040                    }
041    
042                    return _typeSettingsProperties;
043            }
044    
045            @Override
046            public String getTypeSettingsProperty(String key) {
047                    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();
048    
049                    return typeSettingsProperties.getProperty(key);
050            }
051    
052            @Override
053            public String getTypeSettingsProperty(String key, String defaultValue) {
054                    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();
055    
056                    return typeSettingsProperties.getProperty(key, defaultValue);
057            }
058    
059            @Override
060            public void setTypeSettings(String typeSettings) {
061                    _typeSettingsProperties = null;
062    
063                    super.setTypeSettings(typeSettings);
064            }
065    
066            @Override
067            public void setTypeSettingsProperties(
068                    UnicodeProperties typeSettingsProperties) {
069    
070                    _typeSettingsProperties = typeSettingsProperties;
071    
072                    super.setTypeSettings(_typeSettingsProperties.toString());
073            }
074    
075            private UnicodeProperties _typeSettingsProperties;
076    
077    }