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