summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java25
-rw-r--r--components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java4
2 files changed, 16 insertions, 13 deletions
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java
index c7ccff2b..6d43300d 100644
--- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java
+++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/DbController.java
@@ -84,17 +84,20 @@ public class DbController {
return retString;
}
- @GetMapping("/list/")
- @ResponseBody
- @ApiOperation(value="Get all databases by encrypt")
- public List<DbConfig> dblistByEncrypt(@RequestParam boolean encrypt) throws IOException {
- Iterable<Db> ret = dbRepository.findByEncrypt(encrypt);
- List<DbConfig> retDbConfig = new ArrayList<>();
- for(Db db : ret) {
- retDbConfig.add(db.getDbConfig());
- }
- return retDbConfig;
- }
+ @GetMapping("/list")
+ @ResponseBody
+ @ApiOperation(value="Get all dbs by tool")
+ public List<DbConfig> dblistByTool(@RequestParam boolean tool) {
+ log.info("Search dbs by tool start......");
+ Iterable<DbType> dbType = dbTypeRepository.findByTool(tool);
+ List<DbConfig> retDbConfig = new ArrayList<>();
+ for (DbType item : dbType) {
+ for (Db d : item.getDbs()) {
+ retDbConfig.add(d.getDbConfig());
+ }
+ }
+ return retDbConfig;
+ }
@GetMapping("/idAndName/{id}")
@ResponseBody
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java
index b93cb1d1..3b8a5f94 100644
--- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java
+++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/repository/DbTypeRepository.java
@@ -30,6 +30,6 @@ import org.springframework.data.repository.CrudRepository;
*/
public interface DbTypeRepository extends CrudRepository<DbType, String> {
-
-
+
+ Iterable<DbType> findByTool(boolean tool);
}