Coverage Report - org.kuali.rice.krad.bo.AdHocRoutePerson
 
Classes in this File Line Coverage Branch Coverage Complexity
AdHocRoutePerson
0%
0/12
0%
0/10
3.333
 
 1  
 /*
 2  
  * Copyright 2006-2007 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.krad.bo;
 17  
 
 18  
 import javax.persistence.Entity;
 19  
 import javax.persistence.IdClass;
 20  
 import javax.persistence.Table;
 21  
 import javax.persistence.Transient;
 22  
 
 23  
 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
 24  
 import org.kuali.rice.kim.bo.Person;
 25  
 
 26  
 /**
 27  
  * Ad Hoc Route Person Business Object
 28  
  */
 29  
 @IdClass(AdHocRoutePersonId.class)
 30  
 @Entity
 31  
 @Table(name="KRNS_ADHOC_RTE_ACTN_RECIP_T")
 32  
 public class AdHocRoutePerson extends AdHocRouteRecipient {
 33  
 
 34  
     private static final long serialVersionUID = 1L;
 35  
     
 36  
     @Transient
 37  
     private transient Person person;
 38  
 
 39  0
     public AdHocRoutePerson() {
 40  0
         setType(PERSON_TYPE);
 41  0
     }
 42  
 
 43  
     @Override
 44  
     public void setType(Integer type) {
 45  0
         if (!PERSON_TYPE.equals(type)) {
 46  0
             throw new IllegalArgumentException("cannot change type to " + type);
 47  
         }
 48  0
         super.setType(type);
 49  0
     }
 50  
 
 51  
     @Override
 52  
     public String getName() {
 53  0
         if ( person == null || person.getPrincipalName() == null || !person.getPrincipalName().equalsIgnoreCase( getId() ) ) {
 54  0
             person = KimApiServiceLocator.getPersonService().getPersonByPrincipalName( getId() );
 55  
         }
 56  0
         if ( person == null ) {
 57  0
             return "";
 58  
         }
 59  0
         return person.getName();
 60  
     }
 61  
     
 62  
     
 63  
 }
 64