1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }