e0e95f710b0618d53fab5eb778b8d305df30565f
[optf/cmso.git] /
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  *
14  *
15  * Unless otherwise specified, all documentation contained herein is licensed under the Creative
16  * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
17  * in compliance with the License. You may obtain a copy of the License at
18  *
19  * https://creativecommons.org/licenses/by/4.0/
20  *
21  * Unless required by applicable law or agreed to in writing, documentation distributed under the
22  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
23  * express or implied. See the License for the specific language governing permissions and
24  * limitations under the License.
25  */
26
27 package org.onap.optf.cmso.optimizer.clients.topology.models;
28
29 import com.att.eelf.configuration.EELFLogger;
30 import com.att.eelf.configuration.EELFManager;
31 import com.fasterxml.jackson.core.JsonProcessingException;
32 import com.fasterxml.jackson.databind.ObjectMapper;
33 import io.swagger.annotations.ApiModel;
34 import io.swagger.annotations.ApiModelProperty;
35 import java.io.Serializable;
36 import java.util.ArrayList;
37 import java.util.List;
38 import org.onap.optf.cmso.optimizer.service.rs.models.NameValue;
39
40 @ApiModel(value = "Topology Request",
41                 description = "Request to retrieve topology information for the provided elements.")
42 public class TopologyRequest implements Serializable {
43     private static final long serialVersionUID = 1L;
44     private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyRequest.class);
45
46     @ApiModelProperty(value = "Unique Id of the request")
47     private String requestId;
48
49     @ApiModelProperty(value = "Implementation specific name value pairs.")
50     private List<NameValue> commonData;
51
52     @ApiModelProperty(value = "List of the elements for which topology information is requested.")
53     private List<ElementCriteria> elements = new ArrayList<>();
54
55     @ApiModelProperty(value = "List of the policies to control topology retrieve.")
56     private List<TopologyPolicyInfo> policies = new ArrayList<>();
57
58     public String getRequestId() {
59         return requestId;
60     }
61
62
63     public void setRequestId(String requestId) {
64         this.requestId = requestId;
65     }
66
67
68     public List<NameValue> getCommonData() {
69         return commonData;
70     }
71
72
73     public void setCommonData(List<NameValue> commonData) {
74         this.commonData = commonData;
75     }
76
77
78     public List<ElementCriteria> getElements() {
79         return elements;
80     }
81
82
83     public void setElements(List<ElementCriteria> elements) {
84         this.elements = elements;
85     }
86
87
88     public List<TopologyPolicyInfo> getPolicies() {
89         return policies;
90     }
91
92
93     public void setPolicies(List<TopologyPolicyInfo> policies) {
94         this.policies = policies;
95     }
96
97
98     /**
99      * To string.
100      *
101      * @return the string
102      */
103     @Override
104     public String toString() {
105         ObjectMapper mapper = new ObjectMapper();
106         try {
107             return mapper.writeValueAsString(this);
108         } catch (JsonProcessingException e) {
109             log.debug("Error in toString()", e);
110         }
111         return "";
112     }
113
114 }