@RequestMapping( value = {"/dbs/{id}"}, method = RequestMethod.GET) @ResponseBody public List<Database> dbs(@PathVariable(value = "id") Integer serverId) { DatabaseInfo dbInfo = serverService.getDatabaseInfo(serverId); if (dbInfo != null) { return dbInfo.getDatabase(); } return new ArrayList<Database>(); }
private ModelAndView editView(Backup backup) { ModelAndView mview = getModelView("edit_backup"); List<Breadcrumb> bds = new ArrayList<Breadcrumb>(); bds.add(new Breadcrumb("Hosts")); bds.add(new Breadcrumb("Backups", "backups/list")); mview.addObject("breadcrumbs", bds); mview.addObject("backup", backup); mview.addObject("servers", serverService.list()); if (backup.getServerId() != null) { DatabaseInfo dbInfo = serverService.getDatabaseInfo(backup.getServerId()); if (dbInfo != null) { mview.addObject("dbs", dbInfo.getDatabase()); } else { List<Database> dbs = new ArrayList<Database>(); mview.addObject("dbs", dbs); } } else { List<Database> dbs = new ArrayList<Database>(); mview.addObject("dbs", dbs); } if (backup.getId() != null && backup.getId() > 0) { mview.addObject("title", "Edit Backup"); mview.addObject("description", "test"); bds.add(new Breadcrumb("Edit Backup", "backups/edit/" + backup.getId())); } else { mview.addObject("title", "New Backup"); mview.addObject("description", "test"); bds.add(new Breadcrumb("New Backup", "backups/new")); } mview.addObject("dumpFormats", DumpFormat.values()); setupView(mview); return mview; }