Commit includes ControlLoopPolicy API and bugfixes
[policy/engine.git] / ECOMP-ASDC / src / main / java / org / openecomp / policy / asdc / Service.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.policy.asdc;
22
23 import java.io.Serializable;
24 import java.util.UUID;
25
26 public class Service implements Serializable {
27
28         private static final long serialVersionUID = -1249276698549996806L;
29         
30         private UUID            serviceUUID;
31         private UUID            serviceInvariantUUID;
32         private String  serviceName;
33         private String  serviceVersion;
34         
35         public Service() {
36                 //Empty Constructor
37         }
38         
39         public Service(UUID uuid) {
40                 this.serviceUUID = uuid;
41         }
42         
43         public Service(String name) {
44                 this.serviceName = name;
45         }
46         
47         public Service(UUID uuid, UUID invariantUUID, String name, String version) {
48                 this.serviceUUID = uuid;
49                 this.serviceInvariantUUID = invariantUUID;
50                 this.serviceName = name;
51                 this.serviceVersion = version;
52         }
53         
54         public Service(Service service) {
55                 this.serviceUUID = service.serviceUUID;
56                 this.serviceInvariantUUID = service.serviceInvariantUUID;
57                 this.serviceName = service.serviceName;
58                 this.serviceVersion = service.serviceVersion;
59         }
60         
61         public UUID getServiceUUID() {
62                 return serviceUUID;
63         }
64
65         public void setServiceUUID(UUID serviceUUID) {
66                 this.serviceUUID = serviceUUID;
67         }
68
69         public UUID getServiceInvariantUUID() {
70                 return serviceInvariantUUID;
71         }
72
73         public void setServiceInvariantUUID(UUID serviceInvariantUUID) {
74                 this.serviceInvariantUUID = serviceInvariantUUID;
75         }
76
77         public String getServiceName() {
78                 return serviceName;
79         }
80
81         public void setServiceName(String serviceName) {
82                 this.serviceName = serviceName;
83         }
84
85         public String getServiceVersion() {
86                 return serviceVersion;
87         }
88
89         public void setServiceVersion(String serviceVersion) {
90                 this.serviceVersion = serviceVersion;
91         }
92
93         @Override
94         public String toString() {
95                 return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID
96                                 + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]";
97         }
98         @Override
99         public int hashCode() {
100                 final int prime = 31;
101                 int result = 1;
102                 result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode());
103                 result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode());
104                 result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode());
105                 result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode());
106                 return result;
107         }
108         @Override
109         public boolean equals(Object obj) {
110                 if (this == obj)
111                         return true;
112                 if (obj == null)
113                         return false;
114                 if (getClass() != obj.getClass())
115                         return false;
116                 Service other = (Service) obj;
117                 if (serviceInvariantUUID == null) {
118                         if (other.serviceInvariantUUID != null)
119                                 return false;
120                 } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID))
121                         return false;
122                 if (serviceName == null) {
123                         if (other.serviceName != null)
124                                 return false;
125                 } else if (!serviceName.equals(other.serviceName))
126                         return false;
127                 if (serviceUUID == null) {
128                         if (other.serviceUUID != null)
129                                 return false;
130                 } else if (!serviceUUID.equals(other.serviceUUID))
131                         return false;
132                 if (serviceVersion == null) {
133                         if (other.serviceVersion != null)
134                                 return false;
135                 } else if (!serviceVersion.equals(other.serviceVersion))
136                         return false;
137                 return true;
138         }
139
140 }