logger.log(logger.MEDIUM, query.lastError().toString());
}
}
// Get a list of notes that need to be updated
public List <Notebook> getDirty() {
Notebook tempNotebook;
List<Notebook> index = new ArrayList<Notebook>();
boolean check;
NSqlQuery query = new NSqlQuery(db.getConnection());
check = query.exec("Select guid, sequence, name, defaultNotebook, " +
"serviceCreated, serviceUpdated, published, stack, "+
"publishinguri, publishingascending, publishingPublicDescription, "+
"publishingOrder " +
"from "+dbName+" where isDirty=true and local=false and linked=false");
if (!check)
logger.log(logger.EXTREME, dbName+" SQL retrieve has failed.");
while (query.next()) {
tempNotebook = new Notebook();
tempNotebook.setGuid(query.valueString(0));
int sequence = new Integer(query.valueString(1)).intValue();
tempNotebook.setUpdateSequenceNum(sequence);
tempNotebook.setName(query.valueString(2));
DateFormat indfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
try {
tempNotebook.setServiceCreated(indfm.parse(query.valueString(4)).getTime());
tempNotebook.setServiceUpdated(indfm.parse(query.valueString(5)).getTime());
} catch (ParseException e) {
e.printStackTrace();
}
tempNotebook.setPublished(new Boolean(query.valueString(6)));
if (query.valueString(7) != null && !query.valueString(7).trim().equals(""))
tempNotebook.setStack(query.valueString(7));
if (tempNotebook.isPublished()) {
Publishing p = new Publishing();
p.setUri(query.valueString(8));
p.setAscending(query.valueBoolean(9, false));
p.setPublicDescription(query.valueString(10));
p.setOrder(NoteSortOrder.findByValue(query.valueInteger(11)));
if (p.getPublicDescription() != null && p.getPublicDescription().trim().equalsIgnoreCase(""))
p.setPublicDescription(null);
tempNotebook.setPublishing(p);
}
index.add(tempNotebook);
}
return index;