1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.shareddata.impl.campus |
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.JoinColumn |
24 | |
import javax.persistence.OneToOne |
25 | |
import javax.persistence.Table |
26 | |
import org.hibernate.annotations.Type |
27 | |
import org.kuali.rice.kns.bo.Inactivateable |
28 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase |
29 | |
import org.kuali.rice.shareddata.api.campus.CampusContract |
30 | |
|
31 | |
@Entity |
32 | |
@Table(name="KRLC_CMP_T") |
33 | |
public class CampusBo extends PersistableBusinessObjectBase implements Inactivateable, CampusContract { |
34 | |
private static final long serialVersionUID = 787567094298971223L; |
35 | |
@Id |
36 | |
@Column(name="CAMPUS_CD") |
37 | |
def String code; |
38 | |
|
39 | |
@Column(name="CAMPUS_NM") |
40 | |
def String name; |
41 | |
|
42 | |
@Column(name="CAMPUS_SHRT_NM") |
43 | |
def String shortName; |
44 | |
|
45 | |
@Column(name="CAMPUS_TYP_CD") |
46 | |
def String campusTypeCode; |
47 | |
|
48 | |
@Type(type="yes_no") |
49 | |
@Column(name="ACTV_IND") |
50 | |
def boolean active; |
51 | |
|
52 | |
@OneToOne(fetch=FetchType.EAGER) |
53 | |
@JoinColumn(name="CAMPUS_TYP_CD", insertable=false, updatable=false) |
54 | |
def CampusTypeBo campusType; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
static org.kuali.rice.shareddata.api.campus.Campus to(CampusBo bo) { |
62 | 9 | if (bo == null) { return null } |
63 | 8 | return org.kuali.rice.shareddata.api.campus.Campus.Builder.create(bo).build(); |
64 | |
} |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
static CampusBo from(org.kuali.rice.shareddata.api.campus.Campus im) { |
72 | 1 | if (im == null) { return null } |
73 | |
|
74 | 1 | CampusBo bo = new CampusBo() |
75 | 1 | bo.code = im.code |
76 | 1 | bo.name = im.name |
77 | 1 | bo.shortName = im.shortName |
78 | 1 | bo.active = im.active |
79 | 1 | if (im.campusType != null) { |
80 | 0 | bo.campusTypeCode = im.campusType.code |
81 | |
} |
82 | 1 | bo.campusType = CampusTypeBo.from(im.campusType) |
83 | 1 | bo.versionNumber = im.versionNumber |
84 | 1 | bo.objectId = im.objectId |
85 | |
|
86 | 1 | return bo |
87 | |
} |
88 | |
|
89 | |
@Override |
90 | |
CampusTypeBo getCampusType() { |
91 | 8 | return campusType |
92 | |
} |
93 | |
} |