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;
26 import java.util.Date;
28 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
29 import org.openecomp.mso.logger.MsoLogger;
31 public class ServiceRecipe extends MavenLikeVersioning implements Serializable {
33 private static final long serialVersionUID = 768026109321305392L;
36 private String serviceModelUUID;
37 private String action;
38 private String description;
39 private String orchestrationUri;
40 private String serviceParamXSD;
41 private int recipeTimeout;
42 private Integer serviceTimeoutInterim;
43 private Timestamp created;
45 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
47 // This 'default' CTR is now needed for backward compatibility since a new CTR was added below
48 public ServiceRecipe() {
52 // This CTR is needed by the HQL SELECT JOIN between the SERVICE and SERVICE_RECIPE tables
53 // in CatalogDatabase::getServiceRecipe()
54 public ServiceRecipe(int id, String serviceModelUUID, String action,
55 String description, String orchestrationUri,
56 String serviceParamXSD, int recipeTimeout,
57 int serviceTimeoutInterim, Date created) {
59 LOGGER.debug("ServiceRecipe id=" + id + ", serviceModelUUID=" + serviceModelUUID + ", action=" + action + ", description=" + description +
60 ", orchestrationUri=" + orchestrationUri + ", serviceParamXSD=" + serviceParamXSD +
61 ", recipeTimeout=" + recipeTimeout + ", serviceTimeoutInterim=" + serviceTimeoutInterim + ", created=" + created);
63 this.serviceModelUUID = serviceModelUUID;
65 this.description = description;
66 this.orchestrationUri = orchestrationUri;
67 this.serviceParamXSD = serviceParamXSD;
68 this.recipeTimeout = recipeTimeout;
69 this.serviceTimeoutInterim = serviceTimeoutInterim;
70 long date = created.getTime();
71 this.created = new Timestamp(date);
77 public void setId(int id) {
81 public String getServiceModelUUID() {
82 return serviceModelUUID;
84 public void setServiceModelUUID(String serviceModelUUID) {
85 this.serviceModelUUID = serviceModelUUID;
88 public String getAction() {
91 public void setAction(String action) {
95 public String getDescription() {
98 public void setDescription(String description) {
99 this.description = description;
102 public String getOrchestrationUri() {
103 return orchestrationUri;
105 public void setOrchestrationUri(String orchestrationUri) {
106 this.orchestrationUri = orchestrationUri;
109 public String getServiceParamXSD() {
110 return serviceParamXSD;
112 public void setServiceParamXSD(String serviceParamXSD) {
113 this.serviceParamXSD = serviceParamXSD;
116 public int getRecipeTimeout() {
117 return recipeTimeout;
119 public void setRecipeTimeout(int recipeTimeout) {
120 this.recipeTimeout = recipeTimeout;
123 public Integer getServiceTimeoutInterim() {
124 return serviceTimeoutInterim;
127 public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) {
128 this.serviceTimeoutInterim = serviceTimeoutInterim;
131 public Timestamp getCreated() {
135 public void setCreated(Timestamp created) {
136 this.created = created;
140 public String toString() {
141 StringBuilder sb = new StringBuilder();
142 sb.append("RECIPE: " + action);
143 sb.append(",uri=" + orchestrationUri);
144 if (created != null) {
145 sb.append (",created=");
146 sb.append (DateFormat.getInstance().format(created));
148 return sb.toString();