public void addTableUsedByProgram( TargetModule otherModule, Program otherProgram, Program myProgram, Table commonTable) { boolean exists = false; Iterator<TableUsedByProgram> iterator = this.tablesUsedByProgram.iterator(); while (iterator.hasNext()) { TableUsedByProgram tableUsedByProgram = iterator.next(); if (tableUsedByProgram.otherModuleName.equals(otherModule.getName()) && tableUsedByProgram.otherProgramName.equals(otherProgram.getName()) && tableUsedByProgram.myProgramName.equals(myProgram.getName()) && tableUsedByProgram.commonTableName.equals(commonTable.getName())) { exists = true; break; } } // end of loop around the module tables if (!exists) { TableUsedByProgram tableUsed = new TableUsedByProgram(); tableUsed.otherModuleName = otherModule.getName(); tableUsed.otherProgramName = otherProgram.getName(); tableUsed.commonTableName = commonTable.getName(); tableUsed.myProgramName = myProgram.getName(); tablesUsedByProgram.add(tableUsed); } }
public void signalMatchingData(Program program, Table programTable, TargetModule module) { System.out.printf( "Program=%s uses %s module.table=%s.%s for %s \n", program.getPgmNameAndType(), module.getType(), module.getName(), programTable.getName(), program.getCRUDforTable(programTable)); }
private int AdaptScore(int nrOfCommonTables, TargetModule targetModule) { if (nrOfCommonTables != 0) { if (targetModule.getName().toUpperCase().contains("TECHNICAL_KERNEL") || (targetModule.getName().toUpperCase().contains("MDM_MANAGEMENT")) || (targetModule.getName().toUpperCase().contains("UNUSED"))) { return nrOfCommonTables; } else if (targetModule.getName().toUpperCase().contains("ACCOUNT_MANAGEMENT")) { return nrOfCommonTables + 5; } else { return nrOfCommonTables + 10; } } return nrOfCommonTables; }
public void signalTableUsageAcrossModules( TargetModule module, Program program, Table table, boolean external, boolean tocsv, boolean toStdOut) { try { { String usageType; if (external) { usageType = "external"; } else { usageType = "internal"; } if (toStdOut) { System.out.printf( "%s module.program=%s.%s uses %s %s module.table=%s.%s for %s \n", module.getType(), module.getName(), program.getPgmNameAndType(), usageType, table.getAssignedModule().getType(), table.getAssignedModule().getName(), table.getName(), program.getCRUDforTable(table)); } // Output to csv-file as well if (tocsv) { String module4NameProgram; String module4nameTable; String newUsageType; module4NameProgram = getModule4Name(module.getName()); module4nameTable = getModule4Name(table.getAssignedModule().getName()); if (module4NameProgram.equals(module4nameTable)) { newUsageType = usageType.concat("_equal_M4"); } else { newUsageType = usageType; } String line = module.getType() + ";module;program;" + getModule4Name(module.getName()) + ";" + module.getName() + ";" + program.getName() + ";" + program.getPgmType() + ";uses;" + table.getAssignedModule().getType() + ";" + newUsageType + ";module;table;" + getModule4Name(table.getAssignedModule().getName()) + ";" + table.getAssignedModule().getName() + ";" + table.getName() + ";for;" + program.getCRUDforTable(table); CSVWriter writer = new CSVWriter(); writer.writeLineToFile(Constants.CSV_USED, line); } } } catch (Exception e) { // Catch exception if any System.out.printf("Error to place table %s in a module \n", table.getName()); } }