001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kim.impl.identity.privacy; 017 018import javax.persistence.Column; 019import javax.persistence.Convert; 020import javax.persistence.Entity; 021import javax.persistence.Id; 022import javax.persistence.Table; 023 024import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferences; 025import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferencesContract; 026import org.kuali.rice.krad.bo.DataObjectBase; 027import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter; 028 029@Entity 030@Table(name = "KRIM_ENTITY_PRIV_PREF_T") 031public class EntityPrivacyPreferencesBo extends DataObjectBase implements EntityPrivacyPreferencesContract { 032 033 private static final long serialVersionUID = 1L; 034 035 @Id 036 @Column(name = "ENTITY_ID") 037 private String entityId; 038 039 @Column(name = "SUPPRESS_NM_IND") 040 @Convert(converter = BooleanYNConverter.class) 041 private boolean suppressName; 042 043 @Column(name = "SUPPRESS_EMAIL_IND") 044 @Convert(converter = BooleanYNConverter.class) 045 private boolean suppressEmail; 046 047 @Column(name = "SUPPRESS_ADDR_IND") 048 @Convert(converter = BooleanYNConverter.class) 049 private boolean suppressAddress; 050 051 @Column(name = "SUPPRESS_PHONE_IND") 052 @Convert(converter = BooleanYNConverter.class) 053 private boolean suppressPhone; 054 055 @Column(name = "SUPPRESS_PRSNL_IND") 056 @Convert(converter = BooleanYNConverter.class) 057 private boolean suppressPersonal; 058 059 public static EntityPrivacyPreferences to(EntityPrivacyPreferencesBo bo) { 060 if (bo == null) { 061 return null; 062 } 063 return EntityPrivacyPreferences.Builder.create(bo).build(); 064 } 065 066 /** 067 * Creates a CountryBo business object from an immutable representation of a Country. 068 * 069 * @param immutable an immutable Country 070 * @return a CountryBo 071 */ 072 public static EntityPrivacyPreferencesBo from(EntityPrivacyPreferences immutable) { 073 if (immutable == null) { 074 return null; 075 } 076 EntityPrivacyPreferencesBo bo = new EntityPrivacyPreferencesBo(); 077 bo.entityId = immutable.getEntityId(); 078 bo.suppressAddress = immutable.isSuppressAddress(); 079 bo.suppressEmail = immutable.isSuppressEmail(); 080 bo.suppressName = immutable.isSuppressName(); 081 bo.suppressPersonal = immutable.isSuppressPersonal(); 082 bo.suppressPhone = immutable.isSuppressPhone(); 083 bo.setVersionNumber(immutable.getVersionNumber()); 084 bo.setObjectId(immutable.getObjectId()); 085 return bo; 086 } 087 088 @Override 089 public String getEntityId() { 090 return entityId; 091 } 092 093 public void setEntityId(String entityId) { 094 this.entityId = entityId; 095 } 096 097 public boolean getSuppressName() { 098 return suppressName; 099 } 100 101 @Override 102 public boolean isSuppressName() { 103 return suppressName; 104 } 105 106 public void setSuppressName(boolean suppressName) { 107 this.suppressName = suppressName; 108 } 109 110 public boolean getSuppressEmail() { 111 return suppressEmail; 112 } 113 114 @Override 115 public boolean isSuppressEmail() { 116 return suppressEmail; 117 } 118 119 public void setSuppressEmail(boolean suppressEmail) { 120 this.suppressEmail = suppressEmail; 121 } 122 123 public boolean getSuppressAddress() { 124 return suppressAddress; 125 } 126 127 @Override 128 public boolean isSuppressAddress() { 129 return suppressAddress; 130 } 131 132 public void setSuppressAddress(boolean suppressAddress) { 133 this.suppressAddress = suppressAddress; 134 } 135 136 public boolean getSuppressPhone() { 137 return suppressPhone; 138 } 139 140 @Override 141 public boolean isSuppressPhone() { 142 return suppressPhone; 143 } 144 145 public void setSuppressPhone(boolean suppressPhone) { 146 this.suppressPhone = suppressPhone; 147 } 148 149 public boolean getSuppressPersonal() { 150 return suppressPersonal; 151 } 152 153 @Override 154 public boolean isSuppressPersonal() { 155 return suppressPersonal; 156 } 157 158 public void setSuppressPersonal(boolean suppressPersonal) { 159 this.suppressPersonal = suppressPersonal; 160 } 161}