1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.impl.group |
17 | |
|
18 | |
import javax.persistence.Column |
19 | |
import javax.persistence.Entity |
20 | |
import javax.persistence.GeneratedValue |
21 | |
import javax.persistence.Id |
22 | |
import javax.persistence.Table |
23 | |
|
24 | |
import org.hibernate.annotations.GenericGenerator |
25 | |
import org.hibernate.annotations.Parameter |
26 | |
import org.kuali.rice.kim.api.group.GroupMember |
27 | |
import org.kuali.rice.kim.api.group.GroupMemberContract |
28 | |
import org.kuali.rice.kim.impl.membership.AbstractMemberBo |
29 | |
import java.sql.Timestamp |
30 | |
import org.joda.time.DateTime |
31 | |
|
32 | |
@Entity |
33 | |
@Table(name="KRIM_GRP_MBR_T") |
34 | |
public class GroupMemberBo extends AbstractMemberBo implements GroupMemberContract { |
35 | |
private static final long serialVersionUID = 1L; |
36 | |
|
37 | |
@Id |
38 | |
@GeneratedValue(generator="KRIM_GRP_MBR_ID_S") |
39 | |
@GenericGenerator(name="KRIM_GRP_MBR_ID_S",strategy="org.kuali.rice.core.framework.persistence.jpa.RiceNumericStringSequenceStyleGenerator",parameters=[ |
40 | |
@Parameter(name="sequence_name",value="KRIM_GRP_MBR_ID_S"), |
41 | |
@Parameter(name="value_column",value="id") |
42 | |
]) |
43 | |
@Column(name="GRP_MBR_ID") |
44 | |
String id; |
45 | |
|
46 | |
@Column(name="GRP_ID") |
47 | |
String groupId |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
static GroupMember to(GroupMemberBo bo) { |
55 | 0 | if (bo == null) { |
56 | 0 | return null |
57 | |
} |
58 | |
|
59 | 0 | return GroupMember.Builder.create(bo).build(); |
60 | |
} |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
static GroupMemberBo from(GroupMember im) { |
68 | 0 | if (im == null) { |
69 | 0 | return null |
70 | |
} |
71 | |
|
72 | 0 | GroupMemberBo bo = new GroupMemberBo() |
73 | 0 | bo.id = im.id |
74 | 0 | bo.groupId = im.groupId |
75 | 0 | bo.memberId = im.memberId |
76 | 0 | bo.typeCode = im.type.code |
77 | 0 | bo.activeFromDateValue = im.activeFromDate == null ? null : new Timestamp(im.activeFromDate.getMillis()); |
78 | 0 | bo.activeToDateValue = im.activeToDate == null ? null : new Timestamp(im.activeToDate.getMillis()); |
79 | 0 | bo.versionNumber = im.versionNumber |
80 | 0 | bo.objectId = im.objectId; |
81 | |
|
82 | 0 | return bo |
83 | |
} |
84 | |
|
85 | |
} |