aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-26 16:32:48 +0100
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-26 16:32:48 +0100
commitcaee81b311e93720d4c1fe2b3de22cdcbb0fe74d (patch)
tree8774a498a60861bfd00fcd8036e2c695721df906 /id
parentf51b28c24ac466b5e25d3047975beac8f14d2c15 (diff)
downloadmoa-id-spss-caee81b311e93720d4c1fe2b3de22cdcbb0fe74d.tar.gz
moa-id-spss-caee81b311e93720d4c1fe2b3de22cdcbb0fe74d.tar.bz2
moa-id-spss-caee81b311e93720d4c1fe2b3de22cdcbb0fe74d.zip
config
Diffstat (limited to 'id')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java55
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java706
2 files changed, 384 insertions, 377 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
index 6ef85d7ae..db3e12f43 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
@@ -4,6 +4,7 @@ import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.stork.VelocityProvider;
+import at.gv.egovernment.moa.id.commons.db.dao.config.StorkAttribute;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.moduls.IAction;
@@ -64,7 +65,7 @@ public class AuthenticationRequest implements IAction {
Logger.debug("STORK QAA 2 :" + ((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getQAALevel());
StartAuthResponse startAuthResponse = getStartAuthResponse(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());
- HttpSession httpSession = httpReq.getSession();
+ HttpSession httpSession = httpReq.getSession(); performRed
httpSession.setAttribute("STORKSessionID", "12345");
httpResp.setStatus(startAuthResponse.getHttpStatusCode());
try {
@@ -102,12 +103,37 @@ public class AuthenticationRequest implements IAction {
throw new AuthenticationException("stork.12", new Object[] { moasession.getPublicOAURLPrefix() });
+ // Prepare basic AT attributes
+ try {
+ IPersonalAttributeList moaAttrList = moasession.getStorkAttributes();
+ Logger.info("Found number of moa personal attributes: " + moasession.getStorkAttributes().size());
+
+
+ for (PersonalAttribute personalAttribute : moaAttrList) {
+ Logger.info("Personal attribute found: " + personalAttribute.getName() + personalAttribute.getStatus());
+ if (personalAttribute.getValue().size() > 0) {
+ for (String value : personalAttribute.getValue()) {
+ Logger.info(" Value found: " + value);
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ Logger.error("Exception, attributes: " + e.getMessage());
+ }
+
+ authnResponse.setPersonalAttributeList(populateAttributes());
+
+ // Prepare extended attributes
+ Logger.debug("Preparing data container");
+
//httpResp.setStatus(200);
//VPEPSInboundPostHandler
// create fresh container
DataContainer container = new DataContainer();
-
+
+
// - fill in the request we extracted above
container.setRequest(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());
@@ -118,39 +144,20 @@ public class AuthenticationRequest implements IAction {
container.setTarget(((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
+ Logger.debug("Data container prepared");
- if (1==1) // test
+ if (1==0) // test
// see if we need to fetch further attributes
return (new AttributeCollector()).processRequest(container, httpReq, httpResp, oaParam);
+ Logger.debug("Finished sending data container");
-
- try {
- IPersonalAttributeList moaAttrList = moasession.getStorkAttributes();
- Logger.info("Found number of moa personal attributes: " + moasession.getStorkAttributes().size());
-
-
- for (PersonalAttribute personalAttribute : moaAttrList) {
- Logger.info("Personal attribute found: " + personalAttribute.getName() + personalAttribute.getStatus());
- if (personalAttribute.getValue().size() > 0) {
- for (String value : personalAttribute.getValue()) {
- Logger.info(" Value found: " + value);
- }
- }
- }
-
- } catch (Exception e) {
- Logger.error("Exception, attributes: " + e.getMessage());
- }
-
- authnResponse.setPersonalAttributeList(populateAttributes());
-
try {
//Get SAMLEngine instance
STORKSAMLEngine engine = STORKSAMLEngine.getInstance("incoming");
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 e4e4ce98a..88220cded 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
@@ -22,366 +22,366 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManager;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
import at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration;
import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication;
import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
-
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
+import org.apache.commons.lang.StringEscapeUtils;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
@SuppressWarnings("rawtypes")
public class ConfigurationDBRead {
- private static Map<String, String> QUERIES = new HashMap<String, String>();
- static {
- QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'");
- QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))");
- QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");
- QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
- QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
- QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'");
- QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
- QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
- QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken");
- QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'");
- QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'");
- QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk");
- QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
- QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
- QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id");
- QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); }
-
- public static OnlineApplication getActiveOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", StringEscapeUtils.escapeHtml(id));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.debug("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", id);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- if (result.size() > 1) {
- Logger.warn("OAIdentifier match to more then one DB-entry!");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static OnlineApplication getOnlineApplication(long dbid) {
- MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
-
- List result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
- //query.setParameter("id", id+"%");
- query.setParameter("id", dbid);
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return (OnlineApplication) result.get(0);
- }
-
- public static MOAIDConfiguration getMOAIDConfiguration() {
- Logger.trace("Load MOAID Configuration from database.");
-
- List<MOAIDConfiguration> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return (MOAIDConfiguration) result.get(0);
- }
-
- public static List<OnlineApplication> getAllOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
- 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> getAllNewOnlineApplications() {
- Logger.trace("Get All OnlineApplications from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
- 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<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.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
-
- @SuppressWarnings("rawtypes")
- public static List<OnlineApplication> searchOnlineApplications(String id) {
- MiscUtil.assertNotNull(id, "OnlineApplictionID");
- Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
-
- List<OnlineApplication> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
- query.setParameter("id", "%"+id+"%");
-
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
-
- return result;
- }
-
- public static UserDatabase getUserWithID(long id) {
- MiscUtil.assertNotNull(id, "UserID");
- Logger.trace("Getting Userinformation with ID " + id + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
- query.setParameter("id", id);
- 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);
- }
-
- public static UserDatabase getUsersWithOADBID(long id) {
- MiscUtil.assertNotNull(id, "OADBID");
- Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
- query.setParameter("id", id);
- 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);
- }
-
- 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);
- }
-
- public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
- MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
- Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
- query.setParameter("bpk", bpkwbpk);
- 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);
- }
-
- public static UserDatabase getNewUserWithTokken(String tokken) {
- MiscUtil.assertNotNull(tokken, "bpk/wbpk");
- Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
- query.setParameter("tokken", tokken);
- 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);
- }
-
- public static List<UserDatabase> getAllNewUsers() {
- Logger.trace("Get all new Users from Database");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
- 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<UserDatabase> getAllOpenUsersRequests() {
- Logger.trace("Get all new Users from Database");
-
- List<UserDatabase> result;
- EntityManager session = ConfigurationDBUtils.getCurrentSession();
-
- javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
- result = query.getResultList();
-
- Logger.trace("Found entries: " + result.size());
-
- if (result.size() == 0) {
- Logger.trace("No entries found.");
- return null;
- }
- return result;
- }
+ private static Map<String, String> QUERIES = new HashMap<String, String>();
+
+ static {
+ QUERIES.put("getActiveOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'");
+ QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))");
+ QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");
+ QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");
+ QUERIES.put("getAllActiveOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '1'");
+ QUERIES.put("getAllNewOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1'");
+ QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration");
+ QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id");
+ QUERIES.put("getNewUserWithUserTokken", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken");
+ QUERIES.put("getAllNewUsers", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '1'");
+ QUERIES.put("getAllOpenUsersRequests", "select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken is not null and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0'");
+ QUERIES.put("getUserWithUserBPKWBPK", "select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk");
+ QUERIES.put("getUserWithUserUsername", "select userdatabase from UserDatabase userdatabase where userdatabase.username = :username");
+ QUERIES.put("getAllUsers", "select userdatabase from UserDatabase userdatabase");
+ QUERIES.put("getUsersWithOADBID", "select userdatabase from UserDatabase userdatabase inner join userdatabase.onlineApplication oa where oa.hjid = :id");
+ QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id");
+ }
+
+ public static OnlineApplication getActiveOnlineApplication(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", StringEscapeUtils.escapeHtml(id));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.debug("No entries found.");
+ return null;
+ }
+
+ if (result.size() > 1) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static OnlineApplication getOnlineApplication(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", id);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ if (result.size() > 1) {
+ Logger.warn("OAIdentifier match to more then one DB-entry!");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static OnlineApplication getOnlineApplication(long dbid) {
+ MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
+
+ List result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getOnlineApplicationWithDBID"));
+ //query.setParameter("id", id+"%");
+ query.setParameter("id", dbid);
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return (OnlineApplication) result.get(0);
+ }
+
+ public static MOAIDConfiguration getMOAIDConfiguration() {
+ Logger.trace("Load MOAID Configuration from database.");
+
+ List<MOAIDConfiguration> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return (MOAIDConfiguration) result.get(0);
+ }
+
+ public static List<OnlineApplication> getAllOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List<OnlineApplication> result = null;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOnlineApplications"));
+ 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> getAllNewOnlineApplications() {
+ Logger.trace("Get All OnlineApplications from database.");
+
+ List<OnlineApplication> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewOnlineApplications"));
+ 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<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.");
+
+ List<OnlineApplication> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllActiveOnlineApplications"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static List<OnlineApplication> searchOnlineApplications(String id) {
+ MiscUtil.assertNotNull(id, "OnlineApplictionID");
+ Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
+
+ List<OnlineApplication> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsWithID"));
+ query.setParameter("id", "%" + id + "%");
+
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+
+ return result;
+ }
+
+ public static UserDatabase getUserWithID(long id) {
+ MiscUtil.assertNotNull(id, "UserID");
+ Logger.trace("Getting Userinformation with ID " + id + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserID"));
+ query.setParameter("id", id);
+ 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);
+ }
+
+ public static UserDatabase getUsersWithOADBID(long id) {
+ MiscUtil.assertNotNull(id, "OADBID");
+ Logger.trace("Getting Userinformation with OADBID " + id + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUsersWithOADBID"));
+ query.setParameter("id", id);
+ 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);
+ }
+
+ 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);
+ }
+
+ public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) {
+ MiscUtil.assertNotNull(bpkwbpk, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getUserWithUserBPKWBPK"));
+ query.setParameter("bpk", bpkwbpk);
+ 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);
+ }
+
+ public static UserDatabase getNewUserWithTokken(String tokken) {
+ MiscUtil.assertNotNull(tokken, "bpk/wbpk");
+ Logger.trace("Getting Userinformation with Tokken " + tokken + " from database.");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getNewUserWithUserTokken"));
+ query.setParameter("tokken", tokken);
+ 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);
+ }
+
+ public static List<UserDatabase> getAllNewUsers() {
+ Logger.trace("Get all new Users from Database");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllNewUsers"));
+ 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<UserDatabase> getAllOpenUsersRequests() {
+ Logger.trace("Get all new Users from Database");
+
+ List<UserDatabase> result;
+ EntityManager session = ConfigurationDBUtils.getCurrentSession();
+
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getAllOpenUsersRequests"));
+ result = query.getResultList();
+
+ Logger.trace("Found entries: " + result.size());
+
+ if (result.size() == 0) {
+ Logger.trace("No entries found.");
+ return null;
+ }
+ return result;
+ }
}