FileDocCategorySizeDatePackage
SimpleExample.javaAPI DocExample2533Wed May 18 09:39:02 BST 2005com.discursive.jccook.script.velocity.simple

SimpleExample

public class SimpleExample extends Object
Include a table of the Values in DateFormatUtils

Fields Summary
private static Logger
logger
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] pArgs)

     
        LogInit.init();
    
        SimpleExample velocityTest = new SimpleExample();
        velocityTest.testSimpleTemplate();
        velocityTest.testSubscription();
    
public voidtestSimpleTemplate()


        Velocity.init();
        VelocityContext context = new VelocityContext();
        context.put("subscription", testSubscription());
        StringWriter writer = new StringWriter();
        Reader reader =
            new InputStreamReader(getClass().getResourceAsStream("renew.vm"));
        Velocity.evaluate(context, writer, "test", reader);

        logger.debug("renew: " + writer.toString());
    
private SubscriptiontestSubscription()

        // Create Dummy Subscription
        Subscription sub = new Subscription();
        sub.setEndDate("July 23, 2005");

        Customer cust = new Customer();
        cust.setId("AD352CFF");
        cust.setFirstName("Tony");
        sub.setCustomer(cust);

        Magazine mag = new Magazine();
        mag.setTitle("Scientific American");
        mag.setBaseUrl("http://www.sciam.com");
        sub.setMagazine(mag);

        return sub;