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;
25 import java.sql.Timestamp;
26 import java.text.DateFormat;
28 import com.openpojo.business.annotation.BusinessKey;
30 import java.io.Serializable;
32 public class VnfComponent implements Serializable {
36 private String componentType = null;
37 private Integer heatTemplateId;
38 private Integer heatEnvironmentId;
39 public static final long serialVersionUID = -1322322139926390329L;
41 private Timestamp created = null;
43 public VnfComponent() {}
45 public int getVnfId() {
48 public void setVnfId(int id) {
52 public String getComponentType() {
55 public void setComponentType(String ct) {
56 this.componentType = ct;
59 public Integer getHeatTemplateId() {
60 return heatTemplateId;
62 public void setHeatTemplateId(Integer ht) {
63 this.heatTemplateId = ht;
66 public Integer getHeatEnvironmentId() {
67 return heatEnvironmentId;
69 public void setHeatEnvironmentId(Integer he) {
70 this.heatEnvironmentId = he;
73 public Timestamp getCreated() {
77 public void setCreated(Timestamp created) {
78 this.created = created;
82 public String toString() {
83 StringBuilder sb = new StringBuilder();
84 sb.append("VnfComponent: ");
85 sb.append("vnfId=").append(vnfId);
86 sb.append(",componentType=").append(componentType);
87 sb.append(",heatTemplateId=").append(heatTemplateId);
88 sb.append(",heatEnvironmentId=").append(heatEnvironmentId);
90 if (created != null) {
91 sb.append (",created=");
92 sb.append (DateFormat.getInstance().format(created));
98 public boolean equals (Object o) {
99 if (!(o instanceof VnfComponent)) {
105 VnfComponent vnfComponent = (VnfComponent) o;
106 if (vnfComponent.getVnfId() == this.vnfId && vnfComponent.componentType.equalsIgnoreCase(this.componentType)) {
113 public int hashCode () {
114 // return the hashCode of the concat string of type+vnfId - should be okay.
116 result = (this.componentType + this.vnfId).hashCode();