2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.mso.cloudify.v3.model;
23 import java.io.IOException;
24 import java.io.Serializable;
25 import java.util.Date;
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;
33 @JsonIgnoreProperties(ignoreUnknown = true)
34 //@JsonRootName("blueprint")
35 public class Blueprint implements Serializable {
37 private static final long serialVersionUID = 1L;
39 @JsonProperty("created_at")
40 private Date createdAt;
42 @JsonProperty("description")
43 private String description;
48 @JsonProperty("main_file_name")
49 private String mainFileName;
52 private Map<String, Object> plan = null;
54 @JsonProperty("tenant_name")
55 private String tenantName;
57 @JsonProperty("updated_at")
58 private Date updatedAt;
60 // ObjectMapper instance to parse Json stack outputs
62 private static ObjectMapper mapper = new ObjectMapper();
64 public Date getCreatedAt() {
68 public void setCreatedAt(Date createdAt) {
69 this.createdAt = createdAt;
72 public String getDescription() {
76 public void setDescription(String description) {
77 this.description = description;
80 public String getId() {
84 public void setId(String id) {
88 public String getMainFileName() {
92 public void setMainFileName(String mainFileName) {
93 this.mainFileName = mainFileName;
96 public Map<String, Object> getPlan() {
100 public void setPlan(Map<String, Object> plan) {
104 public String getTenantName() {
108 public void setTenantName(String tenantName) {
109 this.tenantName = tenantName;
112 public Date getUpdatedAt() {
116 public void setUpdatedAt(Date updatedAt) {
117 this.updatedAt = updatedAt;
122 * Return an output as a Json-mapped Object of the provided type.
123 * This is useful for json-object outputs.
125 public <T> T getMapValue (Map<String,Object> map, String key, Class<T> type)
127 if (map.containsKey(key)) {
129 String s = mapper.writeValueAsString(map.get(key));
130 return (mapper.readValue(s, type));
132 catch (IOException e) {
140 public String toString() {
141 return "Deployment{" +
143 ", description='" + description + '\'' +
144 ", createdAt=" + createdAt +
145 ", updatedAt=" + updatedAt +
146 ", mainFileName='" + mainFileName + '\'' +
147 ", tenantName='" + tenantName + '\'' +
151 /* Add a definition of the Cloudify "plan" attribute once we know what it is.
153 @JsonIgnoreProperties(ignoreUnknown=true)
154 public static final class Plan {