package org.madore.damlengine; import java.util.HashSet; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; public final class WeblogSelect { private WeblogSelect() { // Forbid instantiation throw new AssertionError("WeblogSelect cannot be instantiated"); } public static void main(String[] args) throws Exception { String year = "2011"; String month = "08"; final Connection conn = WeblogDatabaseConnection.getConnection(); final PreparedStatement selSt = conn.prepareStatement("SELECT id , content FROM entries WHERE edate LIKE ? ORDER BY id DESC"); selSt.setString(1,year+"-"+month+"-__"); final ResultSet selRes = selSt.executeQuery(); final Context.WeblogSelectionContext wsc = new Context.WeblogMonthSelectionContext(year,month); wsc.sel = new HashSet(); wsc.xmlData = new ArrayList(); while ( selRes.next() ) { int id = selRes.getInt(1); String content = selRes.getString(2); wsc.sel.add(new Integer(id)); wsc.xmlData.add(content); } DamlEngine.fullProcess(DamlEngine.class.getResourceAsStream("weblog-month-template.daml"), System.out, wsc); } }