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.onap.so.db.catalog.beans;
23 import java.io.Serializable;
24 import java.util.Date;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.Id;
29 import javax.persistence.PrePersist;
30 import javax.persistence.Table;
31 import javax.persistence.Temporal;
32 import javax.persistence.TemporalType;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
38 import com.openpojo.business.annotation.BusinessKey;
41 @Table(name = "service_recipe")
42 public class ServiceRecipe implements Serializable, Recipe {
44 private static final long serialVersionUID = 768026109321305392L;
51 @Column(name = "SERVICE_MODEL_UUID")
52 private String serviceModelUUID;
55 @Column(name = "ACTION")
56 private String action;
58 @Column(name = "description")
59 private String description;
62 @Column(name = "ORCHESTRATION_URI")
63 private String orchestrationUri;
65 @Column(name = "SERVICE_PARAM_XSD")
66 private String paramXsd;
68 @Column(name = "RECIPE_TIMEOUT")
69 private Integer recipeTimeout;
71 @Column(name = "SERVICE_TIMEOUT_INTERIM")
72 private Integer serviceTimeoutInterim;
74 @Column(name = "CREATION_TIMESTAMP", updatable = false)
75 @Temporal(TemporalType.TIMESTAMP)
79 protected void onCreate() {
80 this.created = new Date();
84 public String toString() {
85 return new ToStringBuilder(this).append("id", id).append("serviceModelUUID", serviceModelUUID)
86 .append("action", action).append("description", description)
87 .append("orchestrationUri", orchestrationUri).append("serviceParamXSD", paramXsd)
88 .append("recipeTimeout", recipeTimeout).append("serviceTimeoutInterim", serviceTimeoutInterim)
89 .append("created", created).toString();
93 public boolean equals(final Object other) {
94 if (!(other instanceof ServiceRecipe)) {
97 ServiceRecipe castOther = (ServiceRecipe) other;
98 return new EqualsBuilder().append(serviceModelUUID, castOther.serviceModelUUID).append(action, castOther.action)
99 .append(orchestrationUri, castOther.orchestrationUri).isEquals();
103 public int hashCode() {
104 return new HashCodeBuilder().append(serviceModelUUID).append(action).append(orchestrationUri).toHashCode();
107 // This 'default' CTR is now needed for backward compatibility since a new
108 // CTR was added below
109 public ServiceRecipe() {
113 public Integer getId() {
117 public void setId(Integer id) {
121 public void setCreated(Date created) {
122 this.created = created;
125 public String getServiceModelUUID() {
126 return serviceModelUUID;
129 public void setServiceModelUUID(String serviceModelUUID) {
130 this.serviceModelUUID = serviceModelUUID;
133 public String getAction() {
137 public void setAction(String action) {
138 this.action = action;
141 public String getDescription() {
145 public void setDescription(String description) {
146 this.description = description;
149 public String getOrchestrationUri() {
150 return orchestrationUri;
153 public void setOrchestrationUri(String orchestrationUri) {
154 this.orchestrationUri = orchestrationUri;
157 public String getParamXsd() {
161 public void setParamXsd(String paramXsd) {
162 this.paramXsd = paramXsd;
165 public Integer getRecipeTimeout() {
166 return recipeTimeout;
169 public void setRecipeTimeout(Integer recipeTimeout) {
170 this.recipeTimeout = recipeTimeout;
173 public Integer getServiceTimeoutInterim() {
174 return serviceTimeoutInterim;
177 public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) {
178 this.serviceTimeoutInterim = serviceTimeoutInterim;
181 public Date getCreated() {