aboutsummaryrefslogtreecommitdiffstats
path: root/ccsdk-app-common/src/main/java/org/onap/ccsdk/dashboard/model/inventory/ServiceTypeRequest.java
blob: 42dd018ab6d34de2a965b3530ca91f988af141a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package org.onap.ccsdk.dashboard.model.inventory;

import java.util.Collection;
import java.util.Optional;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class ServiceTypeRequest {

	/** Owner of the Service Type */
	public String owner;
	/** Name of the Service Type */
	public String typeName;
	/** Version number of the Service Type */
	public Integer typeVersion;
	/** String representation of a Cloudify blueprint with unbound variables */
	public String blueprintTemplate;
	/** controller application name */
	public String application;
	/** onboarding component name */
	public String component;
	/** 
	 * Collection of service ids used to associate with the Service Type.
	 * Service Types with this property as null or empty means they apply for every service id.
	 */
	public Collection<String> serviceIds;
	/** Collection of vnfTypes associated with the Service Type */
	public Collection<String> vnfTypes;
	/**
	 * Collection of service locations that are used to associate with the Service Type.
	 * Service Types with this property as null or empty means they apply for every service location.
	 */
	public Collection<String> serviceLocations;
	/** 
	 * Id of the service this Service Type is associated with. 
	 * Value source is from ASDC's notification event's field 'serviceInvariantUUID'." 
	 * */
	public Optional<String> asdcServiceId;
	/**
	 * Id of the vf/vnf instance this Service Type is associated with.
	 * Value source is from ASDC's notification event's field 'resourceInvariantUUID'."
	 */
	public Optional<String> asdcResourceId;
	/** URL to the ASDC Service Model */
	public Optional<String> asdcServiceURL;

	@JsonCreator
	public ServiceTypeRequest (@JsonProperty("owner") String owner, 
			@JsonProperty("typeName") String typeName, 
			@JsonProperty("typeVersion") Integer typeVersion, 
			@JsonProperty("blueprintTemplate") String blueprintTemplate,
			@JsonProperty("application") String application,
			@JsonProperty("component") String component,
			@JsonProperty("serviceIds") Collection<String> serviceIds, 
			@JsonProperty("vnfTypes") Collection<String> vnfTypes, 
			@JsonProperty("serviceLocations") Collection<String> serviceLocations, 
			@JsonProperty("asdcServiceId") String asdcServiceId, 
			@JsonProperty("asdcResourceId") String asdcResourceId, 
			@JsonProperty("asdcServiceURL") String asdcServiceURL) {
		this(owner, typeName, typeVersion, blueprintTemplate,
			application, component,
			serviceIds, vnfTypes, serviceLocations,
			Optional.ofNullable(asdcServiceId),
			Optional.ofNullable(asdcResourceId),
			Optional.ofNullable(asdcServiceURL));
	}

	public ServiceTypeRequest(String owner,
							String typeName,
							Integer typeVersion,
							String blueprintTemplate,
							String application,
							String component,
							Collection<String> serviceIds,
							Collection<String> vnfTypes,
							Collection<String> serviceLocations,
							Optional<String> asdcServiceId,
							Optional<String> asdcResourceId,
							Optional<String> asdcServiceURL) {
		this.owner = owner;
		this.typeName = typeName;
		this.typeVersion = typeVersion;
		this.blueprintTemplate = blueprintTemplate;
		this.application = application;
		this.component = component;
		this.serviceIds = serviceIds;
		this.vnfTypes = vnfTypes;
		this.serviceLocations = serviceLocations;
		this.asdcServiceId = asdcServiceId;
		this.asdcResourceId = asdcResourceId;
		this.asdcServiceURL = asdcServiceURL;
	}

	public static ServiceTypeRequest from(ServiceType serviceType) {
		return new ServiceTypeRequest(
			serviceType.getOwner(),
			serviceType.getTypeName(),
			serviceType.getTypeVersion(),
			serviceType.getBlueprintTemplate(),
			serviceType.getApplication(),
			serviceType.getComponent(),
			serviceType.getServiceIds(),
			serviceType.getVnfTypes(),
			serviceType.getServiceLocations(),
			serviceType.getAsdcServiceId(),
			serviceType.getAsdcResourceId(),
			serviceType.getAsdcServiceURL()
		);
	}
	
	public String getBlueprintTemplate() {
		return this.blueprintTemplate;
	}
}