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.util.LinkedHashMap; |
20 | |
|
21 | |
import javax.persistence.GeneratedValue; |
22 | |
import javax.persistence.Id; |
23 | |
import javax.persistence.MappedSuperclass; |
24 | |
import javax.persistence.PrePersist; |
25 | |
|
26 | |
import org.hibernate.annotations.GenericGenerator; |
27 | |
import org.hibernate.annotations.Parameter; |
28 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
29 | |
import org.kuali.rice.core.util.KeyValue; |
30 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
31 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
@MappedSuperclass |
39 | |
|
40 | |
public abstract class State extends PersistableBusinessObjectBase implements KeyValue { |
41 | |
@Id |
42 | |
@GeneratedValue(generator="KREW_RTE_NODE_S") |
43 | |
@GenericGenerator(name="KREW_RTE_NODE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
44 | |
@Parameter(name="sequence_name",value="KREW_RTE_NODE_S"), |
45 | |
@Parameter(name="value_column",value="id") |
46 | |
}) |
47 | |
protected String stateId; |
48 | |
private String key; |
49 | |
private String value; |
50 | |
|
51 | 0 | public State() {} |
52 | |
|
53 | 0 | public State(String key, String value) { |
54 | 0 | this.key = key; |
55 | 0 | this.value = value; |
56 | 0 | } |
57 | |
|
58 | |
@PrePersist |
59 | |
public void customPrePersist(){ |
60 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
61 | 0 | } |
62 | |
|
63 | |
public String getStateId() { |
64 | 0 | return stateId; |
65 | |
} |
66 | |
|
67 | |
public void setStateId(String stateId) { |
68 | 0 | this.stateId = stateId; |
69 | 0 | } |
70 | |
|
71 | |
@Override |
72 | |
public String getKey() { |
73 | 0 | return key; |
74 | |
} |
75 | |
|
76 | |
@Override |
77 | |
public String getValue() { |
78 | 0 | return value; |
79 | |
} |
80 | |
|
81 | |
public void setKey(String key) { |
82 | 0 | this.key = key; |
83 | 0 | } |
84 | |
|
85 | |
public void setValue(String value) { |
86 | 0 | this.value = value; |
87 | 0 | } |
88 | |
|
89 | |
protected LinkedHashMap<String, Object> toStringMapperFields() { |
90 | 0 | final LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(); |
91 | 0 | map.put("stateId", stateId); |
92 | 0 | map.put("key", key); |
93 | 0 | map.put("value", value); |
94 | 0 | return map; |
95 | |
} |
96 | |
} |