return success;
}
private boolean cleanupReferences() {
MappingModule mm;
DcModule pm;
DcModule cm;
String sql;
ResultSet rs;
int count;
for (DcModule module : DcModules.getAllModules()) {
if (module.getType() == DcModule._TYPE_MAPPING_MODULE) {
try {
mm = (MappingModule) module;
pm = DcModules.get(mm.getParentModIdx());
cm = DcModules.get(mm.getReferencedModIdx());
sql = "select count(*) as INVALIDENTRIES from " + mm.getTableName() + " where objectid not in " +
"(select id from " + pm.getTableName() + ") or referencedid not in " +
"(select id from " + cm.getTableName() + ")";
rs = DatabaseManager.executeSQL(sql);
rs.next();
count = rs.getInt(1);
rs.close();
if (count > 0) {
logger.info("Cleaning " + mm.getTableName() + " of " + count + " ghost record(s).");
sql = "delete from " + mm.getTableName() + " where objectid not in " +
"(select id from " + pm.getTableName() + ") or referencedid not in " +
"(select id from " + cm.getTableName() + ")";
rs = DatabaseManager.executeSQL(sql);