View Javadoc

1   /**
2    * Copyright 2005-2013 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.impl.identity.privacy;
17  
18  import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferences;
19  import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferencesContract;
20  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
21  import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
22  
23  import javax.persistence.Column;
24  import javax.persistence.Entity;
25  import javax.persistence.Id;
26  import javax.persistence.Table;
27  
28  @Entity
29  @Table(name = "KRIM_ENTITY_PRIV_PREF_T")
30  public class EntityPrivacyPreferencesBo extends PersistableBusinessObjectBase implements EntityPrivacyPreferencesContract {
31      private static final long serialVersionUID = 1L;
32      @Id
33      @Column(name = "ENTITY_ID")
34      private String entityId;
35      @javax.persistence.Convert(converter=BooleanYNConverter.class)
36      @Column(name = "SUPPRESS_NM_IND")
37      private boolean suppressName;
38      @javax.persistence.Convert(converter=BooleanYNConverter.class)
39      @Column(name = "SUPPRESS_EMAIL_IND")
40      private boolean suppressEmail;
41      @javax.persistence.Convert(converter=BooleanYNConverter.class)
42      @Column(name = "SUPPRESS_ADDR_IND")
43      private boolean suppressAddress;
44      @javax.persistence.Convert(converter=BooleanYNConverter.class)
45      @Column(name = "SUPPRESS_PHONE_IND")
46      private boolean suppressPhone;
47      @javax.persistence.Convert(converter=BooleanYNConverter.class)
48      @Column(name = "SUPPRESS_PRSNL_IND")
49      private boolean suppressPersonal;
50  
51      public static EntityPrivacyPreferences to(EntityPrivacyPreferencesBo bo) {
52          if (bo == null) {
53              return null;
54          }
55  
56          return EntityPrivacyPreferences.Builder.create(bo).build();
57      }
58  
59      /**
60       * Creates a CountryBo business object from an immutable representation of a Country.
61       *
62       * @param immutable an immutable Country
63       * @return a CountryBo
64       */
65      public static EntityPrivacyPreferencesBo from(EntityPrivacyPreferences immutable) {
66          if (immutable == null) {
67              return null;
68          }
69  
70          EntityPrivacyPreferencesBo bo = new EntityPrivacyPreferencesBo();
71  
72          bo.entityId = immutable.getEntityId();
73          bo.suppressAddress = immutable.isSuppressAddress();
74          bo.suppressEmail = immutable.isSuppressEmail();
75          bo.suppressName = immutable.isSuppressName();
76          bo.suppressPersonal = immutable.isSuppressPersonal();
77          bo.suppressPhone = immutable.isSuppressPhone();
78          bo.setVersionNumber(immutable.getVersionNumber());
79          bo.setObjectId(immutable.getObjectId());
80  
81          return bo;
82      }
83  
84      @Override
85      public String getEntityId() {
86          return entityId;
87      }
88  
89      public void setEntityId(String entityId) {
90          this.entityId = entityId;
91      }
92  
93      public boolean getSuppressName() {
94          return suppressName;
95      }
96  
97      @Override
98      public boolean isSuppressName() {
99          return suppressName;
100     }
101 
102     public void setSuppressName(boolean suppressName) {
103         this.suppressName = suppressName;
104     }
105 
106     public boolean getSuppressEmail() {
107         return suppressEmail;
108     }
109 
110     @Override
111     public boolean isSuppressEmail() {
112         return suppressEmail;
113     }
114 
115     public void setSuppressEmail(boolean suppressEmail) {
116         this.suppressEmail = suppressEmail;
117     }
118 
119     public boolean getSuppressAddress() {
120         return suppressAddress;
121     }
122 
123     @Override
124     public boolean isSuppressAddress() {
125         return suppressAddress;
126     }
127 
128     public void setSuppressAddress(boolean suppressAddress) {
129         this.suppressAddress = suppressAddress;
130     }
131 
132     public boolean getSuppressPhone() {
133         return suppressPhone;
134     }
135 
136     @Override
137     public boolean isSuppressPhone() {
138         return suppressPhone;
139     }
140 
141     public void setSuppressPhone(boolean suppressPhone) {
142         this.suppressPhone = suppressPhone;
143     }
144 
145     public boolean getSuppressPersonal() {
146         return suppressPersonal;
147     }
148 
149     @Override
150     public boolean isSuppressPersonal() {
151         return suppressPersonal;
152     }
153 
154     public void setSuppressPersonal(boolean suppressPersonal) {
155         this.suppressPersonal = suppressPersonal;
156     }
157 
158 }