Merge "Add subscription for notifications"
[so.git] / cloudify-client / src / main / java / org / onap / so / cloudify / v3 / model / Blueprint.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.onap.so.cloudify.v3.model;
22
23 import java.io.IOException;
24 import java.io.Serializable;
25 import java.util.Date;
26 import java.util.Map;
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
29 import com.fasterxml.jackson.annotation.JsonProperty;
30 import com.fasterxml.jackson.databind.ObjectMapper;
31
32 @JsonIgnoreProperties(ignoreUnknown = true)
33 // @JsonRootName("blueprint")
34 public class Blueprint implements Serializable {
35
36
37     /**
38      * 
39      */
40     private static final long serialVersionUID = 938604986548763151L;
41
42     @JsonProperty("created_at")
43     private Date createdAt;
44
45     @JsonProperty("description")
46     private String description;
47
48     @JsonProperty("id")
49     private String id;
50
51     @JsonProperty("main_file_name")
52     private String mainFileName;
53
54     @JsonProperty("plan")
55     private Map<String, Object> plan = null;
56
57     @JsonProperty("tenant_name")
58     private String tenantName;
59
60     @JsonProperty("updated_at")
61     private Date updatedAt;
62
63     public Date getCreatedAt() {
64         return createdAt;
65     }
66
67     public void setCreatedAt(Date createdAt) {
68         this.createdAt = createdAt;
69     }
70
71     public String getDescription() {
72         return description;
73     }
74
75     public void setDescription(String description) {
76         this.description = description;
77     }
78
79     public String getId() {
80         return id;
81     }
82
83     public void setId(String id) {
84         this.id = id;
85     }
86
87     public String getMainFileName() {
88         return mainFileName;
89     }
90
91     public void setMainFileName(String mainFileName) {
92         this.mainFileName = mainFileName;
93     }
94
95     public Map<String, Object> getPlan() {
96         return this.plan;
97     }
98
99     public void setPlan(Map<String, Object> plan) {
100         this.plan = plan;
101     }
102
103     public String getTenantName() {
104         return tenantName;
105     }
106
107     public void setTenantName(String tenantName) {
108         this.tenantName = tenantName;
109     }
110
111     public Date getUpdatedAt() {
112         return updatedAt;
113     }
114
115     public void setUpdatedAt(Date updatedAt) {
116         this.updatedAt = updatedAt;
117     }
118
119
120     /*
121      * Return an output as a Json-mapped Object of the provided type. This is useful for json-object outputs.
122      */
123     public <T> T getMapValue(Map<String, Object> map, String key, Class<T> type) {
124
125         ObjectMapper mapper = new ObjectMapper();
126
127         if (map.containsKey(key)) {
128             try {
129                 String s = mapper.writeValueAsString(map.get(key));
130                 return (mapper.readValue(s, type));
131             } catch (IOException e) {
132                 return null;
133             }
134         }
135         return null;
136     }
137
138     @Override
139     public String toString() {
140         return "Deployment{" + "id='" + id + '\'' + ", description='" + description + '\'' + ", createdAt=" + createdAt
141                 + ", updatedAt=" + updatedAt + ", mainFileName='" + mainFileName + '\'' + ", tenantName='" + tenantName
142                 + '\'' + '}';
143     }
144
145     /*
146      * Add a definition of the Cloudify "plan" attribute once we know what it is.
147      * 
148      * @JsonIgnoreProperties(ignoreUnknown=true) public static final class Plan { }
149      * 
150      */
151
152
153 }