Merge "Link DCAE MOD design tool to Acumos Adapter"
[dcaegen2/platform.git] / mod / bpgenerator / src / main / java / org / onap / blueprintgenerator / models / blueprint / DmaapObj.java
1 /**============LICENSE_START======================================================= 
2  org.onap.dcae 
3  ================================================================================ 
4  Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. 
5  ================================================================================ 
6  Licensed under the Apache License, Version 2.0 (the "License"); 
7  you may not use this file except in compliance with the License. 
8  You may obtain a copy of the License at 
9
10       http://www.apache.org/licenses/LICENSE-2.0 
11
12  Unless required by applicable law or agreed to in writing, software 
13  distributed under the License is distributed on an "AS IS" BASIS, 
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
15  See the License for the specific language governing permissions and 
16  limitations under the License. 
17  ============LICENSE_END========================================================= 
18
19  */
20
21 package org.onap.blueprintgenerator.models.blueprint;
22
23 import java.util.LinkedHashMap;
24 import java.util.TreeMap;
25
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonInclude.Include;
28
29 import lombok.Getter; import lombok.Setter;
30 @JsonInclude(value=Include.NON_NULL)
31 @Getter @Setter
32 public class DmaapObj {
33         private Object dmaap_info;
34         private String type;
35         private GetInput pass;
36         private GetInput user;
37
38         public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapMRObj(TreeMap<String, LinkedHashMap<String, Object>> inps,
39                                                                                                                                                            String config, char type, String n, String num, boolean isDmaap) {
40                 TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
41                 LinkedHashMap<String, Object> stringType = new LinkedHashMap();
42                 stringType.put("type", "string");
43                 retInputs = inps;
44
45                 //set the dmaapinfo
46                 DmaapInfo info = new DmaapInfo();
47                 if(!isDmaap){
48                         info.createOnapDmaapMRInfo(inps, config, type);
49                         this.setDmaap_info(info);
50                 }
51                 else{
52                         String infoType = "<<" + n + ">>";
53                         this.setDmaap_info(infoType);
54                         //set username
55                         GetInput u = new GetInput();
56                         u.setGet_input(config + "_" + num +"_aaf_username");
57                         this.setUser(u);
58                         retInputs.put(config + "_" + num +"_aaf_username", stringType);
59
60                         //set password
61                         GetInput p = new GetInput();
62                         p.setGet_input(config + "_" + num +"_aaf_password");
63                         this.setPass(p);
64                         retInputs.put(config + "_" + num +"_aaf_password", stringType);
65                 }
66                 return retInputs;
67         }
68         public TreeMap<String, LinkedHashMap<String, Object>> createOnapDmaapDRObj(TreeMap<String, LinkedHashMap<String, Object>> inps, String config, char type, String n, String num, boolean isDmaap) {
69                 TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
70                 retInputs = inps;
71                 
72                 //set the dmaapinfo
73                 DmaapInfo info = new DmaapInfo();
74                 if(!isDmaap){
75                         info.createOnapDmaapDRInfo(inps, config, type);
76                         this.setDmaap_info(info);
77                 }
78                 else {
79                         String infoType = "<<" + n + ">>";
80                         this.setDmaap_info(infoType);
81                 }
82                 return retInputs;
83         }
84 }