1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.engine.node;
18
19 import java.io.Serializable;
20
21 import javax.persistence.Id;
22 import javax.persistence.MappedSuperclass;
23 import javax.persistence.PrePersist;
24
25 import org.apache.commons.lang.builder.ToStringBuilder;
26 import org.kuali.rice.core.jpa.annotations.Sequence;
27 import org.kuali.rice.core.util.OrmUtils;
28 import org.kuali.rice.kew.service.KEWServiceLocator;
29
30
31
32
33
34
35 @MappedSuperclass
36 @Sequence(name="KREW_RTE_NODE_S", property="stateId")
37 public abstract class State extends KeyValuePair implements Serializable {
38 @Id
39 protected Long stateId;
40
41 public State() {}
42
43 @PrePersist
44 public void beforeInsert(){
45 OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
46 }
47
48 public State(String key, String value) {
49 super(key, value);
50 }
51
52 public Long getStateId() {
53 return stateId;
54 }
55
56 public void setStateId(Long stateId) {
57 this.stateId = stateId;
58 }
59
60 public String toString() {
61 return new ToStringBuilder(this)
62 .append("stateId", stateId)
63 .append("key", key)
64 .append("value", value)
65 .toString();
66 }
67 }