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;
31 public class ResourceInstance implements Serializable {
33 private static final long serialVersionUID = -5506162340393802424L;
35 private String resourceInstanceName;
36 private String resourceName;
37 private UUID resourceInvariantUuid;
38 private String resourceVersion;
39 private String resourceType;
40 private UUID resourceUuid;
42 public ResourceInstance() {
49 * @param instance copy object
51 public ResourceInstance(ResourceInstance instance) {
52 if (instance == null) {
55 this.resourceInstanceName = instance.resourceInstanceName;
56 this.resourceName = instance.resourceName;
57 this.resourceInvariantUuid = instance.resourceInvariantUuid;
58 this.resourceVersion = instance.resourceVersion;
59 this.resourceType = instance.resourceType;
60 this.resourceUuid = instance.resourceUuid;
63 public UUID getResourceInvariantUUID() {
64 return resourceInvariantUuid;
67 public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
68 this.resourceInvariantUuid = resourceInvariantUuid;
72 public String toString() {
73 return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
74 + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion
75 + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]";
79 public int hashCode() {
82 result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
83 result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
84 result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
85 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
86 result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
87 result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
92 public boolean equals(Object obj) {
99 if (getClass() != obj.getClass()) {
102 ResourceInstance other = (ResourceInstance) obj;
103 if (resourceInstanceName == null) {
104 if (other.resourceInstanceName != null) {
107 } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
110 if (resourceInvariantUuid == null) {
111 if (other.resourceInvariantUuid != null) {
114 } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
117 if (resourceName == null) {
118 if (other.resourceName != null) {
121 } else if (!resourceName.equals(other.resourceName)) {
124 if (resourceType != other.resourceType) {
127 if (resourceUuid == null) {
128 if (other.resourceUuid != null) {
131 } else if (!resourceUuid.equals(other.resourceUuid)) {
134 if (resourceVersion == null) {
135 if (other.resourceVersion != null) {
138 } else if (!resourceVersion.equals(other.resourceVersion)) {