001/**
002 * Copyright 2005-2015 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 org.kuali.rice.krad.labs;
017
018import org.kuali.rice.krad.bo.DataObjectBase;
019import org.kuali.rice.krad.data.provider.annotation.Label;
020import org.kuali.rice.krad.data.provider.annotation.NonPersistentProperty;
021import org.kuali.rice.krad.data.provider.annotation.ShortLabel;
022import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViewType;
023import org.kuali.rice.krad.data.provider.annotation.UifAutoCreateViews;
024import org.kuali.rice.krad.data.provider.annotation.UifValidCharactersConstraintBeanName;
025import org.kuali.rice.krad.demo.travel.dataobject.TravelAccountType;
026
027import javax.persistence.Column;
028import javax.persistence.Entity;
029import javax.persistence.Id;
030import javax.persistence.Table;
031import javax.validation.constraints.NotNull;
032
033/**
034 * Labs version of {@code TravelAccountType} to demonstrate encryption.
035 *
036 * @author Kuali Rice Team (rice.collab@kuali.org)
037 */
038@Entity
039@Table(name="TRV_ACCT_TYPE")
040@UifAutoCreateViews({UifAutoCreateViewType.INQUIRY,UifAutoCreateViewType.LOOKUP})
041public class LabsEncryptedTravelAccountType extends DataObjectBase {
042    private static final long serialVersionUID = -7663911201081500300L;
043
044    @Id
045    @Column(name="ACCT_TYPE",length=3)
046    @Label("Travel Account Type Code")
047    @ShortLabel("Code")
048    @UifValidCharactersConstraintBeanName("AnyCharacterPatternConstraint")
049    private String accountTypeCode;
050
051    @Column(name="ACCT_TYPE_NAME",length=40)
052    @Label("Account Type Name")
053    @ShortLabel("Name")
054    @NotNull
055    @UifValidCharactersConstraintBeanName("AnyCharacterPatternConstraint")
056    private String name;
057
058
059    public String getAccountTypeCode() {
060        return accountTypeCode;
061    }
062
063
064    public void setAccountTypeCode(String accountTypeCode) {
065        this.accountTypeCode = accountTypeCode;
066    }
067
068
069    public String getName() {
070        return name;
071    }
072
073
074    public void setName(String name) {
075        this.name = name;
076    }
077
078    @NonPersistentProperty
079    @Label("Account Type")
080    public String getCodeAndDescription() {
081        if (accountTypeCode != null) {
082            return accountTypeCode + " - " + name;
083        }
084
085        return "";
086    }
087}