1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.travel.dataobject;
17
18 import edu.sampleu.travel.options.PostalCountryCode;
19 import edu.sampleu.travel.options.PostalCountryCodeKeyValuesFinder;
20 import edu.sampleu.travel.options.PostalStateCode;
21 import edu.sampleu.travel.options.PostalStateCodeKeyValuesFinder;
22 import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
23 import org.kuali.rice.krad.bo.DataObjectBase;
24 import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
25 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
26 import org.kuali.rice.krad.data.provider.annotation.Description;
27 import org.kuali.rice.krad.data.provider.annotation.KeyValuesFinderClass;
28 import org.kuali.rice.krad.data.provider.annotation.Label;
29 import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
30 import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
31 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint;
32 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHintType;
33 import org.kuali.rice.krad.data.provider.annotation.UifDisplayHints;
34 import org.kuali.rice.krad.data.provider.annotation.UifValidCharactersConstraintBeanName;
35
36 import javax.persistence.Column;
37 import javax.persistence.Entity;
38 import javax.persistence.GeneratedValue;
39 import javax.persistence.Id;
40 import javax.persistence.Table;
41 import javax.persistence.Transient;
42 import java.io.Serializable;
43
44
45
46
47
48
49 @Entity
50 @Table(name = "TRVL_DEST_T")
51 @UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP})
52 public class TravelDestination extends DataObjectBase implements MutableInactivatable, Serializable {
53
54 private static final long serialVersionUID = 8448891916448081149L;
55
56 @Id @Column(name = "TRVL_DEST_ID", length = 40)
57 @GeneratedValue(generator = "TRVL_DEST_ID_S")
58 @PortableSequenceGenerator(name = "TRVL_DEST_ID_S")
59 @Label("Id")
60 @Description("Unique identifier for destination item")
61 @UifValidCharactersConstraintBeanName("AlphaNumericPatternConstraint")
62 private String travelDestinationId;
63
64 @Column(name = "DEST_NM", length = 40)
65 @Label("Destination")
66 @Description("Name of location")
67 private String travelDestinationName;
68
69 @Column(name = "POSTAL_CNTRY_CD")
70 @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
71 @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
72 @KeyValuesFinderClass(PostalCountryCodeKeyValuesFinder.class)
73 @Label("Country")
74 private String countryCd;
75
76 @Transient
77 @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA))
78 @Label("Country")
79 private String countryName;
80
81 @Column(name = "POSTAL_STATE_CD")
82 @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
83 @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
84 @KeyValuesFinderClass(PostalStateCodeKeyValuesFinder.class)
85 @Label("State")
86 private String stateCd;
87
88 @Transient
89 @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA))
90 @Label("State")
91 private String stateName;
92
93
94 @Column(name = "ACTV_IND", nullable = false, length = 1)
95 @javax.persistence.Convert(converter = BooleanYNConverter.class)
96 @Label("Active")
97 @Description("Whether active or inactive")
98 private boolean active = Boolean.TRUE;
99
100 public String getTravelDestinationId() {
101 return travelDestinationId;
102 }
103
104 public void setTravelDestinationId(String travelDestinationId) {
105 this.travelDestinationId = travelDestinationId;
106 }
107
108 public String getTravelDestinationName() {
109 return travelDestinationName;
110 }
111
112 public void setTravelDestinationName(String travelDestinationName) {
113 this.travelDestinationName = travelDestinationName;
114 }
115
116 public String getCountryCd() {
117 return countryCd;
118 }
119
120 public void setCountryCd(String countryCd) {
121 this.countryCd = countryCd;
122 }
123
124 public String getCountryName() {
125 return PostalCountryCode.valueOf(countryCd).getLabel();
126 }
127
128 public String getStateCd() {
129 return stateCd;
130 }
131
132 public void setStateCd(String stateCd) {
133 this.stateCd = stateCd;
134 }
135
136 public String getStateName() {
137 return PostalStateCode.valueOf(stateCd).getLabel();
138 }
139
140 public boolean isActive() {
141 return active;
142 }
143
144 public void setActive(boolean active) {
145 this.active = active;
146 }
147 }