Springboot 2.0 upgrade
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / macro / OrchestrationFlow.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
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.macro;
22
23 import java.io.Serializable;
24
25 import javax.persistence.CascadeType;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.FetchType;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.Table;
35
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39 import org.onap.so.db.catalog.beans.BuildingBlockDetail;
40
41 import com.openpojo.business.annotation.BusinessKey;
42
43 import uk.co.blackpepper.bowman.annotation.LinkedResource;
44
45 @Entity
46 @Table(name = "orchestration_flow_reference")
47 public class OrchestrationFlow implements Serializable {
48
49         private static final long serialVersionUID = 2457818854397870011L;
50
51         @Id
52         @Column(name = "ID")
53         @GeneratedValue(strategy = GenerationType.IDENTITY)
54         private Integer id;
55
56         @BusinessKey
57         @Column(name = "COMPOSITE_ACTION")
58         private String action;
59
60         @BusinessKey
61         @Column(name = "SEQ_NO")
62         private Integer sequenceNumber;
63
64         @BusinessKey
65         @Column(name = "FLOW_NAME")
66         private String flowName;
67
68         @BusinessKey
69         @Column(name = "FLOW_VERSION")
70         private Double flowVersion;
71
72         @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
73         @JoinColumn(name = "NB_REQ_REF_LOOKUP_ID")
74         private NorthBoundRequest northBoundRequest;
75         
76         @Override
77         public String toString() {
78                 return new ToStringBuilder(this).append("id", id).append("action", action)
79                                 .append("sequenceNumber", sequenceNumber).append("flowName", flowName)
80                                 .append("flowVersion", flowVersion).toString();
81         }
82
83         @Override
84         public boolean equals(final Object other) {
85                 if (!(other instanceof OrchestrationFlow)) {
86                         return false;
87                 }
88                 OrchestrationFlow castOther = (OrchestrationFlow) other;
89                 return new EqualsBuilder().append(action, castOther.action).append(sequenceNumber, castOther.sequenceNumber)
90                                 .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion).isEquals();
91         }
92
93         @Override
94         public int hashCode() {
95                 return new HashCodeBuilder().append(action).append(sequenceNumber).append(flowName).append(flowVersion)
96                                 .toHashCode();
97         }
98
99         public String getAction() {
100                 return action;
101         }
102
103         public void setAction(String action) {
104                 this.action = action;
105         }
106
107         public Integer getSequenceNumber() {
108                 return sequenceNumber;
109         }
110
111         public void setSequenceNumber(Integer sequenceNumber) {
112                 this.sequenceNumber = sequenceNumber;
113         }
114
115         public String getFlowName() {
116                 return flowName;
117         }
118
119         public void setFlowName(String flowName) {
120                 this.flowName = flowName;
121         }
122
123         public Double getFlowVersion() {
124                 return flowVersion;
125         }
126
127         public void setFlowVersion(Double flowVersion) {
128                 this.flowVersion = flowVersion;
129         }
130
131         public Integer getId() {
132                 return id;
133         }
134
135         public void setId(Integer id) {
136                 this.id = id;
137         }
138
139         @LinkedResource
140         public NorthBoundRequest getNorthBoundRequest() {
141                 return northBoundRequest;
142         }
143
144         public void setNorthBoundRequest(NorthBoundRequest northBoundRequest) {
145                 this.northBoundRequest = northBoundRequest;
146         }
147 }