aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java981
1 files changed, 493 insertions, 488 deletions
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 31126d14f..1ad6e7d6b 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
@@ -27,8 +27,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
import at.gv.egiz.eaaf.core.impl.utils.Random;
import at.gv.egovernment.moa.id.auth.frontend.utils.FormBuildUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
@@ -53,505 +51,512 @@ import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.exception.BasicOAActionException;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.helper.MailHelper;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class EditOAAction extends BasicOAAction {
- private final Logger log = Logger.getLogger(EditOAAction.class);
- private static final long serialVersionUID = 1L;
-
- private String nextPage;
-
- public EditOAAction() {
- super();
-
- OATargetConfiguration oaTarget = new OATargetConfiguration();
- formList.put(oaTarget.getName(), oaTarget);
-
- OAAuthenticationData authOA = new OAAuthenticationData();
- formList.put(authOA.getName(), authOA);
-
- OASAML1Config saml1OA = new OASAML1Config();
- formList.put(saml1OA.getName(), saml1OA);
-
- if (isMoaidMode) {
- OABPKEncryption bPKEncDec = new OABPKEncryption();
- formList.put(bPKEncDec.getName(), bPKEncDec);
-
- OASSOConfig ssoOA = new OASSOConfig();
- formList.put(ssoOA.getName(), ssoOA);
-
- OAPVP2Config pvp2OA = new OAPVP2Config();
- formList.put(pvp2OA.getName(), pvp2OA);
-
- OAOAuth20Config oauth20OA = new OAOAuth20Config();
- formList.put(oauth20OA.getName(), oauth20OA);
-
- OASTORKConfig storkOA = new OASTORKConfig();
- formList.put(storkOA.getName(), storkOA);
-
- Map<String, String> map = new HashMap<String, String>();
- map.putAll(FormBuildUtils.getDefaultMap());
- FormularCustomization formOA = new FormularCustomization(map);
- formList.put(formOA.getName(), formOA);
-
- OARevisionsLogData revisOA = new OARevisionsLogData();
- formList.put(revisOA.getName(), revisOA);
- }
-
- }
-
- // STRUTS actions
- public String inital() {
- try {
- populateBasicInformations();
-
- OnlineApplication onlineapplication = populateOnlineApplicationFromRequest();
-
- if (onlineapplication == null) {
- addActionError(LanguageHelper.getErrorString(
- "errors.listOAs.noOA", request));
- return Constants.STRUTS_SUCCESS;
- }
-
- List<String> errors = new ArrayList<String>();
- for (IOnlineApplicationData form : formList.values()) {
- List<String> error = form.parse(onlineapplication, authUser,
- request);
- if (error != null)
- errors.addAll(error);
- }
- if (errors.size() > 0) {
- for (String el : errors)
- addActionError(el);
- }
-
- setNewOA(false);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- session.setAttribute(Constants.SESSION_OAID, oaid);
-
- return Constants.STRUTS_OA_EDIT;
-
- } catch (BasicActionException e) {
- return Constants.STRUTS_ERROR;
-
- } catch (BasicOAActionException e) {
- addActionError(e.getStrutsError());
- return e.getStrutsReturnValue();
-
- } finally {
-
- }
- }
-
- public String newOA() {
- log.debug("insert new Online-Application");
-
- try {
- populateBasicInformations();
-
- populateBasicNewOnlineApplicationInformation();
-
- // prepare attribute helper list
- ArrayList<AttributeHelper> attributes = new ArrayList<AttributeHelper>();
-
- try {
- for (StorkAttribute current : configuration.getDbRead()
- .getMOAIDConfiguration().getAuthComponentGeneral()
- .getForeignIdentities().getSTORK().getAttributes())
- attributes.add(new AttributeHelper(current));
-
-
- } catch (NullPointerException e) {
-
- }
-
- if (getStorkOA() != null)
- getStorkOA().setHelperAttributes(attributes);
-
- UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser
- .getUserID());
-
- if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null
- && !userdb.isIsMailAddressVerified()) {
- log.info("Online-Applikation managemant disabled. Mail address is not verified.");
- addActionError(LanguageHelper.getErrorString(
- "error.editoa.mailverification", request));
- return Constants.STRUTS_SUCCESS;
- }
-
- if (formList.get(new OAOAuth20Config().getName()) != null)
- session.setAttribute(
- Constants.SESSION_OAUTH20SECRET,
- ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName()))
- .getClientSecret());
-
- if (getFormOA() != null)
- session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap());
-
-
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
-
- return Constants.STRUTS_OA_EDIT;
-
- } catch (BasicActionException e) {
- return Constants.STRUTS_ERROR;
-
- } finally {
-
- }
- }
-
- public String saveOA() {
-
- OnlineApplication onlineapplication = null;
-
- try {
- populateBasicInformations();
- onlineapplication = preProcessSaveOnlineApplication();
-
- List<String> errors = new ArrayList<String>();
-
- // validate forms
- for (IOnlineApplicationData form : formList.values())
- errors.addAll(form.validate(getGeneralOA(), authUser, request));
-
- // Do not allow SSO in combination with special BKUSelection features
- if (getSsoOA() != null && getSsoOA().isUseSSO()
- && (getFormOA() != null && getFormOA().isOnlyMandateAllowed() || !getFormOA()
- .isShowMandateLoginButton())) {
- log.warn("Special BKUSelection features can not be used in combination with SSO");
- errors.add(LanguageHelper.getErrorString(
- "validation.general.bkuselection.specialfeatures.valid",
- request));
- }
-
- if (errors.size() > 0) {
- log.info("OAConfiguration with ID "
- + getGeneralOA().getIdentifier() + " has some errors.");
- for (String el : errors)
- addActionError(el);
-
- formID = Random.nextRandom();
- session.setAttribute(Constants.SESSION_FORMID, formID);
- return Constants.STRUTS_ERROR_VALIDATION;
-
- } else {
- try {
- onlineapplication = postProcessSaveOnlineApplication(onlineapplication, true);
-
- } catch (BasicOAActionException e) {
- addActionError(e.getStrutsError());
- return e.getStrutsReturnValue();
- }
-
- }
-
- Object nextPageAttr = session
- .getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
- session.setAttribute(Constants.SESSION_RETURNAREA, null);
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- if (onlineapplication.isIsAdminRequired()) {
- int numoas = 0;
- int numusers = 0;
-
- List<OnlineApplication> openOAs = configuration.getDbRead()
- .getAllNewOnlineApplications();
- if (openOAs != null)
- numoas = openOAs.size();
-
- List<UserDatabase> openUsers = configuration.getUserManagement().getAllNewUsers();
- if (openUsers != null)
- numusers = openUsers.size();
- try {
-
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.success.admin", getGeneralOA()
- .getIdentifier(), request));
-
- if (numusers > 0 || numoas > 0)
- MailHelper.sendAdminMail(numoas, numusers);
-
- } catch (ConfigurationException e) {
- log.warn("Sending Mail to Admin failed.", e);
- }
-
- } else
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.success",
- getGeneralOA().getIdentifier(), request));
-
- // remove session attributes
- session.setAttribute(Constants.SESSION_OAID, null);
- session.removeAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
- session.removeAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
-
- return Constants.STRUTS_SUCCESS;
-
- } catch (BasicActionException e) {
- return Constants.STRUTS_ERROR;
-
- } catch (BasicOAActionException e) {
- addActionError(e.getStrutsError());
- return e.getStrutsReturnValue();
-
- } finally {
-
- }
- }
-
- public String cancleAndBackOA() {
- try {
- populateBasicInformations();
-
- Object nextPageAttr = session
- .getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
- session.setAttribute(Constants.SESSION_RETURNAREA, null);
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- session.setAttribute(Constants.SESSION_OAID, null);
-
- addActionMessage(LanguageHelper.getGUIString(
- "webpages.oaconfig.cancle", getGeneralOA().getIdentifier(),
- request));
-
- return Constants.STRUTS_SUCCESS;
-
- } catch (BasicActionException e) {
- return Constants.STRUTS_ERROR;
-
- } finally {
-
- }
- }
-
- public String deleteOA() {
- String oaidentifier = null;
- try {
- populateBasicInformations();
-
- Object nextPageAttr = session
- .getAttribute(Constants.SESSION_RETURNAREA);
- if (nextPageAttr != null && nextPageAttr instanceof String) {
- nextPage = (String) nextPageAttr;
-
- } else {
- nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- }
-
- oaidentifier = preProcessDeleteOnlineApplication();
- List<OnlineApplication> onlineapplications = configuration.getDbRead()
- .getOnlineApplications(oaidentifier);
-
- Long oaid = getOAIDFromSession();
-
- OnlineApplication onlineapplication = null;
-
- if (onlineapplications != null && onlineapplications.size() > 1) {
- log.info("Found more then one OA with PublicURLPrefix in configuration. "
- + "Select OA with DB Id ...");
-
- for (OnlineApplication oa : onlineapplications) {
- if (oa.getHjid().equals(oaid)) {
- if (onlineapplication == null)
- onlineapplication = oa;
-
- else {
- log.error("Found more then one OA with same PublicURLPrefix and same DBID.");
- new BasicOAActionException(
- "Found more then one OA with same PublicURLPrefix and same DBID.",
- Constants.STRUTS_SUCCESS);
-
- }
- }
- }
-
- } else if (onlineapplications != null && onlineapplications.size() == 1)
- onlineapplication = onlineapplications.get(0);
-
- request.getSession().setAttribute(Constants.SESSION_OAID, null);
-
+ private static final long serialVersionUID = 1L;
+
+ private String nextPage;
+
+ public EditOAAction() {
+ super();
+
+ final OATargetConfiguration oaTarget = new OATargetConfiguration();
+ formList.put(oaTarget.getName(), oaTarget);
+
+ final OAAuthenticationData authOA = new OAAuthenticationData();
+ formList.put(authOA.getName(), authOA);
+
+ final OASAML1Config saml1OA = new OASAML1Config();
+ formList.put(saml1OA.getName(), saml1OA);
+
+ if (isMoaidMode) {
+ final OABPKEncryption bPKEncDec = new OABPKEncryption();
+ formList.put(bPKEncDec.getName(), bPKEncDec);
+
+ final OASSOConfig ssoOA = new OASSOConfig();
+ formList.put(ssoOA.getName(), ssoOA);
+
+ final OAPVP2Config pvp2OA = new OAPVP2Config();
+ formList.put(pvp2OA.getName(), pvp2OA);
+
+ final OAOAuth20Config oauth20OA = new OAOAuth20Config();
+ formList.put(oauth20OA.getName(), oauth20OA);
+
+ final OASTORKConfig storkOA = new OASTORKConfig();
+ formList.put(storkOA.getName(), storkOA);
+
+ final Map<String, String> map = new HashMap<>();
+ map.putAll(FormBuildUtils.getDefaultMap());
+ final FormularCustomization formOA = new FormularCustomization(map);
+ formList.put(formOA.getName(), formOA);
+
+ final OARevisionsLogData revisOA = new OARevisionsLogData();
+ formList.put(revisOA.getName(), revisOA);
+ }
+
+ }
+
+ // STRUTS actions
+ public String inital() {
+ try {
+ populateBasicInformations();
+
+ final OnlineApplication onlineapplication = populateOnlineApplicationFromRequest();
+
+ if (onlineapplication == null) {
+ addActionError(LanguageHelper.getErrorString(
+ "errors.listOAs.noOA", request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ final List<String> errors = new ArrayList<>();
+ for (final IOnlineApplicationData form : formList.values()) {
+ final List<String> error = form.parse(onlineapplication, authUser,
+ request);
+ if (error != null) {
+ errors.addAll(error);
+ }
+ }
+ if (errors.size() > 0) {
+ for (final String el : errors) {
+ addActionError(el);
+ }
+ }
+
+ setNewOA(false);
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ session.setAttribute(Constants.SESSION_OAID, oaid);
+
+ return Constants.STRUTS_OA_EDIT;
+
+ } catch (final BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ } catch (final BasicOAActionException e) {
+ addActionError(e.getStrutsError());
+ return e.getStrutsReturnValue();
+
+ } finally {
+
+ }
+ }
+
+ public String newOA() {
+ log.debug("insert new Online-Application");
+
+ try {
+ populateBasicInformations();
+
+ populateBasicNewOnlineApplicationInformation();
+
+ // prepare attribute helper list
+ final ArrayList<AttributeHelper> attributes = new ArrayList<>();
+
+ try {
+ for (final StorkAttribute current : configuration.getDbRead()
+ .getMOAIDConfiguration().getAuthComponentGeneral()
+ .getForeignIdentities().getSTORK().getAttributes()) {
+ attributes.add(new AttributeHelper(current));
+ }
+
+ } catch (final NullPointerException e) {
+
+ }
+
+ if (getStorkOA() != null) {
+ getStorkOA().setHelperAttributes(attributes);
+ }
+
+ final UserDatabase userdb = configuration.getUserManagement().getUserWithID(authUser
+ .getUserID());
+
+ if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null
+ && !userdb.isIsMailAddressVerified()) {
+ log.info("Online-Applikation managemant disabled. Mail address is not verified.");
+ addActionError(LanguageHelper.getErrorString(
+ "error.editoa.mailverification", request));
+ return Constants.STRUTS_SUCCESS;
+ }
+
+ if (formList.get(new OAOAuth20Config().getName()) != null) {
+ session.setAttribute(
+ Constants.SESSION_OAUTH20SECRET,
+ ((OAOAuth20Config) formList.get(new OAOAuth20Config().getName()))
+ .getClientSecret());
+ }
+
+ if (getFormOA() != null) {
+ session.setAttribute(Constants.SESSION_BKUFORMPREVIEW, getFormOA().getFormMap());
+ }
+
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+
+ return Constants.STRUTS_OA_EDIT;
+
+ } catch (final BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ } finally {
+
+ }
+ }
+
+ public String saveOA() {
+
+ OnlineApplication onlineapplication = null;
+
+ try {
+ populateBasicInformations();
+ onlineapplication = preProcessSaveOnlineApplication();
+
+ final List<String> errors = new ArrayList<>();
+
+ // validate forms
+ for (final IOnlineApplicationData form : formList.values()) {
+ errors.addAll(form.validate(getGeneralOA(), authUser, request));
+ }
+
+ // Do not allow SSO in combination with special BKUSelection features
+ if (getSsoOA() != null && getSsoOA().isUseSSO()
+ && (getFormOA() != null && getFormOA().isOnlyMandateAllowed() || !getFormOA()
+ .isShowMandateLoginButton())) {
+ log.warn("Special BKUSelection features can not be used in combination with SSO");
+ errors.add(LanguageHelper.getErrorString(
+ "validation.general.bkuselection.specialfeatures.valid",
+ request));
+ }
+
+ if (errors.size() > 0) {
+ log.info("OAConfiguration with ID "
+ + getGeneralOA().getIdentifier() + " has some errors.");
+ for (final String el : errors) {
+ addActionError(el);
+ }
+
+ formID = Random.nextRandom();
+ session.setAttribute(Constants.SESSION_FORMID, formID);
+ return Constants.STRUTS_ERROR_VALIDATION;
+
+ } else {
+ try {
+ onlineapplication = postProcessSaveOnlineApplication(onlineapplication, true);
+
+ } catch (final BasicOAActionException e) {
+ addActionError(e.getStrutsError());
+ return e.getStrutsReturnValue();
+ }
+
+ }
+
+ final Object nextPageAttr = session
+ .getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+ session.setAttribute(Constants.SESSION_RETURNAREA, null);
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ if (onlineapplication.isIsAdminRequired()) {
+ int numoas = 0;
+ int numusers = 0;
+
+ final List<OnlineApplication> openOAs = configuration.getDbRead()
+ .getAllNewOnlineApplications();
+ if (openOAs != null) {
+ numoas = openOAs.size();
+ }
+
+ final List<UserDatabase> openUsers = configuration.getUserManagement().getAllNewUsers();
+ if (openUsers != null) {
+ numusers = openUsers.size();
+ }
+ try {
+
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.success.admin", getGeneralOA()
+ .getIdentifier(), request));
+
+ if (numusers > 0 || numoas > 0) {
+ MailHelper.sendAdminMail(numoas, numusers);
+ }
+
+ } catch (final ConfigurationException e) {
+ log.warn("Sending Mail to Admin failed.", e);
+ }
+
+ } else {
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.success",
+ getGeneralOA().getIdentifier(), request));
+ }
+
+ // remove session attributes
+ session.setAttribute(Constants.SESSION_OAID, null);
+ session.removeAttribute(Constants.SESSION_BKUSELECTIONTEMPLATE);
+ session.removeAttribute(Constants.SESSION_SENDASSERTIONTEMPLATE);
+
+ return Constants.STRUTS_SUCCESS;
+
+ } catch (final BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ } catch (final BasicOAActionException e) {
+ addActionError(e.getStrutsError());
+ return e.getStrutsReturnValue();
+
+ } finally {
+
+ }
+ }
+
+ public String cancleAndBackOA() {
+ try {
+ populateBasicInformations();
+
+ final Object nextPageAttr = session
+ .getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+ session.setAttribute(Constants.SESSION_RETURNAREA, null);
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ session.setAttribute(Constants.SESSION_OAID, null);
+
+ addActionMessage(LanguageHelper.getGUIString(
+ "webpages.oaconfig.cancle", getGeneralOA().getIdentifier(),
+ request));
+
+ return Constants.STRUTS_SUCCESS;
+
+ } catch (final BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ } finally {
+
+ }
+ }
+
+ public String deleteOA() {
+ String oaidentifier = null;
+ try {
+ populateBasicInformations();
+
+ final Object nextPageAttr = session
+ .getAttribute(Constants.SESSION_RETURNAREA);
+ if (nextPageAttr != null && nextPageAttr instanceof String) {
+ nextPage = (String) nextPageAttr;
+
+ } else {
+ nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
+ }
+
+ oaidentifier = preProcessDeleteOnlineApplication();
+ final List<OnlineApplication> onlineapplications = configuration.getDbRead()
+ .getOnlineApplications(oaidentifier);
+
+ final Long oaid = getOAIDFromSession();
+
+ OnlineApplication onlineapplication = null;
+
+ if (onlineapplications != null && onlineapplications.size() > 1) {
+ log.info("Found more then one OA with PublicURLPrefix in configuration. "
+ + "Select OA with DB Id ...");
+
+ for (final OnlineApplication oa : onlineapplications) {
+ if (oa.getHjid().equals(oaid)) {
+ if (onlineapplication == null) {
+ onlineapplication = oa;
+ } else {
+ log.error("Found more then one OA with same PublicURLPrefix and same DBID.");
+ new BasicOAActionException(
+ "Found more then one OA with same PublicURLPrefix and same DBID.",
+ Constants.STRUTS_SUCCESS);
+
+ }
+ }
+ }
+
+ } else if (onlineapplications != null && onlineapplications.size() == 1) {
+ onlineapplication = onlineapplications.get(0);
+ }
+
+ request.getSession().setAttribute(Constants.SESSION_OAID, null);
+
// try {
// if (MiscUtil.isNotEmpty(onlineapplication.getAuthComponentOA()
// .getOAPVP2().getMetadataURL())) {
-//
+//
// MOAIDConfiguration moaconfig = configuration.getDbRead()
// .getMOAIDConfiguration();
// moaconfig.setPvp2RefreshItem(new Date());
// ConfigurationDBUtils.saveOrUpdate(moaconfig);
-//
+//
// }
-// } catch (NullPointerException e) {
+// } catch (NullPointerException e) {
// log.debug("Found no MetadataURL in OA-Databaseconfig");
-//
+//
// } catch (Throwable e) {
// log.info("Set metadata refresh flag FAILED.", e);
// }
-
- if (onlineapplication != null && delete(onlineapplication)) {
-
- if (!authUser.isAdmin()) {
- UserDatabase user = configuration.getUserManagement().getUserWithID(authUser
- .getUserID());
- List<String> useroas = user.getOnlineApplication();
-
- for (String oa : useroas) {
- if (oa.equals(onlineapplication.getHjid())) {
- useroas.remove(oa);
- }
- }
-
- try {
- configuration.getUserManagement().saveOrUpdate(user);
-
- } catch (MOADatabaseException e) {
- log.warn("User information can not be updated in database",
- e);
- addActionError(LanguageHelper.getGUIString(
- "error.db.oa.store", request));
- return Constants.STRUTS_ERROR;
- }
- }
-
- 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;
-
- } catch (BasicOAActionException e) {
- addActionError(e.getStrutsError());
- return e.getStrutsReturnValue();
-
- } finally {
-
- }
-
- }
-
- public OAAuthenticationData getAuthOA() {
- return (OAAuthenticationData) formList.get(new OAAuthenticationData()
- .getName());
- }
-
- public void setAuthOA(OAAuthenticationData generalOA) {
- formList.put(generalOA.getName(), generalOA);
- }
-
- public OASAML1Config getSaml1OA() {
- return (OASAML1Config) formList.get(new OASAML1Config().getName());
- }
-
- public void setSaml1OA(OASAML1Config saml1oa) {
- formList.put(saml1oa.getName(), saml1oa);
- }
-
- public OASSOConfig getSsoOA() {
- return (OASSOConfig) formList.get(new OASSOConfig().getName());
- }
-
- public void setSsoOA(OASSOConfig ssoOA) {
- formList.put(ssoOA.getName(), ssoOA);
- }
-
- public OASTORKConfig getStorkOA() {
- return (OASTORKConfig) formList.get(new OASTORKConfig().getName());
- }
-
- public void setStorkOA(OASTORKConfig storkOA) {
- formList.put(storkOA.getName(), storkOA);
- }
-
-
- public OARevisionsLogData getRevisionsLogOA() {
- return (OARevisionsLogData) formList.get(new OARevisionsLogData().getName());
- }
-
- public void setRevisionsLogOA(OARevisionsLogData storkOA) {
- formList.put(storkOA.getName(), storkOA);
- }
-
-
- /**
- * @return the nextPage
- */
- public String getNextPage() {
- return nextPage;
- }
-
- /**
- * @return the formOA
- */
- public FormularCustomization getFormOA() {
- return (FormularCustomization) formList.get(new FormularCustomization(
- null).getName());
- }
-
- /**
- * @param formOA
- * the formOA to set
- */
- public void setFormOA(FormularCustomization formOA) {
- formList.put(formOA.getName(), formOA);
- }
-
- public OAOAuth20Config getOauth20OA() {
- return (OAOAuth20Config) formList.get(new OAOAuth20Config().getName());
- }
-
- public void setOauth20OA(OAOAuth20Config oauth20OA) {
- formList.put(oauth20OA.getName(), oauth20OA);
- }
-
- /**
- * @return the formOA
- */
- public OATargetConfiguration getTargetConfig() {
- return (OATargetConfiguration) formList.get(new OATargetConfiguration()
- .getName());
- }
-
- /**
- * @param formOA
- * the formOA to set
- */
- public void setTargetConfig(OATargetConfiguration formOA) {
- formList.put(formOA.getName(), formOA);
- }
-
- /**
- * @return the bPK encryption/decryption form
- */
- public OABPKEncryption getBPKEncDecr() {
- return (OABPKEncryption) formList.get(new OABPKEncryption().getName());
- }
-
- /**
- * @param bPK encryption/decryption form
- * the bPK encryption/decryption form to set
- */
- public void setBPKEncDecr(OABPKEncryption formOA) {
- formList.put(formOA.getName(), formOA);
- }
-
+
+ if (onlineapplication != null && delete(onlineapplication)) {
+
+ if (!authUser.isAdmin()) {
+ final UserDatabase user = configuration.getUserManagement().getUserWithID(authUser
+ .getUserID());
+ final List<String> useroas = user.getOnlineApplication();
+
+ for (final String oa : useroas) {
+ if (oa.equals(onlineapplication.getHjid())) {
+ useroas.remove(oa);
+ }
+ }
+
+ try {
+ configuration.getUserManagement().saveOrUpdate(user);
+
+ } catch (final MOADatabaseException e) {
+ log.warn("User information can not be updated in database",
+ e);
+ addActionError(LanguageHelper.getGUIString(
+ "error.db.oa.store", request));
+ return Constants.STRUTS_ERROR;
+ }
+ }
+
+ 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 (final BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ } catch (final BasicOAActionException e) {
+ addActionError(e.getStrutsError());
+ return e.getStrutsReturnValue();
+
+ } finally {
+
+ }
+
+ }
+
+ public OAAuthenticationData getAuthOA() {
+ return (OAAuthenticationData) formList.get(new OAAuthenticationData()
+ .getName());
+ }
+
+ public void setAuthOA(OAAuthenticationData generalOA) {
+ formList.put(generalOA.getName(), generalOA);
+ }
+
+ public OASAML1Config getSaml1OA() {
+ return (OASAML1Config) formList.get(new OASAML1Config().getName());
+ }
+
+ public void setSaml1OA(OASAML1Config saml1oa) {
+ formList.put(saml1oa.getName(), saml1oa);
+ }
+
+ public OASSOConfig getSsoOA() {
+ return (OASSOConfig) formList.get(new OASSOConfig().getName());
+ }
+
+ public void setSsoOA(OASSOConfig ssoOA) {
+ formList.put(ssoOA.getName(), ssoOA);
+ }
+
+ public OASTORKConfig getStorkOA() {
+ return (OASTORKConfig) formList.get(new OASTORKConfig().getName());
+ }
+
+ public void setStorkOA(OASTORKConfig storkOA) {
+ formList.put(storkOA.getName(), storkOA);
+ }
+
+ public OARevisionsLogData getRevisionsLogOA() {
+ return (OARevisionsLogData) formList.get(new OARevisionsLogData().getName());
+ }
+
+ public void setRevisionsLogOA(OARevisionsLogData storkOA) {
+ formList.put(storkOA.getName(), storkOA);
+ }
+
+ /**
+ * @return the nextPage
+ */
+ public String getNextPage() {
+ return nextPage;
+ }
+
+ /**
+ * @return the formOA
+ */
+ public FormularCustomization getFormOA() {
+ return (FormularCustomization) formList.get(new FormularCustomization(
+ null).getName());
+ }
+
+ /**
+ * @param formOA the formOA to set
+ */
+ public void setFormOA(FormularCustomization formOA) {
+ formList.put(formOA.getName(), formOA);
+ }
+
+ public OAOAuth20Config getOauth20OA() {
+ return (OAOAuth20Config) formList.get(new OAOAuth20Config().getName());
+ }
+
+ public void setOauth20OA(OAOAuth20Config oauth20OA) {
+ formList.put(oauth20OA.getName(), oauth20OA);
+ }
+
+ /**
+ * @return the formOA
+ */
+ public OATargetConfiguration getTargetConfig() {
+ return (OATargetConfiguration) formList.get(new OATargetConfiguration()
+ .getName());
+ }
+
+ /**
+ * @param formOA the formOA to set
+ */
+ public void setTargetConfig(OATargetConfiguration formOA) {
+ formList.put(formOA.getName(), formOA);
+ }
+
+ /**
+ * @return the bPK encryption/decryption form
+ */
+ public OABPKEncryption getBPKEncDecr() {
+ return (OABPKEncryption) formList.get(new OABPKEncryption().getName());
+ }
+
+ /**
+ * @param bPK encryption/decryption form the bPK encryption/decryption form to
+ * set
+ */
+ public void setBPKEncDecr(OABPKEncryption formOA) {
+ formList.put(formOA.getName(), formOA);
+ }
+
}