View Javadoc

1   package org.kuali.rice.kim.impl.group;
2   
3   import org.eclipse.persistence.annotations.Customizer;
4   import org.kuali.rice.kim.api.common.attribute.KimAttribute;
5   import org.kuali.rice.kim.api.common.attribute.KimAttributeData;
6   import org.kuali.rice.kim.api.common.attribute.KimAttributeDataContract;
7   import org.kuali.rice.kim.impl.common.attribute.KimAttributeBo;
8   import org.kuali.rice.kim.impl.common.attribute.KimAttributeDataBo;
9   import org.kuali.rice.krad.data.provider.jpa.eclipselink.EclipseLinkSequenceCustomizer;
10  
11  import org.kuali.rice.krad.data.platform.generator.Sequence;
12  
13  import javax.persistence.Column;
14  import javax.persistence.Entity;
15  import javax.persistence.Table;
16  
17  @Entity
18  @Customizer(EclipseLinkSequenceCustomizer.class)
19  @Sequence(name="KRIM_GRP_ATTR_DATA_ID_S", property="id")
20  @Table(name = "KRIM_GRP_ATTR_DATA_T")
21  public class GroupAttributeBo extends KimAttributeDataBo implements KimAttributeDataContract {
22      private static final long serialVersionUID = 6380313567330578976L;
23      @Column(name = "GRP_ID")
24      private String assignedToId;
25  
26      public static KimAttributeData to(GroupAttributeBo bo) {
27          if (bo == null) {
28              return null;
29          }
30  
31          return KimAttributeData.Builder.create(bo).build();
32      }
33  
34      public static GroupAttributeBo from(KimAttributeData im) {
35          if (im == null) {
36              return null;
37          }
38  
39          GroupAttributeBo bo = new GroupAttributeBo();
40          bo.setId(im.getId());
41          bo.setAssignedToId(im.getAssignedToId());
42          bo.setKimAttribute(KimAttributeBo.from(im.getKimAttribute()));
43          final KimAttribute attribute = im.getKimAttribute();
44          bo.setKimAttributeId((attribute == null ? null : attribute.getId()));
45          bo.setAttributeValue(bo.getAttributeValue());
46          bo.setKimTypeId(im.getKimTypeId());
47          bo.setVersionNumber(im.getVersionNumber());
48          bo.setObjectId(im.getObjectId());
49          return bo;
50      }
51  
52      @Override
53      public String getAssignedToId() {
54          return assignedToId;
55      }
56  
57      @Override
58      public void setAssignedToId(String assignedToId) {
59          this.assignedToId = assignedToId;
60      }
61  
62  
63  }