1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.impl.common.attribute;
17
18 import javax.persistence.Column;
19 import javax.persistence.Convert;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.Id;
23 import javax.persistence.Table;
24
25 import org.kuali.rice.kim.api.common.attribute.KimAttribute;
26 import org.kuali.rice.kim.api.common.attribute.KimAttributeContract;
27 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
28 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
29 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
30
31 @Entity
32 @Table(name = "KRIM_ATTR_DEFN_T")
33 public class KimAttributeBo extends PersistableBusinessObjectBase implements KimAttributeContract {
34
35 private static final long serialVersionUID = 1L;
36
37 @PortableSequenceGenerator(name = "KRIM_ATTR_DEFN_ID_S")
38 @GeneratedValue(generator = "KRIM_ATTR_DEFN_ID_S")
39 @Id
40 @Column(name = "KIM_ATTR_DEFN_ID")
41 private String id;
42
43 @Column(name = "CMPNT_NM")
44 private String componentName;
45
46 @Column(name = "NM")
47 private String attributeName;
48
49 @Column(name = "NMSPC_CD")
50 private String namespaceCode;
51
52 @Column(name = "LBL")
53 private String attributeLabel;
54
55 @Column(name = "ACTV_IND")
56 @Convert(converter = BooleanYNConverter.class)
57 private boolean active;
58
59 public static KimAttribute to(KimAttributeBo bo) {
60 if (bo == null) {
61 return null;
62 }
63 return KimAttribute.Builder.create(bo).build();
64 }
65
66 public static KimAttributeBo from(KimAttribute im) {
67 if (im == null) {
68 return null;
69 }
70 KimAttributeBo bo = new KimAttributeBo();
71 bo.setId(im.getId());
72 bo.setComponentName(im.getComponentName());
73 bo.setAttributeName(im.getAttributeName());
74 bo.setNamespaceCode(im.getNamespaceCode());
75 bo.setAttributeLabel(im.getAttributeLabel());
76 bo.setActive(im.isActive());
77 bo.setVersionNumber(im.getVersionNumber());
78 bo.setObjectId(im.getObjectId());
79 return bo;
80 }
81
82 @Override
83 public String getId() {
84 return id;
85 }
86
87 public void setId(String id) {
88 this.id = id;
89 }
90
91 @Override
92 public String getComponentName() {
93 return componentName;
94 }
95
96 public void setComponentName(String componentName) {
97 this.componentName = componentName;
98 }
99
100 @Override
101 public String getAttributeName() {
102 return attributeName;
103 }
104
105 public void setAttributeName(String attributeName) {
106 this.attributeName = attributeName;
107 }
108
109 @Override
110 public String getNamespaceCode() {
111 return namespaceCode;
112 }
113
114 public void setNamespaceCode(String namespaceCode) {
115 this.namespaceCode = namespaceCode;
116 }
117
118 @Override
119 public String getAttributeLabel() {
120 return attributeLabel;
121 }
122
123 public void setAttributeLabel(String attributeLabel) {
124 this.attributeLabel = attributeLabel;
125 }
126
127 public boolean getActive() {
128 return active;
129 }
130
131 @Override
132 public boolean isActive() {
133 return active;
134 }
135
136 public void setActive(boolean active) {
137 this.active = active;
138 }
139 }