3 * * ============LICENSE_START=======================================================
5 * * ================================================================================
6 * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7 * * Copyright (c) 2021 Nokia. All rights reserved.
8 * * ================================================================================
9 * * Licensed under the Apache License, Version 2.0 (the "License");
10 * * you may not use this file except in compliance with the License.
11 * * You may obtain a copy of the License at
13 * * http://www.apache.org/licenses/LICENSE-2.0
15 * * Unless required by applicable law or agreed to in writing, software
16 * * distributed under the License is distributed on an "AS IS" BASIS,
17 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * * See the License for the specific language governing permissions and
19 * * limitations under the License.
20 * * ============LICENSE_END=========================================================
25 package org.onap.blueprintgenerator.service.common;
27 import org.onap.blueprintgenerator.model.common.Dmaap;
28 import org.onap.blueprintgenerator.model.common.GetInput;
29 import org.onap.blueprintgenerator.service.InfoService;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.stereotype.Service;
33 import java.util.HashMap;
34 import java.util.LinkedHashMap;
38 * @author : Ravi Mantena
39 * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add DMAAP Message
43 public class DmaapService {
46 private InfoService infoService;
49 * Creates Dmaap Message Router from given inputs
51 * @param inputs Input Arguments
52 * @param config Configuration
54 * @param counter Counter
55 * @param num Number Incrementor
56 * @param isDmaap Dmaap Argument
59 public Map<String, Object> createDmaapMessageRouter(
60 Map<String, Map<String, Object>> inputs,
67 Map<String, Object> response = new HashMap<>();
68 Dmaap dmaap = new Dmaap();
70 LinkedHashMap<String, Object> stringType = new LinkedHashMap();
71 stringType.put("type", "string");
74 Map<String, Object> infoResponse = infoService
75 .createMessageRouterInfo(inputs, config, type);
76 inputs = (Map<String, Map<String, Object>>) infoResponse.get("inputs");
77 dmaap.setDmaap_info(infoResponse.get("info"));
79 String infoType = "<<" + counter + ">>";
80 dmaap.setDmaap_info(infoType);
82 GetInput u = new GetInput();
83 u.setBpInputName(config + "_" + num + "_aaf_username");
85 inputs.put(config + "_" + num + "_aaf_username", stringType);
87 GetInput p = new GetInput();
88 p.setBpInputName(config + "_" + num + "_aaf_password");
90 inputs.put(config + "_" + num + "_aaf_password", stringType);
92 response.put("dmaap", dmaap);
93 response.put("inputs", inputs);
98 * Creates Dmaap Data Router from given inputs
100 * @param inputs Input Arguments
101 * @param config Configuration
102 * @param counter Counter
103 * @param isDmaap Dmaap Argument
106 public Map<String, Object> createDmaapDataRouter(
107 Map<String, Map<String, Object>> inputs,
112 Map<String, Object> response = new HashMap<>();
113 Dmaap dmaap = new Dmaap();
116 Map<String, Object> infoResponse = infoService.createDataRouterInfo(inputs, config);
117 inputs = (Map<String, Map<String, Object>>) infoResponse.get("inputs");
118 dmaap.setDmaap_info(infoResponse.get("info"));
120 String infoType = "<<" + counter + ">>";
121 dmaap.setDmaap_info(infoType);
123 response.put("dmaap", dmaap);
124 response.put("inputs", inputs);