aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-10-28 12:41:10 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-10-28 12:41:10 +0100
commit41b1942dc69f1284894270e724ef517fb689f075 (patch)
tree7d87eb3597350bcb0f6f6e662ff37ba78789c759 /id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java
parent576f0cd61a686576267c05792d42b69ecbaf4b53 (diff)
downloadmoa-id-spss-41b1942dc69f1284894270e724ef517fb689f075.tar.gz
moa-id-spss-41b1942dc69f1284894270e724ef517fb689f075.tar.bz2
moa-id-spss-41b1942dc69f1284894270e724ef517fb689f075.zip
solve problems with multithreading and hibernate session
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/InterfederationIDPAction.java90
1 files changed, 51 insertions, 39 deletions
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 813aa1960..f84bcdbce 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
@@ -89,9 +89,7 @@ public class InterfederationIDPAction extends BasicOAAction {
session.setAttribute(Constants.SESSION_RETURNAREA,
Constants.STRUTS_RETURNAREA_VALUES.main.name());
-
- ConfigurationDBUtils.closeSession();
-
+
return Constants.STRUTS_SUCCESS;
} else {
@@ -103,6 +101,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
}
@@ -140,6 +141,9 @@ public class InterfederationIDPAction extends BasicOAAction {
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
return Constants.STRUTS_OA_EDIT + interfederationType;
@@ -190,7 +194,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String saveIDP() {
@@ -287,7 +294,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
- }
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
+ }
}
public String cancleAndBackIDP() {
@@ -300,16 +310,19 @@ public class InterfederationIDPAction extends BasicOAAction {
return Constants.STRUTS_NOTALLOWED;
}
+ session.setAttribute(Constants.SESSION_OAID, null);
+ addActionMessage(LanguageHelper.getGUIString("webpages.idp.cancle", getGeneralOA().getIdentifier(), request));
+ ConfigurationDBUtils.closeSession();
+
+ return Constants.STRUTS_SUCCESS;
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- session.setAttribute(Constants.SESSION_OAID, null);
- addActionMessage(LanguageHelper.getGUIString("webpages.idp.cancle", getGeneralOA().getIdentifier(), request));
- ConfigurationDBUtils.closeSession();
-
- return Constants.STRUTS_SUCCESS;
}
public String deleteIDP() {
@@ -325,7 +338,30 @@ public class InterfederationIDPAction extends BasicOAAction {
oaidentifier = preProcessDeleteOnlineApplication();
-
+ session.setAttribute(Constants.SESSION_OAID, null);
+ OnlineApplication onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
+
+ try {
+ if (onlineapplication.getAuthComponentOA().getOAPVP2() != null &&
+ MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) {
+ MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ moaconfig.setPvp2RefreshItem(new Date());
+ ConfigurationDBUtils.saveOrUpdate(moaconfig);
+
+ }
+ } catch (Throwable e) {
+ log.info("Found no MetadataURL in OA-Databaseconfig!", e);
+ }
+
+ if (ConfigurationDBUtils.delete(onlineapplication)) {
+ addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request));
+ return Constants.STRUTS_SUCCESS;
+
+ } else {
+ addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", oaidentifier, request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
} catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
@@ -333,34 +369,10 @@ public class InterfederationIDPAction extends BasicOAAction {
addActionError(e.getStrutsError());
return e.getStrutsReturnValue();
+ } finally {
+ ConfigurationDBUtils.closeSession();
+
}
-
- session.setAttribute(Constants.SESSION_OAID, null);
- OnlineApplication onlineapplication = ConfigurationDBRead.getOnlineApplication(oaidentifier);
-
- try {
- if (onlineapplication.getAuthComponentOA().getOAPVP2() != null &&
- MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA().getOAPVP2().getMetadataURL())) {
- MOAIDConfiguration moaconfig = ConfigurationDBRead.getMOAIDConfiguration();
- moaconfig.setPvp2RefreshItem(new Date());
- ConfigurationDBUtils.saveOrUpdate(moaconfig);
-
- }
- } catch (Throwable e) {
- log.info("Found no MetadataURL in OA-Databaseconfig!", e);
- }
-
- if (ConfigurationDBUtils.delete(onlineapplication)) {
-
- ConfigurationDBUtils.closeSession();
- addActionMessage(LanguageHelper.getGUIString("webpages.oaconfig.delete.message", oaidentifier, request));
- return Constants.STRUTS_SUCCESS;
-
- } else {
- ConfigurationDBUtils.closeSession();
- addActionError(LanguageHelper.getGUIString("webpages.oaconfig.delete.error", oaidentifier, request));
- return Constants.STRUTS_SUCCESS;
- }
}