001    /**
002     * Copyright (c) 2000-2010 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.portal.model.impl;
016    
017    import com.liferay.portal.kernel.plugin.PluginPackage;
018    import com.liferay.portal.model.Plugin;
019    import com.liferay.portal.model.PluginSetting;
020    
021    import java.util.HashMap;
022    import java.util.Map;
023    
024    /**
025     * @author Jorge Ferrer
026     */
027    public abstract class PluginBaseImpl implements Plugin {
028    
029            public PluginPackage getPluginPackage() {
030                    return _pluginPackage;
031            }
032    
033            public void setPluginPackage(PluginPackage pluginPackage) {
034                    _pluginPackage = pluginPackage;
035            }
036    
037            public PluginSetting getDefaultPluginSetting() {
038                    return _defaultPluginSetting;
039            }
040    
041            public PluginSetting getDefaultPluginSetting(long companyId) {
042                    PluginSetting setting = _defaultPluginSettings.get(companyId);
043    
044                    if (setting == null) {
045                            setting = new PluginSettingImpl(_defaultPluginSetting);
046    
047                            setting.setCompanyId(companyId);
048    
049                            _defaultPluginSettings.put(companyId, setting);
050                    }
051    
052                    return setting;
053            }
054    
055            public void setDefaultPluginSetting(PluginSetting pluginSetting) {
056                    _defaultPluginSetting = pluginSetting;
057            }
058    
059            private PluginPackage _pluginPackage;
060            private PluginSetting _defaultPluginSetting;
061            private Map<Long, PluginSetting> _defaultPluginSettings =
062                    new HashMap<Long, PluginSetting>();
063    
064    }