summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhangZihao <zhangzihao@chinamobile.com>2019-11-19 10:58:53 +0800
committerZhangZihao <zhangzihao@chinamobile.com>2019-11-19 10:59:07 +0800
commit65adde9f52c04c21dbf0f99ff9b81b0478e2a768 (patch)
tree9bdd7add423d70ce27c269eb7f3a11176ad01017
parentf5c092d00691458060c24b37d2e09d5816001f88 (diff)
db by tool
Change-Id: Ice7559bf89b79a1cf284eb94e23140406d97b0df Issue-ID: DCAEGEN2-1877 Signed-off-by: ZhangZihao <zhangzihao@chinamobile.com>
-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);
}