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 Service implements Serializable {
31 private static final long serialVersionUID = -1249276698549996806L;
33 public UUID serviceUUID;
34 public UUID serviceInvariantUUID;
35 public String serviceName;
36 public String serviceVersion;
42 public Service(UUID uuid) {
43 this.serviceUUID = uuid;
46 public Service(String name) {
47 this.serviceName = name;
50 public Service(UUID uuid, UUID invariantUUID, String name, String version) {
51 this.serviceUUID = uuid;
52 this.serviceInvariantUUID = invariantUUID;
53 this.serviceName = name;
54 this.serviceVersion = version;
57 public Service(Service service) {
58 this.serviceUUID = service.serviceUUID;
59 this.serviceInvariantUUID = service.serviceInvariantUUID;
60 this.serviceName = service.serviceName;
61 this.serviceVersion = service.serviceVersion;
65 public String toString() {
66 return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID
67 + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]";
70 public int hashCode() {
73 result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode());
74 result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
75 result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
76 result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
80 public boolean equals(Object obj) {
85 if (getClass() != obj.getClass())
87 Service other = (Service) obj;
88 if (serviceInvariantUUID == null) {
89 if (other.serviceInvariantUUID != null)
91 } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID))
93 if (serviceName == null) {
94 if (other.serviceName != null)
96 } else if (!serviceName.equals(other.serviceName))
98 if (serviceUUID == null) {
99 if (other.serviceUUID != null)
101 } else if (!serviceUUID.equals(other.serviceUUID))
103 if (serviceVersion == null) {
104 if (other.serviceVersion != null)
106 } else if (!serviceVersion.equals(other.serviceVersion))