1 package fr.paris.lutece.plugins.identitypicker.business;
2
3 import javax.ws.rs.QueryParam;
4
5 public class IdentitySearchCriteria
6 {
7 @QueryParam( "common_email" )
8 private String commonEmail;
9
10 @QueryParam( "common_lastname" )
11 private String commonLastName;
12
13 @QueryParam( "first_name" )
14 private String firstName;
15
16 @QueryParam( "birthdate" )
17 private String birthDate;
18
19
20 public IdentitySearchCriteria( )
21 {
22 }
23
24
25 public IdentitySearchCriteria( String commonEmail, String commonLastName, String firstName, String birthDate )
26 {
27 this.commonEmail = commonEmail;
28 this.commonLastName = commonLastName;
29 this.firstName = firstName;
30 this.birthDate = birthDate;
31 }
32
33
34 public boolean isValid( )
35 {
36 return hasCommonEmail( ) || ( hasNameAndBirthDate( ) );
37 }
38
39 public boolean hasCommonEmail( )
40 {
41 return commonEmail != null && !commonEmail.isEmpty( );
42 }
43
44 private boolean hasNameAndBirthDate( )
45 {
46 return commonLastName != null && !commonLastName.isEmpty( ) && firstName != null && !firstName.isEmpty( ) && birthDate != null && !birthDate.isEmpty( );
47 }
48
49
50 public String getCommonEmail( )
51 {
52 return commonEmail;
53 }
54
55 public void setCommonEmail( String commonEmail )
56 {
57 this.commonEmail = commonEmail;
58 }
59
60 public String getCommonLastName( )
61 {
62 return commonLastName;
63 }
64
65 public void setCommonLastName( String commonLastName )
66 {
67 this.commonLastName = commonLastName;
68 }
69
70 public String getFirstName( )
71 {
72 return firstName;
73 }
74
75 public void setFirstName( String firstName )
76 {
77 this.firstName = firstName;
78 }
79
80 public String getBirthDate( )
81 {
82 return birthDate;
83 }
84
85 public void setBirthDate( String birthDate )
86 {
87 this.birthDate = birthDate;
88 }
89 }