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