001/** 002 * Copyright 2005-2014 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.visa; 017 018import javax.persistence.Column; 019import javax.persistence.Entity; 020import javax.persistence.GeneratedValue; 021import javax.persistence.Id; 022import javax.persistence.Table; 023import javax.persistence.Transient; 024 025import org.kuali.rice.kim.api.identity.visa.EntityVisa; 026import org.kuali.rice.kim.api.identity.visa.EntityVisaContract; 027import org.kuali.rice.krad.bo.DataObjectBase; 028import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 029 030@Entity 031@Table(name = "KRIM_ENTITY_VISA_T") 032public class EntityVisaBo extends DataObjectBase implements EntityVisaContract { 033 private static final long serialVersionUID = 839311156412785770L; 034 035 @PortableSequenceGenerator(name = "KRIM_ENTITY_VISA_ID_S") 036 @GeneratedValue(generator = "KRIM_ENTITY_VISA_ID_S") 037 @Id 038 @Column(name = "ID") 039 private String id; 040 041 @Transient 042 private String visaTypeCode; 043 044 @Column(name = "ENTITY_ID") 045 private String entityId; 046 047 @Column(name = "VISA_TYPE_KEY") 048 private String visaTypeKey; 049 050 @Column(name = "VISA_ENTRY") 051 private String visaEntry; 052 053 @Column(name = "VISA_ID") 054 private String visaId; 055 056 057 public static EntityVisa to(EntityVisaBo bo) { 058 if (bo == null) { 059 return null; 060 } 061 return EntityVisa.Builder.create(bo).build(); 062 } 063 064 /** 065 * Creates a EntityVisaBo business object from an immutable representation of a EntityVisa. 066 * 067 * @param immutable an immutable EntityVisa 068 * @return a EntityVisaBo 069 */ 070 public static EntityVisaBo from(EntityVisa immutable) { 071 if (immutable == null) { 072 return null; 073 } 074 EntityVisaBo bo = new EntityVisaBo(); 075 bo.id = immutable.getId(); 076 bo.entityId = immutable.getEntityId(); 077 bo.visaTypeKey = immutable.getVisaTypeKey(); 078 bo.visaEntry = immutable.getVisaEntry(); 079 bo.visaId = immutable.getVisaId(); 080 bo.setVersionNumber(immutable.getVersionNumber()); 081 bo.setObjectId(immutable.getObjectId()); 082 return bo; 083 } 084 085 @Override 086 public String getId() { 087 return id; 088 } 089 090 public void setId(String id) { 091 this.id = id; 092 } 093 094 public String getVisaTypeCode() { 095 return visaTypeCode; 096 } 097 098 public void setVisaTypeCode(String visaTypeCode) { 099 this.visaTypeCode = visaTypeCode; 100 } 101 102 @Override 103 public String getEntityId() { 104 return entityId; 105 } 106 107 public void setEntityId(String entityId) { 108 this.entityId = entityId; 109 } 110 111 @Override 112 public String getVisaTypeKey() { 113 return visaTypeKey; 114 } 115 116 public void setVisaTypeKey(String visaTypeKey) { 117 this.visaTypeKey = visaTypeKey; 118 } 119 120 @Override 121 public String getVisaEntry() { 122 return visaEntry; 123 } 124 125 public void setVisaEntry(String visaEntry) { 126 this.visaEntry = visaEntry; 127 } 128 129 @Override 130 public String getVisaId() { 131 return visaId; 132 } 133 134 public void setVisaId(String visaId) { 135 this.visaId = visaId; 136 } 137 138}