1 | |
package org.kuali.student.core.bo; |
2 | |
|
3 | |
import java.util.Date; |
4 | |
|
5 | |
import org.apache.commons.lang.StringUtils; |
6 | |
import org.apache.ojb.broker.PersistenceBrokerException; |
7 | |
import org.kuali.rice.core.api.CoreApiServiceLocator; |
8 | |
import org.kuali.rice.krad.util.GlobalVariables; |
9 | |
|
10 | 0 | public class KsMetaBusinessObjectBase extends KsBusinessObjectBase implements KsMetaBusinessObject { |
11 | |
|
12 | |
private static final long serialVersionUID = -6804800481530556124L; |
13 | |
|
14 | |
|
15 | |
private String createId; |
16 | |
|
17 | |
private Date createDate; |
18 | |
|
19 | |
private String updateId; |
20 | |
|
21 | |
private Date updateDate; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
@Override |
30 | |
public Meta getMeta() { |
31 | 0 | Meta meta = new Meta(); |
32 | |
|
33 | 0 | meta.setCreateId(createId); |
34 | 0 | meta.setCreateTime(createDate); |
35 | 0 | meta.setUpdateId(updateId); |
36 | 0 | meta.setUpdateTime(updateDate); |
37 | |
|
38 | 0 | return meta; |
39 | |
} |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
@Override |
49 | |
public void setMeta(Meta meta) { |
50 | 0 | this.setCreateId(meta.getCreateId()); |
51 | 0 | this.setCreateDate(meta.getCreateTime()); |
52 | 0 | this.setUpdateId(meta.getUpdateId()); |
53 | 0 | this.setUpdateDate(meta.getCreateTime()); |
54 | 0 | } |
55 | |
|
56 | |
@Override |
57 | |
public void prePersist() throws PersistenceBrokerException { |
58 | 0 | super.prePersist(); |
59 | |
|
60 | 0 | if (StringUtils.isBlank(this.getCreateId())) { |
61 | 0 | this.setCreateId(GlobalVariables.getUserSession().getPrincipalName()); |
62 | |
} |
63 | |
|
64 | 0 | if (this.getCreateDate() == null) { |
65 | 0 | this.setCreateDate(CoreApiServiceLocator.getDateTimeService().getCurrentSqlDate()); |
66 | |
} |
67 | 0 | } |
68 | |
|
69 | |
@Override |
70 | |
public void preUpdate() { |
71 | 0 | super.preUpdate(); |
72 | |
|
73 | 0 | this.setUpdateId(GlobalVariables.getUserSession().getPrincipalName()); |
74 | 0 | this.setUpdateDate(CoreApiServiceLocator.getDateTimeService().getCurrentSqlDate()); |
75 | 0 | } |
76 | |
|
77 | |
public String getCreateId() { |
78 | 0 | return createId; |
79 | |
} |
80 | |
|
81 | |
public void setCreateId(String createId) { |
82 | 0 | this.createId = createId; |
83 | 0 | } |
84 | |
|
85 | |
public Date getCreateDate() { |
86 | 0 | return createDate; |
87 | |
} |
88 | |
|
89 | |
public void setCreateDate(Date createDate) { |
90 | 0 | this.createDate = createDate; |
91 | 0 | } |
92 | |
|
93 | |
public String getUpdateId() { |
94 | 0 | return updateId; |
95 | |
} |
96 | |
|
97 | |
public void setUpdateId(String updateId) { |
98 | 0 | this.updateId = updateId; |
99 | 0 | } |
100 | |
|
101 | |
public Date getUpdateDate() { |
102 | 0 | return updateDate; |
103 | |
} |
104 | |
|
105 | |
public void setUpdateDate(Date updateDate) { |
106 | 0 | this.updateDate = updateDate; |
107 | 0 | } |
108 | |
|
109 | |
} |