private void addRelationship(String tableName, String target, String field, Rules rules) { Map rel = map( "filename", tableName, "name", rules.relTypeFor(field), "from", createRelationshipNode(tableName, field, rules), "to", createRelationshipNode(target, field, rules)); relationships.add(rel); }
private void addRelationship(TableInfo table, Rules rules) { if (table.fks.isEmpty()) return; String tableName = table.table; List<Map.Entry<List<String>, String>> fks = new ArrayList<>(table.fks.entrySet()); // todo multi-key Map.Entry<List<String>, String> from = fks.get(0); Map.Entry<List<String>, String> to = fks.get(1); Map rel = map( "filename", tableName, "name", rules.relTypeFor(tableName), "from", createRelationshipNode(from.getValue(), from.getKey().get(0), rules), "to", createRelationshipNode(to.getValue(), to.getKey().get(0), rules)); relationships.add(rel); }