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.db.catalog.beans;
23 import java.io.Serializable;
24 import java.sql.Timestamp;
25 import java.text.DateFormat;
28 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
30 public class HeatTemplate extends MavenLikeVersioning implements Serializable {
32 private static final long serialVersionUID = 768026109321305392L;
34 private String artifactUuid = null;
35 private String templateName = null;
36 private String templateBody = null;
37 private int timeoutMinutes;
38 private Set <HeatTemplateParam> parameters;
39 private Set <HeatNestedTemplate> files;
40 private String description = null;
41 private String asdcUuid = null;
42 private String artifactChecksum = null;
44 private Timestamp created = null;
46 public enum TemplateStatus {
47 PARENT, CHILD, PARENT_COMPLETE
50 public HeatTemplate () {
53 public String getArtifactUuid() {
54 return this.artifactUuid;
57 public void setArtifactUuid (String artifactUuid) {
58 this.artifactUuid = artifactUuid;
61 public String getTemplateName () {
65 public void setTemplateName (String templateName) {
66 this.templateName = templateName;
69 public String getTemplateBody () {
73 public void setTemplateBody (String templateBody) {
74 this.templateBody = templateBody;
77 public int getTimeoutMinutes () {
78 return timeoutMinutes;
81 public void setTimeoutMinutes (int timeout) {
82 this.timeoutMinutes = timeout;
85 public Set <HeatTemplateParam> getParameters () {
89 public void setParameters (Set <HeatTemplateParam> parameters) {
90 this.parameters = parameters;
93 public String getDescription() {
97 public void setDescription(String description) {
98 this.description = description;
101 public String getHeatTemplate () {
102 return this.templateBody;
105 public void setFiles (Set <HeatNestedTemplate> files) {
109 public Set <HeatNestedTemplate> getFiles () {
113 public String getAsdcUuid() {
117 public void setAsdcUuid(String asdcUuidp) {
118 this.asdcUuid = asdcUuidp;
121 public String getArtifactChecksum() {
122 return artifactChecksum;
125 public void setArtifactChecksum(String artifactChecksum) {
126 this.artifactChecksum = artifactChecksum;
129 public Timestamp getCreated() {
133 public void setCreated(Timestamp created) {
134 this.created = created;
138 public String toString () {
139 String body = (templateBody != null) ? "(" + templateBody.length () + " chars)" : "(Not defined)";
140 StringBuilder sb = new StringBuilder ();
141 sb.append ("Template=")
142 .append (templateName)
143 .append (",version=")
147 .append (",timeout=")
148 .append (timeoutMinutes)
149 .append (",asdcUuid=")
151 .append (",description=")
152 .append (description);
153 if (created != null) {
154 sb.append (",created=");
155 sb.append (DateFormat.getInstance().format(created));
159 if (parameters != null && !parameters.isEmpty ()) {
160 sb.append (",params=[");
161 for (HeatTemplateParam param : parameters) {
162 sb.append (param.getParamName ());
163 if (param.isRequired ()) {
164 sb.append ("(reqd)");
168 sb.replace (sb.length () - 1, sb.length (), "]");
170 return sb.toString ();