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;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.PrePersist;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 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;
37 import com.openpojo.business.annotation.BusinessKey;
38 import uk.co.blackpepper.bowman.annotation.RemoteResource;
41 @RemoteResource("/vnfRecipe")
42 @Table(name = "vnf_recipe")
43 public class VnfRecipe implements Serializable, Recipe {
45 private static final long serialVersionUID = 768026109321305392L;
49 @GeneratedValue(strategy = GenerationType.IDENTITY)
53 @Column(name = "NF_ROLE")
54 private String nfRole;
56 @Column(name = "VNF_PARAM_XSD")
57 private String paramXsd;
59 @Column(name = "VF_MODULE_ID")
60 private String vfModuleId;
63 @Column(name = "ACTION")
64 protected String action;
66 @Column(name = "description")
67 private String description;
70 @Column(name = "ORCHESTRATION_URI")
71 protected String orchestrationUri;
73 @Column(name = "RECIPE_TIMEOUT")
74 private Integer recipeTimeout;
76 @Column(name = "VERSION_STR")
77 private String versionStr;
80 @Column(name = "SERVICE_TYPE")
81 private String serviceType;
83 @Column(name = "CREATION_TIMESTAMP", updatable = false)
84 @Temporal(TemporalType.TIMESTAMP)
88 protected void onCreate() {
89 this.created = new Date();
93 public String toString() {
94 return new ToStringBuilder(this).append("id", id).append("vnfType", nfRole).append("paramXsd", paramXsd)
95 .append("vfModuleId", vfModuleId).append("action", action).append("description", description)
96 .append("orchestrationUri", orchestrationUri).append("recipeTimeout", recipeTimeout)
97 .append("serviceType", serviceType).append("created", created).toString();
101 public boolean equals(final Object other) {
102 if (!(other instanceof VnfRecipe)) {
105 VnfRecipe castOther = (VnfRecipe) other;
106 return new EqualsBuilder().append(nfRole, castOther.nfRole).append(action, castOther.action)
107 .append(orchestrationUri, castOther.orchestrationUri).append(serviceType, castOther.serviceType)
112 public int hashCode() {
113 return new HashCodeBuilder().append(nfRole).append(action).append(orchestrationUri).append(serviceType)
117 public String getNfRole() {
121 public void setNfRole(String nfRole) {
122 this.nfRole = nfRole;
126 public String getParamXsd() {
130 public void setParamXsd(String paramXsd) {
131 this.paramXsd = paramXsd;
134 public String getVfModuleId() {
138 public void setVfModuleId(String vfModuleId) {
139 this.vfModuleId = vfModuleId;
143 public Integer getId() {
147 public void setId(Integer id) {
152 public String getAction() {
156 public void setAction(String action) {
157 this.action = action;
161 public String getDescription() {
165 public void setDescription(String description) {
166 this.description = description;
170 public String getOrchestrationUri() {
171 return orchestrationUri;
174 public void setOrchestrationUri(String orchestrationUri) {
175 this.orchestrationUri = orchestrationUri;
179 public Integer getRecipeTimeout() {
180 return recipeTimeout;
183 public void setRecipeTimeout(Integer recipeTimeout) {
184 this.recipeTimeout = recipeTimeout;
187 public String getServiceType() {
191 public void setServiceType(String serviceType) {
192 this.serviceType = serviceType;
195 public Date getCreated() {
199 public String getVersionStr() {
203 public void setVersionStr(String versionStr) {
204 this.versionStr = versionStr;