2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.adapters.cnf.service.aai;
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;
28 import java.util.Collections;
29 import java.util.List;
31 @JsonInclude(JsonInclude.Include.NON_NULL)
32 @JsonIgnoreProperties(ignoreUnknown = true)
33 public class KubernetesResource {
37 private String version;
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;
51 public String getId() {
55 public void setId(String id) {
59 public String getName() {
63 public void setName(String name) {
67 public String getGroup() {
71 public void setGroup(String group) {
75 public String getVersion() {
79 public void setVersion(String version) {
80 this.version = version;
83 public String getKind() {
87 public void setKind(String kind) {
91 public String getNamespace() {
95 public void setNamespace(String namespace) {
96 this.namespace = namespace;
99 public List<String> getLabels() {
103 public void setLabels(List<String> labels) {
105 Collections.sort(labels);
106 this.labels = labels;
109 public String getSelflink() { return selflink; }
111 public void setSelflink(String selflink) { this.selflink = selflink; }
113 public String getDataOwner() {
117 public void setDataOwner(String dataOwner) {
118 this.dataOwner = dataOwner;
121 public String getDataSource() {
125 public void setDataSource(String dataSource) {
126 this.dataSource = dataSource;
129 public String getDataSourceVersion() {
130 return dataSourceVersion;
133 public void setDataSourceVersion(String dataSourceVersion) {
134 this.dataSourceVersion = dataSourceVersion;
137 public String getResourceVersion() {
138 return resourceVersion;
141 public void setResourceVersion(String resourceVersion) {
142 this.resourceVersion = resourceVersion;
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);