9266758070d0d80e4167a162f42ee40989323cfe
[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 = "Supported Policy Information", description = "Policy Information returned from get policies API.")
42 public class TopologyPolicyInfo implements Serializable {
43     private static final long serialVersionUID = 1L;
44     private static EELFLogger log = EELFManager.getInstance().getLogger(TopologyPolicyInfo.class);
45
46     @ApiModelProperty(value = "Policy name")
47     private String policyName;
48
49     @ApiModelProperty(value = "Policy description")
50     private String policyDescription;
51
52     @ApiModelProperty(value = "Named values to modify/override policy attributes.")
53     public List<NameValue> policyModifiers = new ArrayList<>();
54
55     public String getPolicyName() {
56         return policyName;
57     }
58
59     public void setPolicyName(String policyName) {
60         this.policyName = policyName;
61     }
62
63     public String getPolicyDescription() {
64         return policyDescription;
65     }
66
67     public void setPolicyDescription(String policyDescription) {
68         this.policyDescription = policyDescription;
69     }
70
71     public List<NameValue> getPolicyModifiers() {
72         return policyModifiers;
73     }
74
75     public void setPolicyModifiers(List<NameValue> policyModifiers) {
76         this.policyModifiers = policyModifiers;
77     }
78
79     @Override
80     public String toString() {
81         ObjectMapper mapper = new ObjectMapper();
82         try {
83             return mapper.writeValueAsString(this);
84         } catch (JsonProcessingException e) {
85             log.debug("Error in toString()", e);
86         }
87         return "";
88     }
89 }