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 java.io.Serializable;
30 public class VnfComponent implements Serializable {
32 private String componentType = null;
33 private Integer heatTemplateId;
34 private Integer heatEnvironmentId;
35 public static final long serialVersionUID = -1322322139926390329L;
37 private Timestamp created;
39 public VnfComponent() {}
41 public int getVnfId() {
44 public void setVnfId(int id) {
48 public String getComponentType() {
51 public void setComponentType(String ct) {
52 this.componentType = ct;
55 public Integer getHeatTemplateId() {
56 return heatTemplateId;
58 public void setHeatTemplateId(Integer ht) {
59 this.heatTemplateId = ht;
62 public Integer getHeatEnvironmentId() {
63 return heatEnvironmentId;
65 public void setHeatEnvironmentId(Integer he) {
66 this.heatEnvironmentId = he;
69 public Timestamp getCreated() {
73 public void setCreated(Timestamp created) {
74 this.created = created;
78 public String toString() {
79 StringBuilder sb = new StringBuilder();
80 sb.append("VnfComponent: ");
81 sb.append("vnfId=" + vnfId);
82 sb.append(",componentType=" + componentType);
83 sb.append(",heatTemplateId=" + heatTemplateId);
84 sb.append(",heatEnvironmentId=" + heatEnvironmentId);
86 if (created != null) {
87 sb.append (",created=");
88 sb.append (DateFormat.getInstance().format(created));
94 public boolean equals (Object o) {
95 if (!(o instanceof VnfComponent)) {
101 VnfComponent vnfComponent = (VnfComponent) o;
102 if (vnfComponent.getVnfId() == this.vnfId && vnfComponent.componentType.equalsIgnoreCase(this.componentType)) {
109 public int hashCode () {
110 // return the hashCode of the concat string of type+vnfId - should be okay.
112 result = (this.componentType + this.vnfId).toString().hashCode();