25
25
package com.github.mgramin.sqlboot.rest.controllers
26
26
27
27
import com.github.mgramin.sqlboot.exceptions.BootException
28
- import com.github.mgramin.sqlboot.model.connection.DbConnectionList
28
+ import com.github.mgramin.sqlboot.model.connection.EndpointList
29
29
import com.github.mgramin.sqlboot.model.dialect.DbDialectList
30
30
import com.github.mgramin.sqlboot.model.resourcetype.impl.FsResourceType
31
31
import com.github.mgramin.sqlboot.model.uri.Uri
@@ -57,7 +57,7 @@ import javax.servlet.http.HttpServletRequest
57
57
class ApiController {
58
58
59
59
@Autowired
60
- private lateinit var dbConnectionList : DbConnectionList
60
+ private lateinit var endpointList : EndpointList
61
61
62
62
@Autowired
63
63
private lateinit var dbDialectList: DbDialectList
@@ -66,7 +66,7 @@ class ApiController {
66
66
@RequestMapping(value = [" /api/{connectionName}/types" ])
67
67
fun types (@PathVariable connectionName : String ): String {
68
68
val jsonArray = JsonArray ()
69
- FsResourceType (dbConnectionList .getConnectionsByMask(connectionName), emptyList())
69
+ FsResourceType (endpointList .getConnectionsByMask(connectionName), emptyList())
70
70
.resourceTypes()
71
71
.forEach { jsonArray.add(it.toJson()) }
72
72
return jsonArray.toString()
@@ -75,7 +75,7 @@ class ApiController {
75
75
@RequestMapping(value = [" /api/{connectionName}/types/{typeMask}" ])
76
76
fun typesByMask (@PathVariable connectionName : String , @PathVariable typeMask : String ): String {
77
77
val jsonArray = JsonArray ()
78
- FsResourceType (dbConnectionList .getConnectionsByMask(connectionName), emptyList())
78
+ FsResourceType (endpointList .getConnectionsByMask(connectionName), emptyList())
79
79
.resourceTypes()
80
80
.filter { it.name().matches(wildcardToRegex(typeMask)) }
81
81
.forEach { jsonArray.add(it.toJson()) }
@@ -91,7 +91,7 @@ class ApiController {
91
91
val jsonArray = JsonArray ()
92
92
val uri = SqlPlaceholdersWrapper (
93
93
DbUri (" $connection /$type " ))
94
- FsResourceType (listOf (dbConnectionList .getConnectionByName(uri.connection())), emptyList())
94
+ FsResourceType (listOf (endpointList .getConnectionByName(uri.connection())), emptyList())
95
95
.resourceTypes()
96
96
.asSequence()
97
97
.filter { v -> v.name().equals(uri.type(), ignoreCase = true ) }
@@ -109,7 +109,7 @@ class ApiController {
109
109
val jsonArray = JsonArray ()
110
110
val uri = SqlPlaceholdersWrapper (
111
111
DbUri (" $connection /$type /$path " ))
112
- FsResourceType (listOf (dbConnectionList .getConnectionByName(uri.connection())), emptyList())
112
+ FsResourceType (listOf (endpointList .getConnectionByName(uri.connection())), emptyList())
113
113
.resourceTypes()
114
114
.asSequence()
115
115
.filter { v -> v.name().equals(uri.type(), ignoreCase = true ) }
@@ -134,7 +134,7 @@ class ApiController {
134
134
getListResponseEntityHeaders(SqlPlaceholdersWrapper (DbUri (" $connection /$type /$path " )))
135
135
136
136
private fun getListResponseEntityHeaders (uri : Uri ): ResponseEntity <List <Map <String , Any >>> {
137
- val connections = dbConnectionList .getConnectionsByMask(uri.connection())
137
+ val connections = endpointList .getConnectionsByMask(uri.connection())
138
138
try {
139
139
val headers = FsResourceType (connections, dbDialectList.dialects)
140
140
.read(uri)
0 commit comments