try {
session = sessionManager.getSession(docbase);
if (checkpoint.getInsertIndex() == -1) {
logger.fine("Processing Acls");
IQuery queryAclToAdd = buildACLQuery(checkpoint);
collecAclToAdd = queryAclToAdd.execute(session,
IQuery.EXECUTE_READ_QUERY);
logger.fine("execution of the query returns a collection of ACLs"
+ " to add");
IQuery queryAclToModify = buildAclModifyQuery(checkpoint);
collecAclToModify = queryAclToModify.execute(session,
IQuery.EXECUTE_READ_QUERY);
logger.fine("execution of the query returns a collection of ACLs"
+ " to modify");
if ((collecAclToAdd != null && collecAclToAdd.hasNext())
|| (collecAclToModify != null && collecAclToModify.hasNext())) {
documentList = new DctmAclList(this, session, collecAclToAdd,
collecAclToModify, checkpoint);
}
} else {
logger.fine("Processing Documents");
IQuery query = buildAddQuery(checkpoint);
collecToAdd = query.execute(session, IQuery.EXECUTE_READ_QUERY);
logger.fine("execution of the query returns a collection of documents"
+ " to add");
// Only execute the delete query with one of the add queries.
// TODO: We could treat the delete query as a peer of the others,
// and include it in the sequence.
if (checkpoint.getInsertIndex() == 0) {
IQuery queryDocToDel = buildDelQuery(checkpoint);
collecToDel = queryDocToDel.execute(session,
IQuery.EXECUTE_READ_QUERY);
logger.fine("execution of the query returns a collection of " +
"documents to delete");
}