/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.document.library.web.lar; import com.liferay.document.library.web.constants.DLPortletKeys; import com.liferay.exportimport.kernel.lar.BasePortletDataHandler; import com.liferay.exportimport.kernel.lar.DataLevel; import com.liferay.exportimport.kernel.lar.PortletDataContext; import com.liferay.exportimport.kernel.lar.PortletDataHandler; import com.liferay.exportimport.kernel.lar.PortletDataHandlerControl; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.util.PropsValues; import javax.portlet.PortletPreferences; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; /** * @author Raymond Augé */ @Component( property = {"javax.portlet.name=" + DLPortletKeys.MEDIA_GALLERY_DISPLAY}, service = PortletDataHandler.class ) public class IGDisplayPortletDataHandler extends BasePortletDataHandler { public static final String SCHEMA_VERSION = "1.0.0"; @Override public String getSchemaVersion() { return SCHEMA_VERSION; } @Activate protected void activate() { setDataLevel(DataLevel.PORTLET_INSTANCE); setDataPortletPreferences("rootFolderId"); setExportControls(new PortletDataHandlerControl[0]); setPublishToLiveByDefault(PropsValues.DL_PUBLISH_TO_LIVE_BY_DEFAULT); } @Override protected PortletPreferences doDeleteData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { if (portletPreferences == null) { return portletPreferences; } portletPreferences.setValue("enable-comment-ratings", StringPool.BLANK); portletPreferences.setValue("fileEntriesPerPage", StringPool.BLANK); portletPreferences.setValue("fileEntryColumns", StringPool.BLANK); portletPreferences.setValue("folderColumns", StringPool.BLANK); portletPreferences.setValue("foldersPerPage", StringPool.BLANK); portletPreferences.setValue("rootFolderId", StringPool.BLANK); portletPreferences.setValue("showFoldersSearch", StringPool.BLANK); portletPreferences.setValue("showSubfolders", StringPool.BLANK); return portletPreferences; } }