001    /**
002     * Copyright (c) 2000-2010 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.portletconfiguration.util;
016    
017    import com.liferay.portal.model.PublicRenderParameter;
018    import com.liferay.portlet.PortletQNameUtil;
019    
020    /**
021     * @author Alberto Montero
022     */
023    public class PublicRenderParameterConfiguration {
024    
025            public static final String IGNORE_PREFIX = "lfr-prp-ignore-";
026    
027            public static final String MAPPING_PREFIX = "lfr-prp-mapping-";
028    
029            public static String getIgnoreKey(
030                    PublicRenderParameter publicRenderParameter) {
031    
032                    String publicRenderParameterName =
033                            PortletQNameUtil.getPublicRenderParameterName(
034                                    publicRenderParameter.getQName());
035    
036                    return IGNORE_PREFIX.concat(publicRenderParameterName);
037            }
038    
039            public static String getMappingKey(
040                    PublicRenderParameter publicRenderParameter) {
041    
042                    String publicRenderParameterName =
043                            PortletQNameUtil.getPublicRenderParameterName(
044                                    publicRenderParameter.getQName());
045    
046                    return MAPPING_PREFIX.concat(publicRenderParameterName);
047            }
048    
049            public PublicRenderParameterConfiguration(
050                    PublicRenderParameter publicRenderParameter, String mappingValue,
051                    boolean ignoreValue) {
052    
053                    _publicRenderParameter = publicRenderParameter;
054                    _publicRenderParameterName =
055                            PortletQNameUtil.getPublicRenderParameterName(
056                                    publicRenderParameter.getQName());
057                    _mappingValue = mappingValue;
058                    _ignoreValue = ignoreValue;
059            }
060    
061            public String getIgnoreKey() {
062                    return IGNORE_PREFIX.concat(_publicRenderParameterName);
063            }
064    
065            public boolean getIgnoreValue() {
066                    return _ignoreValue;
067            }
068    
069            public String getMappingKey() {
070                    return MAPPING_PREFIX.concat(_publicRenderParameterName);
071            }
072    
073            public String getMappingValue() {
074                    return _mappingValue;
075            }
076    
077            public PublicRenderParameter getPublicRenderParameter() {
078                    return _publicRenderParameter;
079            }
080    
081            public String getPublicRenderParameterName() {
082                    return _publicRenderParameterName;
083            }
084    
085            private boolean _ignoreValue;
086            private String _mappingValue;
087            private PublicRenderParameter _publicRenderParameter;
088            private String _publicRenderParameterName;
089    
090    }