001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.travel.dataobject; 017 018import edu.sampleu.travel.options.PostalCountryCode; 019import edu.sampleu.travel.options.PostalCountryCodeKeyValuesFinder; 020import edu.sampleu.travel.options.PostalStateCode; 021import edu.sampleu.travel.options.PostalStateCodeKeyValuesFinder; 022import org.kuali.rice.core.api.mo.common.active.MutableInactivatable; 023import org.kuali.rice.krad.bo.DataObjectBase; 024import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter; 025import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 026import org.kuali.rice.krad.data.provider.annotation.Description; 027import org.kuali.rice.krad.data.provider.annotation.KeyValuesFinderClass; 028import org.kuali.rice.krad.data.provider.annotation.Label; 029import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType; 030import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews; 031import org.kuali.rice.krad.data.provider.annotation.UifDisplayHint; 032import org.kuali.rice.krad.data.provider.annotation.UifDisplayHintType; 033import org.kuali.rice.krad.data.provider.annotation.UifDisplayHints; 034import org.kuali.rice.krad.data.provider.annotation.UifValidCharactersConstraintBeanName; 035 036import javax.persistence.Column; 037import javax.persistence.Entity; 038import javax.persistence.GeneratedValue; 039import javax.persistence.Id; 040import javax.persistence.Table; 041import javax.persistence.Transient; 042import java.io.Serializable; 043 044/** 045 * This class provides travel destination record for TEM sample 046 * 047 * @author Kuali Rice Team (rice.collab@kuali.org) 048 */ 049@Entity 050@Table(name = "TRVL_DEST_T") 051@UifAutoCreateViews({UifAutoCreateViewType.INQUIRY, UifAutoCreateViewType.LOOKUP}) 052public class TravelDestination extends DataObjectBase implements MutableInactivatable, Serializable { 053 054 private static final long serialVersionUID = 8448891916448081149L; 055 056 @Id 057 @Column(name = "TRVL_DEST_ID", length = 40) 058 @GeneratedValue(generator = "TRVL_DEST_ID_S") 059 @PortableSequenceGenerator(name = "TRVL_DEST_ID_S") 060 @Label("Id") 061 @Description("Unique identifier for destination item") 062 @UifValidCharactersConstraintBeanName("AlphaNumericPatternConstraint") 063 private String travelDestinationId; 064 065 @Column(name = "DEST_NM", length = 40) 066 @Label("Destination") 067 @Description("Name of location") 068 private String travelDestinationName; 069 070 @Column(name = "POSTAL_CNTRY_CD") 071 @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT), 072 @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)}) 073 @KeyValuesFinderClass(PostalCountryCodeKeyValuesFinder.class) 074 @Label("Country") 075 private String countryCd; 076 077 @Transient 078 @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)) 079 @Label("Country") 080 private String countryName; 081 082 @Column(name = "POSTAL_STATE_CD") 083 @UifDisplayHints({@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_RESULT), 084 @UifDisplayHint(UifDisplayHintType.NO_INQUIRY)}) 085 @KeyValuesFinderClass(PostalStateCodeKeyValuesFinder.class) 086 @Label("State") 087 private String stateCd; 088 089 @Transient 090 @UifDisplayHints(@UifDisplayHint(UifDisplayHintType.NO_LOOKUP_CRITERIA)) 091 @Label("State") 092 private String stateName; 093 094 095 @Column(name = "ACTV_IND", nullable = false, length = 1) 096 @javax.persistence.Convert(converter = BooleanYNConverter.class) 097 @Label("Active") 098 @Description("Whether active or inactive") 099 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}