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 import org.kuali.rice.kim.api.common.attribute.KimAttribute;
24 import org.kuali.rice.kim.api.common.attribute.KimAttributeData;
25 import org.kuali.rice.kim.impl.common.attribute.KimAttributeBo;
26 import org.kuali.rice.kim.impl.common.attribute.KimAttributeDataBo;
27 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
28
29 @Entity
30 @Table(name = "KRIM_GRP_ATTR_DATA_T")
31 public class GroupAttributeBo extends KimAttributeDataBo {
32
33 private static final long serialVersionUID = 6380313567330578976L;
34
35 @PortableSequenceGenerator(name = "KRIM_GRP_ATTR_DATA_ID_S")
36 @GeneratedValue(generator = "KRIM_GRP_ATTR_DATA_ID_S")
37 @Id
38 @Column(name = "ATTR_DATA_ID")
39 private String id;
40
41 @Column(name = "GRP_ID")
42 private String assignedToId;
43
44 @Override
45 public String getId() {
46 return id;
47 }
48
49 @Override
50 public void setId(String id) {
51 this.id = id;
52 }
53
54 @Override
55 public String getAssignedToId() {
56 return assignedToId;
57 }
58
59 @Override
60 public void setAssignedToId(String assignedToId) {
61 this.assignedToId = assignedToId;
62 }
63
64 public static KimAttributeData to(GroupAttributeBo bo) {
65 if (bo == null) {
66 return null;
67 }
68 return KimAttributeData.Builder.create(bo).build();
69 }
70
71 public static GroupAttributeBo from(KimAttributeData im) {
72 if (im == null) {
73 return null;
74 }
75 GroupAttributeBo bo = new GroupAttributeBo();
76 bo.setId(im.getId());
77 bo.setAssignedToId(im.getAssignedToId());
78 bo.setKimAttribute(KimAttributeBo.from(im.getKimAttribute()));
79 final KimAttribute attribute = im.getKimAttribute();
80 bo.setKimAttributeId((attribute == null ? null : attribute.getId()));
81 bo.setAttributeValue(bo.getAttributeValue());
82 bo.setKimTypeId(im.getKimTypeId());
83 bo.setVersionNumber(im.getVersionNumber());
84 bo.setObjectId(im.getObjectId());
85 return bo;
86 }
87 }