X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod%2Fbpgenerator%2Fonap%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fblueprintgenerator%2Fservice%2FInfoService.java;h=70ba5047659ec7d78261cab07725df903f79e672;hb=72c2d38329865afa6692454b4fb90ab6f8a70638;hp=fed3707b0ac3bbc53b3d90242edbd2ed2d6f5564;hpb=55dcf3197958c76b1622a0c26489e68fe77e0314;p=dcaegen2%2Fplatform.git diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java index fed3707..70ba504 100644 --- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java +++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java @@ -4,6 +4,7 @@ * * org.onap.dcae * * ================================================================================ * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. + * * Copyright (c) 2021 Nokia. All rights reserved. * * ================================================================================ * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. @@ -35,32 +36,37 @@ import java.util.Map; /** * @author : Ravi Mantena - * @date 10/16/2020 - * Application: ONAP - Blueprint Generator - * Service to create Message Router and Data Router Information + * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create Message Router and + * Data Router Information */ - @Service public class InfoService { @Autowired private BlueprintHelperService blueprintHelperService; - // Method to create info for Message Router - public Map createMessageRouterInfo(Map> inputs, String config, char type) { - - Map response = new HashMap<>(); + /** + * Creates info for Message Router + * + * @param inputs Inputs + * @param config Config + * @param type BP Type + * @return + */ + public Map createMessageRouterInfo( + Map> inputs, String config, char type) { + + Map response = new HashMap<>(); Info info = new Info(); - LinkedHashMap stringType = new LinkedHashMap<>(); + Map stringType = new LinkedHashMap<>(); stringType.put("type", "string"); config = config.replaceAll("-", "_"); - if(type == 'p') { + if (type == 'p') { config = config + "_publish_url"; - } - else if(type == 's') { - config = config+ "_subscribe_url"; + } else if (type == 's') { + config = config + "_subscribe_url"; } GetInput topic = new GetInput(); @@ -74,13 +80,20 @@ public class InfoService { return response; } - // Method to create info for Data Router - public Map createDataRouterInfo(Map> inputs, String config) { - - Map response = new HashMap<>(); + /** + * Creates info for Data Router + * + * @param inputs Inputs + * @param config Config + * @return + */ + public Map createDataRouterInfo( + Map> inputs, String config) { + + Map response = new HashMap<>(); Info info = new Info(); - LinkedHashMap stringType = new LinkedHashMap<>(); + Map stringType = new LinkedHashMap<>(); stringType.put("type", "string"); String userNameInputName = blueprintHelperService.joinUnderscore(config, "username"); @@ -98,12 +111,14 @@ public class InfoService { info.setLocation(location); inputs.put(userlocationInputName, stringType); - String userdeliveryUrlInputName = blueprintHelperService.joinUnderscore(config, "delivery_url"); + String userdeliveryUrlInputName = blueprintHelperService + .joinUnderscore(config, "delivery_url"); GetInput deliveryUrl = new GetInput(userdeliveryUrlInputName); info.setDelivery_url(deliveryUrl); inputs.put(userdeliveryUrlInputName, stringType); - String usersubscriberIDInputName = blueprintHelperService.joinUnderscore(config, "subscriber_id"); + String usersubscriberIDInputName = + blueprintHelperService.joinUnderscore(config, "subscriber_id"); GetInput subscriberID = new GetInput(usersubscriberIDInputName); info.setSubscriber_id(subscriberID); inputs.put(usersubscriberIDInputName, stringType); @@ -112,5 +127,4 @@ public class InfoService { response.put("inputs", inputs); return response; } - }