html.append("</tr>");
}
SimpleDateFormat formatter =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
for (int i = 0; i < searchResults.size(); i++) {
ObjectFields f = searchResults.get(i);
if (xml) {
xmlBuf.append(" <objectFields>\n");
appendXML("pid", f.getPid(), xmlBuf);
appendXML("label", f.getLabel(), xmlBuf);
appendXML("state", f.getState(), xmlBuf);
appendXML("ownerId", f.getOwnerId(), xmlBuf);
appendXML("cDate", f.getCDate(), formatter, xmlBuf);
appendXML("mDate", f.getMDate(), formatter, xmlBuf);
appendXML("dcmDate", f.getDCMDate(), formatter, xmlBuf);
appendXML("title", f.titles(), xmlBuf);
appendXML("creator", f.creators(), xmlBuf);
appendXML("subject", f.subjects(), xmlBuf);
appendXML("description", f.descriptions(), xmlBuf);
appendXML("publisher", f.publishers(), xmlBuf);
appendXML("contributor", f.contributors(), xmlBuf);
appendXML("date", f.dates(), xmlBuf);
appendXML("type", f.types(), xmlBuf);
appendXML("format", f.formats(), xmlBuf);
appendXML("identifier", f.identifiers(), xmlBuf);
appendXML("source", f.sources(), xmlBuf);
appendXML("language", f.languages(), xmlBuf);
appendXML("relation", f.relations(), xmlBuf);
appendXML("coverage", f.coverages(), xmlBuf);
appendXML("rights", f.rights(), xmlBuf);
xmlBuf.append(" </objectFields>\n");
} else {
html.append("<tr>");
for (String l : fieldsArray) {
html.append("<td valign=\"top\">");
if (l.equalsIgnoreCase("pid")) {
html.append("<a href=\"objects/");
html.append(f.getPid().replace("%", "%25"));
html.append("\">");
html.append(f.getPid());
html.append("</a>");
} else if (l.equalsIgnoreCase("label")) {
if (f.getLabel() != null) {
html
.append(StreamUtility.enc(f
.getLabel()));
}
} else if (l.equalsIgnoreCase("state")) {
html.append(f.getState());
} else if (l.equalsIgnoreCase("ownerId")) {
if (f.getOwnerId() != null) {
html.append(f.getOwnerId());
}
} else if (l.equalsIgnoreCase("cDate")) {
html.append(formatter.format(f.getCDate()));
} else if (l.equalsIgnoreCase("mDate")) {
html.append(formatter.format(f.getMDate()));
} else if (l.equalsIgnoreCase("dcmDate")) {
if (f.getDCMDate() != null) {
html.append(formatter
.format(f.getDCMDate()));
}
} else if (l.equalsIgnoreCase("title")) {
html.append(getList(f.titles()));
} else if (l.equalsIgnoreCase("creator")) {
html.append(getList(f.creators()));
} else if (l.equalsIgnoreCase("subject")) {
html.append(getList(f.subjects()));
} else if (l.equalsIgnoreCase("description")) {
html.append(getList(f.descriptions()));
} else if (l.equalsIgnoreCase("publisher")) {
html.append(getList(f.publishers()));
} else if (l.equalsIgnoreCase("contributor")) {
html.append(getList(f.contributors()));
} else if (l.equalsIgnoreCase("date")) {
html.append(getList(f.dates()));
} else if (l.equalsIgnoreCase("type")) {
html.append(getList(f.types()));
} else if (l.equalsIgnoreCase("format")) {
html.append(getList(f.formats()));
} else if (l.equalsIgnoreCase("identifier")) {
html.append(getList(f.identifiers()));
} else if (l.equalsIgnoreCase("source")) {
html.append(getList(f.sources()));
} else if (l.equalsIgnoreCase("language")) {
html.append(getList(f.languages()));
} else if (l.equalsIgnoreCase("relation")) {
html.append(getList(f.relations()));
} else if (l.equalsIgnoreCase("coverage")) {
html.append(getList(f.coverages()));
} else if (l.equalsIgnoreCase("rights")) {
html.append(getList(f.rights()));
}
html.append("</td>");
}
html.append("</tr>");
html.append("<tr><td colspan=\"");