2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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 private String resourceInstanceName;
30 private String resourceName;
31 private UUID resourceInvariantUuid;
32 private String resourceVersion;
33 private ResourceType resourceType;
34 private UUID resourceUuid;
36 public ResourceInstance() {
43 * @param instance copy object
45 public ResourceInstance(ResourceInstance instance) {
46 if (instance == null) {
49 this.resourceInstanceName = instance.resourceInstanceName;
50 this.resourceName = instance.resourceName;
51 this.resourceInvariantUuid = instance.resourceInvariantUuid;
52 this.resourceVersion = instance.resourceVersion;
53 this.resourceType = instance.resourceType;
54 this.resourceUuid = instance.resourceUuid;
57 public String getResourceInstanceName() {
58 return resourceInstanceName;
61 public void setResourceInstanceName(String resourceInstanceName) {
62 this.resourceInstanceName = resourceInstanceName;
65 public String getResourceName() {
69 public void setResourceName(String resourceName) {
70 this.resourceName = resourceName;
73 public UUID getResourceInvariantUUID() {
74 return resourceInvariantUuid;
77 public void setResourceInvariantUUID(UUID resourceInvariantUuid) {
78 this.resourceInvariantUuid = resourceInvariantUuid;
81 public String getResourceVersion() {
82 return resourceVersion;
85 public void setResourceVersion(String resourceVersion) {
86 this.resourceVersion = resourceVersion;
89 public ResourceType getResourceType() {
93 public void setResourceType(ResourceType resourceType) {
94 this.resourceType = resourceType;
97 public UUID getResourceUuid() {
101 public void setResourceUuid(UUID resourceUuid) {
102 this.resourceUuid = resourceUuid;
106 public String toString() {
107 return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName
108 + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion
109 + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]";
113 public int hashCode() {
114 final int prime = 31;
116 result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode());
117 result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode());
118 result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode());
119 result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode());
120 result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode());
121 result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode());
126 public boolean equals(Object obj) {
133 if (getClass() != obj.getClass()) {
136 ResourceInstance other = (ResourceInstance) obj;
137 if (resourceInstanceName == null) {
138 if (other.resourceInstanceName != null) {
141 } else if (!resourceInstanceName.equals(other.resourceInstanceName)) {
144 if (resourceInvariantUuid == null) {
145 if (other.resourceInvariantUuid != null) {
148 } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) {
151 if (resourceName == null) {
152 if (other.resourceName != null) {
155 } else if (!resourceName.equals(other.resourceName)) {
158 if (resourceType != other.resourceType) {
161 if (resourceUuid == null) {
162 if (other.resourceUuid != null) {
165 } else if (!resourceUuid.equals(other.resourceUuid)) {
168 if (resourceVersion == null) {
169 if (other.resourceVersion != null) {
172 } else if (!resourceVersion.equals(other.resourceVersion)) {