View Javadoc
1   /**
2    * Copyright 2005-2016 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * This class provides travel destination record for TEM sample
46   *
47   * @author Kuali Rice Team (rice.collab@kuali.org)
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
57      @Column(name = "TRVL_DEST_ID", length = 40)
58      @GeneratedValue(generator = "TRVL_DEST_ID_S")
59      @PortableSequenceGenerator(name = "TRVL_DEST_ID_S")
60      @Label("Id")
61      @Description("Unique identifier for destination item")
62      @UifValidCharactersConstraintBeanName("AlphaNumericPatternConstraint")
63      private String travelDestinationId;
64  
65      @Column(name = "DEST_NM", length = 40)
66      @Label("Destination")
67      @Description("Name of location")
68      private String travelDestinationName;
69  
70      @Column(name = "POSTAL_CNTRY_CD")
71      @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
72                        @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
73      @KeyValuesFinderClass(PostalCountryCodeKeyValuesFinder.class)
74      @Label("Country")
75      private String countryCd;
76  
77      @Transient
78      @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA))
79      @Label("Country")
80      private String countryName;
81  
82      @Column(name = "POSTAL_STATE_CD")
83      @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT),
84                        @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)})
85      @KeyValuesFinderClass(PostalStateCodeKeyValuesFinder.class)
86      @Label("State")
87      private String stateCd;
88  
89      @Transient
90      @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA))
91      @Label("State")
92      private String stateName;
93  
94  
95      @Column(name = "ACTV_IND", nullable = false, length = 1)
96      @javax.persistence.Convert(converter = BooleanYNConverter.class)
97      @Label("Active")
98      @Description("Whether active or inactive")
99      private boolean active = Boolean.TRUE;
100 
101     public String getTravelDestinationId() {
102         return travelDestinationId;
103     }
104 
105     public void setTravelDestinationId(String travelDestinationId) {
106         this.travelDestinationId = travelDestinationId;
107     }
108 
109     public String getTravelDestinationName() {
110         return travelDestinationName;
111     }
112 
113     public void setTravelDestinationName(String travelDestinationName) {
114         this.travelDestinationName = travelDestinationName;
115     }
116 
117     public String getCountryCd() {
118         return countryCd;
119     }
120 
121     public void setCountryCd(String countryCd) {
122         this.countryCd = countryCd;
123     }
124 
125     public String getCountryName() {
126         return PostalCountryCode.valueOf(countryCd).getLabel();
127     }
128 
129     public String getStateCd() {
130         return stateCd;
131     }
132 
133     public void setStateCd(String stateCd) {
134         this.stateCd = stateCd;
135     }
136 
137     public String getStateName() {
138         return PostalStateCode.valueOf(stateCd).getLabel();
139     }
140 
141     public boolean isActive() {
142         return active;
143     }
144 
145     public void setActive(boolean active) {
146         this.active = active;
147     }
148 }