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;
26 import java.sql.Timestamp;
27 import java.text.DateFormat;
28 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
29 import java.util.Date;
30 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
31 import org.openecomp.mso.logger.MsoLogger;
33 public class ServiceRecipe extends MavenLikeVersioning {
35 private int serviceId;
36 private String action;
37 private String description;
38 private String orchestrationUri;
39 private String serviceParamXSD;
40 private int recipeTimeout;
41 private Integer serviceTimeoutInterim;
43 private Timestamp created;
46 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
48 // This 'default' CTR is now needed for backward compatibility since a new CTR was added below
49 public ServiceRecipe() {
53 // This CTR is needed by the HQL SELECT JOIN between the SERVICE and SERVICE_RECIPE tables
54 // in CatalogDatabase::getServiceRecipe()
55 public ServiceRecipe(int id, int serviceId, String action,
56 String description, String orchestrationUri,
57 String serviceParamXSD, int recipeTimeout,
58 int serviceTimeoutInterim, Date created) {
60 LOGGER.debug("ServiceRecipe id=" + id + ", serviceId=" + serviceId + ", action=" + action + ", description=" + description +
61 ", orchestrationUri=" + orchestrationUri + ", serviceParamXSD=" + serviceParamXSD +
62 ", recipeTimeout=" + recipeTimeout + ", serviceTimeoutInterim=" + serviceTimeoutInterim + ", created=" + created);
64 this.serviceId = serviceId;
66 this.description = description;
67 this.orchestrationUri = orchestrationUri;
68 this.serviceParamXSD = serviceParamXSD;
69 this.recipeTimeout = recipeTimeout;
70 this.serviceTimeoutInterim = serviceTimeoutInterim;
71 long date = created.getTime();
72 this.created = new Timestamp(date);
78 public void setId(int id) {
82 public int getServiceId() {
85 public void setServiceId(int serviceId) {
86 this.serviceId = serviceId;
89 public String getAction() {
92 public void setAction(String action) {
96 public String getDescription() {
99 public void setDescription(String description) {
100 this.description = description;
103 public String getOrchestrationUri() {
104 return orchestrationUri;
106 public void setOrchestrationUri(String orchestrationUri) {
107 this.orchestrationUri = orchestrationUri;
110 public String getServiceParamXSD() {
111 return serviceParamXSD;
113 public void setServiceParamXSD(String serviceParamXSD) {
114 this.serviceParamXSD = serviceParamXSD;
117 public int getRecipeTimeout() {
118 return recipeTimeout;
120 public void setRecipeTimeout(int recipeTimeout) {
121 this.recipeTimeout = recipeTimeout;
124 public Integer getServiceTimeoutInterim() {
125 return serviceTimeoutInterim;
128 public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) {
129 this.serviceTimeoutInterim = serviceTimeoutInterim;
132 public Timestamp getCreated() {
136 public void setCreated(Timestamp created) {
137 this.created = created;
141 public String toString() {
142 StringBuilder sb = new StringBuilder();
143 sb.append("RECIPE: " + action);
144 sb.append(",uri=" + orchestrationUri);
145 if (created != null) {
146 sb.append (",created=");
147 sb.append (DateFormat.getInstance().format(created));
149 return sb.toString();