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 org.kuali.rice.kim.api.common.attribute.KimAttribute;
19 import org.kuali.rice.kim.api.common.attribute.KimAttributeData;
20 import org.kuali.rice.kim.api.common.attribute.KimAttributeDataContract;
21 import org.kuali.rice.kim.api.common.attribute.KimAttributeDataHistory;
22 import org.kuali.rice.kim.impl.common.attribute.KimAttributeBo;
23 import org.kuali.rice.kim.impl.common.attribute.KimAttributeDataBo;
24 import org.kuali.rice.krad.data.jpa.eclipselink.PortableSequenceGenerator;
25
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.Id;
30 import javax.persistence.Table;
31
32 @Entity
33 @Table(name = "KRIM_HIST_GRP_ATTR_DATA_T")
34 public class GroupAttributeHistoryBo extends KimAttributeDataBo implements KimAttributeDataContract
35 {
36 private static final long serialVersionUID = -1358263879165065051L;
37
38 @Id
39 @GeneratedValue(generator = "KRIM_HIST_GRP_ATTR_DATA_ID_S")
40 @PortableSequenceGenerator(name = "KRIM_HIST_GRP_ATTR_DATA_ID_S")
41 @Column(name="ATTR_DATA_ID")
42 private String id;
43
44 @Column(name = "GRP_HIST_ID")
45 private String assignedToId;
46
47 @Override
48 public String getId() {
49 return id;
50 }
51
52 @Override
53 public void setId(String id) {
54 this.id = id;
55 }
56
57 @Override
58 public String getAssignedToId() {
59 return assignedToId;
60 }
61
62 @Override
63 public void setAssignedToId(String assignedToId) {
64 this.assignedToId = assignedToId;
65 }
66
67
68
69
70
71
72 public static KimAttributeData to(GroupAttributeHistoryBo bo) {
73 if (bo == null) {
74 return null;
75 }
76
77 return KimAttributeData.Builder.create(bo).build();
78 }
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 public static GroupAttributeHistoryBo from(KimAttributeData im) {
100 if (im == null) {
101 return null;
102 }
103
104 GroupAttributeHistoryBo bo = new GroupAttributeHistoryBo();
105 bo.setId(im.getId());
106
107 bo.setAssignedToId(im.getAssignedToId());
108
109 bo.setKimAttribute(KimAttributeBo.from(im.getKimAttribute()));
110 final KimAttribute attribute = im.getKimAttribute();
111 bo.setKimAttributeId((attribute == null ? null : attribute.getId()));
112 bo.setAttributeValue(bo.getAttributeValue());
113 bo.setKimTypeId(im.getKimTypeId());
114 bo.setVersionNumber(im.getVersionNumber());
115 bo.setObjectId(im.getObjectId());
116
117 return bo;
118 }
119
120 }