All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.confluence.utils.MacroParametersUtils Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.confluence.utils;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.atlassian.renderer.v2.components.HtmlEscaper;

/**
 * 

MacroParametersUtils class.

* * @author oaouattara * @version $Id: $Id */ public class MacroParametersUtils { /** *

extractParameter.

* * @param name a {@link java.lang.String} object. * @param parameters a {@link java.util.Map} object. * @return a {@link java.lang.String} object. */ public static String extractParameter(String name, Map parameters) { Object value = parameters.get(name); return (value != null) ? xssEscape(value.toString()) : ""; } private static String xssEscape(String value) { return HtmlEscaper.escapeAll(value, true); } /** *

extractParameterMultiple.

* * @param name a {@link java.lang.String} object. * @param parameters a {@link java.util.Map} object. * @return an array of {@link java.lang.String} objects. */ public static String[] extractParameterMultiple(String name, Map parameters) { String paramValues = extractParameter(name, parameters); return StringUtils.stripAll(StringUtils.split(paramValues, ", ")); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy