Search in sources :

Example 1 with STGroupDir

use of org.stringtemplate.v4.STGroupDir in project uPortal by Jasig.

the class EmailPasswordResetNotificationImpl method formatBody.

/**
     * Get the body content of the email.
     *
     * @param resetUrl the password reset URL
     * @param account the user account that has had its password reset
     * @param locale the locale of the user who reset the password
     * @return The message body as a string.
     */
private String formatBody(URL resetUrl, ILocalAccountPerson account, Locale locale) {
    final STGroup group = new STGroupDir(templateDir, '$', '$');
    final ST template = group.getInstanceOf(templateName);
    String name = findDisplayNameFromLocalAccountPerson(account);
    template.add("displayName", name);
    template.add("url", resetUrl.toString());
    return template.render();
}
Also used : ST(org.stringtemplate.v4.ST) STGroupDir(org.stringtemplate.v4.STGroupDir) STGroup(org.stringtemplate.v4.STGroup)

Example 2 with STGroupDir

use of org.stringtemplate.v4.STGroupDir in project bndtools by bndtools.

the class STTests method test.

@Test
public void test() {
    STGroupDir group = new STGroupDir("testdata/stuff", '$', '$');
    ST st = group.getInstanceOf("foo");
    st.add("name", "Neil");
    System.out.println(st.render());
}
Also used : ST(org.stringtemplate.v4.ST) STGroupDir(org.stringtemplate.v4.STGroupDir) Test(org.junit.Test)

Aggregations

ST (org.stringtemplate.v4.ST)2 STGroupDir (org.stringtemplate.v4.STGroupDir)2 Test (org.junit.Test)1 STGroup (org.stringtemplate.v4.STGroup)1