diff options
Diffstat (limited to 'components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller')
2 files changed, 28 insertions, 5 deletions
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java index 8d1bf316..41995e04 100644 --- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java +++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java @@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; +import java.util.ArrayList; /** * This controller manages kafka settings @@ -129,7 +130,17 @@ public class KafkaController { @GetMapping("") @ResponseBody - @ApiOperation(value="List all Kafkas") + @ApiOperation(value="List all Kafka id") + public List<Integer> list() { + Iterable<Kafka> ret = kafkaRepository.findAll(); + List<Integer> retString = new ArrayList<>(); + for (Kafka k : ret) + { + retString.add(k.getId()); + } + return retString; + } + public List<KafkaConfig> queryAllKafka(){ return kafkaService.getAllKafka(); } diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/TopicController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/TopicController.java index b59b2a7b..2500075b 100644 --- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/TopicController.java +++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/TopicController.java @@ -93,16 +93,28 @@ public class TopicController { return dmaapService.getTopics(); } + @GetMapping("/default") + @ResponseBody + @ApiOperation(value = "Get default topic configuration.") + public TopicConfig getDefaultConfig(HttpServletResponse response) throws IOException { + Topic topic = topicService.getDefaultTopicFromFeeder(); + if(topic == null) { + sendError(response, 404, "Topic not found"); + return null; + } + return topic.getTopicConfig(); + } + @GetMapping("") @ResponseBody - @ApiOperation(value="List all topic names in database") - public List<String> list() { + @ApiOperation(value="List all topic id in database") + public List<Integer> list() { Iterable<Topic> ret = topicRepository.findAll(); - List<String> retString = new ArrayList<>(); + List<Integer> retString = new ArrayList<>(); for(Topic item : ret) { if(!topicService.isDefaultTopic(item)) - retString.add(item.getName()); + retString.add(item.getId()); } return retString; } |