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