1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
package org.kuali.rice.shareddata.impl.country |
22 | |
|
23 | |
import javax.persistence.Column |
24 | |
import javax.persistence.Id |
25 | |
import org.hibernate.annotations.Type |
26 | |
import org.kuali.rice.kns.bo.ExternalizableBusinessObject |
27 | |
import org.kuali.rice.kns.bo.Inactivateable |
28 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase |
29 | |
import org.kuali.rice.shareddata.api.country.Country |
30 | |
import org.kuali.rice.shareddata.api.country.CountryContract |
31 | |
import javax.persistence.Entity |
32 | |
import javax.persistence.Table |
33 | |
|
34 | |
@Entity |
35 | |
@Table(name="KRLC_CNTRY_T") |
36 | |
class CountryBo extends PersistableBusinessObjectBase implements Inactivateable, CountryContract, ExternalizableBusinessObject { |
37 | |
|
38 | |
@Id |
39 | |
@Column(name = "POSTAL_CNTRY_CD") |
40 | |
def String code; |
41 | |
|
42 | |
@Column(name = "ALT_POSTAL_CNTRY_CD") |
43 | |
def String alternateCode; |
44 | |
|
45 | |
@Column(name = "POSTAL_CNTRY_NM") |
46 | |
def String name; |
47 | |
|
48 | |
@Type(type = "yes_no") |
49 | |
@Column(name = "PSTL_CNTRY_RSTRC_IND") |
50 | |
def boolean restricted; |
51 | |
|
52 | |
@Type(type = "yes_no") |
53 | |
@Column(name = "ACTV_IND") |
54 | |
def boolean active; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
static Country to(CountryBo bo) { |
62 | 11 | if (bo == null) { return null } |
63 | 7 | return Country.Builder.create(bo).build() |
64 | |
} |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
static CountryBo from(Country immutable) { |
72 | 1 | if (immutable == null) {return null} |
73 | |
|
74 | 1 | CountryBo bo = new CountryBo() |
75 | 1 | bo.code = immutable.code |
76 | 1 | bo.alternateCode = immutable.alternateCode |
77 | 1 | bo.name = immutable.name |
78 | 1 | bo.restricted = immutable.restricted |
79 | 1 | bo.active = immutable.active |
80 | 1 | bo.versionNumber = immutable.versionNumber |
81 | |
|
82 | 1 | return bo; |
83 | |
} |
84 | |
} |