001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.trash.model.impl;
016    
017    import com.liferay.portal.kernel.util.UnicodeProperties;
018    import com.liferay.portlet.trash.model.TrashEntry;
019    
020    /**
021     * @author Zsolt Berentey
022     */
023    public class TrashEntryImpl extends TrashEntryBaseImpl {
024    
025            public TrashEntry getRootEntry() {
026                    return _rootEntry;
027            }
028    
029            @Override
030            public String getTypeSettings() {
031                    if (_typeSettingsProperties == null) {
032                            return super.getTypeSettings();
033                    }
034                    else {
035                            return _typeSettingsProperties.toString();
036                    }
037            }
038    
039            public UnicodeProperties getTypeSettingsProperties() {
040                    if (_typeSettingsProperties == null) {
041                            _typeSettingsProperties = new UnicodeProperties(true);
042    
043                            _typeSettingsProperties.fastLoad(super.getTypeSettings());
044                    }
045    
046                    return _typeSettingsProperties;
047            }
048    
049            public String getTypeSettingsProperty(String key) {
050                    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();
051    
052                    return typeSettingsProperties.getProperty(key);
053            }
054    
055            public String getTypeSettingsProperty(String key, String defaultValue) {
056                    UnicodeProperties typeSettingsProperties = getTypeSettingsProperties();
057    
058                    return typeSettingsProperties.getProperty(key, defaultValue);
059            }
060    
061            public void setRootEntry(TrashEntry rootEntry) {
062                    _rootEntry = rootEntry;
063            }
064    
065            @Override
066            public void setTypeSettings(String typeSettings) {
067                    _typeSettingsProperties = null;
068    
069                    super.setTypeSettings(typeSettings);
070            }
071    
072            public void setTypeSettingsProperties(
073                    UnicodeProperties typeSettingsProperties) {
074    
075                    _typeSettingsProperties = typeSettingsProperties;
076    
077                    super.setTypeSettings(_typeSettingsProperties.toString());
078            }
079    
080            private TrashEntry _rootEntry;
081            private UnicodeProperties _typeSettingsProperties;
082    
083    }