Switch over BBRollback to use DB lookups.
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / BuildingBlockRollback.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2021 Bell Canada. 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import com.openpojo.business.annotation.BusinessKey;
25 import java.io.Serializable;
26 import java.util.Objects;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.Table;
33 import uk.co.blackpepper.bowman.annotation.RemoteResource;
34
35 @Entity
36 @RemoteResource("/buildingBlockRollback")
37 @Table(name = "building_block_rollback")
38 public class BuildingBlockRollback implements Serializable {
39
40     private static final long serialVersionUID = 1;
41
42     @Id
43     @BusinessKey
44     @GeneratedValue(strategy = GenerationType.IDENTITY)
45     @Column(name = "ID", nullable = false, updatable = false)
46     private Integer id;
47
48     @BusinessKey
49     @JsonProperty("building_block_name")
50     @Column(name = "BUILDING_BLOCK_NAME", nullable = false, length = 200)
51     private String buildingBlockName;
52
53     @BusinessKey
54     @JsonProperty("action")
55     @Column(name = "ACTION", length = 200)
56     private String action;
57
58     @BusinessKey
59     @JsonProperty("rollback_building_block_name")
60     @Column(name = "ROLLBACK_BUILDING_BLOCK_NAME", nullable = false, length = 200)
61     private String rollbackBuildingBlockName;
62
63     @BusinessKey
64     @JsonProperty("rollback_action")
65     @Column(name = "ROLLBACK_ACTION", length = 200)
66     private String rollbackAction;
67
68     public BuildingBlockRollback() {}
69
70     public BuildingBlockRollback(Integer id, String buildingBlockName, String action, String rollbackBuildingBlockName,
71             String rollbackAction) {
72         this.id = id;
73         this.buildingBlockName = buildingBlockName;
74         this.action = action;
75         this.rollbackBuildingBlockName = rollbackBuildingBlockName;
76         this.rollbackAction = rollbackAction;
77     }
78
79     public Integer getId() {
80         return id;
81     }
82
83     public void setId(Integer id) {
84         this.id = id;
85     }
86
87     public String getBuildingBlockName() {
88         return buildingBlockName;
89     }
90
91     public void setBuildingBlockName(String buildingBlockName) {
92         this.buildingBlockName = buildingBlockName;
93     }
94
95     public String getAction() {
96         return action;
97     }
98
99     public void setAction(String action) {
100         this.action = action;
101     }
102
103     public String getRollbackBuildingBlockName() {
104         return rollbackBuildingBlockName;
105     }
106
107     public void setRollbackBuildingBlockName(String rollbackBuildingBlockName) {
108         this.rollbackBuildingBlockName = rollbackBuildingBlockName;
109     }
110
111     public String getRollbackAction() {
112         return rollbackAction;
113     }
114
115     public void setRollbackAction(String rollbackAction) {
116         this.rollbackAction = rollbackAction;
117     }
118
119     @Override
120     public boolean equals(Object o) {
121         if (this == o) {
122             return true;
123         }
124         if (o == null || getClass() != o.getClass()) {
125             return false;
126         }
127         BuildingBlockRollback that = (BuildingBlockRollback) o;
128         return id.equals(that.id) && buildingBlockName.equals(that.buildingBlockName)
129                 && Objects.equals(action, that.action)
130                 && rollbackBuildingBlockName.equals(that.rollbackBuildingBlockName)
131                 && Objects.equals(rollbackAction, that.rollbackAction);
132     }
133
134     @Override
135     public int hashCode() {
136         return Objects.hash(id, buildingBlockName, action, rollbackBuildingBlockName, rollbackAction);
137     }
138
139     @Override
140     public String toString() {
141         return "BuildingBlockRollback{" + "id='" + id + '\'' + ", buildingBlockName='" + buildingBlockName + '\''
142                 + ", action='" + action + '\'' + ", rollbackBuildingBlockName='" + rollbackBuildingBlockName + '\''
143                 + ", rollbackAction='" + rollbackAction + '\'' + '}';
144     }
145 }