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.CascadeType; |
22 | |
import javax.persistence.Column; |
23 | |
import javax.persistence.Entity; |
24 | |
import javax.persistence.FetchType; |
25 | |
import javax.persistence.GeneratedValue; |
26 | |
import javax.persistence.Id; |
27 | |
import javax.persistence.JoinColumn; |
28 | |
import javax.persistence.ManyToOne; |
29 | |
import javax.persistence.OneToOne; |
30 | |
import javax.persistence.Table; |
31 | |
import javax.persistence.Version; |
32 | |
|
33 | |
import org.hibernate.annotations.GenericGenerator; |
34 | |
import org.hibernate.annotations.Parameter; |
35 | |
import org.kuali.rice.core.framework.persistence.jpa.OrmUtils; |
36 | |
import org.kuali.rice.kew.api.doctype.ProcessContract; |
37 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
38 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | 0 | @Entity |
49 | |
@Table(name="KREW_DOC_TYP_PROC_T") |
50 | |
|
51 | 0 | public class Process implements Serializable, ProcessContract { |
52 | |
|
53 | |
private static final long serialVersionUID = -6338857095673479752L; |
54 | |
|
55 | |
@Id |
56 | |
@GeneratedValue(generator="KREW_RTE_NODE_S") |
57 | |
@GenericGenerator(name="KREW_RTE_NODE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
58 | |
@Parameter(name="sequence_name",value="KREW_RTE_NODE_S"), |
59 | |
@Parameter(name="value_column",value="id") |
60 | |
}) |
61 | |
@Column(name="DOC_TYP_PROC_ID") |
62 | |
private String processId; |
63 | |
@Column(name="NM") |
64 | |
private String name; |
65 | |
@ManyToOne(fetch=FetchType.EAGER) |
66 | |
@JoinColumn(name="DOC_TYP_ID") |
67 | |
private DocumentType documentType; |
68 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.MERGE}) |
69 | |
@JoinColumn(name="INIT_RTE_NODE_ID") |
70 | |
private RouteNode initialRouteNode; |
71 | 0 | @Column(name="INIT_IND") |
72 | |
private boolean initial = false; |
73 | |
@Version |
74 | |
@Column(name="VER_NBR") |
75 | |
private Integer lockVerNbr; |
76 | |
|
77 | |
public String getProcessId() { |
78 | 0 | return processId; |
79 | |
} |
80 | |
public void setProcessId(String processId) { |
81 | 0 | this.processId = processId; |
82 | 0 | } |
83 | |
public DocumentType getDocumentType() { |
84 | 0 | return documentType; |
85 | |
} |
86 | |
public void setDocumentType(DocumentType documentType) { |
87 | 0 | this.documentType = documentType; |
88 | 0 | } |
89 | |
public RouteNode getInitialRouteNode() { |
90 | 0 | return initialRouteNode; |
91 | |
} |
92 | |
public void setInitialRouteNode(RouteNode initialRouteNode) { |
93 | 0 | this.initialRouteNode = initialRouteNode; |
94 | 0 | } |
95 | |
public String getName() { |
96 | 0 | return name; |
97 | |
} |
98 | |
public void setName(String name) { |
99 | 0 | this.name = name; |
100 | 0 | } |
101 | |
public boolean isInitial() { |
102 | 0 | return initial; |
103 | |
} |
104 | |
public void setInitial(boolean initial) { |
105 | 0 | this.initial = initial; |
106 | 0 | } |
107 | |
public Integer getLockVerNbr() { |
108 | 0 | return lockVerNbr; |
109 | |
} |
110 | |
public void setLockVerNbr(Integer lockVerNbr) { |
111 | 0 | this.lockVerNbr = lockVerNbr; |
112 | 0 | } |
113 | |
|
114 | |
|
115 | |
public void beforeInsert(){ |
116 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
117 | 0 | } |
118 | |
|
119 | |
@Override |
120 | |
public String getId() { |
121 | 0 | if (processId == null) { |
122 | 0 | return null; |
123 | |
} |
124 | 0 | return processId.toString(); |
125 | |
} |
126 | |
|
127 | |
@Override |
128 | |
public Long getVersionNumber() { |
129 | 0 | if (lockVerNbr == null) { |
130 | 0 | return null; |
131 | |
} |
132 | 0 | return new Long(lockVerNbr.longValue()); |
133 | |
} |
134 | |
|
135 | |
@Override |
136 | |
public String getDocumentTypeId() { |
137 | 0 | if (documentType == null) { |
138 | 0 | return null; |
139 | |
} |
140 | 0 | return documentType.getId(); |
141 | |
} |
142 | |
|
143 | |
} |