/**
* 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.asset.publisher.web.internal.exportimport.portlet.preferences.processor;
import com.liferay.asset.kernel.model.AssetEntry;
import com.liferay.portal.kernel.template.TemplateHandler;
import com.liferay.portal.kernel.template.TemplateHandlerRegistryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.Validator;
import javax.portlet.PortletPreferences;
/**
* Provides utility methods used for the Asset Publisher's export and import
* capabilities.
*
* @author Mate Thurzo
*/
public class AssetPublisherExportImportPortletPreferencesProcessorUtil {
public static String getDisplayStyle(
PortletPreferences portletPreferences) {
try {
TemplateHandler templateHandler =
TemplateHandlerRegistryUtil.getTemplateHandler(
AssetEntry.class.getName());
if (Validator.isNotNull(templateHandler)) {
return portletPreferences.getValue("displayStyle", null);
}
}
catch (Exception e) {
}
return null;
}
public static long getDisplayStyleGroupId(
PortletPreferences portletPreferences) {
try {
TemplateHandler templateHandler =
TemplateHandlerRegistryUtil.getTemplateHandler(
AssetEntry.class.getName());
if (Validator.isNotNull(templateHandler)) {
return GetterUtil.getLong(
portletPreferences.getValue("displayStyleGroupId", null));
}
}
catch (Exception e) {
}
return 0;
}
}