diff options
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at')
3 files changed, 60 insertions, 51 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java index 22a978014..4cb7eba2d 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAGeneralConfig.java @@ -42,9 +42,7 @@ public class OAGeneralConfig implements IOnlineApplicationData{ private static final Logger log = Logger.getLogger(OAGeneralConfig.class); private boolean isActive = false; - - private String dbID = null; - + private String identifier = null; private String friendlyName = null; private boolean businessService = false; @@ -67,7 +65,7 @@ public class OAGeneralConfig implements IOnlineApplicationData{ friendlyName = dbOAConfig.getFriendlyName(); identifier = dbOAConfig.getPublicURLPrefix(); - + if (dbOAConfig.getType().equals(Constants.MOA_CONFIG_BUSINESSSERVICE)) businessService = true; else @@ -163,27 +161,5 @@ public class OAGeneralConfig implements IOnlineApplicationData{ public void setActive(boolean isActive) { this.isActive = isActive; - } - - /** - * @return the dbID - */ - public String getDbID() { - return dbID; - } - - - /** - * @param dbID the dbID to set - */ - public void setDbID(long dbID) { - this.dbID = String.valueOf(dbID); - } - - /** - * @param dbID the dbID to set - */ - public void setDbID(String dbID) { - this.dbID = dbID; - } + } } 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 71639abef..c80bc1925 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 @@ -262,25 +262,8 @@ public class BasicOAAction extends BasicAction { OnlineApplication onlineapplication = null; - Object oadbid = request.getSession().getAttribute(Constants.SESSION_OAID); - Long oaid = (long) -1; - - if (oadbid != null) { - try { - oaid = (Long) oadbid; - if (oaid < 0 || oaid > Long.MAX_VALUE) { - throw new BasicOAActionException( - LanguageHelper.getErrorString("errors.edit.oa.oaid", request), - Constants.STRUTS_ERROR); - } - - } catch (Throwable t) { - throw new BasicOAActionException( - LanguageHelper.getErrorString("errors.edit.oa.oaid", request), - Constants.STRUTS_ERROR); - } - } - + Long oaid = getOAIDFromSession(); + // valid DBID and check entry OAGeneralConfig oaGeneralForm = ((OAGeneralConfig)formList.get(new OAGeneralConfig().getName())); String oaidentifier = oaGeneralForm.getIdentifier(); @@ -316,14 +299,15 @@ public class BasicOAAction extends BasicAction { onlineapplication = configuration.getDbRead().getOnlineApplication(oaidentifier); } - setNewOA(true); + if (onlineapplication != null) { log.info("The OAIdentifier is not unique"); throw new BasicOAActionException( LanguageHelper.getErrorString("validation.general.oaidentifier.notunique", request), Constants.STRUTS_ERROR_VALIDATION); - } + } else + setNewOA(true); } else { onlineapplication = configuration.getDbRead().getOnlineApplication(oaid); @@ -362,6 +346,29 @@ public class BasicOAAction extends BasicAction { } + protected Long getOAIDFromSession() throws BasicOAActionException { + Object oadbid = request.getSession().getAttribute(Constants.SESSION_OAID); + Long oaid = (long) -1; + + if (oadbid != null) { + try { + oaid = (Long) oadbid; + if (oaid < 0 || oaid > Long.MAX_VALUE) { + throw new BasicOAActionException( + LanguageHelper.getErrorString("errors.edit.oa.oaid", request), + Constants.STRUTS_ERROR); + } + + } catch (Throwable t) { + throw new BasicOAActionException( + LanguageHelper.getErrorString("errors.edit.oa.oaid", request), + Constants.STRUTS_ERROR); + } + } + + return oaid; + } + protected String preProcessDeleteOnlineApplication() throws BasicOAActionException { try { Object formidobj = session.getAttribute(Constants.SESSION_FORMID); 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 a8dd48ca0..85b8a8ea0 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 @@ -344,9 +344,35 @@ public class EditOAAction extends BasicOAAction { } oaidentifier = preProcessDeleteOnlineApplication(); - OnlineApplication onlineapplication = configuration.getDbRead() - .getOnlineApplication(oaidentifier); - + 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); // try { |