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