7dd8f7a7041d8d26f14d42839a23993661882af3
[so/adapters/so-cnf-adapter.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2021 Samsung Electronics Co. Ltd. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.adapters.cnf.service.aai;
22
23 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
24 import com.fasterxml.jackson.annotation.JsonInclude;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.google.common.base.Objects;
27
28 import java.util.Collections;
29 import java.util.List;
30
31 @JsonInclude(JsonInclude.Include.NON_NULL)
32 @JsonIgnoreProperties(ignoreUnknown = true)
33 public class KubernetesResource {
34     private String id;
35     private String name;
36     private String group;
37     private String version;
38     private String kind;
39     private String namespace;
40     private List<String> labels;
41     private String selflink;
42     @JsonProperty("data-owner")
43     private String dataOwner;
44     @JsonProperty("data-source")
45     private String dataSource;
46     @JsonProperty("data-source-version")
47     private String dataSourceVersion;
48     @JsonProperty("resource-version")
49     private String resourceVersion;
50
51     public String getId() {
52         return id;
53     }
54
55     public void setId(String id) {
56         this.id = id;
57     }
58
59     public String getName() {
60         return name;
61     }
62
63     public void setName(String name) {
64         this.name = name;
65     }
66
67     public String getGroup() {
68         return group;
69     }
70
71     public void setGroup(String group) {
72         this.group = group;
73     }
74
75     public String getVersion() {
76         return version;
77     }
78
79     public void setVersion(String version) {
80         this.version = version;
81     }
82
83     public String getKind() {
84         return kind;
85     }
86
87     public void setKind(String kind) {
88         this.kind = kind;
89     }
90
91     public String getNamespace() {
92         return namespace;
93     }
94
95     public void setNamespace(String namespace) {
96         this.namespace = namespace;
97     }
98
99     public List<String> getLabels() {
100         return labels;
101     }
102
103     public void setLabels(List<String> labels) {
104         if (labels != null)
105             Collections.sort(labels);
106         this.labels = labels;
107     }
108
109     public String getSelflink() { return selflink; }
110
111     public void setSelflink(String selflink) { this.selflink = selflink; }
112
113     public String getDataOwner() {
114         return dataOwner;
115     }
116
117     public void setDataOwner(String dataOwner) {
118         this.dataOwner = dataOwner;
119     }
120
121     public String getDataSource() {
122         return dataSource;
123     }
124
125     public void setDataSource(String dataSource) {
126         this.dataSource = dataSource;
127     }
128
129     public String getDataSourceVersion() {
130         return dataSourceVersion;
131     }
132
133     public void setDataSourceVersion(String dataSourceVersion) {
134         this.dataSourceVersion = dataSourceVersion;
135     }
136
137     public String getResourceVersion() {
138         return resourceVersion;
139     }
140
141     public void setResourceVersion(String resourceVersion) {
142         this.resourceVersion = resourceVersion;
143     }
144
145     public boolean compare(KubernetesResource reference) {
146         boolean result = reference != null &&
147                 Objects.equal(id, reference.id) &&
148                 Objects.equal(name, reference.name) &&
149                 Objects.equal(version, reference.version) &&
150                 Objects.equal(kind, reference.kind) &&
151                 Objects.equal(group, reference.group) &&
152                 Objects.equal(namespace, reference.namespace) &&
153                 Objects.equal(dataOwner, reference.dataOwner) &&
154                 Objects.equal(dataSource, reference.dataSource) &&
155                 Objects.equal(dataSourceVersion, reference.dataSourceVersion);
156                 Objects.equal(labels, reference.labels);
157         return result;
158     }
159 }