Springboot 2.0 upgrade
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / BuildingBlockDetail.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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
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 java.io.Serializable;
24 import java.util.List;
25
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.EnumType;
30 import javax.persistence.Enumerated;
31 import javax.persistence.FetchType;
32 import javax.persistence.GeneratedValue;
33 import javax.persistence.GenerationType;
34 import javax.persistence.Id;
35 import javax.persistence.OneToMany;
36 import javax.persistence.Table;
37
38 import org.apache.commons.lang3.builder.EqualsBuilder;
39 import org.apache.commons.lang3.builder.HashCodeBuilder;
40 import org.apache.commons.lang3.builder.ToStringBuilder;
41 import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
42
43 import com.openpojo.business.annotation.BusinessKey;
44
45 @Entity
46 @Table(name = "building_block_detail")
47 public class BuildingBlockDetail implements Serializable {
48         private static final long serialVersionUID = -2375223199178059155L;
49         
50         @Id
51         @Column(name = "id")
52         @GeneratedValue(strategy = GenerationType.IDENTITY)
53         private Integer id;
54         
55         @BusinessKey
56         @Column(name = "BUILDING_BLOCK_NAME")
57         private String buildingBlockName;
58         
59         @Enumerated(EnumType.STRING)
60         @Column(name = "RESOURCE_TYPE")
61         private ResourceType resourceType;
62
63         @Enumerated(EnumType.STRING)
64         @Column(name = "TARGET_ACTION")
65         private OrchestrationAction targetAction;
66         
67         @Override
68         public String toString() {
69                 return new ToStringBuilder(this).append("buildingBlockName", buildingBlockName)
70                                 .append("resourceType", resourceType).append("targetAction", targetAction).toString();          
71         }
72         
73         @Override
74         public boolean equals(final Object other) {
75                 if (!(other instanceof BuildingBlockDetail)) {
76                         return false;
77                 }
78                 BuildingBlockDetail castOther = (BuildingBlockDetail) other;
79                 return new EqualsBuilder().append(buildingBlockName, castOther.buildingBlockName).isEquals();
80         }
81         
82         @Override
83         public int hashCode() {
84                 return new HashCodeBuilder().append(buildingBlockName).toHashCode();
85         }
86         
87         public Integer getId() {
88                 return id;
89         }
90
91         public void setId(Integer id) {
92                 this.id = id;
93         }
94         
95         public String getBuildingBlockName() {
96                 return buildingBlockName;
97         }
98
99         public void setBuildingBlockName(String buildingBlockName) {
100                 this.buildingBlockName = buildingBlockName;
101         }
102
103         public ResourceType getResourceType() {
104                 return resourceType;
105         }
106
107         public void setResourceType(ResourceType resourceType) {
108                 this.resourceType = resourceType;
109         }
110
111         public OrchestrationAction getTargetAction() {
112                 return targetAction;
113         }
114
115         public void setTargetAction(OrchestrationAction targetAction) {
116                 this.targetAction = targetAction;
117         }
118 }