Skip to content

Commit

Permalink
[MODEL] Coherence check
Browse files Browse the repository at this point in the history
-Fix in coherence check in Guest model (canBeSingleOrLeader)
-Restored Xerces lib in pom.xml dependencies
  • Loading branch information
guido committed Mar 14, 2013
1 parent 993fdb3 commit 2b87bbe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mysql.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ DBmaxWait=10000

DBhost=localhost
DBport=3306
DBusername=utente
DBpassword=utente
DBusername=root
DBpassword=root
DBdump=sql
DBdriverClassName=com.mysql.jdbc.Driver
DBurl=jdbc:mysql://localhost:3306/locanda
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime.3_7_1</groupId>
<artifactId>org.apache.xerces</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<organization>
<name>Sardegna Ricerche</name>
Expand Down
14 changes: 10 additions & 4 deletions src/model/Guest.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ public boolean equals(Object obj) {

public Boolean canBeMember() {
Boolean ret = true;
if (this.id_countryOfBirth == 1 &&
if (this.id_countryOfBirth == 1 && //Born in Italy
(this.id_municipalityOfBirth == null || this.id_municipalityOfBirth.equals(0))
) {
ret = false;
}
if (this.id_countryOfResidence == 1 &&
if (this.id_countryOfResidence == 1 && //Lives in Italy
(this.id_municipalityOfResidence == null || this.id_municipalityOfResidence.equals(0))
) {
ret = false;
Expand All @@ -111,8 +111,14 @@ public Boolean canBeMember() {

public Boolean canBeSingleOrLeader() {
Boolean ret = true;
if (!this.canBeMember() || this.getId_idType() == null || this.getIdNumber().equals("")) {
ret = false;
if (this.getId_citizenship() == 1) { //Italian citizenship
if (!this.canBeMember() || this.getId_idType() == null || this.getId_idPlace() == null || this.getIdNumber().equals("")) {
ret = false;
}
}else { //foreign citizens
if (!this.canBeMember() || this.getId_idType() == null || this.getIdNumber().equals("")) {
ret = false;
}
}
return ret;
}
Expand Down

0 comments on commit 2b87bbe

Please sign in to comment.