From 63c0626cb2a0bcfb37f903b98cf7975797186aca Mon Sep 17 00:00:00 2001 From: Gerwin Gsenger Date: Fri, 16 Jan 2015 16:11:46 +0100 Subject: add JSON annotations, remove unnecessary cast --- .../moa/id/commons/db/ConfigurationFromDBExtractor.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'id/server/moa-id-commons/src/main/java') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationFromDBExtractor.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationFromDBExtractor.java index 63c3b5bfb..d657ed16a 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationFromDBExtractor.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationFromDBExtractor.java @@ -14,6 +14,8 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; +import com.fasterxml.jackson.annotation.JsonProperty; + public class ConfigurationFromDBExtractor { private ConfigurationFromDBExtractor() { @@ -24,7 +26,7 @@ public class ConfigurationFromDBExtractor { EntityManager session = ConfigurationDBUtils.getCurrentSession(); TypedQuery query = session.createQuery(queryString, clazz); try { - result = clazz.cast(query.getSingleResult()); + result = query.getSingleResult(); } catch (Exception e) { return null; } @@ -43,38 +45,47 @@ public class ConfigurationFromDBExtractor { return result; } + @JsonProperty("getAuthComponentGeneral") public static AuthComponentGeneral getAuthComponentGeneral() { return getSingleValue("from AuthComponentGeneral", AuthComponentGeneral.class); } + @JsonProperty("getChainingModes") public static ChainingModes getChainingModes() { return (ChainingModes) getSingleValue("from ChainingModes", ChainingModes.class); } + @JsonProperty("getOnlineApplications") public static List getOnlineApplications() { return getListOfValues("from OnlineApplication", OnlineApplication.class); } + @JsonProperty("getGenericConfigurations") public static List getGenericConfigurations() { return getListOfValues("from GenericConfiguration", GenericConfiguration.class); } + @JsonProperty("getTrustedCACertificates") public static String getTrustedCACertificates() { return getSingleValue("select trustedCACertificates from MOAIDConfiguration", String.class); } + @JsonProperty("getDefaultBKUs") public static DefaultBKUs getDefaultBKUs() { return getSingleValue("select defaultBKUs from MOAIDConfiguration", DefaultBKUs.class); } + @JsonProperty("getSLRequestTemplates") public static SLRequestTemplates getSLRequestTemplates() { return getSingleValue("select SLRequestTemplates from MOAIDConfiguration", SLRequestTemplates.class); } + @JsonProperty("getTimeStampItem") public static Date getTimeStampItem() { return getSingleValue("select timestampItem from MOAIDConfiguration", Date.class); } + @JsonProperty("getPvp2RefreshItem") public static Date getPvp2RefreshItem() { return getSingleValue("select pvp2RefreshItem from MOAIDConfiguration", Date.class); } -- cgit v1.2.3