summaryrefslogtreecommitdiffstats
path: root/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
diff options
context:
space:
mode:
authorRavi Mantena <rx908f@att.com>2020-12-21 11:31:55 -0500
committerRavi Mantena <rx908f@att.com>2020-12-21 11:32:34 -0500
commita520d00e005db1b232b9dae0c70d4dc5d73b33e1 (patch)
tree9c0e16ce5fab9bc12da138c4d8c613bcff54516b /mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
parent2f551ba584dbb70568a69144b39e6da7c55c517f (diff)
BpGen refactor Code Quality Issue-ID: DCAEGEN2-2502
Issue-ID: DCAEGEN2-2502 Change-Id: If6e08f0bb88c9039fb27898d50d2645f79175ba4 Signed-off-by: Ravi Mantena <rx908f@att.com>
Diffstat (limited to 'mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java')
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java51
1 files changed, 32 insertions, 19 deletions
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..66f71da 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
@@ -35,32 +35,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<String,Object> createMessageRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config, char type) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates info for Message Router
+ *
+ * @param inputs Inputs
+ * @param config Config
+ * @param type BP Type
+ * @return
+ */
+ public Map<String, Object> createMessageRouterInfo(
+ Map<String, LinkedHashMap<String, Object>> inputs, String config, char type) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
LinkedHashMap<String, Object> 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,10 +79,17 @@ public class InfoService {
return response;
}
- // Method to create info for Data Router
- public Map<String,Object> createDataRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates info for Data Router
+ *
+ * @param inputs Inputs
+ * @param config Config
+ * @return
+ */
+ public Map<String, Object> createDataRouterInfo(
+ Map<String, LinkedHashMap<String, Object>> inputs, String config) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
@@ -98,12 +110,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 +126,4 @@ public class InfoService {
response.put("inputs", inputs);
return response;
}
-
}