aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-02-24 16:33:39 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-02-24 16:33:39 +0100
commite02b92ca37607ddc3ffb1cca6c2e85720514cb5c (patch)
treeb10017d0070035a0bf0e14103a7450516036a241 /id/ConfigWebTool/src/main/java
parent3e1b7b29b415e5577f27f06d8936d8ea974aad44 (diff)
downloadmoa-id-spss-e02b92ca37607ddc3ffb1cca6c2e85720514cb5c.tar.gz
moa-id-spss-e02b92ca37607ddc3ffb1cca6c2e85720514cb5c.tar.bz2
moa-id-spss-e02b92ca37607ddc3ffb1cca6c2e85720514cb5c.zip
update PVP2 contact information
Diffstat (limited to 'id/ConfigWebTool/src/main/java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java13
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java11
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java4
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/ValidationHelper.java28
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/PVP2ContactValidator.java2
5 files changed, 50 insertions, 8 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java
index a2d6d8775..01615a056 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/pvp2/ContactForm.java
@@ -43,8 +43,17 @@ public class ContactForm {
public ContactForm(Contact dbcont) {
this.surname = dbcont.getSurName();
this.givenname = dbcont.getGivenName();
- this.mail =dbcont.getMail();
- this.phone = dbcont.getPhone();
+
+ if (dbcont.getMail() != null) {
+ this.mail = new ArrayList<String>();
+ this.mail.addAll(dbcont.getMail());
+ }
+
+ if (dbcont.getPhone() != null) {
+ this.phone = new ArrayList<String>();
+ this.phone.addAll(dbcont.getPhone());
+ }
+
this.company = dbcont.getCompany();
this.type = dbcont.getType();
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
index c9e834662..5df12a7a5 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
@@ -341,8 +341,13 @@ public class EditGeneralConfigAction extends ActionSupport
pvp2cont = new ArrayList<Contact>();
pvp2.setContact(pvp2cont);
}
- Contact cont = new Contact();
- pvp2cont.add(cont);
+
+ if (pvp2cont.size() == 0) {
+ Contact cont = new Contact();
+ pvp2cont.add(cont);
+ }
+
+ Contact cont = pvp2cont.get(0);
if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getCompany()))
cont.setCompany(moaconfig.getPvp2Contact().getCompany());
@@ -354,7 +359,7 @@ public class EditGeneralConfigAction extends ActionSupport
cont.setMail(Arrays.asList(moaconfig.getPvp2Contact().getMail()));
if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getPhone()))
cont.setPhone(Arrays.asList(moaconfig.getPvp2Contact().getPhone()));
-
+
if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getSurname()))
cont.setSurName(moaconfig.getPvp2Contact().getSurname());
if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getType()))
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
index ee9b38f74..8885432f1 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
@@ -624,8 +624,8 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
check = user.getPhone();
if (MiscUtil.isNotEmpty(check)) {
- if (ValidationHelper.containsPotentialCSSCharacter(check, false)) {
- log.warn("Phonenumber contains potentail XSS characters: " + check);
+ if (!ValidationHelper.validatePhoneNumber(check)) {
+ log.warn("No valid Phone Number: " + check);
addActionError(LanguageHelper.getErrorString("validation.edituser.phone.valid",
new Object[] {ValidationHelper.getPotentialCSSCharacter(false)} ));
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/ValidationHelper.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/ValidationHelper.java
index a95d967bb..c1feddfb8 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/ValidationHelper.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/ValidationHelper.java
@@ -167,6 +167,34 @@ public class ValidationHelper {
}
+ public static boolean validatePhoneNumber(String value) {
+ log.debug ("Validate PhoneNumber " + value);
+
+ /* ************************************************************************************************
+ * Legende:
+ * ======== AA = post/pre-Text
+ * BB = (+49)
+ * CC = Vorwahl
+ * DD = Durchwahl
+ * EE = Nebenstelle
+ * Pattern p = Pattern.compile("^ [a-zA-Z .,;:/\\-]* [ ]* [(]{0,1}[ ]*[+]{0,1}[ ]*[0-9]{0,2}[ ]*[)]{0,1} [ ]* [0-9]*[ ]* [0-9][ ]* [0-9]* [ ]* [a-zA-Z .,;:\\/-]* $");
+ * ------- AA ------- --------------------- BB --------------------- --------- CC -------- - DD - - EE - ------- AA -------
+ * ************************************************************************************************ */
+ Pattern pattern = Pattern.compile("^[a-zA-Z .,;:/\\-]*[ ]*[(]{0,1}[ ]*[+]{0,1}[ ]*[0-9]{0,2}[ ]*[)]{0,1}[ ]*[0-9]*[ ]*[0-9]*[ ]*[0-9]*[ ]*[a-zA-Z .,;:\\/-]*$");
+ Matcher matcher = pattern.matcher(value);
+ boolean b = matcher.matches();
+ if (b) {
+ log.debug("Parameter PhoneNumber erfolgreich ueberprueft");
+ return true;
+ }
+ else {
+ log.error("Fehler Ueberpruefung Parameter PhoneNumber. PhoneNumber entspricht nicht den Kriterien ^ [a-zA-Z .,;:/\\-]* [ ]* [(]{0,1}[ ]*[+]{0,1}[ ]*[0-9]{0,2}[ ]*[)]{0,1} [ ]* [0-9]*[ ]*[/\\-]{0,1} [ ]*[ ]* [0-9]* [ ]* [a-zA-Z .,;:\\/-]* $");
+ return false;
+ }
+
+
+ }
+
public static boolean validateURL(String urlString) {
log.debug("Validate URL " + urlString);
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/PVP2ContactValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/PVP2ContactValidator.java
index f8ccebc09..5286725df 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/PVP2ContactValidator.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/PVP2ContactValidator.java
@@ -91,7 +91,7 @@ public class PVP2ContactValidator {
check = contact.getPhone();
if (MiscUtil.isNotEmpty(check)) {
- if (!ValidationHelper.containsPotentialCSSCharacter(check, false)) {
+ if (!ValidationHelper.validatePhoneNumber(check)) {
errors.add(LanguageHelper.getErrorString("validation.general.protocol.pvp2.contact.phone.valid"));
}
}