[SDC] rebase 1710 code
[sdc.git] / asdc-tests / 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         String serviceType;
31         String serviceRole;
32
33         public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
34                         String contactId, String icon) {
35                 this.name = serviceName;
36                 // this.category = category;
37                 this.tags = tags;
38                 this.description = description;
39                 this.contactId = contactId;
40                 this.icon = icon;
41                 this.serviceType = "";
42                 this.serviceRole = "";
43                 projectCode = "12345";
44                 CategoryDefinition categoryDefinition = new CategoryDefinition();
45                 categoryDefinition.setName(category);
46                 categories = new ArrayList<>();
47                 categories.add(categoryDefinition);
48
49         }
50
51         public ServiceReqDetails(Service service) {
52                 this.contactId = service.getContactId();
53                 this.categories = service.getCategories();
54                 this.creatorUserId = service.getCreatorUserId();
55                 this.creatorFullName = service.getCreatorFullName();
56                 this.description = service.getDescription();
57                 this.icon = service.getIcon();
58                 this.name = service.getName();
59                 this.projectCode = service.getProjectCode();
60                 this.tags = service.getTags();
61                 this.uniqueId = service.getUniqueId();
62                 this.UUID = service.getUUID();
63                 this.version = service.getVersion();
64                 this.serviceType = service.getServiceType();
65                 this.serviceRole = service.getServiceRole();
66
67         }
68
69         public ServiceReqDetails() {
70                 contactId = "aa1234";
71                 projectCode = "12345";
72         }
73
74         public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
75                 a.setName(newServiceName);
76         }
77
78         @Override
79         public String toString() {
80                 return "ServiceDetails [name=" + name + ", category=" + getCategory() + ", tags=" + tags + ", description="
81                                 + description + ", contactId=" + contactId + ", icon=" + icon + "]";
82         }
83
84         public ServiceReqDetails(ServiceReqDetails aService) {
85                 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
86                                 aService.getDescription(), aService.getContactId(), aService.getIcon());
87                 uniqueId = aService.getUniqueId();
88                 version = aService.getVersion();
89         }
90
91         public String getCategory() {
92                 if (categories != null && categories.size() >= 1) {
93                         return categories.get(0).getName();
94                 }
95                 return null;
96         }
97
98 }