From 456513332389b2dbb7a6d1461f77dda9b7393050 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 14 Aug 2015 13:53:00 +0200 Subject: use old ConfigTool --- .../id/config/webgui/MOAIDConfigurationModul.java | 29 +++++++++++++--------- .../moa/id/config/webgui/helper/GUIDataParser.java | 2 +- .../validation/MOAIDConfigurationValidator.java | 6 +++-- .../task/impl/ServicesBKUSelectionTask.java | 25 +++++++++++++++++-- 4 files changed, 45 insertions(+), 17 deletions(-) (limited to 'id/moa-id-webgui/src/main/java/at/gv') diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java index 9238ea3df..59f36f475 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/MOAIDConfigurationModul.java @@ -179,7 +179,10 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ throws ConfigurationStorageException { logger.debug("Start configuration saving process ..."); - MOAIDConfigurationValidator configValidator = new MOAIDConfigurationValidator(); + MOAIDConfigurationValidator configValidator = new MOAIDConfigurationValidator(); + if (deleted == null) + deleted = new ArrayList(); + int numOfGroups = configValidator.preProcess(changed, added, deleted); if (configValidator.getPreProcessedConfigurationData() != null && @@ -238,18 +241,20 @@ public class MOAIDConfigurationModul implements ConfigurationModul{ } private void deleteEntries(List deleted) { - logger.debug("Delete {} keys pairs from configuration", deleted.size()); - Iterator deleteInterator = deleted.iterator(); - while (deleteInterator.hasNext()) { - String el = deleteInterator.next(); - try { - config.deleteIds(el); - logger.trace("Delete key {}", el); - - } catch (ConfigurationException e) { - logger.error("Delete key: " + el + " FAILED.", e); + if (deleted != null) { + logger.debug("Delete {} keys pairs from configuration", deleted.size()); + Iterator deleteInterator = deleted.iterator(); + while (deleteInterator.hasNext()) { + String el = deleteInterator.next(); + try { + config.deleteIds(el); + logger.trace("Delete key {}", el); - } + } catch (ConfigurationException e) { + logger.error("Delete key: " + el + " FAILED.", e); + + } + } } } diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java index be47a404f..6b6bf8427 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/helper/GUIDataParser.java @@ -54,7 +54,7 @@ public class GUIDataParser { base64 = guiUpload; try { - if (Base64Utils.decode(base64, false) == null) + if (Base64Utils.decode(base64, false) != null) return base64; } catch (IOException e) { diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java index 5fc5b86d2..42ef0e1e6 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/MOAIDConfigurationValidator.java @@ -125,10 +125,12 @@ public class MOAIDConfigurationValidator { data = new HashMap>(); //classify changed key/value pairs - keyValueClassification(changed.entrySet().iterator(), data); + if (changed != null) + keyValueClassification(changed.entrySet().iterator(), data); //classify new key/value pairs - keyValueClassification(added.entrySet().iterator(), data); + if (added != null) + keyValueClassification(added.entrySet().iterator(), data); return data.size(); } diff --git a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java index b6561ccf4..ca1109aa1 100644 --- a/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java +++ b/id/moa-id-webgui/src/main/java/at/gv/egovernment/moa/id/config/webgui/validation/task/impl/ServicesBKUSelectionTask.java @@ -100,12 +100,33 @@ public class ServicesBKUSelectionTask extends AbstractTaskValidator implements I newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, bkuSelectionFile); - String sendAssertionTemplateUpload = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA); + String sendAssertionTemplateUpload = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA); String sendAssertionTemplate = GUIDataParser.getBase64ContentFromGUIUpload(sendAssertionTemplateUpload); if (sendAssertionTemplate != null) - newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA, sendAssertionTemplate); + String deleteBKUSelectionTemplate = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE); + if (MiscUtil.isNotEmpty(deleteBKUSelectionTemplate) && Boolean.parseBoolean(deleteBKUSelectionTemplate)) { + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA, + null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE, String.valueOf(false)); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW, null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME, null); + + } + + String deleteSendAssertionTemplate = input.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE); + if (MiscUtil.isNotEmpty(deleteSendAssertionTemplate) && Boolean.parseBoolean(deleteSendAssertionTemplate)) { + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA, + null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE, String.valueOf(false)); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW, null); + newConfigValues.put(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME, null); + } + + + if (newConfigValues.isEmpty()) return null; else -- cgit v1.2.3