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