14c96a0b7e3500c7a26f56aa1160830f8bb5c8a7
[optf/cmso.git] /
1 /*******************************************************************************
2  *
3  * Copyright © 2019 AT&T Intellectual Property.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6  * in compliance with the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software distributed under the License
11  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12  * or implied. See the License for the specific language governing permissions and limitations under
13  * the License.
14  *
15  *
16  * Unless otherwise specified, all documentation contained herein is licensed under the Creative
17  * Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except
18  * in compliance with the License. You may obtain a copy of the License at
19  *
20  * https://creativecommons.org/licenses/by/4.0/
21  *
22  * Unless required by applicable law or agreed to in writing, documentation distributed under the
23  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
24  * express or implied. See the License for the specific language governing permissions and
25  * limitations under the License.
26  ******************************************************************************/
27
28 package org.onap.optf.cmso.optimizer.clients.topology.models;
29
30 import com.att.eelf.configuration.EELFLogger;
31 import com.att.eelf.configuration.EELFManager;
32 import com.fasterxml.jackson.core.JsonProcessingException;
33 import com.fasterxml.jackson.databind.ObjectMapper;
34 import io.swagger.annotations.ApiModel;
35 import io.swagger.annotations.ApiModelProperty;
36 import java.io.Serializable;
37 import java.util.ArrayList;
38 import java.util.List;
39 import org.onap.optf.cmso.optimizer.service.rs.models.NameValue;
40
41 @ApiModel(value = "Topology Element", description = "Element Information returned from TopologyRequuest.")
42 public class TopologyElementInfo implements Serializable {
43     private static final long serialVersionUID = 1L;
44     private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyElementInfo.class);
45
46     @ApiModelProperty(value = "Element identifier")
47     private String elementId;
48
49     @ApiModelProperty(value = "Location information for the element.")
50     private ElementLocation elementLocation;
51
52     @ApiModelProperty(value = "List of related elements required to be available to execute the chenge.")
53     private List<String> requiredElements;
54
55     @ApiModelProperty(value = "Lists of related elements that must be "
56                     + " available to avoid network outage while executing the change."
57                     + " Each set constraint elements")
58     private List<ConstraintElements> constraintElements = new ArrayList<>();
59
60     @ApiModelProperty(value = "Implementation specific element data.")
61     public List<NameValue> elementData = new ArrayList<>();
62
63     public String getElementId() {
64         return elementId;
65     }
66
67     public void setElementId(String elementId) {
68         this.elementId = elementId;
69     }
70
71     public ElementLocation getElementLocation() {
72         return elementLocation;
73     }
74
75     public void setElementLocation(ElementLocation elementLocation) {
76         this.elementLocation = elementLocation;
77     }
78
79     public List<String> getRequiredElements() {
80         return requiredElements;
81     }
82
83     public void setRequiredElements(List<String> requiredElements) {
84         this.requiredElements = requiredElements;
85     }
86
87     public List<NameValue> getElementData() {
88         return elementData;
89     }
90
91     public void setElementData(List<NameValue> elementData) {
92         this.elementData = elementData;
93     }
94
95     public List<ConstraintElements> getConstraintElements() {
96         return constraintElements;
97     }
98
99     public void setConstraintElements(List<ConstraintElements> constraintElements) {
100         this.constraintElements = constraintElements;
101     }
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 }