/** * Returns a view action property This method will try to replace template parameters "{param}" * with query parameters if available * * @param ctx interaction context * @param property action property * @return property value */ public static String getViewActionProperty(InteractionContext ctx, String property) { String prop = null; if (ctx.getCurrentState().getViewAction() != null) { Properties properties = ctx.getCurrentState().getViewAction().getProperties(); if (properties != null && properties.containsKey(property)) { // Get the specified action property prop = getActionProperty(property, properties, ctx.getQueryParameters()); // Fill in template parameters if (prop != null) { Matcher m = parameterPattern.matcher(prop); while (m.find()) { String templateParam = m.group(1); // e.g. code if (ctx.getQueryParameters().containsKey(templateParam)) { prop = prop.replaceAll( "\\{" + templateParam + "\\}", ctx.getQueryParameters().getFirst(templateParam)); } else if (ctx.getPathParameters().containsKey(templateParam)) { prop = prop.replaceAll( "\\{" + templateParam + "\\}", ctx.getPathParameters().getFirst(templateParam)); } } } } } return prop != null && !prop.equals(property) ? prop : null; }