/** * List Tables * <p> * This method is called to populate the tables hashtable. It reads all tables that have a foreign constraint to core_patient, excluding those tables specified in the exclude tables section of the configuration file. * * @return 0 for or SUCCESS -1 for ERROR * </p> */ private int listTables() { tablesList = new MergeTableDetailsVoCollection(); // Get list of entities with foreign constraints to Patient Iterator it = Registry.getInstance().getConfiguration().getClassMappings(); while (it.hasNext()) { PersistentClass cls = (PersistentClass) it.next(); // If this is to be excluded, then continue if (pMergeConfig.isExcluded(cls.getClassName())) continue; Table tab = cls.getTable(); Iterator it3= tab.getForeignKeyIterator(); if (it3 != null) { while (it3.hasNext()) { ForeignKey key = (ForeignKey) it3.next(); if (key.getReferencedEntityName().equals(PATIENT_CLASS)) { MergeTableDetailsVo tableDet = new MergeTableDetailsVo(); tableDet.setTableName(tab.getName()); tableDet.setColumnName(((Column)key.getColumns().get(0)).getName()); tableDet.setEntityName(cls.getClassName()); tableDet.setAttributeName(getAttributeForTabCol(cls.getClassName(), tableDet.getColumnName())); tablesList.add(tableDet); } } } } localLogger.debug("Tables List for MERGE..."); for (int i=0; i<tablesList.size(); i++) { localLogger.debug("" + (i+1) + "Table:" + tablesList.get(i).getTableName() + " Col:" + tablesList.get(i).getColumnName() + " Entity:" + tablesList.get(i).getEntityName() + " Att:" + tablesList.get(i).getAttributeName()); } return tablesList.size(); }