1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.routeheader; |
17 | |
|
18 | |
import org.bouncycastle.ocsp.OCSPReqGenerator; |
19 | |
import org.hibernate.annotations.GenericGenerator; |
20 | |
import org.hibernate.annotations.Parameter; |
21 | |
import org.joda.time.DateTime; |
22 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; |
23 | |
|
24 | |
import javax.persistence.*; |
25 | |
import java.sql.Timestamp; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
@Entity |
35 | |
@Table(name="KREW_APP_DOC_STAT_TRAN_T") |
36 | |
public class DocumentStatusTransition extends PersistableBusinessObjectBase { |
37 | |
private static final long serialVersionUID = -2212481684546954746L; |
38 | |
|
39 | |
@Id |
40 | |
@GeneratedValue(generator="KREW_DOC_HDR_S") |
41 | |
@GenericGenerator(name="KREW_DOC_HDR_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
42 | |
@Parameter(name="sequence_name",value="KREW_DOC_HDR_S"), |
43 | |
@Parameter(name="value_column",value="id") |
44 | |
}) |
45 | |
@Column(name="APP_DOC_STAT_TRAN_ID") |
46 | |
private String statusTransitionId; |
47 | |
|
48 | |
@Column(name="DOC_HDR_ID") |
49 | |
private String documentId; |
50 | |
|
51 | |
@Column(name="APP_DOC_STAT_FROM") |
52 | |
private String oldAppDocStatus; |
53 | |
|
54 | |
@Column(name="APP_DOC_STAT_TO") |
55 | |
private String newAppDocStatus; |
56 | |
|
57 | |
@Column(name="STAT_TRANS_DATE") |
58 | |
private java.sql.Timestamp statusTransitionDate; |
59 | |
|
60 | 0 | public DocumentStatusTransition() { |
61 | 0 | } |
62 | |
|
63 | 0 | public DocumentStatusTransition(String documentId, String oldStatus, String newStatus) { |
64 | 0 | this.documentId = documentId; |
65 | 0 | this.oldAppDocStatus = oldStatus; |
66 | 0 | this.newAppDocStatus = newStatus; |
67 | 0 | this.statusTransitionDate = new Timestamp(System.currentTimeMillis()); |
68 | 0 | } |
69 | |
|
70 | |
public String getStatusTransitionId() { |
71 | 0 | return this.statusTransitionId; |
72 | |
} |
73 | |
|
74 | |
public void setStatusTransitionId(String statusTransitionId) { |
75 | 0 | this.statusTransitionId = statusTransitionId; |
76 | 0 | } |
77 | |
|
78 | |
public String getDocumentId() { |
79 | 0 | return this.documentId; |
80 | |
} |
81 | |
|
82 | |
public void setDocumentId(String documentId) { |
83 | 0 | this.documentId = documentId; |
84 | 0 | } |
85 | |
|
86 | |
public String getOldAppDocStatus() { |
87 | 0 | return this.oldAppDocStatus; |
88 | |
} |
89 | |
|
90 | |
public void setOldAppDocStatus(String oldAppDocStatus) { |
91 | 0 | this.oldAppDocStatus = oldAppDocStatus; |
92 | 0 | } |
93 | |
|
94 | |
public String getNewAppDocStatus() { |
95 | 0 | return this.newAppDocStatus; |
96 | |
} |
97 | |
|
98 | |
public void setNewAppDocStatus(String newAppDocStatus) { |
99 | 0 | this.newAppDocStatus = newAppDocStatus; |
100 | 0 | } |
101 | |
|
102 | |
public java.sql.Timestamp getStatusTransitionDate() { |
103 | 0 | return this.statusTransitionDate; |
104 | |
} |
105 | |
|
106 | |
public void setStatusTransitionDate(java.sql.Timestamp statusTransitionDate) { |
107 | 0 | this.statusTransitionDate = statusTransitionDate; |
108 | 0 | } |
109 | |
|
110 | |
public static DocumentStatusTransition from(org.kuali.rice.kew.api.document.DocumentStatusTransition im) { |
111 | 0 | if (im == null) { |
112 | 0 | return null; |
113 | |
} |
114 | 0 | DocumentStatusTransition transition = new DocumentStatusTransition(im.getDocumentId(), im.getOldStatus(), im.getNewStatus()); |
115 | 0 | transition.setStatusTransitionId(im.getId()); |
116 | 0 | if (im.getStatusTransitionDate() != null) { |
117 | 0 | transition.setStatusTransitionDate(new Timestamp(im.getStatusTransitionDate().getMillis())); |
118 | |
} |
119 | 0 | return transition; |
120 | |
} |
121 | |
|
122 | |
public static org.kuali.rice.kew.api.document.DocumentStatusTransition to(DocumentStatusTransition bo) { |
123 | 0 | if (bo == null) { |
124 | 0 | return null; |
125 | |
} |
126 | |
|
127 | 0 | org.kuali.rice.kew.api.document.DocumentStatusTransition.Builder builder = org.kuali.rice.kew.api.document.DocumentStatusTransition.Builder.create(bo.getDocumentId(), bo.getOldAppDocStatus(), bo.getNewAppDocStatus()); |
128 | 0 | builder.setId(bo.getStatusTransitionId()); |
129 | 0 | if (bo.getStatusTransitionDate() != null) { |
130 | 0 | builder.setStatusTransitionDate(new DateTime(bo.getStatusTransitionDate().getTime())); |
131 | |
} |
132 | 0 | return builder.build(); |
133 | |
} |
134 | |
} |