FileDocCategorySizeDatePackage
MailExample.javaAPI DocExample3893Wed May 18 09:39:02 BST 2005com.discursive.jccook.script.velocity.macro

MailExample

public class MailExample 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();
    
        MailExample velocityTest = new MailExample();
        velocityTest.testSimpleTemplate();
        velocityTest.testAppointment();
    
private AppointmenttestAppointment()


        // Create Dummy Appointment
        Appointment appt = new Appointment();
        appt.setId("A3D54");
        appt.setStartTime("9 AM");
        appt.setEndTime("2 PM");
        appt.setDate("9/13/03");

        // Create Dummy Organization
        Organization org = new Organization();
        org.setId("5DD2");
        org.setBaseUrl("http://www.organize.com/");
        org.setEmail("scheduling@organize.com");

        Person orgPres = new Person();
        orgPres.setFirstName("Brishen");
        orgPres.setLastName("R.");
        orgPres.setEmailAddress("brishenr@organize.com");
        org.setPresident(orgPres);

        Address orgAddr = new Address();
        orgAddr.setStreet1("201 N. 2nd Street");
        orgAddr.setStreet2("Suite 201");
        orgAddr.setCity("Jersey City");
        orgAddr.setState("NJ");
        orgAddr.setZipcode("20232");
        org.setAddress(orgAddr);

        appt.setOrganization(org);

        // Create a Dummy Volunteer
        Person volunteer = new Person();
        volunteer.setEmailAddress("johns@space.com");
        volunteer.setFirstName("John");
        volunteer.setLastName("S.");

        appt.setVolunteer(volunteer);

        // Create a Dummy Location
        Location location = new Location();
        location.setId("FD1B");
        location.setName("Boston Homeless Veterans Shelter");

        Address locAddr = new Address();
        locAddr.setStreet1("14 Court Street");
        locAddr.setStreet2("Apt. #2E");
        locAddr.setCity("Boston");
        locAddr.setState("MA");
        locAddr.setZipcode("01102");
        location.setAddress(locAddr);

        appt.setLocation(location);

        return appt;
    
public voidtestSimpleTemplate()


        VelocityEngine vEngine = new VelocityEngine();
        vEngine.init();
        VelocityContext context = new VelocityContext();
        context.put("appointment", testAppointment());
        StringWriter writer = new StringWriter();
        Reader reader =
            new InputStreamReader(
                getClass().getResourceAsStream("organize.vm"));
        vEngine.evaluate(context, writer, "test", reader);

        logger.debug("organize: " + writer.toString());