Catalog alignment
[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 org.openecomp.sdc.be.model.Service;
24 import org.openecomp.sdc.be.model.category.CategoryDefinition;
25 import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceInstantiationType;
26
27 import java.util.ArrayList;
28 import java.util.Collections;
29
30 public class ServiceReqDetails extends ComponentReqDetails {
31         
32         protected String serviceType = "MyServiceType";
33         protected String serviceRole = "MyServiceRole";
34         protected String namingPolicy = "MyServiceNamingPolicy";
35         protected Boolean ecompGeneratedNaming = true;
36         protected String instantiationType = ServiceInstantiationType.A_LA_CARTE.getValue();
37         protected String serviceFunction = "";
38
39         public String getServiceType() {
40                 return serviceType;
41         }
42
43         public void setServiceType(String serviceType) {
44                 this.serviceType = serviceType;
45         }
46         
47         public String getInstantiationType() {
48                 return instantiationType;
49         }
50         
51         public String getServiceRole() {
52                 return serviceRole;
53         }
54
55         public void setServiceRole(String serviceRole) {
56                 this.serviceRole = serviceRole;
57         }
58
59         public String getNamingPolicy() {
60                 return namingPolicy;
61         }
62
63         public void setNamingPolicy(String namingPolicy) {
64                 this.namingPolicy = namingPolicy;
65         }
66
67         public Boolean getEcompGeneratedNaming() {
68                 return ecompGeneratedNaming;
69         }
70
71         public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
72                 this.ecompGeneratedNaming = ecompGeneratedNaming;
73         }
74
75         public String getServiceFunction() {
76                 return serviceFunction;
77         }
78
79         public void setServiceFunction(String serviceFunction) {
80                 this.serviceFunction = serviceFunction;
81         }
82
83         public ServiceReqDetails(String serviceName, String category, ArrayList<String> tags, String description,
84                         String contactId, String icon, String instantiationType) {
85                 this.name = serviceName;
86                 this.tags = tags;
87                 this.description = description;
88                 this.contactId = contactId;
89                 this.icon = icon;
90                 projectCode = "12345";
91                 serviceFunction = "serviceFunction name";
92                 CategoryDefinition categoryDefinition = new CategoryDefinition();
93                 categoryDefinition.setName(category);
94                 categoryDefinition.setIcons(Collections.singletonList(icon));
95                 categories = new ArrayList<>();
96                 categories.add(categoryDefinition);
97
98         }
99
100         public ServiceReqDetails(Service service) {
101                 this.contactId = service.getContactId();
102                 this.categories = service.getCategories();
103                 this.creatorUserId = service.getCreatorUserId();
104                 this.creatorFullName = service.getCreatorFullName();
105                 this.description = service.getDescription();
106                 this.icon = service.getIcon();
107                 this.name = service.getName();
108                 this.projectCode = service.getProjectCode();
109                 this.tags = service.getTags();
110                 this.uniqueId = service.getUniqueId();
111                 this.UUID = service.getUUID();
112                 this.version = service.getVersion();
113
114         }
115
116         public ServiceReqDetails() {
117                 contactId = "aa1234";
118                 projectCode = "12345";
119         }
120
121         public ServiceReqDetails(ServiceReqDetails a, String newServiceName) {
122                 a.setName(newServiceName);
123         }
124
125         @Override
126         public String toString() {
127                 return "ServiceDetails [name = " + name + ", category = " + getCategory() + ", tags = " + tags + ", description = "
128                                 + description + ", contactId = " + contactId + ", icon = " + icon + ", instantiation type = " + getInstantiationType() + "]";
129         }
130
131         public ServiceReqDetails(ServiceReqDetails aService) {
132                 this(aService.getName(), aService.getCategory(), (ArrayList<String>) aService.getTags(),
133                                 aService.getDescription(), aService.getContactId(), aService.getIcon(), aService.getInstantiationType());
134                 uniqueId = aService.getUniqueId();
135                 version = aService.getVersion();
136         }
137
138         public String getCategory() {
139                 if (categories != null && categories.size() >= 1) {
140                         return categories.get(0).getName();
141                 }
142                 return null;
143         }
144
145 }