} else {
dbRowValues[6] = "" + dcmd.DSCreateDT.getTime();
}
if (dcmd != null && m_indexDCFields) {
InputStream in = dcmd.getContentStream();
DCFields dc = new DCFields(in);
dbRowValues[7] = getDbValue(dc.titles());
dbRowValues[8] = getDbValue(dc.creators());
dbRowValues[9] = getDbValue(dc.subjects());
dbRowValues[10] = getDbValue(dc.descriptions());
dbRowValues[11] = getDbValue(dc.publishers());
dbRowValues[12] = getDbValue(dc.contributors());
dbRowValues[13] = getDbValue(dc.dates());
// delete any dc.dates that survive from earlier versions
st = conn.prepareStatement("DELETE FROM dcDates WHERE pid=?");
st.setString(1, pid);
st.executeUpdate();
// get any dc.dates strings that are formed such that they
// can be treated as a timestamp
List<Date> wellFormedDates = null;
for (int i = 0; i < dc.dates().size(); i++) {
if (i == 0) {
wellFormedDates = new ArrayList<Date>();
}
Date p = DateUtility.parseDateLoose(dc.dates().get(i).getValue());
if (p != null) {
wellFormedDates.add(p);
}
}
if (wellFormedDates != null && wellFormedDates.size() > 0) {
// found at least one valid date, so add them.
for (int i = 0; i < wellFormedDates.size(); i++) {
Date dt = wellFormedDates.get(i);
String query =
"INSERT INTO dcDates (pid, dcDate) values (?, ?)";
st = conn.prepareStatement(query);
st.setString(1, pid);
st.setLong(2, dt.getTime());
st.executeUpdate();
}
}
dbRowValues[14] = getDbValue(dc.types());
dbRowValues[15] = getDbValue(dc.formats());
dbRowValues[16] = getDbValue(dc.identifiers());
dbRowValues[17] = getDbValue(dc.sources());
dbRowValues[18] = getDbValue(dc.languages());
dbRowValues[19] = getDbValue(dc.relations());
dbRowValues[20] = getDbValue(dc.coverages());
dbRowValues[21] = getDbValue(dc.rights());
logger.debug("Formulating SQL and inserting/updating WITH DC...");
SQLUtility.replaceInto(conn,
"doFields",
DB_COLUMN_NAMES,
dbRowValues,