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