e953ff2cd441693805eda1f4f208650b2fc46e82
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / WorkflowActivitySpecSequence.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 javax.persistence.CascadeType;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.Table;
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 import com.openpojo.business.annotation.BusinessKey;
38 import uk.co.blackpepper.bowman.annotation.LinkedResource;
39
40
41 @Entity
42 @Table(name = "workflow_activity_spec_sequence")
43 public class WorkflowActivitySpecSequence implements Serializable {
44
45     private static final long serialVersionUID = -8788505759463286871L;
46
47     @Id
48     @Column(name = "ID", nullable = false, updatable = false)
49     @GeneratedValue(strategy = GenerationType.IDENTITY)
50     private Integer ID;
51
52     @BusinessKey
53     @Column(name = "ACTIVITY_SPEC_ID")
54     private Integer activitySpecId;
55
56     @Column(name = "SEQ_NO")
57     private Integer seqNo;
58
59     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
60     @JoinColumn(name = "ACTIVITY_SPEC_ID", updatable = false, insertable = false)
61     private ActivitySpec activitySpec;
62
63     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
64     @JoinColumn(name = "WORKFLOW_ID")
65     private Workflow workflow;
66
67     @Override
68     public String toString() {
69         return new ToStringBuilder(this).append("activitySpecId", activitySpecId).toString();
70     }
71
72     @Override
73     public boolean equals(final Object other) {
74         if (!(other instanceof WorkflowActivitySpecSequence)) {
75             return false;
76         }
77         WorkflowActivitySpecSequence castOther = (WorkflowActivitySpecSequence) other;
78         return new EqualsBuilder().append(activitySpecId, castOther.activitySpecId).isEquals();
79     }
80
81     @Override
82     public int hashCode() {
83         return new HashCodeBuilder().append(activitySpecId).toHashCode();
84     }
85
86     public Integer getID() {
87         return ID;
88     }
89
90     public Integer getActivitySpecId() {
91         return activitySpecId;
92     }
93
94     public void setActivitySpecId(Integer activitySpecId) {
95         this.activitySpecId = activitySpecId;
96     }
97
98     @LinkedResource
99     public ActivitySpec getActivitySpec() {
100         return activitySpec;
101     }
102
103     public void setActivitySpec(ActivitySpec activitySpec) {
104         this.activitySpec = activitySpec;
105     }
106
107     @LinkedResource
108     public Workflow getWorkflow() {
109         return workflow;
110     }
111
112     public void setWorkflow(Workflow workflow) {
113         this.workflow = workflow;
114     }
115
116     public Integer getSeqNo() {
117         return seqNo;
118     }
119
120     public void setSeqNo(Integer seqNo) {
121         this.seqNo = seqNo;
122     }
123
124 }