private void populateCageMap() {
        try {
            ResultSet cagesRs = query.getCages();
            while (cagesRs.next()) {
                Cage cage = extractCageData(cagesRs);

                cages.put(cage.getId(), cage);
                ResultSet entranceRs = query2.getEntrances(cage.getId());

                while (entranceRs.next()) {
                    Entrance entrance = new Entrance(entranceRs.getInt("id"));
                    cage.getEntrances().put(entrance.getId(), entrance);
                    ResultSet doorsRs = query3.getDoors(entrance.getId());
                    while (doorsRs.next()) {
                        Door door = new Door(doorsRs.getInt("id"));
                        switch (doorsRs.getString("open")) {
                            case "true":
                                door.open();
                                break;
                            case "false":
                                door.close();
                                break;
                        }
                        switch (doorsRs.getString("locked")) {
                            case "true":
                                door.lock();
                                break;
                            case "false":
                                door.unlock();
                                break;
                        }
                        entrance.getDoors().put(door.getId(), door);
                    }
                }
            }
        } catch (SQLException ex) {
            System.out.println(ex);
        }
    }