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