throws FormatException, IOException {
DcwColumnInfo dci[] = drf.getColumnInfo();
int rowlist[] = (int[]) request.getAttribute(ROWLIST_OBJECT);
ListElement rows = new ListElement();
WrapElement table = new WrapElement("table", "BORDER=1 ALIGN=CENTER", rows);
TableRowElement thr = generateHeader(request, response, dci);
rows.addElement(thr);
String row_show = request.getParameter(RowSelectParam);
boolean printall = RowSelectAll.equals(row_show);
boolean parseall = RowSelectTest.equals(row_show);
boolean schemaonly = RowSelectNone.equals(row_show);
String baseurl = request.getContextPath() + request.getServletPath()
+ request.getPathInfo();
String all = baseurl + "?" + RowSelectParam + "=" + RowSelectAll;
String none = baseurl + "?" + RowSelectParam + "=" + RowSelectNone;
String some = baseurl;
String test = baseurl + "?" + RowSelectParam + "=" + RowSelectTest;
String qstr = request.getQueryString();
if (rowlist != null) {
qstr = null;
}
if (qstr == null) {
qstr = VDTParam + "=ALL";
}
if (qstr.indexOf(VDTParam + "=") == -1) {
qstr += "&" + VDTParam + "=ALL";
}
String vdtlookup = baseurl + "?" + qstr;
response.getWriter().println("<H2>Table Data</H2>");
String redisplay = "Redisplay " + buildHREF(response, all, "All")
+ "\r\n|" + buildHREF(response, none, "None") + "\r\n|"
+ buildHREF(response, some, "Some") + "\r\n|"
+ buildHREF(response, test, "Test") + "\r\n|"
+ buildHREF(response, vdtlookup, "All VDT Columns") + "\r\n";
if (schemaonly) {
response.getWriter().println("Data Omitted: " + redisplay);
return;
}
RowMaker rm;
String basepath = getRootDir(request);
String joincol = request.getParameter(JoinColumnParam);
String jointable = request.getParameter(JoinOtherTableParam);
String jointablekey = request.getParameter(JoinOtherTableKeyParam);
if ((joincol != null) && (jointable != null)) {
String isTiledJoin = request.getParameter(IsTiledParam);
boolean isTiled = Boolean.valueOf(isTiledJoin).booleanValue();
if (Constants.ID.equals(jointablekey)) {
rm = new JoinRowMaker(drf, joincol, jointable, isTiled);
} else {
rm = new ComplexJoinRowMaker(drf, joincol, jointable, jointablekey, isTiled);
}
} else if (drf.getTableName().equals(Constants.charVDTTableName)
|| drf.getTableName().equals(Constants.intVDTTableName)) {
rm = new VDTRowMaker(request, response, basepath, drf);
} else if (drf.getTableName().equals("fcs")) {
rm = new FCSRowMaker(request, response, basepath, drf);
} else if (request.getParameter(VDTParam) != null) {
String subsetmarkup = request.getParameter(VDTParam);
String[] ss = null;
if (subsetmarkup != null) {
StringTokenizer st = new StringTokenizer(subsetmarkup, ",", false);
ss = new String[st.countTokens()];
for (int i = 0; i < ss.length; i++) {
ss[i] = st.nextToken();
if ("ALL".equals(ss[i])) {
ss = null; // null array gets all VDT lookups
break;
}
}
}
rm = new DetailRowMaker(drf, ss);
} else if (drf.getTableName().endsWith(".fit")) {
rm = new FITRowMaker(drf);
} else if (drf.getTableName().endsWith(".cft")
|| drf.getTableName().endsWith(".cjt")) {
rm = new ComplexFeatureJoinRowMaker(drf);
} else {
rm = new PlainRowMaker();
}
Iterator rowiter;
if (rowlist != null) {
rowiter = new TableSubsetRecordIterator(rowlist, drf);
} else if (printall) {
rowiter = new TableListIterator(drf);
} else if (parseall) {
rowiter = new TableTestParseIterator(drf);
} else {
rowiter = new TableSampleIterator(drf);
}
// response.getWriter().println("<hr>Tn = " +
// drf.getTableName() +
// "<hr>" + rm.getClass().getName() + " " +
// rowiter.getClass().getName() + "<hr>");
int rowcount = 0;
while (rowiter.hasNext()) {
if (rowcount++ >= 99) {
response.getWriter().println(redisplay);
table.generate(response.getWriter());
rows = new ListElement();
table = new WrapElement("table", "BORDER=1 ALIGN=CENTER", rows);
rows.addElement(new WrapElement("CAPTION", new StringElement("table data")));
rows.addElement(thr);
rowcount = 0;
}
rows.addElement(rm.generateRow((List) rowiter.next()));
}
rm.close();
response.getWriter().println(redisplay);
table.generate(response.getWriter());
}