View Javadoc
1   /**
2    * Copyright 2005-2015 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 org.kuali.rice.kim.impl.identity.visa;
17  
18  import javax.persistence.Column;
19  import javax.persistence.Entity;
20  import javax.persistence.GeneratedValue;
21  import javax.persistence.Id;
22  import javax.persistence.Table;
23  import javax.persistence.Transient;
24  
25  import org.kuali.rice.kim.api.identity.visa.EntityVisa;
26  import org.kuali.rice.kim.api.identity.visa.EntityVisaContract;
27  import org.kuali.rice.krad.bo.DataObjectBase;
28  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
29  
30  @Entity
31  @Table(name = "KRIM_ENTITY_VISA_T")
32  public class EntityVisaBo extends DataObjectBase implements EntityVisaContract {
33      private static final long serialVersionUID = 839311156412785770L;
34  
35      @PortableSequenceGenerator(name = "KRIM_ENTITY_VISA_ID_S")
36      @GeneratedValue(generator = "KRIM_ENTITY_VISA_ID_S")
37      @Id
38      @Column(name = "ID")
39      private String id;
40  
41      @Transient
42      private String visaTypeCode;
43  
44      @Column(name = "ENTITY_ID")
45      private String entityId;
46  
47      @Column(name = "VISA_TYPE_KEY")
48      private String visaTypeKey;
49  
50      @Column(name = "VISA_ENTRY")
51      private String visaEntry;
52  
53      @Column(name = "VISA_ID")
54      private String visaId;
55  
56  
57      public static EntityVisa to(EntityVisaBo bo) {
58          if (bo == null) {
59              return null;
60          }
61          return EntityVisa.Builder.create(bo).build();
62      }
63  
64      /**
65       * Creates a EntityVisaBo business object from an immutable representation of a EntityVisa.
66       *
67       * @param immutable an immutable EntityVisa
68       * @return a EntityVisaBo
69       */
70      public static EntityVisaBo from(EntityVisa immutable) {
71          if (immutable == null) {
72              return null;
73          }
74          EntityVisaBo bo = new EntityVisaBo();
75          bo.id = immutable.getId();
76          bo.entityId = immutable.getEntityId();
77          bo.visaTypeKey = immutable.getVisaTypeKey();
78          bo.visaEntry = immutable.getVisaEntry();
79          bo.visaId = immutable.getVisaId();
80          bo.setVersionNumber(immutable.getVersionNumber());
81          bo.setObjectId(immutable.getObjectId());
82          return bo;
83      }
84  
85      @Override
86      public String getId() {
87          return id;
88      }
89  
90      public void setId(String id) {
91          this.id = id;
92      }
93  
94      public String getVisaTypeCode() {
95          return visaTypeCode;
96      }
97  
98      public void setVisaTypeCode(String visaTypeCode) {
99          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 }