001    /**
002     * Copyright (c) 2000-2013 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.documentlibrary.lar;
016    
017    import com.liferay.portal.kernel.lar.DataLevel;
018    import com.liferay.portal.kernel.lar.PortletDataContext;
019    import com.liferay.portal.kernel.lar.PortletDataHandlerControl;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.util.PropsValues;
022    
023    import javax.portlet.PortletPreferences;
024    
025    /**
026     * @author Raymond Aug??
027     */
028    public class DLDisplayPortletDataHandler extends DLPortletDataHandler {
029    
030            public DLDisplayPortletDataHandler() {
031                    setDataLevel(DataLevel.PORTLET_INSTANCE);
032                    setDataPortletPreferences("rootFolderId");
033                    setExportControls(new PortletDataHandlerControl[0]);
034                    setPublishToLiveByDefault(PropsValues.DL_PUBLISH_TO_LIVE_BY_DEFAULT);
035            }
036    
037            @Override
038            protected PortletPreferences doDeleteData(
039                            PortletDataContext portletDataContext, String portletId,
040                            PortletPreferences portletPreferences)
041                    throws Exception {
042    
043                    if (portletPreferences == null) {
044                            return portletPreferences;
045                    }
046    
047                    portletPreferences.setValue("enable-comment-ratings", StringPool.BLANK);
048                    portletPreferences.setValue("fileEntriesPerPage", StringPool.BLANK);
049                    portletPreferences.setValue("fileEntryColumns", StringPool.BLANK);
050                    portletPreferences.setValue("folderColumns", StringPool.BLANK);
051                    portletPreferences.setValue("foldersPerPage", StringPool.BLANK);
052                    portletPreferences.setValue("rootFolderId", StringPool.BLANK);
053                    portletPreferences.setValue("showFoldersSearch", StringPool.BLANK);
054                    portletPreferences.setValue("showSubfolders", StringPool.BLANK);
055    
056                    return portletPreferences;
057            }
058    
059    }