Adding endpoints to SDC simulator
[integration/csit.git] / plans / so / integration-etsi-testing / so-simulators / sdc-simulator / src / main / java / org / onap / so / sdcsimulator / models / Resource.java
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.sdcsimulator.models;
21
22 import java.io.Serializable;
23 import java.util.HashSet;
24 import java.util.Set;
25 import org.springframework.util.ObjectUtils;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27
28 /**
29  *
30  * @author Waqas Ikram (waqas.ikram@est.tech)
31  *
32  */
33 public class Resource implements Serializable {
34
35     private static final long serialVersionUID = -8014206400770867160L;
36
37     @JsonProperty("resourceInstanceName")
38     private String resourceInstanceName;
39
40     @JsonProperty("resourceName")
41     private String resourceName;
42
43     @JsonProperty("resourceInvariantUUID")
44     private String resourceInvariantUuid;
45
46     @JsonProperty("resourceVersion")
47     private String resourceVersion;
48
49     @JsonProperty("resoucreType")
50     private String resourceType;
51
52     @JsonProperty("resourceUUID")
53     private String resourceUuid;
54
55     @JsonProperty("artifacts")
56     private Set<Artifact> artifacts = new HashSet<>();
57
58     public String getResourceInstanceName() {
59         return resourceInstanceName;
60     }
61
62     public void setResourceInstanceName(final String resourceInstanceName) {
63         this.resourceInstanceName = resourceInstanceName;
64     }
65
66     public Resource resourceInstanceName(final String resourceInstanceName) {
67         this.resourceInstanceName = resourceInstanceName;
68         return this;
69     }
70
71     public String getResourceName() {
72         return resourceName;
73     }
74
75     public void setResourceName(final String resourceName) {
76         this.resourceName = resourceName;
77     }
78
79     public Resource resourceName(final String resourceName) {
80         this.resourceName = resourceName;
81         return this;
82     }
83
84     public String getResourceInvariantUuid() {
85         return resourceInvariantUuid;
86     }
87
88     public void setResourceInvariantUuid(final String resourceInvariantUuid) {
89         this.resourceInvariantUuid = resourceInvariantUuid;
90     }
91
92     public Resource resourceInvariantUuid(final String resourceInvariantUuid) {
93         this.resourceInvariantUuid = resourceInvariantUuid;
94         return this;
95     }
96
97     public String getResourceVersion() {
98         return resourceVersion;
99     }
100
101     public void setResourceVersion(final String resourceVersion) {
102         this.resourceVersion = resourceVersion;
103     }
104
105     public Resource resourceVersion(final String resourceVersion) {
106         this.resourceVersion = resourceVersion;
107         return this;
108     }
109
110     public String getResourceType() {
111         return resourceType;
112     }
113
114     public void setResourceType(final String resourceType) {
115         this.resourceType = resourceType;
116     }
117
118     public Resource resourceType(final String resourceType) {
119         this.resourceType = resourceType;
120         return this;
121     }
122
123     public String getResourceUuid() {
124         return resourceUuid;
125     }
126
127     public void setResourceUuid(final String resourceUuid) {
128         this.resourceUuid = resourceUuid;
129     }
130
131     public Resource resourceUUID(final String resourceUuid) {
132         this.resourceUuid = resourceUuid;
133         return this;
134     }
135
136     public Set<Artifact> getArtifacts() {
137         return artifacts;
138     }
139
140     public void setArtifacts(final Set<Artifact> artifacts) {
141         this.artifacts = artifacts;
142     }
143
144     public Resource artifacts(final Set<Artifact> artifacts) {
145         this.artifacts = artifacts;
146         return this;
147     }
148
149     @Override
150     public int hashCode() {
151         final int prime = 31;
152         int result = 1;
153         result = prime * result + ((artifacts == null) ? 0 : artifacts.hashCode());
154         result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
155         result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
156         result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
157         result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
158         result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
159         result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
160         return result;
161     }
162
163     @Override
164     public boolean equals(final Object obj) {
165         if (obj instanceof Resource) {
166             final Resource other = (Resource) obj;
167             return ObjectUtils.nullSafeEquals(resourceInstanceName, other.resourceInstanceName)
168                     && ObjectUtils.nullSafeEquals(resourceName, other.resourceName)
169                     && ObjectUtils.nullSafeEquals(resourceInvariantUuid, other.resourceInvariantUuid)
170                     && ObjectUtils.nullSafeEquals(resourceVersion, other.resourceVersion)
171                     && ObjectUtils.nullSafeEquals(resourceType, other.resourceType)
172                     && ObjectUtils.nullSafeEquals(resourceUuid, other.resourceUuid)
173                     && ObjectUtils.nullSafeEquals(artifacts, other.artifacts);
174         }
175         return false;
176
177     }
178
179     @Override
180     public String toString() {
181         final StringBuilder sb = new StringBuilder();
182         sb.append("class Resource {\n");
183         sb.append("    resourceInstanceName: ").append(resourceInstanceName).append("\n");
184         sb.append("    resourceName: ").append(resourceName).append("\n");
185         sb.append("    resourceInvariantUuid: ").append(resourceInvariantUuid).append("\n");
186         sb.append("    resourceVersion: ").append(resourceVersion).append("\n");
187         sb.append("    resourceType: ").append(resourceType).append("\n");
188         sb.append("    resourceUuid: ").append(resourceUuid).append("\n");
189         sb.append("    artifacts: ").append(artifacts).append("\n");
190
191         sb.append("}");
192         return sb.toString();
193
194     }
195
196
197
198 }