aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
authorGerwin Gsenger <g.gsenger@datentechnik-innovation.at>2015-01-21 13:34:07 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-06-19 11:08:03 +0200
commitbf1c8cc094a3e2a4d0a53facfeecbf5eb282d9b9 (patch)
tree676b65e7846b640c008dc7a5547bfdffe1df8100 /id/server/moa-id-commons
parent893f6f7ffc1f5d17d03f5fcd47762b6e4699587a (diff)
downloadmoa-id-spss-bf1c8cc094a3e2a4d0a53facfeecbf5eb282d9b9.tar.gz
moa-id-spss-bf1c8cc094a3e2a4d0a53facfeecbf5eb282d9b9.tar.bz2
moa-id-spss-bf1c8cc094a3e2a4d0a53facfeecbf5eb282d9b9.zip
add javadoc
Diffstat (limited to 'id/server/moa-id-commons')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationFromDBExtractor.java88
1 files changed, 88 insertions, 0 deletions
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 78cd8a670..394c9cdeb 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
@@ -16,11 +16,28 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates;
import com.fasterxml.jackson.annotation.JsonProperty;
+/**
+ * This class is used to extract information from a legacy moa-id database.
+ */
public class ConfigurationFromDBExtractor {
+ /**
+ * This class should not be instantiated.
+ */
private ConfigurationFromDBExtractor() {
}
+ /**
+ * Helper method, to query for a single value. NOTE: returns {@code null} if
+ * there is no result, more than one result or if an exception is thrown
+ * while querying the database.
+ *
+ * @param queryString
+ * a jpa query string.
+ * @param clazz
+ * the class type of the expected result.
+ * @return the result of the query or {@code null}.
+ */
private static <T> T getSingleValue(String queryString, Class<T> clazz) {
T result = null;
EntityManager session = ConfigurationDBUtils.getCurrentSession();
@@ -33,6 +50,16 @@ public class ConfigurationFromDBExtractor {
return result;
}
+ /**
+ * Helper method, to query for a a list of values. NOTE: the returned list
+ * may be empty but is never {@code null}.
+ *
+ * @param queryString
+ * a jpa query string.
+ * @param clazz
+ * the class type of the elements the expected result list.
+ * @return a list with the result of the query or an empty list.
+ */
private static <T> List<T> getListOfValues(String queryString, Class<T> clazz) {
List<T> result = new ArrayList<T>();
EntityManager session = ConfigurationDBUtils.getCurrentSession();
@@ -45,46 +72,107 @@ public class ConfigurationFromDBExtractor {
return result;
}
+ /**
+ * Extracts an {@link AuthComponentGeneral} from the database. NOTE: returns
+ * {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return an AuthComponentgeneral or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY)
public static AuthComponentGeneral getAuthComponentGeneral() {
return getSingleValue("from AuthComponentGeneral", AuthComponentGeneral.class);
}
+ /**
+ * Extracts an {@link AuthComponentGeneral} from the database. NOTE: returns
+ * {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return an AuthComponentgeneral or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.CHAINING_MODES_KEY)
public static ChainingModes getChainingModes() {
return (ChainingModes) getSingleValue("from ChainingModes", ChainingModes.class);
}
+ /**
+ * Extracts a list of {@link OnlineApplication} from the database. NOTE: the
+ * returned list may be empty but is never {@code null}.
+ *
+ * @return a list of {@link OnlineApplication}.
+ */
@JsonProperty(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY)
public static List<OnlineApplication> getOnlineApplications() {
return getListOfValues("from OnlineApplication", OnlineApplication.class);
}
+ /**
+ * Extracts a list of {@link GenericConfiguration} from the database. NOTE:
+ * the returned list may be empty but is never {@code null}.
+ *
+ * @return a list of {@link GenericConfiguration}.
+ */
@JsonProperty(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY)
public static List<GenericConfiguration> getGenericConfigurations() {
return getListOfValues("from GenericConfiguration", GenericConfiguration.class);
}
+ /**
+ * Extracts the trusted CA-certificates from the database. NOTE: returns
+ * {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return the trusted CA-certificates or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY)
public static String getTrustedCACertificates() {
return getSingleValue("select trustedCACertificates from MOAIDConfiguration", String.class);
}
+ /**
+ * Extracts a {@link DefaultBKUs} from the database. NOTE: returns
+ * {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return a DefaultBKUs or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY)
public static DefaultBKUs getDefaultBKUs() {
return getSingleValue("select defaultBKUs from MOAIDConfiguration", DefaultBKUs.class);
}
+ /**
+ * Extracts a {@link SLRequestTemplates} from the database. NOTE: returns
+ * {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return a SLRequestTemplates or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY)
public static SLRequestTemplates getSLRequestTemplates() {
return getSingleValue("select SLRequestTemplates from MOAIDConfiguration", SLRequestTemplates.class);
}
+ /**
+ * Extracts the moa-id timestamp (last update) from the database. NOTE:
+ * returns {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return the moa-id timestamp (last update) or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY)
public static Date getTimeStampItem() {
return getSingleValue("select timestampItem from MOAIDConfiguration", Date.class);
}
+ /**
+ * Extracts the date of the last pvp2refresh from the database. NOTE:
+ * returns {@code null} if there is no result, more than one result or if an
+ * exception is thrown while querying the database.
+ *
+ * @return the date of the last pvp2refresh or {@code null}.
+ */
@JsonProperty(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY)
public static Date getPvp2RefreshItem() {
return getSingleValue("select pvp2RefreshItem from MOAIDConfiguration", Date.class);