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 org.kuali.rice.kew.engine.node.dao.impl.RouteNodeDAOJpa;
19
20 import javax.persistence.AttributeOverride;
21 import javax.persistence.AttributeOverrides;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.FetchType;
25 import javax.persistence.JoinColumn;
26 import javax.persistence.ManyToOne;
27 import javax.persistence.NamedQueries;
28 import javax.persistence.NamedQuery;
29 import javax.persistence.Table;
30 import javax.persistence.Version;
31 import java.util.Map;
32
33
34
35
36
37
38 @Entity
39 @Table(name="KREW_RTE_NODE_INSTN_ST_T")
40 @AttributeOverrides({
41 @AttributeOverride(name="stateId", column=@Column(name="RTE_NODE_INSTN_ST_ID")) ,
42 @AttributeOverride(name="versionNumber", column=@Column(name="VER_NBR", updatable=false, insertable=false)),
43
44 @AttributeOverride(name="objectId", column=@Column(name="KEY_CD", updatable=false, insertable=false) )
45 })
46 public class NodeState extends State {
47
48 private static final long serialVersionUID = -4382379569851955918L;
49
50 @Column(name= "RTE_NODE_INSTN_ID", insertable = false, updatable = false)
51 private String routeNodeInstanceId;
52
53 @ManyToOne(fetch=FetchType.EAGER)
54 @JoinColumn(name="RTE_NODE_INSTN_ID")
55 private RouteNodeInstance nodeInstance;
56
57 @Version
58 @Column(name="VER_NBR")
59 private Integer lockVerNbr;
60
61
62 public NodeState() {}
63
64 public NodeState(String key, String value) {
65 super(key, value);
66 }
67
68
69 public RouteNodeInstance getNodeInstance() {
70 return nodeInstance;
71 }
72 public void setNodeInstance(RouteNodeInstance nodeInstance) {
73 this.nodeInstance = nodeInstance;
74 }
75
76 public String getNodeStateId() {
77 return getStateId();
78 }
79
80 public void setNodeStateId(String nodeStateId) {
81 setStateId(nodeStateId);
82 }
83
84 public Integer getLockVerNbr() {
85 return lockVerNbr;
86 }
87
88 public void setLockVerNbr(Integer lockVerNbr) {
89 this.lockVerNbr = lockVerNbr;
90 }
91
92 public NodeState deepCopy(Map<Object, Object> visited) {
93 if (visited.containsKey(this)) {
94 return (NodeState)visited.get(this);
95 }
96 NodeState copy = new NodeState(getKey(), getValue());
97 visited.put(this, copy);
98 copy.stateId = stateId;
99 copy.lockVerNbr = lockVerNbr;
100 if (nodeInstance != null) {
101 copy.nodeInstance = nodeInstance.deepCopy(visited);
102 }
103 return copy;
104 }
105
106 public String getRouteNodeInstanceId() {
107 return getNodeInstance() != null ? getNodeInstance().getRouteNodeInstanceId() : null;
108 }
109
110
111 }