mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-09 05:48:20 +00:00
More 'dbAdmin' renaming
This commit is contained in:
parent
4d34595186
commit
1fbd337c22
@ -76,7 +76,7 @@ public class DataExportController {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(DataExportFormat.class);
|
private static final Logger logger = LoggerFactory.getLogger(DataExportFormat.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdmin dbAdmin;
|
private SnapAdmin snapAdmin;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdminRepository repository;
|
private SnapAdminRepository repository;
|
||||||
@ -131,7 +131,7 @@ public class DataExportController {
|
|||||||
@RequestParam MultiValueMap<String, String> otherParams) {
|
@RequestParam MultiValueMap<String, String> otherParams) {
|
||||||
if (raw == null) raw = false;
|
if (raw == null) raw = false;
|
||||||
|
|
||||||
DbObjectSchema schema = dbAdmin.findSchemaByClassName(className);
|
DbObjectSchema schema = snapAdmin.findSchemaByClassName(className);
|
||||||
|
|
||||||
if (!schema.isExportEnabled()) {
|
if (!schema.isExportEnabled()) {
|
||||||
throw new SnapAdminException("Export is not enabled for this table: " + schema.getTableName());
|
throw new SnapAdminException("Export is not enabled for this table: " + schema.getTableName());
|
||||||
|
@ -53,7 +53,7 @@ public class FileDownloadController {
|
|||||||
private SnapAdminRepository repository;
|
private SnapAdminRepository repository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdmin dbAdmin;
|
private SnapAdmin snapAdmin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +68,7 @@ public class FileDownloadController {
|
|||||||
public ResponseEntity<byte[]> serveImage(@PathVariable String className,
|
public ResponseEntity<byte[]> serveImage(@PathVariable String className,
|
||||||
@PathVariable String fieldName, @PathVariable String id) {
|
@PathVariable String fieldName, @PathVariable String id) {
|
||||||
|
|
||||||
DbObjectSchema schema = dbAdmin.findSchemaByClassName(className);
|
DbObjectSchema schema = snapAdmin.findSchemaByClassName(className);
|
||||||
|
|
||||||
Optional<DbObject> object = repository.findById(schema, id);
|
Optional<DbObject> object = repository.findById(schema, id);
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class FileDownloadController {
|
|||||||
public ResponseEntity<byte[]> serveFile(@PathVariable String className,
|
public ResponseEntity<byte[]> serveFile(@PathVariable String className,
|
||||||
@PathVariable String fieldName, @PathVariable String id) {
|
@PathVariable String fieldName, @PathVariable String id) {
|
||||||
|
|
||||||
DbObjectSchema schema = dbAdmin.findSchemaByClassName(className);
|
DbObjectSchema schema = snapAdmin.findSchemaByClassName(className);
|
||||||
|
|
||||||
Optional<DbObject> object = repository.findById(schema, id);
|
Optional<DbObject> object = repository.findById(schema, id);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class GlobalController {
|
|||||||
private UserConfiguration userConf;
|
private UserConfiguration userConf;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdmin dbAdmin;
|
private SnapAdmin snapAdmin;
|
||||||
|
|
||||||
@ExceptionHandler(SnapAdminException.class)
|
@ExceptionHandler(SnapAdminException.class)
|
||||||
public String handleException(Exception e, Model model, HttpServletResponse response) {
|
public String handleException(Exception e, Model model, HttpServletResponse response) {
|
||||||
@ -58,7 +58,7 @@ public class GlobalController {
|
|||||||
model.addAttribute("message", e.getMessage());
|
model.addAttribute("message", e.getMessage());
|
||||||
model.addAttribute("snapadmin_userConf", userConf);
|
model.addAttribute("snapadmin_userConf", userConf);
|
||||||
model.addAttribute("snapadmin_baseUrl", getBaseUrl());
|
model.addAttribute("snapadmin_baseUrl", getBaseUrl());
|
||||||
model.addAttribute("snapadmin_version", dbAdmin.getVersion());
|
model.addAttribute("snapadmin_version", snapAdmin.getVersion());
|
||||||
model.addAttribute("snapadmin_properties", props);
|
model.addAttribute("snapadmin_properties", props);
|
||||||
return "other/error";
|
return "other/error";
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ public class GlobalController {
|
|||||||
model.addAttribute("message", e.getMessage());
|
model.addAttribute("message", e.getMessage());
|
||||||
model.addAttribute("snapadmin_userConf", userConf);
|
model.addAttribute("snapadmin_userConf", userConf);
|
||||||
model.addAttribute("snapadmin_baseUrl", getBaseUrl());
|
model.addAttribute("snapadmin_baseUrl", getBaseUrl());
|
||||||
model.addAttribute("snapadmin_version", dbAdmin.getVersion());
|
model.addAttribute("snapadmin_version", snapAdmin.getVersion());
|
||||||
model.addAttribute("snapadmin_properties", props);
|
model.addAttribute("snapadmin_properties", props);
|
||||||
response.setStatus(404);
|
response.setStatus(404);
|
||||||
return "other/error";
|
return "other/error";
|
||||||
@ -78,7 +78,7 @@ public class GlobalController {
|
|||||||
|
|
||||||
@ModelAttribute("snapadmin_version")
|
@ModelAttribute("snapadmin_version")
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return dbAdmin.getVersion();
|
return snapAdmin.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,7 +128,7 @@ public class GlobalController {
|
|||||||
|
|
||||||
@ModelAttribute("snapadmin_authenticated")
|
@ModelAttribute("snapadmin_authenticated")
|
||||||
public boolean isAuthenticated() {
|
public boolean isAuthenticated() {
|
||||||
return dbAdmin.isAuthenticated();
|
return snapAdmin.isAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ import tech.ailef.snapadmin.external.dto.AutocompleteSearchResult;
|
|||||||
@RequestMapping(value= {"/${snapadmin.baseUrl}/api/autocomplete", "/${snapadmin.baseUrl}/api/autocomplete/"})
|
@RequestMapping(value= {"/${snapadmin.baseUrl}/api/autocomplete", "/${snapadmin.baseUrl}/api/autocomplete/"})
|
||||||
public class AutocompleteController {
|
public class AutocompleteController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdmin dbAdmin;
|
private SnapAdmin snapAdmin;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdminRepository repository;
|
private SnapAdminRepository repository;
|
||||||
@ -55,7 +55,7 @@ public class AutocompleteController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/{className}")
|
@GetMapping("/{className}")
|
||||||
public ResponseEntity<?> autocomplete(@PathVariable String className, @RequestParam String query) {
|
public ResponseEntity<?> autocomplete(@PathVariable String className, @RequestParam String query) {
|
||||||
DbObjectSchema schema = dbAdmin.findSchemaByClassName(className);
|
DbObjectSchema schema = snapAdmin.findSchemaByClassName(className);
|
||||||
|
|
||||||
List<AutocompleteSearchResult> search = repository.search(schema, query)
|
List<AutocompleteSearchResult> search = repository.search(schema, query)
|
||||||
.stream().map(x -> new AutocompleteSearchResult(x))
|
.stream().map(x -> new AutocompleteSearchResult(x))
|
||||||
|
@ -66,7 +66,7 @@ public class SnapAdminRepository {
|
|||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SnapAdmin dbAdmin;
|
private SnapAdmin snapAdmin;
|
||||||
|
|
||||||
public SnapAdminRepository() {
|
public SnapAdminRepository() {
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ public class SnapAdminRepository {
|
|||||||
Object o = rs.getObject(i + 1);
|
Object o = rs.getObject(i + 1);
|
||||||
String columnName = metaData.getColumnName(i + 1);
|
String columnName = metaData.getColumnName(i + 1);
|
||||||
String tableName = metaData.getTableName(i + 1);
|
String tableName = metaData.getTableName(i + 1);
|
||||||
DbQueryOutputField field = new DbQueryOutputField(columnName, tableName, dbAdmin);
|
DbQueryOutputField field = new DbQueryOutputField(columnName, tableName, snapAdmin);
|
||||||
|
|
||||||
result.put(field, o);
|
result.put(field, o);
|
||||||
}
|
}
|
||||||
|
@ -39,12 +39,12 @@ public class DbQueryOutputField {
|
|||||||
|
|
||||||
private DbQueryResultRow result;
|
private DbQueryResultRow result;
|
||||||
|
|
||||||
public DbQueryOutputField(String name, String table, SnapAdmin dbAdmin) {
|
public DbQueryOutputField(String name, String table, SnapAdmin snapAdmin) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.table = table;
|
this.table = table;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DbObjectSchema schema = dbAdmin.findSchemaByTableName(table);
|
DbObjectSchema schema = snapAdmin.findSchemaByTableName(table);
|
||||||
DbField dbField = schema.getFieldByName(name);
|
DbField dbField = schema.getFieldByName(name);
|
||||||
this.dbField = dbField;
|
this.dbField = dbField;
|
||||||
} catch (SnapAdminException e) {
|
} catch (SnapAdminException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user