3 * * ============LICENSE_START=======================================================
5 * * ================================================================================
6 * * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
7 * * ================================================================================
8 * * Licensed under the Apache License, Version 2.0 (the "License");
9 * * you may not use this file except in compliance with the License.
10 * * You may obtain a copy of the License at
12 * * http://www.apache.org/licenses/LICENSE-2.0
14 * * Unless required by applicable law or agreed to in writing, software
15 * * distributed under the License is distributed on an "AS IS" BASIS,
16 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * * See the License for the specific language governing permissions and
18 * * limitations under the License.
19 * * ============LICENSE_END=========================================================
24 package org.onap.blueprintgenerator.service.common;
26 import org.onap.blueprintgenerator.model.common.Dmaap;
27 import org.onap.blueprintgenerator.model.common.GetInput;
28 import org.onap.blueprintgenerator.service.InfoService;
29 import org.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.stereotype.Service;
32 import java.util.HashMap;
33 import java.util.LinkedHashMap;
37 * @author : Ravi Mantena
38 * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add DMAAP Message
42 public class DmaapService {
45 private InfoService infoService;
48 * Creates Dmaap Message Router from given inputs
50 * @param inputs Input Arguments
51 * @param config Configuration
53 * @param counter Counter
54 * @param num Number Incrementor
55 * @param isDmaap Dmaap Argument
58 public Map<String, Object> createDmaapMessageRouter(
59 Map<String, LinkedHashMap<String, Object>> inputs,
66 Map<String, Object> response = new HashMap<>();
67 Dmaap dmaap = new Dmaap();
69 LinkedHashMap<String, Object> stringType = new LinkedHashMap();
70 stringType.put("type", "string");
73 Map<String, Object> infoResponse = infoService
74 .createMessageRouterInfo(inputs, config, type);
75 inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
76 dmaap.setDmaap_info(infoResponse.get("info"));
78 String infoType = "<<" + counter + ">>";
79 dmaap.setDmaap_info(infoType);
81 GetInput u = new GetInput();
82 u.setBpInputName(config + "_" + num + "_aaf_username");
84 inputs.put(config + "_" + num + "_aaf_username", stringType);
86 GetInput p = new GetInput();
87 p.setBpInputName(config + "_" + num + "_aaf_password");
89 inputs.put(config + "_" + num + "_aaf_password", stringType);
91 response.put("dmaap", dmaap);
92 response.put("inputs", inputs);
97 * Creates Dmaap Data Router from given inputs
99 * @param inputs Input Arguments
100 * @param config Configuration
101 * @param counter Counter
102 * @param isDmaap Dmaap Argument
105 public Map<String, Object> createDmaapDataRouter(
106 Map<String, LinkedHashMap<String, Object>> inputs,
111 Map<String, Object> response = new HashMap<>();
112 Dmaap dmaap = new Dmaap();
115 Map<String, Object> infoResponse = infoService.createDataRouterInfo(inputs, config);
116 inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
117 dmaap.setDmaap_info(infoResponse.get("info"));
119 String infoType = "<<" + counter + ">>";
120 dmaap.setDmaap_info(infoType);
122 response.put("dmaap", dmaap);
123 response.put("inputs", inputs);