From d624a3ec33b8e3a4e80aa64f05caa8df5d1fcb42 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 31 Oct 2014 11:11:29 +0100 Subject: fix MOA-IDP stored twince --- .../moa/id/configuration/struts/action/BasicOAAction.java | 12 +++++++----- .../moa/id/configuration/struts/action/EditOAAction.java | 2 +- .../struts/action/InterfederationIDPAction.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java index 415e1c957..5a9787069 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicOAAction.java @@ -142,7 +142,7 @@ public class BasicOAAction extends BasicAction { session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, null); } - protected OnlineApplication postProcessSaveOnlineApplication(OnlineApplication onlineapplication ) throws BasicOAActionException { + protected OnlineApplication postProcessSaveOnlineApplication(OnlineApplication onlineapplication, boolean persistOA) throws BasicOAActionException { if (onlineapplication == null) { onlineapplication = new OnlineApplication(); onlineapplication.setIsNew(true); @@ -186,7 +186,7 @@ public class BasicOAAction extends BasicAction { } //save OA configuration - String error = saveOAConfigToDatabase(onlineapplication); + String error = saveOAConfigToDatabase(onlineapplication, persistOA); if (MiscUtil.isNotEmpty(error)) { log.warn("OA configuration can not be stored!"); addActionError(error); @@ -395,7 +395,7 @@ public class BasicOAAction extends BasicAction { } } - private String saveOAConfigToDatabase(OnlineApplication dboa) { + private String saveOAConfigToDatabase(OnlineApplication dboa, boolean persistOA) { for (IOnlineApplicationData form : formList.values()) form.store(dboa, authUser, request); @@ -412,12 +412,14 @@ public class BasicOAAction extends BasicAction { ConfigurationDBUtils.saveOrUpdate(user); } else { - ConfigurationDBUtils.save(dboa); + if (persistOA) + ConfigurationDBUtils.save(dboa); } } else - ConfigurationDBUtils.saveOrUpdate(dboa); + if (persistOA) + ConfigurationDBUtils.saveOrUpdate(dboa); } catch (MOADatabaseException e) { log.warn("Online-Application can not be stored.", e); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java index 4cd556b75..1da948eec 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java @@ -217,7 +217,7 @@ public class EditOAAction extends BasicOAAction { } else { try { - onlineapplication = postProcessSaveOnlineApplication(onlineapplication); + onlineapplication = postProcessSaveOnlineApplication(onlineapplication, true); } catch (BasicOAActionException e) { addActionError(e.getStrutsError()); diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java index 89dce3200..b92b17217 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java @@ -265,7 +265,7 @@ public class InterfederationIDPAction extends BasicOAAction { return Constants.STRUTS_ERROR_VALIDATION; } else { - onlineapplication = postProcessSaveOnlineApplication(onlineapplication); + onlineapplication = postProcessSaveOnlineApplication(onlineapplication, false); //set default Target interfederated nameID caluclation if (getPvp2OA() != null) { -- cgit v1.2.3