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