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 {
29 private static final long serialVersionUID = -5506162340393802424L;
31 private String resourceInstanceName;
32 private String resourceName;
33 private UUID resourceInvariantUuid;
34 private String resourceVersion;
35 private ResourceType resourceType;
36 private UUID resourceUuid;
38 public ResourceInstance() {
45 * @param instance copy object
47 public ResourceInstance(ResourceInstance instance) {
48 if (instance == null) {
51 this.resourceInstanceName = instance.resourceInstanceName;
52 this.resourceName = instance.resourceName;
53 this.resourceInvariantUuid = instance.resourceInvariantUuid;
54 this.resourceVersion = instance.resourceVersion;
55 this.resourceType = instance.resourceType;
56 this.resourceUuid = instance.resourceUuid;
59 public String getResourceInstanceName() {
60 return resourceInstanceName;
63 public void setResourceInstanceName(String resourceInstanceName) {
64 this.resourceInstanceName = resourceInstanceName;
67 public String getResourceName() {
71 public void setResourceName(String resourceName) {
72 this.resourceName = resourceName;
75 public UUID getResourceInvariantUUID() {
76 return resourceInvariantUuid;
79 public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
80 this.resourceInvariantUuid = resourceInvariantUuid;
83 public String getResourceVersion() {
84 return resourceVersion;
87 public void setResourceVersion(String resourceVersion) {
88 this.resourceVersion = resourceVersion;
91 public ResourceType getResourceType() {
95 public void setResourceType(ResourceType resourceType) {
96 this.resourceType = resourceType;
99 public UUID getResourceUuid() {
103 public void setResourceUuid(UUID resourceUuid) {
104 this.resourceUuid = resourceUuid;
108 public String toString() {
109 return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
110 + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion
111 + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]";
115 public int hashCode() {
116 final int prime = 31;
118 result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
119 result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
120 result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
121 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
122 result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
123 result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
128 public boolean equals(Object obj) {
135 if (getClass() != obj.getClass()) {
138 ResourceInstance other = (ResourceInstance) obj;
139 if (resourceInstanceName == null) {
140 if (other.resourceInstanceName != null) {
143 } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
146 if (resourceInvariantUuid == null) {
147 if (other.resourceInvariantUuid != null) {
150 } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
153 if (resourceName == null) {
154 if (other.resourceName != null) {
157 } else if (!resourceName.equals(other.resourceName)) {
160 if (resourceType != other.resourceType) {
163 if (resourceUuid == null) {
164 if (other.resourceUuid != null) {
167 } else if (!resourceUuid.equals(other.resourceUuid)) {
170 if (resourceVersion == null) {
171 if (other.resourceVersion != null) {
174 } else if (!resourceVersion.equals(other.resourceVersion)) {