1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.r2.common.entity; |
17 |
|
|
18 |
|
import java.util.Date; |
19 |
|
|
20 |
|
import javax.persistence.Column; |
21 |
|
import javax.persistence.Embeddable; |
22 |
|
import javax.persistence.MappedSuperclass; |
23 |
|
import javax.persistence.Temporal; |
24 |
|
import javax.persistence.TemporalType; |
25 |
|
|
26 |
|
import org.kuali.student.common.dto.MetaInfo; |
27 |
|
import org.kuali.student.common.util.security.SecurityUtils; |
28 |
|
import org.kuali.student.core.entity.BaseEntity; |
29 |
|
|
30 |
|
@MappedSuperclass |
31 |
|
@Embeddable |
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 12 |
Complexity Density: 0.48 |
|
32 |
|
public abstract class MetaEntity extends BaseEntity{ |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
@Temporal(TemporalType.TIMESTAMP) |
39 |
|
@Column(updatable=false) |
40 |
|
private Date createTime; |
41 |
|
|
42 |
|
@Column(updatable=false) |
43 |
|
private String createId; |
44 |
|
|
45 |
|
@Temporal(TemporalType.TIMESTAMP) |
46 |
|
private Date updateTime; |
47 |
|
|
48 |
|
private String updateId; |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0
|
public Date getCreateTime() {... |
59 |
0
|
return createTime; |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
0
|
public void setCreateTime(Date createTime) {... |
63 |
0
|
this.createTime = createTime; |
64 |
|
} |
65 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
0
|
public String getCreateId() {... |
67 |
0
|
return createId; |
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
0
|
public void setCreateId(String createId) {... |
71 |
0
|
this.createId = createId; |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0
|
public Date getUpdateTime() {... |
75 |
0
|
return updateTime; |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
0
|
public void setUpdateTime(Date updateTime) {... |
79 |
0
|
this.updateTime = updateTime; |
80 |
|
} |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0
|
public String getUpdateId() {... |
83 |
0
|
return updateId; |
84 |
|
} |
85 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
86 |
0
|
public void setUpdateId(String updateId) {... |
87 |
0
|
this.updateId = updateId; |
88 |
|
} |
89 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
90 |
0
|
@Override... |
91 |
|
protected void onPrePersist(){ |
92 |
0
|
super.onPrePersist(); |
93 |
0
|
setCreateTime(new Date()); |
94 |
0
|
setUpdateTime(new Date()); |
95 |
|
|
96 |
0
|
String user = SecurityUtils.getCurrentUserId(); |
97 |
0
|
setCreateId(user); |
98 |
0
|
setUpdateId(user); |
99 |
|
|
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
102 |
0
|
@Override... |
103 |
|
protected void onPreUpdate(){ |
104 |
0
|
super.onPreUpdate(); |
105 |
|
|
106 |
0
|
if(getCreateTime() == null){ |
107 |
0
|
setCreateTime(new Date()); |
108 |
|
} |
109 |
|
|
110 |
0
|
String user = SecurityUtils.getCurrentUserId(); |
111 |
0
|
setUpdateId(user); |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
114 |
0
|
public MetaInfo toDTO() {... |
115 |
0
|
MetaInfo.Builder miBuilder = new MetaInfo.Builder(); |
116 |
0
|
miBuilder.setCreateId(getCreateId()); |
117 |
0
|
miBuilder.setCreateTime(getCreateTime()); |
118 |
0
|
miBuilder.setUpdateId(getUpdateId()); |
119 |
0
|
miBuilder.setUpdateTime(getUpdateTime()); |
120 |
|
|
121 |
0
|
return miBuilder.build(); |
122 |
|
} |
123 |
|
} |