1313import javax .persistence .NamedQuery ;
1414import javax .persistence .Table ;
1515
16+ import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
17+ import org .apache .commons .lang3 .StringUtils ;
18+
1619@ Entity
1720@ Table (name = "sites" )
1821@ NamedQueries ({
2831 ,
2932 @ NamedQuery (name = "Site.findHQ" , query = "SELECT s FROM Site s WHERE s.hqUsage = true ORDER BY s" )
3033})
34+ @ JsonIgnoreProperties (ignoreUnknown = true )
3135public class Site implements Serializable {
3236
3337 private String siteCode ;
3438 private List <String > emailDomains ;
3539 private List <String > pocEmails ;
36- private String lab ;
37- private boolean standardUsage = false ;
38- private boolean hqUsage = false ;
40+ private String labName ;
41+ private Boolean standardUsage ;
42+ private Boolean hqUsage ;
3943 private String softwareGroupEmail ;
4044
4145 public Site () {
@@ -62,6 +66,14 @@ public List<String> getEmailDomains() {
6266 }
6367
6468 public void setEmailDomains (List <String > emailDomains ) {
69+ for (int i = emailDomains .size () - 1 ; i >= 0 ; i --) {
70+ // do not allow empty strings
71+ if (StringUtils .isBlank (emailDomains .get (i )))
72+ emailDomains .remove (i );
73+ else
74+ emailDomains .set (i , emailDomains .get (i ).toLowerCase ());
75+ }
76+
6577 this .emailDomains = emailDomains ;
6678 }
6779
@@ -79,38 +91,52 @@ public void setPocEmails(List<String> pocEmails) {
7991 if (pocEmails == null )
8092 pocEmails = new ArrayList <>();
8193
82- for (int i = 0 ; i < pocEmails .size (); i ++)
83- pocEmails .set (i , pocEmails .get (i ).toLowerCase ());
94+ for (int i = pocEmails .size () - 1 ; i >= 0 ; i --) {
95+ // do not allow empty strings
96+ if (StringUtils .isBlank (pocEmails .get (i )))
97+ pocEmails .remove (i );
98+ else
99+ pocEmails .set (i , pocEmails .get (i ).toLowerCase ());
100+ }
84101
85102 this .pocEmails = pocEmails ;
86103 }
87104
88- public String getLab () {
89- return lab ;
105+ @ Column (name = "LAB_NAME" )
106+ public String getLabName () {
107+ return labName ;
90108 }
91109
92- public void setLab (String lab ) {
93- this .lab = lab ;
110+ public void setLabName (String lab ) {
111+ this .labName = lab ;
94112 }
95113
96114 @ Column (name = "standard_usage" , nullable = false )
97- public boolean isStandardUsage () {
115+ public Boolean getStandardUsage () {
98116 return standardUsage ;
99117 }
100118
101- public void setStandardUsage (boolean usage ) {
119+ public void setStandardUsage (Boolean usage ) {
102120 this .standardUsage = usage ;
103121 }
104122
123+ public Boolean isStandardUsage () {
124+ return standardUsage ;
125+ }
126+
105127 @ Column (name = "hq_usage" , nullable = false )
106- public boolean isHqUsage () {
128+ public Boolean getHqUsage () {
107129 return hqUsage ;
108130 }
109131
110- public void setHqUsage (boolean usage ) {
132+ public void setHqUsage (Boolean usage ) {
111133 this .hqUsage = usage ;
112134 }
113135
136+ public Boolean isHqUsage () {
137+ return hqUsage ;
138+ }
139+
114140 @ Column (name = "SOFTWARE_GROUP_EMAIL" )
115141 public String getSoftwareGroupEmail () {
116142 return softwareGroupEmail ;
0 commit comments