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