2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.sdcsimulator.models;
22 import java.util.HashSet;
24 import org.springframework.util.ObjectUtils;
25 import com.fasterxml.jackson.annotation.JsonProperty;
29 * @author Waqas Ikram (waqas.ikram@est.tech)
32 public class Metadata extends AssetInfo {
34 private static final long serialVersionUID = 2754071491333890698L;
36 @JsonProperty("resources")
37 private Set<Resource> resources = new HashSet<>();
39 @JsonProperty("artifacts")
40 private Set<Artifact> artifacts = new HashSet<>();
43 public Set<Resource> getResources() {
47 public void setResources(final Set<Resource> resources) {
48 this.resources = resources;
51 public Metadata resources(final Set<Resource> resources) {
52 this.resources = resources;
56 public Set<Artifact> getArtifacts() {
60 public void setArtifacts(final Set<Artifact> artifacts) {
61 this.artifacts = artifacts;
64 public Metadata artifacts(Set<Artifact> artifacts) {
65 this.artifacts = artifacts;
70 public int hashCode() {
73 result = prime * result + super.hashCode();
74 result = prime * result + ((resources == null) ? 0 : resources.hashCode());
75 result = prime * result + ((artifacts == null) ? 0 : artifacts.hashCode());
81 public boolean equals(final Object obj) {
82 if (obj instanceof Metadata) {
83 final Metadata other = (Metadata) obj;
84 return super.equals(obj) && ObjectUtils.nullSafeEquals(resources, other.resources)
85 && ObjectUtils.nullSafeEquals(artifacts, other.artifacts);
92 public String toString() {
93 final StringBuilder sb = new StringBuilder();
94 sb.append(super.toString());
95 sb.deleteCharAt(sb.length() - 1);
96 sb.append(" resources: ").append(resources).append("\n");
97 sb.append(" artifacts: ").append(artifacts).append("\n");
100 return sb.toString();