1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.location.impl.country;
17
18 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
19 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
20 import org.kuali.rice.location.api.country.Country;
21 import org.kuali.rice.location.framework.country.CountryEbo;
22
23 import javax.persistence.Column;
24 import javax.persistence.Convert;
25 import javax.persistence.Entity;
26 import javax.persistence.Id;
27 import javax.persistence.Table;
28
29 @Entity
30 @Table(name = "KRLC_CNTRY_T")
31 public class CountryBo extends PersistableBusinessObjectBase implements CountryEbo {
32
33 private static final long serialVersionUID = 5725250018402409870L;
34
35 @Id
36 @Column(name = "POSTAL_CNTRY_CD")
37 private String code;
38
39 @Column(name = "ALT_POSTAL_CNTRY_CD")
40 private String alternateCode;
41
42 @Column(name = "POSTAL_CNTRY_NM")
43 private String name;
44
45 @Column(name = "PSTL_CNTRY_RSTRC_IND")
46 @Convert(converter = BooleanYNConverter.class)
47 private boolean restricted;
48
49 @Column(name = "ACTV_IND")
50 @Convert(converter = BooleanYNConverter.class)
51 private boolean active;
52
53 @Override
54 public String getCode() {
55 return code;
56 }
57
58 public void setCode(String code) {
59 this.code = code;
60 }
61
62 @Override
63 public String getAlternateCode() {
64 return alternateCode;
65 }
66
67 public void setAlternateCode(String alternateCode) {
68 this.alternateCode = alternateCode;
69 }
70
71 @Override
72 public String getName() {
73 return name;
74 }
75
76 public void setName(String name) {
77 this.name = name;
78 }
79
80 @Override
81 public boolean isRestricted() {
82 return restricted;
83 }
84
85 public void setRestricted(boolean restricted) {
86 this.restricted = restricted;
87 }
88
89 @Override
90 public boolean isActive() {
91 return active;
92 }
93
94 @Override
95 public void setActive(boolean active) {
96 this.active = active;
97 }
98
99
100
101
102
103
104 public static Country to(CountryBo bo) {
105 if (bo == null) {
106 return null;
107 }
108 return Country.Builder.create(bo).build();
109 }
110
111
112
113
114
115
116 public static CountryBo from(Country immutable) {
117 if (immutable == null) {
118 return null;
119 }
120
121 CountryBo bo = new CountryBo();
122 bo.code = immutable.getCode();
123 bo.alternateCode = immutable.getAlternateCode();
124 bo.name = immutable.getName();
125 bo.restricted = immutable.isRestricted();
126 bo.active = immutable.isActive();
127 bo.versionNumber = immutable.getVersionNumber();
128
129 return bo;
130 }
131 }