1 | |
package org.kuali.student.core.bo; |
2 | |
|
3 | |
import java.util.Date; |
4 | |
|
5 | |
import javax.persistence.Column; |
6 | |
import javax.persistence.Temporal; |
7 | |
import javax.persistence.TemporalType; |
8 | |
|
9 | |
import org.apache.ojb.broker.PersistenceBroker; |
10 | |
import org.apache.ojb.broker.PersistenceBrokerException; |
11 | |
import org.kuali.student.common.util.UUIDHelper; |
12 | |
|
13 | 0 | public abstract class KsVersionBusinessObjectBase extends KsMetaBusinessObjectBase implements KsVersionBusinessObject { |
14 | |
|
15 | |
private static final long serialVersionUID = -1307889585226114528L; |
16 | |
|
17 | |
@Column(name = "VER_IND_ID") |
18 | |
private String versionIndId; |
19 | |
|
20 | |
@Column(name = "SEQ_NUM") |
21 | |
private Long sequenceNumber; |
22 | |
|
23 | |
@Temporal(TemporalType.TIMESTAMP) |
24 | |
@Column(name = "CURR_VER_START") |
25 | |
private Date currentVersionStart; |
26 | |
|
27 | |
@Temporal(TemporalType.TIMESTAMP) |
28 | |
@Column(name = "CURR_VER_END") |
29 | |
private Date currentVersionEnd; |
30 | |
|
31 | |
@Column(name = "VER_FROM_ID") |
32 | |
private String versionedFromId; |
33 | |
|
34 | |
@Column(name = "VER_CMT") |
35 | |
private String versionComment; |
36 | |
|
37 | |
|
38 | |
@Override |
39 | |
public void prePersist() { |
40 | 0 | super.prePersist(); |
41 | |
|
42 | 0 | if(this.getSequenceNumber() == null){ |
43 | 0 | this.setSequenceNumber(Long.valueOf(1)); |
44 | |
} |
45 | |
|
46 | 0 | this.setVersionIndId(UUIDHelper.genStringUUID(this.getVersionIndId())); |
47 | 0 | } |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
@Override |
55 | |
public Version getVersion() { |
56 | 0 | Version version = new Version(); |
57 | |
|
58 | 0 | version.setVersionIndId(versionIndId); |
59 | 0 | version.setSequenceNumber(sequenceNumber); |
60 | 0 | version.setVersionedFromId(versionedFromId); |
61 | 0 | version.setVersionComment(versionComment); |
62 | 0 | version.setCurrentVersionStart(currentVersionStart); |
63 | 0 | version.setCurrentVersionEnd(currentVersionEnd); |
64 | |
|
65 | 0 | return version; |
66 | |
} |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
@Override |
76 | |
public void setVersion(Version version) { |
77 | 0 | this.setVersionIndId(version.getVersionIndId()); |
78 | 0 | this.setSequenceNumber(version.getSequenceNumber()); |
79 | 0 | this.setVersionedFromId(version.getVersionedFromId()); |
80 | 0 | this.setVersionComment(version.getVersionComment()); |
81 | 0 | this.setCurrentVersionStart(version.getCurrentVersionStart()); |
82 | 0 | this.setCurrentVersionEnd(version.getCurrentVersionEnd()); |
83 | 0 | } |
84 | |
|
85 | |
@Override |
86 | |
public String getVersionIndId() { |
87 | 0 | return versionIndId; |
88 | |
} |
89 | |
|
90 | |
@Override |
91 | |
public void setVersionIndId(String versionIndId) { |
92 | 0 | this.versionIndId = versionIndId; |
93 | 0 | } |
94 | |
|
95 | |
@Override |
96 | |
public Long getSequenceNumber() { |
97 | 0 | return sequenceNumber; |
98 | |
} |
99 | |
|
100 | |
@Override |
101 | |
public void setSequenceNumber(Long sequenceNumber) { |
102 | 0 | this.sequenceNumber = sequenceNumber; |
103 | 0 | } |
104 | |
|
105 | |
@Override |
106 | |
public Date getCurrentVersionStart() { |
107 | 0 | return currentVersionStart; |
108 | |
} |
109 | |
|
110 | |
@Override |
111 | |
public void setCurrentVersionStart(Date currentVersionStart) { |
112 | 0 | this.currentVersionStart = currentVersionStart; |
113 | 0 | } |
114 | |
|
115 | |
@Override |
116 | |
public Date getCurrentVersionEnd() { |
117 | 0 | return currentVersionEnd; |
118 | |
} |
119 | |
|
120 | |
@Override |
121 | |
public void setCurrentVersionEnd(Date currentVersionEnd) { |
122 | 0 | this.currentVersionEnd = currentVersionEnd; |
123 | 0 | } |
124 | |
|
125 | |
@Override |
126 | |
public String getVersionedFromId() { |
127 | 0 | return versionedFromId; |
128 | |
} |
129 | |
|
130 | |
@Override |
131 | |
public void setVersionedFromId(String versionedFromId) { |
132 | 0 | this.versionedFromId = versionedFromId; |
133 | 0 | } |
134 | |
|
135 | |
@Override |
136 | |
public String getVersionComment() { |
137 | 0 | return versionComment; |
138 | |
} |
139 | |
|
140 | |
@Override |
141 | |
public void setVersionComment(String versionComment) { |
142 | 0 | this.versionComment = versionComment; |
143 | 0 | } |
144 | |
|
145 | |
} |