aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main/java/at/gv/egovernment
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main/java/at/gv/egovernment')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java44
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java1
2 files changed, 44 insertions, 1 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
index 08cb32625..795981777 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java
@@ -24,6 +24,8 @@ public class ConfigurationDBRead {
QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
+ QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
+ QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); }
@SuppressWarnings("rawtypes")
@@ -133,6 +135,24 @@ public class ConfigurationDBRead {
return result;
}
+ public static List<UserDatabase> getAllUsers() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllUsers"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
public static List<OnlineApplication> getAllActiveOnlineApplications() {
Logger.trace("Get All active OnlineApplications from database.");
@@ -192,5 +212,27 @@ public class ConfigurationDBRead {
return null;
}
return (UserDatabase) result.get(0);
- }
+ }
+
+
+
+ public static UserDatabase getUserWithUserName(String username) {
+ MiscUtil.assertNotNull(username, "UserName");
+ Logger.trace("Getting Userinformation with ID " + username + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserUsername"));
+ query.setParameter("username", username);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return (UserDatabase) result.get(0);
+ }
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
index c8bacb470..16cea07d8 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java
@@ -80,6 +80,7 @@ public final class ConfigurationDBUtils {
query.getResultList();
} catch (Throwable e) {
+ Logger.warn("JPA Session Handling Warning!!!! - This error should not occur.");
session = getNewSession();
}