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 org.kuali.rice.kim.impl.identity; 017 018import javax.persistence.Column; 019import javax.persistence.Convert; 020import javax.persistence.Entity; 021import javax.persistence.Id; 022import javax.persistence.Table; 023 024import org.kuali.rice.kim.api.identity.CodedAttribute; 025import org.kuali.rice.kim.framework.identity.EntityTypeEbo; 026import org.kuali.rice.krad.bo.DataObjectBase; 027import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter; 028 029@Entity 030@Table(name = "KRIM_ENT_TYP_T") 031public class EntityTypeBo extends DataObjectBase implements EntityTypeEbo { 032 private static final long serialVersionUID = 1L; 033 034 @Id 035 @Column(name = "ENT_TYP_CD") 036 private String code; 037 038 @Column(name = "NM") 039 private String name; 040 041 @Column(name = "ACTV_IND") 042 @Convert(converter = BooleanYNConverter.class) 043 private boolean active; 044 045 @Column(name = "DISPLAY_SORT_CD") 046 private String sortCode; 047 048 /** 049 * Converts a mutable AddressTypeBo to an immutable AddressType representation. 050 * 051 * @param bo 052 * @return an immutable AddressType 053 */ 054 public static CodedAttribute to(EntityTypeBo bo) { 055 if (bo == null) { 056 return null; 057 } 058 return CodedAttribute.Builder.create(bo).build(); 059 } 060 061 /** 062 * Creates a AddressType business object from an immutable representation of a AddressType. 063 * 064 * @param an immutable AddressType 065 * @return a AddressTypeBo 066 */ 067 public static EntityTypeBo from(CodedAttribute immutable) { 068 if (immutable == null) { 069 return null; 070 } 071 EntityTypeBo bo = new EntityTypeBo(); 072 bo.code = immutable.getCode(); 073 bo.name = immutable.getName(); 074 bo.sortCode = immutable.getSortCode(); 075 bo.active = immutable.isActive(); 076 bo.setVersionNumber(immutable.getVersionNumber()); 077 bo.setObjectId(immutable.getObjectId()); 078 return bo; 079 } 080 081 @Override 082 public String getCode() { 083 return code; 084 } 085 086 public void setCode(String code) { 087 this.code = code; 088 } 089 090 @Override 091 public String getName() { 092 return name; 093 } 094 095 public void setName(String name) { 096 this.name = name; 097 } 098 099 public boolean getActive() { 100 return active; 101 } 102 103 @Override 104 public boolean isActive() { 105 return active; 106 } 107 108 public void setActive(boolean active) { 109 this.active = active; 110 } 111 112 @Override 113 public String getSortCode() { 114 return sortCode; 115 } 116 117 public void setSortCode(String sortCode) { 118 this.sortCode = sortCode; 119 } 120 121 @Override 122 public void refresh() { 123 } 124}