public String expandQueryVariables(String query, Map<String, Object> params) { if (params != null && params.size() > 0) { TextTemplate tmpl = new TextTemplate(); for (String key : params.keySet()) { Object val = params.get(key); if (val == null) { continue; } else if (val instanceof Calendar) { tmpl.setVariable(key, Long.toString(((Calendar) val).getTime().getTime())); } else if (val instanceof Date) { tmpl.setVariable(key, Long.toString(((Date) val).getTime())); } else { tmpl.setVariable(key, val.toString()); } } query = tmpl.processText(query); } return query; }
ttProps.put(PARAM_DB_USER, dbUser); ttProps.put(PARAM_DB_PWD, dbPassword); TextTemplate tt = new TextTemplate(ttProps); String url = tt.processText(connectionUrl); Properties conProps = new Properties();
final TextTemplate templateParser = new TextTemplate(config); templateParser.setKeepEncryptedAsVar(true); templateParser.setTrim(true);
/** * Read the classpath parameter from the template and expand parameters with their value. It allow classpath of the * form ${nuxeo.home}/nxserver/bundles/... * * @param template The name of the template */ // VisibleForTesting String getClasspathForTemplate(String template) { String classPath = configurationGenerator.getUserConfig().getProperty(template + PARAM_CHECK_CLASSPATH_SUFFIX); TextTemplate templateParser = new TextTemplate(configurationGenerator.getUserConfig()); return templateParser.processText(classPath); }
ttProps.put(PARAM_DB_USER, dbUser); ttProps.put(PARAM_DB_PWD, dbPassword); TextTemplate tt = new TextTemplate(ttProps); String url = tt.processText(connectionUrl); Properties conProps = new Properties();