1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.impl.component; |
17 | |
|
18 | |
|
19 | |
import javax.persistence.Column |
20 | |
import javax.persistence.Entity |
21 | |
import javax.persistence.FetchType |
22 | |
import javax.persistence.Id |
23 | |
import javax.persistence.IdClass |
24 | |
import javax.persistence.JoinColumn |
25 | |
import javax.persistence.ManyToOne |
26 | |
import javax.persistence.Table |
27 | |
import javax.persistence.Transient |
28 | |
import org.hibernate.annotations.Type |
29 | |
import org.kuali.rice.core.api.component.Component |
30 | |
import org.kuali.rice.core.api.component.ComponentContract |
31 | |
import org.kuali.rice.core.impl.namespace.NamespaceBo |
32 | |
import org.kuali.rice.kns.bo.Inactivateable |
33 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase |
34 | |
|
35 | |
@IdClass(ComponentId.class) |
36 | |
@Entity |
37 | |
@Table(name="KRNS_PARM_DTL_TYP_T") |
38 | |
public class ComponentBo extends PersistableBusinessObjectBase implements ComponentContract, Inactivateable { |
39 | |
|
40 | |
private static final long serialVersionUID = 1L; |
41 | |
|
42 | |
@Id |
43 | |
@Column(name="NMSPC_CD") |
44 | |
def String namespaceCode; |
45 | |
|
46 | |
@Id |
47 | |
@Column(name="PARM_DTL_TYP_CD") |
48 | |
def String code; |
49 | |
|
50 | |
@Column(name="NM") |
51 | |
def String name; |
52 | |
|
53 | |
@Type(type="yes_no") |
54 | |
@Column(name="ACTV_IND") |
55 | |
def boolean active = true; |
56 | |
|
57 | |
@Transient |
58 | |
def boolean virtual; |
59 | |
|
60 | |
@ManyToOne(fetch=FetchType.LAZY) |
61 | |
@JoinColumn(name="NMSPC_CD", insertable=false, updatable=false) |
62 | |
def NamespaceBo namespace; |
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
static Component to(ComponentBo bo) { |
70 | 0 | if (bo == null) { |
71 | 0 | return null |
72 | |
} |
73 | |
|
74 | 0 | return Component.Builder.create(bo).build(); |
75 | |
} |
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
static ComponentBo from(Component im) { |
83 | 0 | if (im == null) { |
84 | 0 | return null |
85 | |
} |
86 | |
|
87 | 0 | ComponentBo bo = new ComponentBo() |
88 | 0 | bo.code = im.code |
89 | 0 | bo.name = im.name |
90 | 0 | bo.active = im.active |
91 | 0 | bo.namespaceCode = im.namespaceCode |
92 | 0 | bo.virtual = im.virtual |
93 | 0 | bo.versionNumber = im.versionNumber |
94 | 0 | bo.objectId = im.objectId |
95 | |
|
96 | 0 | return bo; |
97 | |
} |
98 | |
} |
99 | |
|