Coverage Report - org.kuali.rice.kim.bo.entity.dto.KimEntityEntityTypeInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
KimEntityEntityTypeInfo
0%
0/54
0%
0/32
1.889
 
 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.entity.dto;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 
 21  
 import org.kuali.rice.kim.bo.entity.KimEntityAddress;
 22  
 import org.kuali.rice.kim.bo.entity.KimEntityEmail;
 23  
 import org.kuali.rice.kim.bo.entity.KimEntityEntityType;
 24  
 import org.kuali.rice.kim.bo.entity.KimEntityPhone;
 25  
 import org.kuali.rice.kim.bo.reference.dto.EntityTypeInfo;
 26  
 
 27  
 /**
 28  
  * Contains entity type info.  Plus, contains addresses, emails, and phone information.
 29  
  * 
 30  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 31  
  */
 32  0
 public class KimEntityEntityTypeInfo extends KimInactivatableInfo implements KimEntityEntityType {
 33  
 
 34  
         private static final long serialVersionUID = -6849727371078726861L;
 35  
 
 36  
         private List<KimEntityAddressInfo> addresses;
 37  
         private KimEntityAddressInfo defaultAddress;
 38  
         private List<KimEntityEmailInfo> emailAddresses;
 39  
         private KimEntityEmailInfo defaultEmailAddress;
 40  
         private EntityTypeInfo entityType;
 41  0
         private String entityTypeCode = "";
 42  
         private List<KimEntityPhoneInfo> phoneNumbers;
 43  
         private KimEntityPhoneInfo defaultPhoneNumber;
 44  
 
 45  
         public KimEntityEntityTypeInfo() {
 46  0
                 super();
 47  0
                 active = true;
 48  0
         }
 49  
 
 50  
         public KimEntityEntityTypeInfo(KimEntityEntityType kimEntityEntityType) {
 51  0
                 this();
 52  0
                 if ( kimEntityEntityType != null ) {
 53  0
                         active = kimEntityEntityType.isActive();
 54  0
                         entityTypeCode = kimEntityEntityType.getEntityTypeCode();
 55  0
                         if (kimEntityEntityType.getEntityType() != null) {
 56  0
                             entityType = new EntityTypeInfo(kimEntityEntityType.getEntityType());
 57  
                         }
 58  0
                         if (kimEntityEntityType.getAddresses() != null) {
 59  0
                                 addresses = new ArrayList<KimEntityAddressInfo>( kimEntityEntityType.getAddresses().size() );
 60  0
                                 for ( KimEntityAddress p : kimEntityEntityType.getAddresses() ) if (p != null) {
 61  0
                                         addresses.add( new KimEntityAddressInfo( p ) );
 62  
                                 }
 63  
                         }
 64  0
                         if (kimEntityEntityType.getDefaultAddress() != null) {
 65  0
                             defaultAddress = new KimEntityAddressInfo(kimEntityEntityType.getDefaultAddress());
 66  
                         }
 67  0
                         if (kimEntityEntityType.getEmailAddresses() != null) {
 68  0
                                 emailAddresses = new ArrayList<KimEntityEmailInfo>( kimEntityEntityType.getEmailAddresses().size() );
 69  0
                                 for ( KimEntityEmail p : kimEntityEntityType.getEmailAddresses() ) if (p != null) {
 70  0
                                         emailAddresses.add( new KimEntityEmailInfo( p ) );
 71  
                                 }
 72  
                         }
 73  0
                         if (kimEntityEntityType.getDefaultEmailAddress() != null) {
 74  0
                             defaultEmailAddress = new KimEntityEmailInfo(kimEntityEntityType.getDefaultEmailAddress());
 75  
                         }
 76  0
                         if (kimEntityEntityType.getPhoneNumbers() != null) {
 77  0
                                 phoneNumbers = new ArrayList<KimEntityPhoneInfo>( kimEntityEntityType.getPhoneNumbers().size() );
 78  0
                                 for ( KimEntityPhone p : kimEntityEntityType.getPhoneNumbers() ) if (p != null) {
 79  0
                                         phoneNumbers.add( new KimEntityPhoneInfo( p ) );
 80  
                                 }
 81  
                         }
 82  0
                         if (kimEntityEntityType.getDefaultPhoneNumber() != null) {
 83  0
                             defaultPhoneNumber = new KimEntityPhoneInfo(kimEntityEntityType.getDefaultPhoneNumber());
 84  
                         }
 85  
                 }
 86  0
         }
 87  
 
 88  
         /**
 89  
          * {@inheritDoc} 
 90  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getAddresses()
 91  
          */
 92  
         public List<KimEntityAddressInfo> getAddresses() {
 93  
             // assign and return an empty collection if our reference is null.
 94  0
                 return (addresses != null) ? addresses : (addresses = new ArrayList<KimEntityAddressInfo>());
 95  
         }
 96  
 
 97  
         /**
 98  
          * @param addresses the addresses to set
 99  
          */
 100  
         public void setAddresses(List<KimEntityAddressInfo> addresses) {
 101  0
                 this.addresses = addresses;
 102  0
         }
 103  
 
 104  
         /**
 105  
          * {@inheritDoc} 
 106  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getDefaultAddress()
 107  
          */
 108  
         public KimEntityAddressInfo getDefaultAddress() {
 109  0
                 return defaultAddress;
 110  
         }
 111  
 
 112  
         /**
 113  
          * @param defaultAddress the defaultAddress to set
 114  
          */
 115  
         public void setDefaultAddress(KimEntityAddressInfo defaultAddress) {
 116  0
                 this.defaultAddress = defaultAddress;
 117  0
         }
 118  
 
 119  
         /**
 120  
          * {@inheritDoc} 
 121  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getEmailAddresses()
 122  
          */
 123  
         public List<KimEntityEmailInfo> getEmailAddresses() {
 124  0
                 return emailAddresses;
 125  
         }
 126  
 
 127  
         /**
 128  
          * @param emailAddresses the emailAddresses to set
 129  
          */
 130  
         public void setEmailAddresses(List<KimEntityEmailInfo> emailAddresses) {
 131  0
                 this.emailAddresses = emailAddresses;
 132  0
         }
 133  
 
 134  
         /**
 135  
          * {@inheritDoc} 
 136  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getDefaultEmailAddress()
 137  
          */
 138  
         public KimEntityEmailInfo getDefaultEmailAddress() {
 139  0
                 return defaultEmailAddress;
 140  
         }
 141  
 
 142  
         /**
 143  
          * @param defaultEmailAddress the defaultEmailAddress to set
 144  
          */
 145  
         public void setDefaultEmailAddress(KimEntityEmailInfo defaultEmailAddress) {
 146  0
                 this.defaultEmailAddress = defaultEmailAddress;
 147  0
         }
 148  
 
 149  
         /**
 150  
          * {@inheritDoc} 
 151  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getEntityType()
 152  
          */
 153  
         public EntityTypeInfo getEntityType() {
 154  0
                 return entityType;
 155  
         }
 156  
 
 157  
         /**
 158  
          * @param entityType the entityType to set
 159  
          */
 160  
         public void setEntityType(EntityTypeInfo entityType) {
 161  0
                 this.entityType = entityType;
 162  0
         }
 163  
 
 164  
         /**
 165  
          * {@inheritDoc} 
 166  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getEntityTypeCode()
 167  
          */
 168  
         public String getEntityTypeCode() {
 169  0
                 return entityTypeCode;
 170  
         }
 171  
 
 172  
         /**
 173  
          * @param entityTypeCode the entityTypeCode to set
 174  
          */
 175  
         public void setEntityTypeCode(String entityTypeCode) {
 176  0
                 this.entityTypeCode = entityTypeCode;
 177  0
         }
 178  
 
 179  
         /**
 180  
          * {@inheritDoc} 
 181  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getPhoneNumbers()
 182  
          */
 183  
         public List<KimEntityPhoneInfo> getPhoneNumbers() {
 184  
             // assign and return an empty collection if our reference is null.
 185  0
         return (phoneNumbers != null) ? phoneNumbers : (phoneNumbers = new ArrayList<KimEntityPhoneInfo>());
 186  
         }
 187  
 
 188  
         /**
 189  
          * @param phoneNumbers the phoneNumbers to set
 190  
          */
 191  
         public void setPhoneNumbers(List<KimEntityPhoneInfo> phoneNumbers) {
 192  0
                 this.phoneNumbers = phoneNumbers;
 193  0
         }
 194  
 
 195  
         /**
 196  
          * {@inheritDoc} 
 197  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEntityType#getDefaultPhoneNumber()
 198  
          */
 199  
         public KimEntityPhoneInfo getDefaultPhoneNumber() {
 200  0
                 return defaultPhoneNumber;
 201  
         }
 202  
 
 203  
         /**
 204  
          * @param defaultPhoneNumber the defaultPhoneNumber to set
 205  
          */
 206  
         public void setDefaultPhoneNumber(KimEntityPhoneInfo defaultPhoneNumber) {
 207  0
                 this.defaultPhoneNumber = defaultPhoneNumber;
 208  0
         }
 209  
 
 210  
 }