Coverage Report - org.kuali.rice.kim.bo.entity.impl.KimEntityEmailImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimEntityEmailImpl
0%
0/34
0%
0/6
1.333
 
 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.entity.impl;
 17  
 
 18  
 import java.util.LinkedHashMap;
 19  
 
 20  
 import javax.persistence.Column;
 21  
 import javax.persistence.Entity;
 22  
 import javax.persistence.FetchType;
 23  
 import javax.persistence.Id;
 24  
 import javax.persistence.JoinColumn;
 25  
 import javax.persistence.ManyToOne;
 26  
 import javax.persistence.Table;
 27  
 import javax.persistence.Transient;
 28  
 
 29  
 import org.kuali.rice.kim.bo.entity.KimEntityEmail;
 30  
 import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences;
 31  
 import org.kuali.rice.kim.bo.reference.EmailType;
 32  
 import org.kuali.rice.kim.bo.reference.impl.EmailTypeImpl;
 33  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 34  
 import org.kuali.rice.kim.util.KimCommonUtils;
 35  
 import org.kuali.rice.kim.util.KimConstants;
 36  
 
 37  
 /**
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  
 @Entity
 41  
 @Table(name = "KRIM_ENTITY_EMAIL_T")
 42  0
 public class KimEntityEmailImpl extends KimDefaultableEntityDataBase implements KimEntityEmail {
 43  
 
 44  
         private static final long serialVersionUID = 1L;
 45  
 
 46  
         @Id
 47  
         @Column(name = "ENTITY_EMAIL_ID")
 48  
         protected String entityEmailId;
 49  
 
 50  
         @Column(name = "ENTITY_ID")
 51  
         protected String entityId;
 52  
 
 53  
         @Column(name = "ENT_TYP_CD")
 54  
         protected String entityTypeCode;
 55  
 
 56  
         @Column(name = "EMAIL_TYP_CD")
 57  
         protected String emailTypeCode;
 58  
 
 59  
         @Column(name = "EMAIL_ADDR")
 60  
         protected String emailAddress;
 61  
 
 62  
         @ManyToOne(targetEntity=EmailTypeImpl.class, fetch = FetchType.EAGER, cascade = {})
 63  
         @JoinColumn(name = "EMAIL_TYP_CD", insertable = false, updatable = false)
 64  
         protected EmailType emailType;
 65  
         
 66  
         @Transient
 67  
         protected Boolean suppressEmail;
 68  
 
 69  
         /**
 70  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#getEmailAddress()
 71  
          */
 72  
         public String getEmailAddress() {
 73  0
             if (isSuppressEmail()) {
 74  0
             return KimConstants.RESTRICTED_DATA_MASK;
 75  
         }
 76  0
                 return emailAddress;
 77  
         }
 78  
 
 79  
         /**
 80  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#getEmailTypeCode()
 81  
          */
 82  
         public String getEmailTypeCode() {
 83  0
                 return emailTypeCode;
 84  
         }
 85  
 
 86  
         /**
 87  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#getEntityEmailId()
 88  
          */
 89  
         public String getEntityEmailId() {
 90  0
                 return entityEmailId;
 91  
         }
 92  
 
 93  
         /**
 94  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#setEmailAddress(java.lang.String)
 95  
          */
 96  
         public void setEmailAddress(String emailAddress) {
 97  0
                 this.emailAddress = emailAddress;
 98  0
         }
 99  
 
 100  
         /**
 101  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#setEmailTypeCode(java.lang.String)
 102  
          */
 103  
         public void setEmailTypeCode(String emailTypeCode) {
 104  0
                 this.emailTypeCode = emailTypeCode;
 105  0
         }
 106  
 
 107  
         /**
 108  
          * @see org.kuali.rice.kim.bo.entity.KimDefaultableEntityTypeData#getEntityTypeCode()
 109  
          */
 110  
         public String getEntityTypeCode() {
 111  0
                 return entityTypeCode;
 112  
         }
 113  
 
 114  
         /**
 115  
          * @see org.kuali.rice.kim.bo.entity.KimDefaultableEntityTypeData#setEntityTypeCode(java.lang.String)
 116  
          */
 117  
         public void setEntityTypeCode(String entityTypeCode) {
 118  0
                 this.entityTypeCode = entityTypeCode;
 119  0
         }
 120  
 
 121  
         /**
 122  
          * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
 123  
          */
 124  
         @Override
 125  
         protected LinkedHashMap toStringMapper() {
 126  0
                 LinkedHashMap m = new LinkedHashMap();
 127  0
                 m.put("entityEmailId", entityEmailId);
 128  0
                 m.put("entityTypeCode", entityTypeCode);
 129  0
                 m.put("emailTypeCode", emailTypeCode);
 130  0
                 return m;
 131  
         }
 132  
 
 133  
         public String getEntityId() {
 134  0
                 return this.entityId;
 135  
         }
 136  
 
 137  
         public void setEntityId(String entityId) {
 138  0
                 this.entityId = entityId;
 139  0
         }
 140  
 
 141  
         public void setEntityEmailId(String entityEmailId) {
 142  0
                 this.entityEmailId = entityEmailId;
 143  0
         }
 144  
 
 145  
         public EmailType getEmailType() {
 146  0
                 return this.emailType;
 147  
         }
 148  
 
 149  
         public void setEmailType(EmailType emailType) {
 150  0
                 this.emailType = emailType;
 151  0
         }
 152  
 
 153  
     public boolean isSuppressEmail() {
 154  0
         if (suppressEmail != null) {
 155  0
             return suppressEmail.booleanValue();
 156  
         }
 157  0
         KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId());
 158  
 
 159  0
         suppressEmail = false;
 160  0
         if (privacy != null) {
 161  0
             suppressEmail = privacy.isSuppressEmail();
 162  
         } 
 163  0
         return suppressEmail.booleanValue();
 164  
     }
 165  
 
 166  
     /**
 167  
      * @see org.kuali.rice.kim.bo.entity.KimEntityEmail#getEmailAddressUnmasked()
 168  
      */
 169  
     public String getEmailAddressUnmasked() {
 170  0
         return this.emailAddress;
 171  
     }
 172  
 
 173  
 }