Coverage Report - org.kuali.rice.kim.bo.ui.PersonDocumentAffiliation
 
Classes in this File Line Coverage Branch Coverage Complexity
PersonDocumentAffiliation
0%
0/32
0%
0/8
1.571
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.bo.ui;
 17  
 
 18  
 import org.hibernate.annotations.Fetch;
 19  
 import org.hibernate.annotations.FetchMode;
 20  
 import org.hibernate.annotations.GenericGenerator;
 21  
 import org.hibernate.annotations.Parameter;
 22  
 import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationTypeBo;
 23  
 import org.kuali.rice.krad.util.ObjectUtils;
 24  
 
 25  
 import javax.persistence.CascadeType;
 26  
 import javax.persistence.Column;
 27  
 import javax.persistence.Entity;
 28  
 import javax.persistence.FetchType;
 29  
 import javax.persistence.GeneratedValue;
 30  
 import javax.persistence.Id;
 31  
 import javax.persistence.IdClass;
 32  
 import javax.persistence.JoinColumn;
 33  
 import javax.persistence.JoinColumns;
 34  
 import javax.persistence.ManyToOne;
 35  
 import javax.persistence.OneToMany;
 36  
 import javax.persistence.Table;
 37  
 import javax.persistence.Transient;
 38  
 import java.util.ArrayList;
 39  
 import java.util.List;
 40  
 
 41  
 /**
 42  
  * This is a description of what this class does - shyu don't forget to fill this in. 
 43  
  * 
 44  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 45  
  *
 46  
  */
 47  
 @IdClass(PersonDocumentAffiliationId.class)
 48  
 @Entity
 49  
 @Table(name = "KRIM_PND_AFLTN_MT")
 50  
 public class PersonDocumentAffiliation extends PersonDocumentBoDefaultBase {
 51  
         private static final long serialVersionUID = 1L;
 52  
 
 53  
         @Id
 54  
         @GeneratedValue(generator="KRIM_ENTITY_AFLTN_ID_S")
 55  
         @GenericGenerator(name="KRIM_ENTITY_AFLTN_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
 56  
                         @Parameter(name="sequence_name",value="KRIM_ENTITY_AFLTN_ID_S"),
 57  
                         @Parameter(name="value_column",value="id")
 58  
                 })
 59  
         @Column(name = "ENTITY_AFLTN_ID")
 60  
         protected String entityAffiliationId;
 61  
 
 62  
         @Column(name = "AFLTN_TYP_CD")
 63  
         protected String affiliationTypeCode;
 64  
 
 65  
         @Column(name = "CAMPUS_CD")
 66  
         protected String campusCode;
 67  
 
 68  
         @ManyToOne(targetEntity=EntityAffiliationTypeBo.class, fetch = FetchType.EAGER, cascade = {})
 69  
         @JoinColumn(name = "AFLTN_TYP_CD", insertable = false, updatable = false)
 70  
         protected EntityAffiliationTypeBo affiliationType;
 71  
         @Transient
 72  
         protected PersonDocumentEmploymentInfo newEmpInfo;
 73  
 
 74  
         @OneToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER)
 75  
         //@JoinColumn(name="ENTITY_AFLTN_ID", insertable=false, updatable=false)
 76  
         @Fetch(value = FetchMode.SELECT)
 77  
         @JoinColumns({
 78  
                 @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false),
 79  
                 @JoinColumn(name="ENTITY_AFLTN_ID", insertable=false, updatable=false)
 80  
         })
 81  
         protected List<PersonDocumentEmploymentInfo> empInfos;
 82  
 
 83  0
         public PersonDocumentAffiliation() {
 84  0
                 empInfos = new ArrayList<PersonDocumentEmploymentInfo>();
 85  0
                 setNewEmpInfo(new PersonDocumentEmploymentInfo());
 86  0
                 this.active = true;
 87  0
         }
 88  
 
 89  
         /**
 90  
          * @see org.kuali.rice.kim.api.identity.EntityAffiliationContract#getAffiliationTypeCode()
 91  
          */
 92  
         public String getAffiliationTypeCode() {
 93  0
                 if(ObjectUtils.isNull(affiliationTypeCode))
 94  0
                         return "";
 95  0
                 return affiliationTypeCode;
 96  
         }
 97  
 
 98  
         /**
 99  
          * @see org.kuali.rice.kim.api.identity.EntityAffiliationContract#getCampusCode()
 100  
          */
 101  
         public String getCampusCode() {
 102  0
                 return campusCode;
 103  
         }
 104  
 
 105  
         /**
 106  
          * @see org.kuali.rice.kim.api.identity.EntityAffiliationContract#getEntityAffiliationId()
 107  
          */
 108  
         public String getEntityAffiliationId() {
 109  0
                 if(ObjectUtils.isNull(entityAffiliationId))
 110  0
                         return "";
 111  0
                 return entityAffiliationId;
 112  
         }
 113  
 
 114  
         /**
 115  
          * @see org.kuali.rice.kim.api.identity.EntityAffiliationContract#setAffiliationTypeCode(java.lang.String)
 116  
          */
 117  
         public void setAffiliationTypeCode(String affiliationTypeCode) {
 118  0
                 this.affiliationTypeCode = affiliationTypeCode;
 119  0
         }
 120  
 
 121  
         /**
 122  
          * @see org.kuali.rice.kim.api.identity.EntityAffiliationContract#setCampusCode(java.lang.String)
 123  
          */
 124  
         public void setCampusCode(String campusCode) {
 125  0
                 this.campusCode = campusCode;
 126  0
         }
 127  
 
 128  
         public void setEntityAffiliationId(String entityAffiliationId) {
 129  0
                 this.entityAffiliationId = entityAffiliationId;
 130  0
         }
 131  
 
 132  
         public PersonDocumentEmploymentInfo getNewEmpInfo() {
 133  0
                 return this.newEmpInfo;
 134  
         }
 135  
 
 136  
         public void setNewEmpInfo(PersonDocumentEmploymentInfo newEmpInfo) {
 137  0
                 this.newEmpInfo = newEmpInfo;
 138  0
         }
 139  
 
 140  
         public List<PersonDocumentEmploymentInfo> getEmpInfos() {
 141  0
                 return this.empInfos;
 142  
         }
 143  
 
 144  
         public void setEmpInfos(List<PersonDocumentEmploymentInfo> empInfos) {
 145  0
                 this.empInfos = empInfos;
 146  0
         }
 147  
 
 148  
         public EntityAffiliationTypeBo getAffiliationType() {
 149  0
                 if(ObjectUtils.isNull(affiliationType))
 150  0
                         return null;
 151  0
                 return this.affiliationType;
 152  
         }
 153  
 
 154  
         public boolean isEmploymentAffiliationType() {
 155  0
                 if(ObjectUtils.isNull(affiliationType))
 156  0
                         return false;
 157  0
                 return this.affiliationType.isEmploymentAffiliationType();
 158  
         }
 159  
          
 160  
         public void setAffiliationType(EntityAffiliationTypeBo affiliationType) {
 161  0
                 this.affiliationType = affiliationType;
 162  0
         }
 163  
 
 164  
 }