org.onap migration
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / Service.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
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.onap.vid.model;
22
23 import org.onap.vid.asdc.beans.tosca.Input;
24
25 import java.util.Map;
26 import java.util.UUID;
27
28 /**
29  * The Class Service.
30  */
31 public class Service {
32
33         /** The uuid. */
34         private String uuid;
35         
36         /** The invariant uuid. */
37         private String invariantUuid;
38         
39         /** The name. */
40         private String name;
41         
42         /** The version. */
43         private String version;
44         
45         /** The tosca model URL. */
46         private String toscaModelURL;
47         
48         /** The category. */
49         private String category;
50
51         /** The Service Type. */
52         private String serviceType;
53
54         /** The Service Role */
55         private String serviceRole;
56         
57         /** The description. */
58         private String description;
59         
60         /** The service ecomp naming flag */
61         private String serviceEcompNaming;
62
63         private String instantiationType;
64
65
66         /** The inputs. */
67         private Map<String, Input> inputs;
68         
69         /**
70          * Gets the uuid.
71          *
72          * @return the uuid
73          */
74         public String getUuid() {
75                 return uuid;
76         }
77         
78         /**
79          * Gets the invariant uuid.
80          *
81          * @return the invariant uuid
82          */
83         public String getInvariantUuid() {
84                 return invariantUuid;
85         }
86         
87         /**
88          * Gets the name.
89          *
90          * @return the name
91          */
92         public String getName() {
93                 return name;
94         }
95         
96         /**
97          * Gets the version.
98          *
99          * @return the version
100          */
101         public String getVersion() {
102                 return version;
103         }
104         
105         /**
106          * Gets the tosca model URL.
107          *
108          * @return the tosca model URL
109          */
110         public String getToscaModelURL() {
111                 return toscaModelURL;
112         }
113         
114         /**
115          * Gets the category.
116          *
117          * @return the category
118          */
119         public String getCategory() {
120                 return category;
121         }
122         
123         /**
124          * Gets the description.
125          *
126          * @return the description
127          */
128         public String getDescription() {
129                 return description;
130         }
131         
132         /**
133          * Gets the inputs.
134          *
135          * @return the inputs
136          */
137         public Map<String, Input> getInputs() {
138                 return inputs;
139         }
140         /**
141          * Get the serviceEcompNaming value
142          *
143          * @return serviceEcompNaming
144          */
145         public String getServiceEcompNaming() {
146                 return serviceEcompNaming;
147         }
148
149
150         public String getInstantiationType() { return instantiationType; }
151
152         public void setInstantiationType(String instantiationType) { this.instantiationType = instantiationType; }
153         /**
154          * Sets the uuid.
155          *
156          * @param uuid the new uuid
157          */
158         public void setUuid(String uuid) {
159                 this.uuid = uuid;
160         }
161         
162         /**
163          * Sets the invariant uuid.
164          *
165          * @param invariantUuid the new invariant uuid
166          */
167         public void setInvariantUuid(String invariantUuid) {
168                 this.invariantUuid = invariantUuid;
169         }
170         
171         /**
172          * Sets the name.
173          *
174          * @param name the new name
175          */
176         public void setName(String name) {
177                 this.name = name;
178         }
179         
180         /**
181          * Sets the version.
182          *
183          * @param version the new version
184          */
185         public void setVersion(String version) {
186                 this.version = version;
187         }
188         
189         /**
190          * Sets the tosca model URL.
191          *
192          * @param toscaModelURL the new tosca model URL
193          */
194         public void setToscaModelURL(String toscaModelURL) {
195                 this.toscaModelURL = toscaModelURL;
196         }
197         
198         /**
199          * Sets the category.
200          *
201          * @param category the new category
202          */
203         public void setCategory(String category) {
204                 this.category = category;
205         }
206         
207         /**
208          * Sets the description.
209          *
210          * @param description the new description
211          */
212         public void setDescription(String description) {
213                 this.description = description;
214         }
215         
216         /**
217          * Sets the inputs.
218          *
219          * @param inputs the inputs
220          */
221         public void setInputs(Map<String, Input> inputs) {
222                 this.inputs = inputs;
223         }
224         /**
225          * Sets the service ecomp naming.
226          *
227          * @param serviceEcompNaming the new service ecomp naming
228          */
229         public void setServiceEcompNaming(String serviceEcompNaming) {
230                 this.serviceEcompNaming = serviceEcompNaming;
231         }
232         /* (non-Javadoc)
233          * @see java.lang.Object#hashCode()
234          */
235         @Override
236         public int hashCode() {
237                 final UUID uuid = UUID.fromString(getUuid());
238                 
239                 return uuid.hashCode();
240         }
241         
242         /* (non-Javadoc)
243          * @see java.lang.Object#equals(java.lang.Object)
244          */
245         @Override
246         public boolean equals(Object o) {
247                 if (o == this) return true;
248                 if (!(o instanceof Service)) return false;
249                 
250                 final Service service = (Service) o;
251                 
252                 return (service.getUuid().equals(getUuid()));
253         }
254
255         public String getServiceType() {
256                 return serviceType;
257         }
258
259         public void setServiceType(String serviceType) {
260                 this.serviceType = serviceType;
261         }
262
263         public String getServiceRole() {
264                 return serviceRole;
265         }
266
267         public void setServiceRole(String serviceRole) {
268                 this.serviceRole = serviceRole;
269         }
270
271         /*public static void extractVfModuleCustomizationUUID (Service s, String vnfCustomizationName, VfModule vfMod ) {
272                 
273                 //Look for vnfCustomizationName..vfModuleCustomizationName
274                 String nameToFind = vnfCustomizationName + ".." + vfMod.getModelCustomizationName();
275                 for (Entry<UUID, VfModule> vfModuleComponent : s.getVfModules().entrySet()) {
276                         VfModule xMod = vfModuleComponent.getValue();
277                         if ( (xMod.getModelCustomizationName() != null) && (xMod.getModelCustomizationName().equalsIgnoreCase(nameToFind)) ) {
278                                 vfMod.setCustomizationUuid( xMod.getCustomizationUuid());
279                                 return;
280                         }
281                 }
282         }*/
283 }