2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.sdc;
24 import java.io.Serializable;
25 import java.util.UUID;
27 public class ResourceInstance implements Serializable {
28 private static final long serialVersionUID = -5506162340393802424L;
30 private String resourceInstanceName;
31 private String resourceName;
32 private UUID resourceInvariantUuid;
33 private String resourceVersion;
34 private ResourceType resourceType;
35 private UUID resourceUuid;
37 public ResourceInstance() {
44 * @param instance copy object
46 public ResourceInstance(ResourceInstance instance) {
47 if (instance == null) {
50 this.resourceInstanceName = instance.resourceInstanceName;
51 this.resourceName = instance.resourceName;
52 this.resourceInvariantUuid = instance.resourceInvariantUuid;
53 this.resourceVersion = instance.resourceVersion;
54 this.resourceType = instance.resourceType;
55 this.resourceUuid = instance.resourceUuid;
58 public String getResourceInstanceName() {
59 return resourceInstanceName;
62 public void setResourceInstanceName(String resourceInstanceName) {
63 this.resourceInstanceName = resourceInstanceName;
66 public String getResourceName() {
70 public void setResourceName(String resourceName) {
71 this.resourceName = resourceName;
74 public UUID getResourceInvariantUUID() {
75 return resourceInvariantUuid;
78 public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
79 this.resourceInvariantUuid = resourceInvariantUuid;
82 public String getResourceVersion() {
83 return resourceVersion;
86 public void setResourceVersion(String resourceVersion) {
87 this.resourceVersion = resourceVersion;
90 public ResourceType getResourceType() {
94 public void setResourceType(ResourceType resourceType) {
95 this.resourceType = resourceType;
98 public UUID getResourceUuid() {
102 public void setResourceUuid(UUID resourceUuid) {
103 this.resourceUuid = resourceUuid;
107 public String toString() {
108 return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
109 + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion
110 + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]";
114 public int hashCode() {
115 final int prime = 31;
117 result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
118 result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
119 result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
120 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
121 result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
122 result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
127 public boolean equals(Object obj) {
134 if (getClass() != obj.getClass()) {
137 ResourceInstance other = (ResourceInstance) obj;
138 if (resourceInstanceName == null) {
139 if (other.resourceInstanceName != null) {
142 } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
145 if (resourceInvariantUuid == null) {
146 if (other.resourceInvariantUuid != null) {
149 } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
152 if (resourceName == null) {
153 if (other.resourceName != null) {
156 } else if (!resourceName.equals(other.resourceName)) {
159 if (resourceType != other.resourceType) {
162 if (resourceUuid == null) {
163 if (other.resourceUuid != null) {
166 } else if (!resourceUuid.equals(other.resourceUuid)) {
169 if (resourceVersion == null) {
170 if (other.resourceVersion != null) {
173 } else if (!resourceVersion.equals(other.resourceVersion)) {