diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-02-23 13:35:12 +0100 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-02-23 13:35:12 +0100 |
commit | 80ea041e0240eb3d9291eb0d699bb09c90aaa2a9 (patch) | |
tree | c1d950bbdfbc40991e2bcfc7822ff3e181951688 /id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config | |
parent | f35737cbb27dda96caf0435c4bac7d279832e4fd (diff) | |
download | moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.gz moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.tar.bz2 moa-id-spss-80ea041e0240eb3d9291eb0d699bb09c90aaa2a9.zip |
first untested unfactoring for Postgresql suppport
The scheme of configuration DB changed, therefore this version is incompatible to 3.3.2 configuration
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config')
2 files changed, 17 insertions, 23 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/SpringProfileConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/SpringProfileConstants.java index 14824b1f8..f64e10d0d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/SpringProfileConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/SpringProfileConstants.java @@ -5,4 +5,5 @@ public final class SpringProfileConstants { public static final String ADVANCED_LOG = "advancedLogOn"; public static final String REDIS_BACKEND = "redisBackend"; public static final String DB_BACKEND = "dbBackend"; + public static final String BYTEBASEDCONFIG = "byteBasedConfig"; } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java index b9b5ad611..4fd382606 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java @@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional; import at.gv.egiz.components.configuration.api.Configuration; import at.gv.egiz.components.configuration.api.ConfigurationException; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.db.dao.config.AbstractConfigProperty; import at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty; import at.gv.egovernment.moa.id.commons.db.dao.config.DatabaseConfigPropertyImpl; import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; @@ -31,14 +32,6 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement // Configuration configPropertyDao; // -// /** -// * Sets the {@link ConfigPropertyDao}. -// * @param configPropertyDao the ConfigPropertyDao -// */ -// @Required -// public void setConfigPropertyDao(Configuration configPropertyDao) { -// this.configPropertyDao = configPropertyDao; -// } public void setStringValue(String id, String value) throws ConfigurationException { super.setStringValue(id, value); @@ -63,9 +56,9 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } - TypedQuery<ConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class); configQuery.setParameter("key", preFix + "%"); - List<ConfigProperty> configResult = configQuery.getResultList(); + List<AbstractConfigProperty> configResult = configQuery.getResultList(); if (configResult == null || configResult.isEmpty()) { Logger.warn("Found no configuration keys with prefix: " + preFix + ".%"); @@ -101,9 +94,9 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } - TypedQuery<ConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + TypedQuery<AbstractConfigProperty> configQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class); configQuery.setParameter("key", searchKey.replace("*", "%")); - List<ConfigProperty> configResult = configQuery.getResultList(); + List<AbstractConfigProperty> configResult = configQuery.getResultList(); if (configResult == null || configResult.isEmpty()) { Logger.warn("Found no configuration keys with searchKey: " + searchKey); @@ -134,8 +127,8 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement + ".%." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER; - List<ConfigProperty> oaSearchResult = null; - TypedQuery<ConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key and dbconfig.value = SUBSTRING(:uniqueID, 1, LENGTH(dbconfig.value))", ConfigProperty.class); + List<AbstractConfigProperty> oaSearchResult = null; + TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key and dbconfig.value = SUBSTRING(:uniqueID, 1, LENGTH(dbconfig.value))", AbstractConfigProperty.class); oaSearchQuery.setParameter("key", keyId); oaSearchQuery.setParameter("uniqueID", publicURLPrefix); oaSearchResult = oaSearchQuery.getResultList(); @@ -164,13 +157,13 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement + ".%." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER; - List<ConfigProperty> oaSearchResult = new ArrayList<ConfigProperty>(); + List<AbstractConfigProperty> oaSearchResult = new ArrayList<AbstractConfigProperty>(); - TypedQuery<ConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + TypedQuery<AbstractConfigProperty> oaSearchQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class); oaSearchQuery.setParameter("key", keyId); - List<ConfigProperty> intermResult = oaSearchQuery.getResultList(); + List<AbstractConfigProperty> intermResult = oaSearchQuery.getResultList(); if (intermResult != null) { - for (ConfigProperty el : intermResult) { + for (AbstractConfigProperty el : intermResult) { if (publicURLPrefix.startsWith(el.getValue())) oaSearchResult.add(el); @@ -189,10 +182,10 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement * @param removePrefix: Indicates if the prefix should be removed from the result key * @return the {@link Map} of configuration properties */ - private Map<String, String> getKeyValueFromDatabaseDAO(Iterator<ConfigProperty> input, final String prefix, boolean removePrefix) { + private Map<String, String> getKeyValueFromDatabaseDAO(Iterator<AbstractConfigProperty> input, final String prefix, boolean removePrefix) { Map<String, String> configProp = new HashMap<String, String>(); while (input.hasNext()) { - ConfigProperty el = input.next(); + AbstractConfigProperty el = input.next(); if (removePrefix) { if (el.getKey().startsWith(prefix)) { String propertyName = KeyValueUtils.removePrefixFromKey(el.getKey(), prefix); @@ -213,7 +206,7 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement * @param oaSearchResult Search result of first OA selection operation * @return Map of post-processed OA configuration key/value pairs */ - private Map<String, String> postProcessLoadOnlineApplication(EntityManager em, List<ConfigProperty> oaSearchResult) { + private Map<String, String> postProcessLoadOnlineApplication(EntityManager em, List<AbstractConfigProperty> oaSearchResult) { if (oaSearchResult == null || oaSearchResult.size() == 0) { Logger.debug("No entries found."); return null; } @@ -231,9 +224,9 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement String oaType = KeyValueUtils.getFirstChildAfterPrefix(oaIdKey, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES); String oaKey = KeyValueUtils.getPrefixFromKey(oaIdKey, MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER); - TypedQuery<ConfigProperty> oaConfigQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", ConfigProperty.class); + TypedQuery<AbstractConfigProperty> oaConfigQuery = em.createQuery("select dbconfig from ConfigProperty dbconfig where dbconfig.key like :key", AbstractConfigProperty.class); oaConfigQuery.setParameter("key", oaKey + ".%"); - List<ConfigProperty> oaConfigResult = oaConfigQuery.getResultList(); + List<AbstractConfigProperty> oaConfigResult = oaConfigQuery.getResultList(); if (oaConfigResult == null) { Logger.warn("Found no configuration keys with prefix: " + oaKey + ".%"); |