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 ServiceInstance implements Serializable {
33 private static final long serialVersionUID = 6285260780966679625L;
35 private UUID personaModelUUID;
36 private UUID serviceUUID;
37 private UUID serviceInstanceUUID;
38 private UUID widgetModelUUID;
39 private String widgetModelVersion;
40 private String serviceName;
41 private String serviceInstanceName;
43 public ServiceInstance() {
50 * @param instance copy object
52 public ServiceInstance(ServiceInstance instance) {
53 if (instance == null) {
56 this.personaModelUUID = instance.personaModelUUID;
57 this.serviceUUID = instance.serviceUUID;
58 this.serviceInstanceUUID = instance.serviceInstanceUUID;
59 this.widgetModelUUID = instance.widgetModelUUID;
60 this.widgetModelVersion = instance.widgetModelVersion;
61 this.serviceName = instance.serviceName;
62 this.serviceInstanceName = instance.serviceInstanceName;
66 public String toString() {
67 return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID
68 + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID
69 + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName
70 + ", serviceInstanceName=" + serviceInstanceName + "]";
74 public int hashCode() {
77 result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode());
78 result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode());
79 result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode());
80 result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
81 result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
82 result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode());
83 result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode());
88 public boolean equals(Object obj) {
95 if (getClass() != obj.getClass()) {
98 ServiceInstance other = (ServiceInstance) obj;
99 if (personaModelUUID == null) {
100 if (other.personaModelUUID != null) {
103 } else if (!personaModelUUID.equals(other.personaModelUUID)) {
106 if (serviceInstanceName == null) {
107 if (other.serviceInstanceName != null) {
110 } else if (!serviceInstanceName.equals(other.serviceInstanceName)) {
113 if (serviceInstanceUUID == null) {
114 if (other.serviceInstanceUUID != null) {
117 } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) {
120 if (serviceName == null) {
121 if (other.serviceName != null) {
124 } else if (!serviceName.equals(other.serviceName)) {
127 if (serviceUUID == null) {
128 if (other.serviceUUID != null) {
131 } else if (!serviceUUID.equals(other.serviceUUID)) {
134 if (widgetModelUUID == null) {
135 if (other.widgetModelUUID != null) {
138 } else if (!widgetModelUUID.equals(other.widgetModelUUID)) {
141 if (widgetModelVersion == null) {
142 return other.widgetModelVersion == null;
144 return widgetModelVersion.equals(other.widgetModelVersion);