1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.engine.node;
17
18 import javax.persistence.AttributeOverride;
19 import javax.persistence.AttributeOverrides;
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.JoinColumn;
23 import javax.persistence.ManyToOne;
24 import javax.persistence.Table;
25 import javax.persistence.Version;
26 import java.util.Map;
27
28
29
30
31
32
33 @Entity
34 @Table(name="KREW_RTE_BRCH_ST_T")
35 @AttributeOverrides({
36 @AttributeOverride(name="stateId", column=@Column(name="RTE_BRCH_ST_ID")),
37 @AttributeOverride(name="versionNumber", column=@Column(name="VER_NBR", insertable = false, updatable = false))
38 })
39 public class BranchState extends State {
40
41
42
43
44 public static final String VARIABLE_PREFIX = "var::";
45
46 private static final long serialVersionUID = -7642477013444817952L;
47
48 @ManyToOne
49 @JoinColumn(name="RTE_BRCH_ID", nullable = false)
50 private Branch branch;
51
52 @Version
53 @Column(name="VER_NBR")
54 private Integer lockVerNbr;
55
56 public BranchState() {}
57
58 public BranchState(String key, String value) {
59 super(key, value);
60 }
61
62 public Branch getBranch() {
63 return branch;
64 }
65
66 public void setBranch(Branch branch) {
67 this.branch = branch;
68 }
69
70 public String getBranchStateId() {
71 return getStateId();
72 }
73
74 public Integer getLockVerNbr() {
75 return lockVerNbr;
76 }
77
78 public void setLockVerNbr(Integer lockVerNbr) {
79 this.lockVerNbr = lockVerNbr;
80 }
81
82 public BranchState deepCopy(Map<Object, Object> visited) {
83 if (visited.containsKey(this)) {
84 return (BranchState)visited.get(this);
85 }
86 BranchState copy = new BranchState(getKey(), getValue());
87 visited.put(this, copy);
88 copy.stateId = stateId;
89 copy.lockVerNbr = lockVerNbr;
90 if (branch != null) {
91 copy.branch = branch.deepCopy(visited);
92 }
93 return copy;
94 }
95
96 }
97