}
if (end != null) {
query = query.concat(" AND (v.creationDate < :createdBefore)");
}
Session session = sessionFactory_.openSession();
final long startTime = System.currentTimeMillis();
try{
session.beginTransaction();
Query dbQuery = session.createSQLQuery(query);
dbQuery.setBoolean("resAdminAction", resourceAdminAction);
dbQuery.setString("resId", Long.toString(resourceableId));
if (begin != null) {
dbQuery.setDate("createdAfter", begin);
}
if (end != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(end);
cal.add(Calendar.DAY_OF_MONTH, 1);
end = cal.getTime();
dbQuery.setDate("createdBefore", end);
}
dbQuery.setString("outFile", outFile.getAbsolutePath());
dbQuery.scroll();
} catch(RuntimeException e) {
e.printStackTrace(System.out);
} catch(Error er) {
er.printStackTrace(System.out);
} finally {
if (session!=null) {
session.close();
}
final long diff = System.currentTimeMillis() - startTime;
log_.info("exportCourseLog: END DURATION="+diff+", outFile="+outFile+", charSet="+charSet+", resourceableId="+resourceableId+", begin="+begin+", end="+end+", resourceAdminAction="+resourceAdminAction+", anonymize="+anonymize);
}
}