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 public DocumentStatusTransition() {
61 }
62
63 public DocumentStatusTransition(String documentId, String oldStatus, String newStatus) {
64 this.documentId = documentId;
65 this.oldAppDocStatus = oldStatus;
66 this.newAppDocStatus = newStatus;
67 this.statusTransitionDate = new Timestamp(System.currentTimeMillis());
68 }
69
70 public String getStatusTransitionId() {
71 return this.statusTransitionId;
72 }
73
74 public void setStatusTransitionId(String statusTransitionId) {
75 this.statusTransitionId = statusTransitionId;
76 }
77
78 public String getDocumentId() {
79 return this.documentId;
80 }
81
82 public void setDocumentId(String documentId) {
83 this.documentId = documentId;
84 }
85
86 public String getOldAppDocStatus() {
87 return this.oldAppDocStatus;
88 }
89
90 public void setOldAppDocStatus(String oldAppDocStatus) {
91 this.oldAppDocStatus = oldAppDocStatus;
92 }
93
94 public String getNewAppDocStatus() {
95 return this.newAppDocStatus;
96 }
97
98 public void setNewAppDocStatus(String newAppDocStatus) {
99 this.newAppDocStatus = newAppDocStatus;
100 }
101
102 public java.sql.Timestamp getStatusTransitionDate() {
103 return this.statusTransitionDate;
104 }
105
106 public void setStatusTransitionDate(java.sql.Timestamp statusTransitionDate) {
107 this.statusTransitionDate = statusTransitionDate;
108 }
109
110 public static DocumentStatusTransition from(org.kuali.rice.kew.api.document.DocumentStatusTransition im) {
111 if (im == null) {
112 return null;
113 }
114 DocumentStatusTransition transition = new DocumentStatusTransition(im.getDocumentId(), im.getOldStatus(), im.getNewStatus());
115 transition.setStatusTransitionId(im.getId());
116 if (im.getStatusTransitionDate() != null) {
117 transition.setStatusTransitionDate(new Timestamp(im.getStatusTransitionDate().getMillis()));
118 }
119 return transition;
120 }
121
122 public static org.kuali.rice.kew.api.document.DocumentStatusTransition to(DocumentStatusTransition bo) {
123 if (bo == null) {
124 return null;
125 }
126
127 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 builder.setId(bo.getStatusTransitionId());
129 if (bo.getStatusTransitionDate() != null) {
130 builder.setStatusTransitionDate(new DateTime(bo.getStatusTransitionDate().getTime()));
131 }
132 return builder.build();
133 }
134 }