001 /**
002 * Copyright 2005-2013 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 */
016 package org.kuali.rice.kim.impl.identity.residency;
017
018 import org.joda.time.DateTime;
019 import org.kuali.rice.kim.api.identity.CodedAttributeContract;
020 import org.kuali.rice.kim.api.identity.residency.EntityResidency;
021 import org.kuali.rice.kim.api.identity.residency.EntityResidencyContract;
022 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
023 import org.kuali.rice.krad.data.jpa.eclipselink.PortableSequenceGenerator;
024
025 import javax.persistence.Column;
026 import javax.persistence.Entity;
027 import javax.persistence.GeneratedValue;
028 import javax.persistence.Id;
029 import javax.persistence.Table;
030
031 @Entity
032 @Table(name = "KRIM_ENTITY_RESIDENCY_T")
033 public class EntityResidencyBo extends PersistableBusinessObjectBase implements EntityResidencyContract {
034 private static final long serialVersionUID = 1L;
035 @Id
036 @GeneratedValue(generator = "KRIM_ENTITY_RESIDENCY_ID_S")
037 @PortableSequenceGenerator(name = "KRIM_ENTITY_RESIDENCY_ID_S")
038 @Column(name = "ID")
039 private String id;
040 @Column(name = "ENTITY_ID")
041 private String entityId;
042 @Column(name = "DETERMINATION_METHOD")
043 private String determinationMethod;
044 @Column(name = "IN_STATE")
045 private String inState;
046
047 public static EntityResidency to(EntityResidencyBo bo) {
048 if (bo == null) {
049 return null;
050 }
051
052 return EntityResidency.Builder.create(bo).build();
053 }
054
055 /**
056 * Creates a EntityResidencyBo business object from an immutable representation of a EntityResidency.
057 *
058 * @param immutable an immutable EntityResidency
059 * @return a EntityResidencyBo
060 */
061 public static EntityResidencyBo from(EntityResidency immutable) {
062 if (immutable == null) {
063 return null;
064 }
065
066 EntityResidencyBo bo = new EntityResidencyBo();
067 bo.entityId = immutable.getEntityId();
068 bo.id = immutable.getId();
069 bo.determinationMethod = immutable.getDeterminationMethod();
070 bo.inState = immutable.getInState();
071 bo.setVersionNumber(immutable.getVersionNumber());
072 bo.setObjectId(immutable.getObjectId());
073
074 return bo;
075 }
076
077 @Override
078 public DateTime getEstablishedDate() {
079 return null;//To change body of implemented methods use File | Settings | File Templates.
080 }
081
082 @Override
083 public DateTime getChangeDate() {
084 return null;//To change body of implemented methods use File | Settings | File Templates.
085 }
086
087 @Override
088 public String getCountryCode() {
089 return null;//To change body of implemented methods use File | Settings | File Templates.
090 }
091
092 @Override
093 public String getCountyCode() {
094 return null;//To change body of implemented methods use File | Settings | File Templates.
095 }
096
097 @Override
098 public String getStateProvinceCode() {
099 return null;//To change body of implemented methods use File | Settings | File Templates.
100 }
101
102 @Override
103 public CodedAttributeContract getResidencyStatus() {
104 return null;//To change body of implemented methods use File | Settings | File Templates.
105 }
106
107 @Override
108 public CodedAttributeContract getResidencyType() {
109 return null;//To change body of implemented methods use File | Settings | File Templates.
110 }
111
112 @Override
113 public String getId() {
114 return id;
115 }
116
117 public void setId(String id) {
118 this.id = id;
119 }
120
121 @Override
122 public String getEntityId() {
123 return entityId;
124 }
125
126 public void setEntityId(String entityId) {
127 this.entityId = entityId;
128 }
129
130 @Override
131 public String getDeterminationMethod() {
132 return determinationMethod;
133 }
134
135 public void setDeterminationMethod(String determinationMethod) {
136 this.determinationMethod = determinationMethod;
137 }
138
139 @Override
140 public String getInState() {
141 return inState;
142 }
143
144 public void setInState(String inState) {
145 this.inState = inState;
146 }
147
148 }