* * 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.
/**
* @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, Map<String, Object>> inputs, String config, char type) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
+ Map<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();
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, Map<String, Object>> inputs, String config) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
- LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
+ Map<String, Object> stringType = new LinkedHashMap<>();
stringType.put("type", "string");
String userNameInputName = blueprintHelperService.joinUnderscore(config, "username");
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);
response.put("inputs", inputs);
return response;
}
-
}