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;
29 import org.openecomp.mso.logger.MsoLogger;
31 public class HeatTemplate extends MavenLikeVersioning implements Serializable {
33 private static final long serialVersionUID = 768026109321305392L;
35 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
37 private String artifactUuid;
38 private String templateName;
39 private String templateBody = null;
40 private int timeoutMinutes;
41 private Set <HeatTemplateParam> parameters;
42 private Set <HeatNestedTemplate> files;
43 private String description;
44 private String asdcUuid;
45 private String artifactChecksum;
47 private Timestamp created;
49 public enum TemplateStatus {
50 PARENT, CHILD, PARENT_COMPLETE
53 public HeatTemplate () {
56 public String getArtifactUuid() {
57 return this.artifactUuid;
60 public void setArtifactUuid (String artifactUuid) {
61 this.artifactUuid = artifactUuid;
64 public String getTemplateName () {
68 public void setTemplateName (String templateName) {
69 this.templateName = templateName;
72 public String getTemplateBody () {
76 public void setTemplateBody (String templateBody) {
77 this.templateBody = templateBody;
80 public int getTimeoutMinutes () {
81 return timeoutMinutes;
84 public void setTimeoutMinutes (int timeout) {
85 this.timeoutMinutes = timeout;
88 public Set <HeatTemplateParam> getParameters () {
92 public void setParameters (Set <HeatTemplateParam> parameters) {
93 this.parameters = parameters;
96 public String getDescription() {
100 public void setDescription(String description) {
101 this.description = description;
104 public String getHeatTemplate () {
105 return this.templateBody;
108 public void setFiles (Set <HeatNestedTemplate> files) {
112 public Set <HeatNestedTemplate> getFiles () {
116 public String getAsdcUuid() {
120 public void setAsdcUuid(String asdcUuidp) {
121 this.asdcUuid = asdcUuidp;
124 public String getArtifactChecksum() {
125 return artifactChecksum;
128 public void setArtifactChecksum(String artifactChecksum) {
129 this.artifactChecksum = artifactChecksum;
132 public Timestamp getCreated() {
136 public void setCreated(Timestamp created) {
137 this.created = created;
141 public String toString () {
142 String body = (templateBody != null) ? "(" + templateBody.length () + " chars)" : "(Not defined)";
143 StringBuilder sb = new StringBuilder ();
144 sb.append ("Template=")
145 .append (templateName)
146 .append (",version=")
150 .append (",timeout=")
151 .append (timeoutMinutes)
152 .append (",asdcUuid=")
154 .append (",description=")
155 .append (description);
156 if (created != null) {
157 sb.append (",created=");
158 sb.append (DateFormat.getInstance().format(created));
162 if (parameters != null && !parameters.isEmpty ()) {
163 sb.append (",params=[");
164 for (HeatTemplateParam param : parameters) {
165 sb.append (param.getParamName ());
166 if (param.isRequired ()) {
167 sb.append ("(reqd)");
171 sb.replace (sb.length () - 1, sb.length (), "]");
173 return sb.toString ();