@VisibleForTesting
void checkGroupDeletions() {
final String METHOD = "checkGroupDeletions";
LOGGER.entering(CLASS_NAME, METHOD);
NotesView groupView = null;
ArrayList<Long> groupsToDelete = new ArrayList<Long>();
Statement stmt = null;
try {
groupView = directoryDatabase.getView(NCCONST.DIRVIEW_VIMGROUPS);
groupView.refresh();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(
"select groupid,groupname,pseudogroup from " + groupTableName);
while (rs.next()) {
long groupId;
String groupName;
boolean pseudoGroup = false;
try {
groupId = rs.getLong(1);
groupName = rs.getString(2);
pseudoGroup = rs.getBoolean(3);
} catch (SQLException e) {
LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD,
"Failure reading group table data", e);
continue;
}
if (pseudoGroup) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.logp(Level.FINEST, CLASS_NAME, METHOD,
"Skipping deletion check for pseudo-group: " + groupName);
}
continue;
}
try {
if (Util.isCanonical(groupName)) {
NotesName notesGroupName = notesSession.createName(groupName);
groupName = notesGroupName.getAbbreviated();
}
NotesDocument notesGroupDoc = groupView.getDocumentByKey(groupName);
if (notesGroupDoc == null) {
// This group no longer exists.
LOGGER.logp(Level.INFO, CLASS_NAME, METHOD,
"Group no longer exists in source directory"
+ " and will be deleted: " + groupName);