Coverage Report - org.kuali.rice.kim.bo.entity.impl.KimEntityEthnicityImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimEntityEthnicityImpl
0%
0/24
0%
0/8
1.7
 
 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 org.hibernate.annotations.GenericGenerator;
 19  
 import org.hibernate.annotations.Parameter;
 20  
 import org.kuali.rice.kim.api.entity.privacy.EntityPrivacyPreferences;
 21  
 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
 22  
 import org.kuali.rice.kim.bo.entity.KimEntityEthnicity;
 23  
 import org.kuali.rice.kim.util.KimConstants;
 24  
 
 25  
 import javax.persistence.Column;
 26  
 import javax.persistence.Entity;
 27  
 import javax.persistence.GeneratedValue;
 28  
 import javax.persistence.Id;
 29  
 import javax.persistence.Table;
 30  
 import javax.persistence.Transient;
 31  
 
 32  
 /**
 33  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 34  
  */
 35  
 @Entity
 36  
 @Table(name = "KRIM_ENTITY_ETHNIC_T")
 37  0
 public class KimEntityEthnicityImpl extends KimEntityDataBase implements KimEntityEthnicity {
 38  
 
 39  
         private static final long serialVersionUID = 4870141334376945160L;
 40  
 
 41  
         @Id
 42  
         @GeneratedValue(generator="KRIM_ENTITY_ETHNIC_ID_S")
 43  
         @GenericGenerator(name="KRIM_ENTITY_ETHNIC_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
 44  
                         @Parameter(name="sequence_name",value="KRIM_ENTITY_ETHNIC_ID_S"),
 45  
                         @Parameter(name="value_column",value="id")
 46  
                 })        
 47  
         @Column(name = "ID")
 48  
         protected String id;
 49  
 
 50  
         @Column(name = "ENTITY_ID")
 51  
         protected String entityId;
 52  
 
 53  
         @Column(name = "ETHNCTY_CD")
 54  
         protected String ethnicityCode;
 55  
 
 56  
         @Column(name = "SUB_ETHNCTY_CD")
 57  
         protected String subEthnicityCode;
 58  
 
 59  
         @Transient
 60  
     protected Boolean suppressPersonal;
 61  
 
 62  
         /**
 63  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getEthnicityCode()
 64  
          */
 65  
         @Override
 66  
         public String getEthnicityCode() {
 67  0
             if (isSuppressPersonal()) {
 68  0
             return KimConstants.RESTRICTED_DATA_MASK;
 69  
         }
 70  0
                 return ethnicityCode;
 71  
         }
 72  
 
 73  
     /**
 74  
      * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getEthnicityCodeUnmasked()
 75  
      */
 76  
     @Override
 77  
         public String getEthnicityCodeUnmasked() {
 78  0
         return this.ethnicityCode;
 79  
     }
 80  
 
 81  
     /**
 82  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getSubEthnicityCode()
 83  
          */
 84  
         @Override
 85  
         public String getSubEthnicityCode() {
 86  0
             if (isSuppressPersonal()) {
 87  0
             return KimConstants.RESTRICTED_DATA_MASK;
 88  
         }
 89  0
                 return subEthnicityCode;
 90  
         }
 91  
 
 92  
         /**
 93  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getSubEthnicityCodeUnmasked()
 94  
          */
 95  
         @Override
 96  
         public String getSubEthnicityCodeUnmasked() {
 97  0
                 return this.subEthnicityCode;
 98  
         }
 99  
 
 100  
         /**
 101  
          * @see org.kuali.rice.kim.bo.entity.KimEntityEthnicity#getId()
 102  
          */
 103  
         @Override
 104  
         public String getId() {
 105  0
                 return entityId;
 106  
         }
 107  
 
 108  
         @Override
 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  
     @Override
 126  
         public boolean isSuppressPersonal() {
 127  0
         if (suppressPersonal != null) {
 128  0
             return suppressPersonal.booleanValue();
 129  
         }
 130  0
         EntityPrivacyPreferences privacy = KimApiServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId());
 131  
 
 132  0
         suppressPersonal = false;
 133  0
         if (privacy != null) {
 134  0
             suppressPersonal = privacy.isSuppressPersonal();
 135  
         } 
 136  0
         return suppressPersonal.booleanValue();
 137  
     }
 138  
 
 139  
 }