diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-07-11 09:03:40 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-07-11 09:03:40 +0200 |
commit | 1e368ef5077cbc7ebacf2a0034de23c027e93eb3 (patch) | |
tree | 850e29ca39cc0ddccedc0d9dd8a85d735d6813f5 /id/ConfigWebTool/src/main | |
parent | 7212f4902eb4c2b3cf8026075ee04dd4506965ce (diff) | |
download | moa-id-spss-1e368ef5077cbc7ebacf2a0034de23c027e93eb3.tar.gz moa-id-spss-1e368ef5077cbc7ebacf2a0034de23c027e93eb3.tar.bz2 moa-id-spss-1e368ef5077cbc7ebacf2a0034de23c027e93eb3.zip |
update general configuration DB representation
Diffstat (limited to 'id/ConfigWebTool/src/main')
-rw-r--r-- | id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java | 52 |
1 files changed, 38 insertions, 14 deletions
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 0f1673c3a..32ffd2ba3 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 @@ -308,14 +308,36 @@ public class EditGeneralConfigAction extends BasicAction { legprot = new LegacyAllowed(); dbprotocols.setLegacyAllowed(legprot); } - - List<String> el = new ArrayList<String>(); - if (moaconfig.isLegacy_pvp2()) - el.add(Constants.MOA_CONFIG_PROTOCOL_PVP2); - if (moaconfig.isLegacy_saml1()) - el.add(Constants.MOA_CONFIG_PROTOCOL_SAML1); - legprot.setProtocolName(el); + List<String> el = legprot.getProtocolName(); + if (el == null) { + el = new ArrayList<String>(); + legprot.setProtocolName(el); + + } + + //Workaround for DB cleaning is only needed for one or the releases (insert in 2.1.1) + if (el.size() > 2) + el.clear(); + + if (el.contains(Constants.MOA_CONFIG_PROTOCOL_PVP2)) { + if (!moaconfig.isLegacy_pvp2()) + el.remove(Constants.MOA_CONFIG_PROTOCOL_PVP2); + + } else { + if (moaconfig.isLegacy_pvp2()) + el.add(Constants.MOA_CONFIG_PROTOCOL_PVP2); + } + + if (el.contains(Constants.MOA_CONFIG_PROTOCOL_SAML1)) { + if (!moaconfig.isLegacy_saml1()) + el.remove(Constants.MOA_CONFIG_PROTOCOL_SAML1); + + } else { + if (moaconfig.isLegacy_saml1()) + el.add(Constants.MOA_CONFIG_PROTOCOL_SAML1); + } + SAML1 saml1= dbprotocols.getSAML1(); if (saml1 == null) { saml1 = new SAML1(); @@ -385,15 +407,17 @@ public class EditGeneralConfigAction extends BasicAction { cont.setGivenName(StringHelper.getUTF8String( moaconfig.getPvp2Contact().getGivenname())); - //TODO: change to list if required - if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getMail())) + if (cont.getMail() != null && cont.getMail().size() > 0) + cont.getMail().set(0, moaconfig.getPvp2Contact().getMail()); + else cont.setMail(Arrays.asList(moaconfig.getPvp2Contact().getMail())); - if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getPhone())) + + if (cont.getPhone() != null && cont.getPhone().size() > 0) + cont.getPhone().set(0, moaconfig.getPvp2Contact().getPhone()); + else cont.setPhone(Arrays.asList(moaconfig.getPvp2Contact().getPhone())); - - if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getSurname())) - cont.setSurName(StringHelper.getUTF8String( - moaconfig.getPvp2Contact().getSurname())); + + cont.setSurName(StringHelper.getUTF8String(moaconfig.getPvp2Contact().getSurname())); if (MiscUtil.isNotEmpty(moaconfig.getPvp2Contact().getType())) cont.setType(moaconfig.getPvp2Contact().getType()); |