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.portlet.sitemap.lar;
16  
17  import com.liferay.portal.kernel.util.StringPool;
18  import com.liferay.portal.lar.BasePortletDataHandler;
19  import com.liferay.portal.lar.PortletDataContext;
20  import com.liferay.portal.lar.PortletDataException;
21  import com.liferay.portal.lar.PortletDataHandlerControl;
22  
23  import javax.portlet.PortletPreferences;
24  
25  /**
26   * <a href="SitemapPortletDataHandlerImpl.java.html"><b><i>View Source</i></b>
27   * </a>
28   *
29   * @author Bruno Farache
30   */
31  public class SitemapPortletDataHandlerImpl extends BasePortletDataHandler {
32  
33      public PortletPreferences deleteData(
34              PortletDataContext context, String portletId,
35              PortletPreferences preferences)
36          throws PortletDataException {
37  
38          try {
39              preferences.setValue("root-layout-id", StringPool.BLANK);
40              preferences.setValue("display-depth", StringPool.BLANK);
41              preferences.setValue("include-root-in-tree", StringPool.BLANK);
42              preferences.setValue("show-current-page", StringPool.BLANK);
43              preferences.setValue("use-html-title", StringPool.BLANK);
44              preferences.setValue("show-hidden-pages", StringPool.BLANK);
45  
46              return preferences;
47          }
48          catch (Exception e) {
49              throw new PortletDataException(e);
50          }
51      }
52  
53      public String exportData(
54          PortletDataContext context, String portletId,
55          PortletPreferences preferences) {
56  
57          return StringPool.BLANK;
58      }
59  
60      public PortletDataHandlerControl[] getExportControls() {
61          return new PortletDataHandlerControl[0];
62      }
63  
64      public PortletDataHandlerControl[] getImportControls() {
65          return new PortletDataHandlerControl[0];
66      }
67  
68      public PortletPreferences importData(
69          PortletDataContext context, String portletId,
70          PortletPreferences preferences, String data) {
71  
72          return preferences;
73      }
74  
75      public boolean isPublishToLiveByDefault() {
76          return _PUBLISH_TO_LIVE_BY_DEFAULT;
77      }
78  
79      private static final boolean _PUBLISH_TO_LIVE_BY_DEFAULT = true;
80  
81  }