[SDC-29] rebase continue work to align source
[sdc.git] / test-apis-ci / src / main / java / org / openecomp / sdc / ci / tests / datatypes / ServiceReqDetails.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.sdc.ci.tests.datatypes;
22
23 import java.util.ArrayList;
24
25 import org.openecomp.sdc.be.model.Service;
26 import org.openecomp.sdc.be.model.category.CategoryDefinition;
27
28 public class ServiceReqDetails extends ComponentReqDetails {
29
30         public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
31                         String contactId, String icon) {
32                 this.name = serviceName;
33                 // this.category = category;
34                 this.tags = tags;
35                 this.description = description;
36                 this.contactId = contactId;
37                 this.icon = icon;
38                 projectCode = "12345";
39                 CategoryDefinition categoryDefinition = new CategoryDefinition();
40                 categoryDefinition.setName(category);
41                 categories = new ArrayList<>();
42                 categories.add(categoryDefinition);
43
44         }
45
46         public ServiceReqDetails(Service service) {
47                 this.contactId = service.getContactId();
48                 this.categories = service.getCategories();
49                 this.creatorUserId = service.getCreatorUserId();
50                 this.creatorFullName = service.getCreatorFullName();
51                 this.description = service.getDescription();
52                 this.icon = service.getIcon();
53                 this.name = service.getName();
54                 this.projectCode = service.getProjectCode();
55                 this.tags = service.getTags();
56                 this.uniqueId = service.getUniqueId();
57                 this.UUID = service.getUUID();
58                 this.version = service.getVersion();
59
60         }
61
62         public ServiceReqDetails() {
63                 contactId = "aa1234";
64                 projectCode = "12345";
65         }
66
67         public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
68                 a.setName(newServiceName);
69         }
70
71         @Override
72         public String toString() {
73                 return "ServiceDetails [name=" + name + ", category=" + getCategory() + ", tags=" + tags + ", description="
74                                 + description + ", contactId=" + contactId + ", icon=" + icon + "]";
75         }
76
77         public ServiceReqDetails(ServiceReqDetails aService) {
78                 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
79                                 aService.getDescription(), aService.getContactId(), aService.getIcon());
80                 uniqueId = aService.getUniqueId();
81                 version = aService.getVersion();
82         }
83
84         public String getCategory() {
85                 if (categories != null && categories.size() >= 1) {
86                         return categories.get(0).getName();
87                 }
88                 return null;
89         }
90
91 }