/** * Encodes an action statement in string form. This method will * take care of escaping any illegal characters in function parameter values. * * @param actionName The name of the action. * @param parameters The function's parameters. This is a Map<String,String> * where the keys are parameter names, and the values are parameter values * @return An encoded touchpoint instruction statement */ public static String encodeAction(String actionName, Map<String, String> parameters) { StringBuffer result = new StringBuffer(actionName); result.append('('); boolean first = true; for (Entry<String, String> entry : parameters.entrySet()) { if (first) first = false; else result.append(','); result.append(entry.getKey()); result.append(':'); appendEncoded(result, entry.getValue()); } result.append(')').append(';'); return result.toString(); }