From 2b87bbe2befa091ed80768377aadbb865997c9cf Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 14 Mar 2013 17:21:35 +0100 Subject: [PATCH] [MODEL] Coherence check -Fix in coherence check in Guest model (canBeSingleOrLeader) -Restored Xerces lib in pom.xml dependencies --- mysql.properties | 4 ++-- pom.xml | 5 +++++ src/model/Guest.java | 14 ++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/mysql.properties b/mysql.properties index d12e6435..bbfb207b 100644 --- a/mysql.properties +++ b/mysql.properties @@ -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 diff --git a/pom.xml b/pom.xml index 982d85f1..2f805d60 100644 --- a/pom.xml +++ b/pom.xml @@ -475,6 +475,11 @@ + + org.eclipse.birt.runtime.3_7_1 + org.apache.xerces + 2.9.0 + Sardegna Ricerche diff --git a/src/model/Guest.java b/src/model/Guest.java index cd62db1a..00eadf54 100644 --- a/src/model/Guest.java +++ b/src/model/Guest.java @@ -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; @@ -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; }