diff options
author | Guobiao Mo <guobiaomo@chinamobile.com> | 2020-01-21 16:46:38 -0800 |
---|---|---|
committer | Ekko Chang <ekko.chang@qct.io> | 2020-01-22 01:26:30 +0000 |
commit | 5d81682e5bbaa28c4dd8258fb530a775d4f7b5e2 (patch) | |
tree | daa58bb0268fa32d8ad37a7b99b3e2f35ed6c57b /components/datalake-handler/feeder/src | |
parent | 678c78c5c47bf836cef69a25345d766bf7fb3091 (diff) |
Add a method to retrieve DB type list
Issue-ID: DCAEGEN2-1877
Change-Id: I8eae95aba59a7f5dcbd6df2928b78a82c3235e49
Signed-off-by: Guobiao Mo <guobiaomo@chinamobile.com>
Diffstat (limited to 'components/datalake-handler/feeder/src')
2 files changed, 14 insertions, 1 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 058d4ca9..fc709360 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 @@ -258,6 +258,15 @@ public class DbController { } + //get db type list + @GetMapping("/dbtypes") + @ResponseBody + @ApiOperation(value="Get a list of all db types.") + public Iterable<DbType> getDbTypes(HttpServletResponse response) throws IOException { + log.info("Get a list of all db types ......"); + Iterable<DbType> dbTypes = dbTypeRepository.findAll(); + return dbTypes; + } @PostMapping("/verify") @ResponseBody diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/domain/DbType.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/domain/DbType.java index 9c83a9cd..700ce8cb 100644 --- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/domain/DbType.java +++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/domain/DbType.java @@ -29,6 +29,9 @@ import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; + +import com.fasterxml.jackson.annotation.JsonBackReference; + import lombok.Getter; import lombok.Setter; @@ -56,7 +59,8 @@ public class DbType { @Column(name="`tool`", nullable = false) private boolean tool; - + + @JsonBackReference @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dbType") protected Set<Db> dbs = new HashSet<>(); |