001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }