Coverage Report - org.kuali.rice.kim.bo.ui.PersonDocumentPhone
 
Classes in this File Line Coverage Branch Coverage Complexity
PersonDocumentPhone
0%
0/30
0%
0/2
1.062
 
 1  
 /*
 2  
  * Copyright 2007-2008 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.apache.commons.lang.StringUtils;
 19  
 import org.hibernate.annotations.GenericGenerator;
 20  
 import org.hibernate.annotations.Parameter;
 21  
 import org.kuali.rice.kim.api.identity.TypeContract;
 22  
 import org.kuali.rice.kim.impl.identity.phone.EntityPhoneTypeBo;
 23  
 
 24  
 import javax.persistence.Column;
 25  
 import javax.persistence.Entity;
 26  
 import javax.persistence.FetchType;
 27  
 import javax.persistence.GeneratedValue;
 28  
 import javax.persistence.Id;
 29  
 import javax.persistence.IdClass;
 30  
 import javax.persistence.JoinColumn;
 31  
 import javax.persistence.ManyToOne;
 32  
 import javax.persistence.Table;
 33  
 
 34  
 /**
 35  
  * This is a description of what this class does - shyu don't forget to fill this in. 
 36  
  * 
 37  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 38  
  *
 39  
  */
 40  
 @IdClass(PersonDocumentPhoneId.class)
 41  
 @Entity
 42  
 @Table(name = "KRIM_PND_PHONE_MT")
 43  
 public class PersonDocumentPhone extends PersonDocumentBoDefaultBase {
 44  
         @Id
 45  
         @GeneratedValue(generator="KRIM_ENTITY_PHONE_ID_S")
 46  
         @GenericGenerator(name="KRIM_ENTITY_PHONE_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
 47  
                         @Parameter(name="sequence_name",value="KRIM_ENTITY_PHONE_ID_S"),
 48  
                         @Parameter(name="value_column",value="id")
 49  
                 })
 50  
         @Column(name = "ENTITY_PHONE_ID")
 51  
         protected String entityPhoneId;
 52  
                 
 53  
         @Column(name = "ENT_TYP_CD")
 54  
         protected String entityTypeCode;
 55  
         
 56  
         @Column(name = "PHONE_TYP_CD")
 57  
         protected String phoneTypeCode;
 58  
         
 59  
         @Column(name = "PHONE_NBR")
 60  
         protected String phoneNumber;
 61  
         
 62  
         @Column(name = "PHONE_EXTN_NBR")
 63  
         protected String extensionNumber;
 64  
         
 65  
         @Column(name = "POSTAL_CNTRY_CD")
 66  
         protected String countryCode;
 67  
         
 68  
         @ManyToOne(targetEntity=EntityPhoneTypeBo.class, fetch = FetchType.EAGER, cascade = {})
 69  
         @JoinColumn(name = "PHONE_TYP_CD", insertable = false, updatable = false)
 70  
         protected TypeContract phoneType;
 71  
 
 72  
         // Waiting until we pull in from KFS
 73  
         // protected Country country;
 74  0
         public PersonDocumentPhone() {
 75  0
                 this.active = true;
 76  0
         }
 77  
         
 78  
         /**
 79  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#getCountryCode()
 80  
          */
 81  
         public String getCountryCode() {
 82  0
                 return countryCode;
 83  
         }
 84  
 
 85  
         /**
 86  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#getEntityPhoneId()
 87  
          */
 88  
         public String getEntityPhoneId() {
 89  0
                 return entityPhoneId;
 90  
         }
 91  
 
 92  
         /**
 93  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#getExtensionNumber()
 94  
          */
 95  
         public String getExtensionNumber() {
 96  0
                 return extensionNumber;
 97  
         }
 98  
 
 99  
         /**
 100  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#getPhoneNumber()
 101  
          */
 102  
         public String getPhoneNumber() {
 103  0
                 return phoneNumber;
 104  
         }
 105  
 
 106  
         /**
 107  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#getPhoneTypeCode()
 108  
          */
 109  
         public String getPhoneTypeCode() {
 110  0
                 return phoneTypeCode;
 111  
         }
 112  
 
 113  
         /**
 114  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#setCountryCode(java.lang.String)
 115  
          */
 116  
         public void setCountryCode(String countryCode) {
 117  0
                 this.countryCode = countryCode;
 118  0
         }
 119  
 
 120  
         /**
 121  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#setExtensionNumber(java.lang.String)
 122  
          */
 123  
         public void setExtensionNumber(String extensionNumber) {
 124  0
                 this.extensionNumber = extensionNumber;
 125  0
         }
 126  
 
 127  
         /**
 128  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#setPhoneNumber(java.lang.String)
 129  
          */
 130  
         public void setPhoneNumber(String phoneNumber) {
 131  0
                 this.phoneNumber = phoneNumber;
 132  0
         }
 133  
 
 134  
         /**
 135  
          * @see org.kuali.rice.kim.bo.entity.KimEntityPhone#setPhoneTypeCode(java.lang.String)
 136  
          */
 137  
         public void setPhoneTypeCode(String phoneTypeCode) {
 138  0
                 this.phoneTypeCode = phoneTypeCode;
 139  0
         }
 140  
 
 141  
         /**
 142  
          * @see org.kuali.rice.kim.bo.entity.KimDefaultableEntityTypeData#getEntityTypeCode()
 143  
          */
 144  
         public String getEntityTypeCode() {
 145  0
                 return entityTypeCode;
 146  
         }
 147  
 
 148  
         /**
 149  
          * @see org.kuali.rice.kim.bo.entity.KimDefaultableEntityTypeData#setEntityTypeCode(java.lang.String)
 150  
          */
 151  
         public void setEntityTypeCode(String entityTypeCode) {
 152  0
                 this.entityTypeCode = entityTypeCode;
 153  0
         }
 154  
 
 155  
         public TypeContract getPhoneType() {
 156  0
                 return this.phoneType;
 157  
         }
 158  
 
 159  
         public void setPhoneType(TypeContract phoneType) {
 160  0
                 this.phoneType = phoneType;
 161  0
         }
 162  
 
 163  
         public void setEntityPhoneId(String entityPhoneId) {
 164  0
                 this.entityPhoneId = entityPhoneId;
 165  0
         }
 166  
 
 167  
         public String getFormattedPhoneNumber() {
 168  0
                 StringBuffer sb = new StringBuffer( 30 );
 169  
                 
 170  
                 // TODO: get extension from country code table
 171  
                 // TODO: append "+xxx" if country is not the default country
 172  0
                 sb.append( getPhoneNumber() );
 173  0
                 if ( StringUtils.isNotBlank( getExtensionNumber() ) ) {
 174  0
                         sb.append( " x" );
 175  0
                         sb.append( getExtensionNumber() );
 176  
                 }
 177  
                 
 178  0
                 return sb.toString();
 179  
         }
 180  
 
 181  
 }