[VID-6] Initial rebase push
[vid.git] / vid-app-common / src / main / java / org / openecomp / vid / model / Service.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * VID\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.vid.model;\r
22 \r
23 import java.util.Map;\r
24 import java.util.UUID;\r
25 import java.util.Map.Entry;\r
26 \r
27 import org.openecomp.vid.asdc.beans.tosca.Input;\r
28 \r
29 /**\r
30  * The Class Service.\r
31  */\r
32 public class Service {\r
33 \r
34         /** The uuid. */\r
35         private String uuid;\r
36         \r
37         /** The invariant uuid. */\r
38         private String invariantUuid;\r
39         \r
40         /** The name. */\r
41         private String name;\r
42         \r
43         /** The version. */\r
44         private String version;\r
45         \r
46         /** The tosca model URL. */\r
47         private String toscaModelURL;\r
48         \r
49         /** The category. */\r
50         private String category;\r
51         \r
52         /** The description. */\r
53         private String description;\r
54         \r
55         /** The service ecomp naming flag */\r
56         private String serviceEcompNaming;\r
57         \r
58         /** The inputs. */\r
59         private Map<String, Input> inputs;\r
60         \r
61         /**\r
62          * Gets the uuid.\r
63          *\r
64          * @return the uuid\r
65          */\r
66         public String getUuid() {\r
67                 return uuid;\r
68         }\r
69         \r
70         /**\r
71          * Gets the invariant uuid.\r
72          *\r
73          * @return the invariant uuid\r
74          */\r
75         public String getInvariantUuid() {\r
76                 return invariantUuid;\r
77         }\r
78         \r
79         /**\r
80          * Gets the name.\r
81          *\r
82          * @return the name\r
83          */\r
84         public String getName() {\r
85                 return name;\r
86         }\r
87         \r
88         /**\r
89          * Gets the version.\r
90          *\r
91          * @return the version\r
92          */\r
93         public String getVersion() {\r
94                 return version;\r
95         }\r
96         \r
97         /**\r
98          * Gets the tosca model URL.\r
99          *\r
100          * @return the tosca model URL\r
101          */\r
102         public String getToscaModelURL() {\r
103                 return toscaModelURL;\r
104         }\r
105         \r
106         /**\r
107          * Gets the category.\r
108          *\r
109          * @return the category\r
110          */\r
111         public String getCategory() {\r
112                 return category;\r
113         }\r
114         \r
115         /**\r
116          * Gets the description.\r
117          *\r
118          * @return the description\r
119          */\r
120         public String getDescription() {\r
121                 return description;\r
122         }\r
123         \r
124         /**\r
125          * Gets the inputs.\r
126          *\r
127          * @return the inputs\r
128          */\r
129         public Map<String, Input> getInputs() {\r
130                 return inputs;\r
131         }\r
132         /**\r
133          * Get the serviceEcompNaming value\r
134          *\r
135          * @return serviceEcompNaming\r
136          */\r
137         public String getServiceEcompNaming() {\r
138                 return serviceEcompNaming;\r
139         } \r
140         /**\r
141          * Sets the uuid.\r
142          *\r
143          * @param uuid the new uuid\r
144          */\r
145         public void setUuid(String uuid) {\r
146                 this.uuid = uuid;\r
147         }\r
148         \r
149         /**\r
150          * Sets the invariant uuid.\r
151          *\r
152          * @param invariantUuid the new invariant uuid\r
153          */\r
154         public void setInvariantUuid(String invariantUuid) {\r
155                 this.invariantUuid = invariantUuid;\r
156         }\r
157         \r
158         /**\r
159          * Sets the name.\r
160          *\r
161          * @param name the new name\r
162          */\r
163         public void setName(String name) {\r
164                 this.name = name;\r
165         }\r
166         \r
167         /**\r
168          * Sets the version.\r
169          *\r
170          * @param version the new version\r
171          */\r
172         public void setVersion(String version) {\r
173                 this.version = version;\r
174         }\r
175         \r
176         /**\r
177          * Sets the tosca model URL.\r
178          *\r
179          * @param toscaModelURL the new tosca model URL\r
180          */\r
181         public void setToscaModelURL(String toscaModelURL) {\r
182                 this.toscaModelURL = toscaModelURL;\r
183         }\r
184         \r
185         /**\r
186          * Sets the category.\r
187          *\r
188          * @param category the new category\r
189          */\r
190         public void setCategory(String category) {\r
191                 this.category = category;\r
192         }\r
193         \r
194         /**\r
195          * Sets the description.\r
196          *\r
197          * @param description the new description\r
198          */\r
199         public void setDescription(String description) {\r
200                 this.description = description;\r
201         }\r
202         \r
203         /**\r
204          * Sets the inputs.\r
205          *\r
206          * @param inputs the inputs\r
207          */\r
208         public void setInputs(Map<String, Input> inputs) {\r
209                 this.inputs = inputs;\r
210         }\r
211         /**\r
212          * Sets the service ecomp naming.\r
213          *\r
214          * @param serviceEcompNaming the new service ecomp naming\r
215          */\r
216         public void setServiceEcompNaming(String serviceEcompNaming) {\r
217                 this.serviceEcompNaming = serviceEcompNaming;\r
218         }\r
219         /* (non-Javadoc)\r
220          * @see java.lang.Object#hashCode()\r
221          */\r
222         @Override\r
223         public int hashCode() {\r
224                 final UUID uuid = UUID.fromString(getUuid());\r
225                 \r
226                 return uuid.hashCode();\r
227         }\r
228         \r
229         /* (non-Javadoc)\r
230          * @see java.lang.Object#equals(java.lang.Object)\r
231          */\r
232         @Override\r
233         public boolean equals(Object o) {\r
234                 if (o == this) return true;\r
235                 if (!(o instanceof Service)) return false;\r
236                 \r
237                 final Service service = (Service) o;\r
238                 \r
239                 return (service.getUuid().equals(getUuid()));\r
240         }\r
241         /*public static void extractVfModuleCustomizationUUID (Service s, String vnfCustomizationName, VfModule vfMod ) {\r
242                 \r
243                 //Look for vnfCustomizationName..vfModuleCustomizationName\r
244                 String nameToFind = vnfCustomizationName + ".." + vfMod.getModelCustomizationName();\r
245                 for (Entry<UUID, VfModule> vfModuleComponent : s.getVfModules().entrySet()) {\r
246                         VfModule xMod = vfModuleComponent.getValue();\r
247                         if ( (xMod.getModelCustomizationName() != null) && (xMod.getModelCustomizationName().equalsIgnoreCase(nameToFind)) ) {\r
248                                 vfMod.setCustomizationUuid( xMod.getCustomizationUuid());\r
249                                 return;\r
250                         }\r
251                 }\r
252         }*/\r
253 }\r