View Javadoc
1   /**
2    * Copyright 2005-2014 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 javax.persistence.Column;
19  import javax.persistence.Convert;
20  import javax.persistence.Entity;
21  import javax.persistence.Id;
22  import javax.persistence.Table;
23  
24  import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferences;
25  import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferencesContract;
26  import org.kuali.rice.krad.bo.DataObjectBase;
27  import org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter;
28  
29  @Entity
30  @Table(name = "KRIM_ENTITY_PRIV_PREF_T")
31  public class EntityPrivacyPreferencesBo extends DataObjectBase implements EntityPrivacyPreferencesContract {
32  
33      private static final long serialVersionUID = 1L;
34  
35      @Id
36      @Column(name = "ENTITY_ID")
37      private String entityId;
38  
39      @Column(name = "SUPPRESS_NM_IND")
40      @Convert(converter = BooleanYNConverter.class)
41      private boolean suppressName;
42  
43      @Column(name = "SUPPRESS_EMAIL_IND")
44      @Convert(converter = BooleanYNConverter.class)
45      private boolean suppressEmail;
46  
47      @Column(name = "SUPPRESS_ADDR_IND")
48      @Convert(converter = BooleanYNConverter.class)
49      private boolean suppressAddress;
50  
51      @Column(name = "SUPPRESS_PHONE_IND")
52      @Convert(converter = BooleanYNConverter.class)
53      private boolean suppressPhone;
54  
55      @Column(name = "SUPPRESS_PRSNL_IND")
56      @Convert(converter = BooleanYNConverter.class)
57      private boolean suppressPersonal;
58  
59      public static EntityPrivacyPreferences to(EntityPrivacyPreferencesBo bo) {
60          if (bo == null) {
61              return null;
62          }
63          return EntityPrivacyPreferences.Builder.create(bo).build();
64      }
65  
66      /**
67       * Creates a CountryBo business object from an immutable representation of a Country.
68       *
69       * @param immutable an immutable Country
70       * @return a CountryBo
71       */
72      public static EntityPrivacyPreferencesBo from(EntityPrivacyPreferences immutable) {
73          if (immutable == null) {
74              return null;
75          }
76          EntityPrivacyPreferencesBo bo = new EntityPrivacyPreferencesBo();
77          bo.entityId = immutable.getEntityId();
78          bo.suppressAddress = immutable.isSuppressAddress();
79          bo.suppressEmail = immutable.isSuppressEmail();
80          bo.suppressName = immutable.isSuppressName();
81          bo.suppressPersonal = immutable.isSuppressPersonal();
82          bo.suppressPhone = immutable.isSuppressPhone();
83          bo.setVersionNumber(immutable.getVersionNumber());
84          bo.setObjectId(immutable.getObjectId());
85          return bo;
86      }
87  
88      @Override
89      public String getEntityId() {
90          return entityId;
91      }
92  
93      public void setEntityId(String entityId) {
94          this.entityId = entityId;
95      }
96  
97      public boolean getSuppressName() {
98          return suppressName;
99      }
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 }