Coverage Report - org.kuali.rice.kim.bo.entity.impl.KimEntityEthnicityImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimEntityEthnicityImpl
0%
0/29
0%
0/8
1.636
 
 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.impl;
 17  
 
 18  
 import java.util.LinkedHashMap;
 19  
 
 20  
 import javax.persistence.Column;
 21  
 import javax.persistence.Entity;
 22  
 import javax.persistence.Id;
 23  
 import javax.persistence.Table;
 24  
 import javax.persistence.Transient;
 25  
 
 26  
 import org.kuali.rice.kim.bo.entity.KimEntityEthnicity;
 27  
 import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences;
 28  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 29  
 import org.kuali.rice.kim.util.KimConstants;
 30  
 
 31  
 /**
 32  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 33  
  */
 34  
 @Entity
 35  
 @Table(name = "KRIM_ENTITY_ETHNIC_T")
 36  0
 public class KimEntityEthnicityImpl extends KimEntityDataBase implements KimEntityEthnicity {
 37  
 
 38  
         private static final long serialVersionUID = 4870141334376945160L;
 39  
 
 40  
         @Id
 41  
         @Column(name = "ID")
 42  
         protected String id;
 43  
 
 44  
         @Column(name = "ENTITY_ID")
 45  
         protected String entityId;
 46  
 
 47  
         @Column(name = "ETHNCTY_CD")
 48  
         protected String ethnicityCode;
 49  
 
 50  
         @Column(name = "SUB_ETHNCTY_CD")
 51  
         protected String subEthnicityCode;
 52  
 
 53  
         @Transient
 54  
     protected Boolean suppressPersonal;
 55  
 
 56  
         /**
 57  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getEthnicityCode()
 58  
          */
 59  
         public String getEthnicityCode() {
 60  0
             if (isSuppressPersonal()) {
 61  0
             return KimConstants.RESTRICTED_DATA_MASK;
 62  
         }
 63  0
                 return ethnicityCode;
 64  
         }
 65  
 
 66  
     /**
 67  
      * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getEthnicityCodeUnmasked()
 68  
      */
 69  
     public String getEthnicityCodeUnmasked() {
 70  0
         return this.ethnicityCode;
 71  
     }
 72  
 
 73  
     /**
 74  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getSubEthnicityCode()
 75  
          */
 76  
         public String getSubEthnicityCode() {
 77  0
             if (isSuppressPersonal()) {
 78  0
             return KimConstants.RESTRICTED_DATA_MASK;
 79  
         }
 80  0
                 return subEthnicityCode;
 81  
         }
 82  
 
 83  
         /**
 84  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getSubEthnicityCodeUnmasked()
 85  
          */
 86  
         public String getSubEthnicityCodeUnmasked() {
 87  0
                 return this.subEthnicityCode;
 88  
         }
 89  
 
 90  
         /**
 91  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getId()
 92  
          */
 93  
         public String getId() {
 94  0
                 return entityId;
 95  
         }
 96  
 
 97  
         /**
 98  
          * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
 99  
          */
 100  
         @Override
 101  
         protected LinkedHashMap<String, String> toStringMapper() {
 102  0
                 LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
 103  0
                 m.put("entityId", entityId);
 104  0
                 m.put("ethnicityCode", ethnicityCode);
 105  0
                 m.put("subEthnicityCode", subEthnicityCode);
 106  0
                 return m;
 107  
         }
 108  
 
 109  
         public String getEntityId() {
 110  0
                 return this.entityId;
 111  
         }
 112  
 
 113  
         public void setEntityId(String entityId) {
 114  0
                 this.entityId = entityId;
 115  0
         }
 116  
 
 117  
         public void setEthnicityCode(String ethnicityCode) {
 118  0
                 this.ethnicityCode = ethnicityCode;
 119  0
         }
 120  
 
 121  
         public void setSubEthnicityCode(String subEthnicityCode) {
 122  0
                 this.subEthnicityCode = subEthnicityCode;
 123  0
         }
 124  
 
 125  
     public boolean isSuppressPersonal() {
 126  0
         if (suppressPersonal != null) {
 127  0
             return suppressPersonal.booleanValue();
 128  
         }
 129  0
         KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId());
 130  
 
 131  0
         suppressPersonal = false;
 132  0
         if (privacy != null) {
 133  0
             suppressPersonal = privacy.isSuppressPersonal();
 134  
         } 
 135  0
         return suppressPersonal.booleanValue();
 136  
     }
 137  
 
 138  
 }