2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. 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.policy.sdc;
23 import java.io.Serializable;
24 import java.util.UUID;
26 public class ResourceInstance implements Serializable {
27 private static final long serialVersionUID = -5506162340393802424L;
29 public String resourceInstanceName;
30 public String resourceName;
31 public UUID resourceInvariantUUID;
32 public String resourceVersion;
33 public ResourceType resourceType;
34 public UUID resourceUUID;
36 public ResourceInstance() {
40 public ResourceInstance(ResourceInstance instance) {
41 if (instance == null) {
44 this.resourceInstanceName = instance.resourceInstanceName;
45 this.resourceName = instance.resourceName;
46 this.resourceInvariantUUID = instance.resourceInvariantUUID;
47 this.resourceVersion = instance.resourceVersion;
48 this.resourceType = instance.resourceType;
49 this.resourceUUID = instance.resourceUUID;
53 public String toString() {
54 return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
55 + ", resourceInvariantUUID=" + resourceInvariantUUID + ", resourceVersion=" + resourceVersion
56 + ", resourceType=" + resourceType + ", resourceUUID=" + resourceUUID + "]";
59 public int hashCode() {
62 result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
63 result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode());
64 result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
65 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
66 result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode());
67 result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
71 public boolean equals(Object obj) {
76 if (getClass() != obj.getClass())
78 ResourceInstance other = (ResourceInstance) obj;
79 if (resourceInstanceName == null) {
80 if (other.resourceInstanceName != null)
82 } else if (!resourceInstanceName.equals(other.resourceInstanceName))
84 if (resourceInvariantUUID == null) {
85 if (other.resourceInvariantUUID != null)
87 } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID))
89 if (resourceName == null) {
90 if (other.resourceName != null)
92 } else if (!resourceName.equals(other.resourceName))
94 if (resourceType != other.resourceType)
96 if (resourceUUID == null) {
97 if (other.resourceUUID != null)
99 } else if (!resourceUUID.equals(other.resourceUUID))
101 if (resourceVersion == null) {
102 if (other.resourceVersion != null)
104 } else if (!resourceVersion.equals(other.resourceVersion))