2ba8aa7aea2dae31b723ef5c68570fb06339bf2d
[ccsdk/dashboard.git] /
1 /*******************************************************************************
2  * =============LICENSE_START=========================================================
3  *
4  * =================================================================================
5  *  Copyright (c) 2019 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  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  *******************************************************************************/
22 package org.onap.ccsdk.dashboard.model.inventory;
23
24 import java.util.Collection;
25 import java.util.Optional;
26
27 import com.fasterxml.jackson.annotation.JsonCreator;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29
30 public class ServiceTypeUploadRequest {
31
32     /** Owner of the Service Type */
33     public String owner;
34     /** Name of the Service Type */
35     public String typeName;
36     /** Version number of the Service Type */
37     public Integer typeVersion;
38     /** String representation of a Cloudify blueprint with unbound variables */
39     public String blueprintTemplate;
40     /** Application controller name */
41     public String application;
42     /** onboarding component name */
43     public String component;
44
45     @JsonCreator
46     public ServiceTypeUploadRequest(@JsonProperty("owner") String owner, @JsonProperty("typeName") String typeName,
47             @JsonProperty("typeVersion") Integer typeVersion,
48             @JsonProperty("blueprintTemplate") String blueprintTemplate,
49             @JsonProperty("application") String application, @JsonProperty("component") String component) {
50         this.owner = owner;
51         this.typeName = typeName;
52         this.typeVersion = typeVersion;
53         this.blueprintTemplate = blueprintTemplate;
54         this.application = application;
55         this.component = component;
56     }
57
58     public static ServiceTypeUploadRequest from(ServiceType serviceType) {
59         return new ServiceTypeUploadRequest(serviceType.getOwner(), serviceType.getTypeName(),
60                 serviceType.getTypeVersion(), serviceType.getBlueprintTemplate(), serviceType.getApplication(),
61                 serviceType.getComponent());
62     }
63
64     public String getBlueprintTemplate() {
65         return this.blueprintTemplate;
66
67     }
68 }