Springboot 2.0 upgrade
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / OrchestrationStatusStateTransitionDirective.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
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.EnumType;
28 import javax.persistence.Enumerated;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.Table;
33
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
37
38 import com.openpojo.business.annotation.BusinessKey;
39
40 @Entity
41 @Table(name = "orchestration_status_state_transition_directive")
42 public class OrchestrationStatusStateTransitionDirective implements Serializable {
43         private static final long serialVersionUID = -4626396955833442376L;
44
45         @Id
46         @Column(name = "id")
47         @GeneratedValue(strategy = GenerationType.IDENTITY)
48         private Integer id;
49
50         @Enumerated(EnumType.STRING)
51         @Column(name = "RESOURCE_TYPE")
52         @BusinessKey
53         private ResourceType resourceType;
54
55         @Enumerated(EnumType.STRING)
56         @Column(name = "ORCHESTRATION_STATUS")
57         @BusinessKey
58         private OrchestrationStatus orchestrationStatus;
59
60         @Enumerated(EnumType.STRING)
61         @Column(name = "TARGET_ACTION")
62         @BusinessKey
63         private OrchestrationAction targetAction;
64
65         @Enumerated(EnumType.STRING)
66         @Column(name = "FLOW_DIRECTIVE")
67         @BusinessKey
68         private OrchestrationStatusValidationDirective flowDirective;
69
70         @Override
71         public String toString() {
72                 return new ToStringBuilder(this).append("id", id).append("resourceType", resourceType)
73                                 .append("orchestrationStatus", orchestrationStatus).append("targetAction", targetAction)
74                                 .append("flowDirective", flowDirective).toString();
75         }
76
77         public Integer getId() {
78                 return id;
79         }
80
81         public void setId(Integer id) {
82                 this.id = id;
83         }
84
85         public ResourceType getResourceType() {
86                 return resourceType;
87         }
88
89         public void setResourceType(ResourceType resourceType) {
90                 this.resourceType = resourceType;
91         }
92
93         public OrchestrationStatus getOrchestrationStatus() {
94                 return orchestrationStatus;
95         }
96
97         public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
98                 this.orchestrationStatus = orchestrationStatus;
99         }
100
101         public OrchestrationAction getTargetAction() {
102                 return targetAction;
103         }
104
105         public void setTargetAction(OrchestrationAction targetAction) {
106                 this.targetAction = targetAction;
107         }
108
109         public OrchestrationStatusValidationDirective getFlowDirective() {
110                 return flowDirective;
111         }
112
113         public void setFlowDirective(OrchestrationStatusValidationDirective flowDirective) {
114                 this.flowDirective = flowDirective;
115         }
116
117         @Override
118         public boolean equals(final Object other) {
119                 if (!(other instanceof OrchestrationStatusStateTransitionDirective)) {
120                         return false;
121                 }
122                 OrchestrationStatusStateTransitionDirective castOther = (OrchestrationStatusStateTransitionDirective) other;
123                 return new EqualsBuilder().append(getResourceType(), castOther.getResourceType())
124                                 .append(getOrchestrationStatus(), castOther.getOrchestrationStatus())
125                                 .append(getTargetAction(), castOther.getTargetAction())
126                                 .append(getFlowDirective(), castOther.getFlowDirective()).isEquals();
127         }
128
129         @Override
130         public int hashCode() {
131                 return new HashCodeBuilder().append(getResourceType()).append(getOrchestrationStatus())
132                                 .append(getTargetAction()).append(getFlowDirective()).toHashCode();
133         }
134 }