1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.model.impl;
16  
17  import com.liferay.portal.kernel.plugin.PluginPackage;
18  import com.liferay.portal.model.Plugin;
19  import com.liferay.portal.model.PluginSetting;
20  
21  import java.util.HashMap;
22  import java.util.Map;
23  
24  /**
25   * <a href="PluginBaseImpl.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Jorge Ferrer
28   */
29  public abstract class PluginBaseImpl implements Plugin {
30  
31      public PluginPackage getPluginPackage() {
32          return _pluginPackage;
33      }
34  
35      public void setPluginPackage(PluginPackage pluginPackage) {
36          _pluginPackage = pluginPackage;
37      }
38  
39      public PluginSetting getDefaultPluginSetting() {
40          return _defaultPluginSetting;
41      }
42  
43      public PluginSetting getDefaultPluginSetting(long companyId) {
44          PluginSetting setting = _defaultPluginSettings.get(companyId);
45  
46          if (setting == null) {
47              setting = new PluginSettingImpl(_defaultPluginSetting);
48  
49              setting.setCompanyId(companyId);
50  
51              _defaultPluginSettings.put(companyId, setting);
52          }
53  
54          return setting;
55      }
56  
57      public void setDefaultPluginSetting(PluginSetting pluginSetting) {
58          _defaultPluginSetting = pluginSetting;
59      }
60  
61      private PluginPackage _pluginPackage;
62      private PluginSetting _defaultPluginSetting;
63      private Map<Long, PluginSetting> _defaultPluginSettings =
64          new HashMap<Long, PluginSetting>();
65  
66  }