aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-commons/src/main')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java175
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBUtils.java39
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java30
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/StatisticLogDBUtils.java188
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java22
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java26
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java125
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java48
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java22
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/statistic/StatisticLog.java397
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java22
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml (renamed from id/server/moa-id-commons/src/main/resources/config/hibernate.cfg.xml)1
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml11
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd56
14 files changed, 1103 insertions, 59 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 795981777..e4e4ce98a 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
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
import java.util.HashMap;
@@ -6,6 +28,8 @@ 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;
@@ -13,22 +37,28 @@ 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;
+@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 like SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1'");
- QUERIES.put("getOnlineApplicationWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.publicURLPrefix like SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix))");
+ 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"); }
- @SuppressWarnings("rawtypes")
public static OnlineApplication getActiveOnlineApplication(String id) {
MiscUtil.assertNotNull(id, "OnlineApplictionID");
Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
@@ -38,21 +68,24 @@ public class ConfigurationDBRead {
javax.persistence.Query query = session.createQuery(QUERIES.get("getActiveOnlineApplicationWithID"));
//query.setParameter("id", id+"%");
- query.setParameter("id", id);
+ query.setParameter("id", StringEscapeUtils.escapeHtml(id));
result = query.getResultList();
Logger.trace("Found entries: " + result.size());
if (result.size() == 0) {
- Logger.trace("No entries found.");
+ 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);
}
-
- @SuppressWarnings("rawtypes")
public static OnlineApplication getOnlineApplication(String id) {
MiscUtil.assertNotNull(id, "OnlineApplictionID");
Logger.trace("Getting OnlineApplication with ID " + id + " from database.");
@@ -71,11 +104,15 @@ public class ConfigurationDBRead {
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);
}
- @SuppressWarnings("rawtypes")
public static OnlineApplication getOnlineApplication(long dbid) {
MiscUtil.assertNotNull(dbid, "OnlineApplictionID");
Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database.");
@@ -98,13 +135,13 @@ public class ConfigurationDBRead {
return (OnlineApplication) result.get(0);
}
- public static MOAIDConfiguration getMOAIDConfiguration() {
+ public static MOAIDConfiguration getMOAIDConfiguration() {
Logger.trace("Load MOAID Configuration from database.");
- List result;
+ List<MOAIDConfiguration> result;
EntityManager session = ConfigurationDBUtils.getCurrentSession();
- javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
+ javax.persistence.Query query = session.createQuery(QUERIES.get("getMOAIDConfiguration"));
result = query.getResultList();
Logger.trace("Found entries: " + result.size());
@@ -135,6 +172,24 @@ public class ConfigurationDBRead {
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.");
@@ -214,7 +269,25 @@ public class ConfigurationDBRead {
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");
@@ -235,4 +308,80 @@ public class ConfigurationDBRead {
}
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;
+ }
}
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 16cea07d8..6bd987f96 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
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
import java.util.Properties;
@@ -8,8 +30,6 @@ import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import org.hibernate.HibernateException;
-import org.hibernate.Session;
-
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.logging.Logger;
@@ -27,20 +47,8 @@ public final class ConfigurationDBUtils {
public static void initHibernate(Properties props) throws MOADatabaseException {
try {
-
- //add Hibernate annotations
-// Configuration hibernateConfig = new Configuration();
-// hibernateConfig.addAnnotatedClass(AssertionStore.class);
-// hibernateConfig.addAnnotatedClass(AuthenticatedSessionStore.class);
-// hibernateConfig.addAnnotatedClass(OASessionStore.class);
-// hibernateConfig.addAnnotatedClass(OldSSOSessionIDStore.class);
-// hibernateConfig.addProperties(props);
-
Logger.debug("Creating initial session factory...");
-// entitymanagerfactory =
-// Persistence.createEntityManagerFactory("at.gv.egovernment.moa.id.commons.db.dao.config",
-// hibernateConfig.getProperties());
entitymanagerfactory =
Persistence.createEntityManagerFactory("at.gv.egovernment.moa.id.commons.db.dao.config",
@@ -94,7 +102,6 @@ public final class ConfigurationDBUtils {
public static EntityManager getNewSession() {
if (automaticSessionHandling) {
Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead.");
- //return sessionFactory.getCurrentSession();
return entitymanagerfactory.createEntityManager();
}
EntityManager session = (EntityManager) THREAD_LOCAL_CONFIG.get();
@@ -198,8 +205,6 @@ public final class ConfigurationDBUtils {
tx.begin();
session.remove(session.contains(dbo) ? dbo : session.merge(dbo));
tx.commit();
-
- //session.clear();
}
return true;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
index 5e4ec0f13..0065f2242 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db;
import java.util.Properties;
@@ -11,10 +33,6 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
-import at.gv.egovernment.moa.id.commons.db.dao.session.AssertionStore;
-import at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore;
-import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore;
-import at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.logging.Logger;
@@ -29,8 +47,6 @@ public final class MOASessionDBUtils {
private static final String[] AUTOMATIC_SESSION_HANDLING_VALUES = new String[] { "jta", "thread" };
private static final String SESSION_HANDLING_KEY = "hibernate.current_session_context_class";
-
- private static Configuration configuration;
protected MOASessionDBUtils() { }
@@ -50,7 +66,7 @@ public final class MOASessionDBUtils {
//Create the SessionFactory
Logger.debug("Creating initial MOASession session factory...");
- config.configure();
+ config.configure("hibernate_moasession.cfg.xml");
serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
sessionFactory = config.buildSessionFactory(serviceRegistry);
Logger.debug("Initial MOASession session factory successfully created.");
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/StatisticLogDBUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/StatisticLogDBUtils.java
new file mode 100644
index 000000000..fac653eb2
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/StatisticLogDBUtils.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
+package at.gv.egovernment.moa.id.commons.db;
+
+import java.util.Properties;
+
+import org.apache.commons.lang3.StringUtils;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
+
+import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
+import at.gv.egovernment.moa.logging.Logger;
+
+public final class StatisticLogDBUtils {
+
+ private static SessionFactory sessionFactory;
+ private static ServiceRegistry serviceRegistry;
+
+ @SuppressWarnings("rawtypes")
+ private static final ThreadLocal THREAD_LOCAL_STATISTIC = new ThreadLocal();
+ private static boolean automaticSessionHandling = false;
+
+ private static final String[] AUTOMATIC_SESSION_HANDLING_VALUES = new String[] { "jta", "thread" };
+ private static final String SESSION_HANDLING_KEY = "hibernate.current_session_context_class";
+
+ protected StatisticLogDBUtils() { }
+
+ public static void initHibernate(Configuration config, Properties hibernateProperties) {
+
+ String scm = StringUtils.trimToNull(hibernateProperties.getProperty(SESSION_HANDLING_KEY));
+ if (scm != null) {
+ automaticSessionHandling = scm.indexOf(AUTOMATIC_SESSION_HANDLING_VALUES[0]) != -1 || scm.indexOf(AUTOMATIC_SESSION_HANDLING_VALUES[1]) != -1;
+ }
+ Logger.debug("Evaluating hibernate property \"" + SESSION_HANDLING_KEY + "\".");
+ if (automaticSessionHandling) {
+ Logger.info("Hibernate is automatically handling session context management.");
+ } else {
+ Logger.info("Hibernate is NOT automatically handling session context management. Using build-in ThreadLocal session handling.");
+ }
+ try {
+ //Create the SessionFactory
+ Logger.debug("Creating initial StatisicLogger session factory...");
+
+ config.configure("hibernate_statistic.cfg.xml");
+ serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
+ sessionFactory = config.buildSessionFactory(serviceRegistry);
+ Logger.debug("Initial StatisicLogger session factory successfully created.");
+
+ } catch (Throwable ex) {
+ Logger.error("Initial StatisicLogger session factory creation failed: " + ex.getMessage());
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+
+ /**
+ * Checks if a session factory is currently available. If necessary a new
+ * session factory is created.
+ *
+ * @return current (or new) session factory
+ * @throws HibernateException
+ * thrown if a hibernate error occurs
+ */
+ public static Session getCurrentSession() {
+ if (automaticSessionHandling) {
+ return sessionFactory.getCurrentSession();
+ }
+ Session session = (Session) THREAD_LOCAL_STATISTIC.get();
+ // Open a new Session, if this Thread has none yet
+ if (session == null || !session.isConnected()) {
+ session = getNewSession();
+ }
+ return session;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Session getNewSession() {
+ if (automaticSessionHandling) {
+ Logger.warn("Session is being automatically handled by hibernate. Therefore this session maybe not being newly created. Use HibernateUtil.getCurrentSession() instead.");
+ return sessionFactory.getCurrentSession();
+ }
+ Session session = (Session) THREAD_LOCAL_STATISTIC.get();
+ if (session != null) {
+ Logger.warn("Previous StatisicLogger session has not been closed; closing session now.");
+ closeSession();
+ }
+ Logger.debug("Opening new StatisicLogger hibernate session...");
+ try {
+ session = sessionFactory.openSession();
+ THREAD_LOCAL_STATISTIC.set(session);
+ } catch (HibernateException hex) {
+ Logger.error(hex.getMessage());
+ }
+ return session;
+ }
+
+ /**
+ * Closes the current session.
+ *
+ * @throws HibernateException
+ * thrown if session is already closed or a hibernate error
+ * occurs.
+ */
+ @SuppressWarnings("unchecked")
+ public static void closeSession() {
+ if (automaticSessionHandling) {
+ Logger.warn("Session is being automatically handled by hibernate. Therefore the current session cannot be closed on demand.");
+ return;
+ }
+ Logger.debug("Closing current StatisicLogger hibernate session...");
+ Session session = (Session) THREAD_LOCAL_STATISTIC.get();
+ THREAD_LOCAL_STATISTIC.set(null);
+ if (session != null) {
+ try {
+ session.close();
+
+ } catch (HibernateException hex) {
+ Logger.error(hex.getMessage());
+ }
+ }
+ }
+
+ public static boolean saveOrUpdate(Object dbo) throws MOADatabaseException {
+ Transaction tx = null;
+ try {
+ Session session = StatisticLogDBUtils.getCurrentSession();
+
+ synchronized (session) {
+ tx = session.beginTransaction();
+ session.saveOrUpdate(dbo);
+ tx.commit();
+ }
+
+ Logger.info("Insert advanced statistic log entry into database");
+ return true;
+
+ } catch(HibernateException e) {
+ Logger.warn("Error during StatisicLogger database saveOrUpdate. Rollback.", e);
+ tx.rollback();
+ throw new MOADatabaseException(e);
+ }
+ }
+
+ public static boolean delete(Object dbo) {
+ Transaction tx = null;
+ try {
+ Session session = StatisticLogDBUtils.getCurrentSession();
+
+ synchronized (session) {
+ tx = session.beginTransaction();
+ session.delete(dbo);
+ tx.commit();
+ }
+
+ return true;
+
+ } catch(HibernateException e) {
+ Logger.warn("Error during StatisicLogger database delete. Rollback.", e);
+ tx.rollback();
+ return false;
+ }
+ }
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java
index 50c156c4e..4c07d44fd 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AssertionStore.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.dao.session;
import java.io.Serializable;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
index ed865d70f..64f543973 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/AuthenticatedSessionStore.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.dao.session;
import java.io.Serializable;
@@ -12,14 +34,14 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
import org.hibernate.annotations.DynamicUpdate;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java
new file mode 100644
index 000000000..7efb18a77
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
+package at.gv.egovernment.moa.id.commons.db.dao.session;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.DynamicUpdate;
+
+
+
+@Entity
+@DynamicUpdate(value=true)
+@Table(name = "exceptionstore")
+@NamedQueries({
+ @NamedQuery(name="getExceptionWithID", query = "select exceptionstore from ExceptionStore exceptionstore where exceptionstore.exid = :id"),
+ @NamedQuery(name="getExceptionWithTimeOut", query = "select exceptionstore from ExceptionStore exceptionstore where exceptionstore.timestamp < :timeout")
+})
+
+public class ExceptionStore implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id", unique=true, nullable=false)
+ private long id;
+
+ @Column(name = "exid", unique=true, nullable=false)
+ private String exid;
+
+ @Column(name = "exception", nullable=false)
+ @Lob private byte [] exception;
+
+ @Column(name = "timestamp", nullable=false)
+ private Date timestamp;
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the exid
+ */
+ public String getExid() {
+ return exid;
+ }
+
+ /**
+ * @param exid the exid to set
+ */
+ public void setExid(String exid) {
+ this.exid = exid;
+ }
+
+ /**
+ * @return the exception
+ */
+ public byte[] getException() {
+ return exception;
+ }
+
+ /**
+ * @param exception the exception to set
+ */
+ public void setException(byte[] exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * @return the timestamp
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * @param timestamp the timestamp to set
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java
index 6e0f47805..6d1b64262 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.dao.session;
import java.io.Serializable;
@@ -11,14 +33,9 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
-import javax.persistence.PrePersist;
import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
import org.hibernate.annotations.DynamicUpdate;
-import org.hibernate.annotations.NamedQueries;
-import org.hibernate.annotations.NamedQuery;
@Entity
@DynamicUpdate(value=true)
@@ -36,6 +53,9 @@ public class OASessionStore implements Serializable{
@Column(name = "oaurlprefix", unique=false, nullable=false)
private String oaurlprefix;
+ @Column(name = "assertionSessionID", unique=false, nullable=true)
+ private String assertionSessionID;
+
@Column(name = "created", updatable=false, nullable=false)
// @Temporal(TemporalType.TIMESTAMP)
private Date created;
@@ -80,8 +100,22 @@ public class OASessionStore implements Serializable{
public void setCreated(Date created) {
this.created = created;
}
-
-
+ /**
+ * @return the assertionSessionID
+ */
+ public String getAssertionSessionID() {
+ return assertionSessionID;
+ }
+
+ /**
+ * @param assertionSessionID the assertionSessionID to set
+ */
+ public void setAssertionSessionID(String assertionSessionID) {
+ this.assertionSessionID = assertionSessionID;
+ }
+
+
+
}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java
index 3ec2babad..7961e1d0e 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OldSSOSessionIDStore.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.dao.session;
import java.io.Serializable;
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/statistic/StatisticLog.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/statistic/StatisticLog.java
new file mode 100644
index 000000000..65c9003e3
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/statistic/StatisticLog.java
@@ -0,0 +1,397 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
+package at.gv.egovernment.moa.id.commons.db.dao.statistic;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.DynamicUpdate;
+
+
+
+@Entity
+@DynamicUpdate(value=true)
+@Table(name = "statisiclog")
+@NamedQueries({
+ @NamedQuery(name="getAllEntriesNotBeforeTimeStamp", query = "select statisiclog from StatisticLog statisiclog where statisiclog.timestamp > :timeout")
+})
+
+public class StatisticLog implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id", unique=true, nullable=false)
+ private long id;
+
+ @Column(name = "timestamp", nullable=false)
+ Date timestamp;
+
+ @Column(name = "OAID", unique=false)
+ private long oaID;
+
+ @Column(name = "OAURLPrefix", unique=false)
+ private String oaurlprefix;
+
+ @Column(name = "OAFriendlyName", unique=false)
+ private String oafriendlyName;
+
+ @Column(name = "OATarget", unique=false)
+ private String oatarget;
+
+ @Column(name = "BKUURL", unique=false)
+ private String bkuurl;
+
+ @Column(name = "BKUType", unique=false)
+ private String bkutype;
+
+ @Column(name = "isSSOLogin", unique=false)
+ private boolean ssosession;
+
+ @Column(name = "isBusinessService", unique=false)
+ private boolean businessservice;
+
+ @Column(name = "isMandateLogin", unique=false)
+ private boolean mandatelogin;
+
+ @Column(name = "MandateType", unique=false)
+ private String mandatetype;
+
+ @Column(name = "MandatorType", unique=false)
+ private String mandatortype;
+
+ @Column(name = "isPV", unique=false)
+ private boolean pv;
+
+ @Column(name = "PVOID", unique=false)
+ private String pvOID;
+
+ @Column(name = "ProtocolType", unique=false)
+ private String protocoltype;
+
+ @Column(name = "ProtocolSubType", unique=false)
+ private String protocolsubtype;
+
+ @Column(name = "ExceptionCode", unique=false)
+ private String errorcode;
+
+ @Column(name = "ExceptionType", unique=false)
+ private String errortype;
+
+ @Column(name = "ExceptionMessage", unique=false)
+ private String errormessage;
+
+ /**
+ * @return the id
+ */
+ public long getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the timestamp
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * @param timestamp the timestamp to set
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * @return the oaurlprefix
+ */
+ public String getOaurlprefix() {
+ return oaurlprefix;
+ }
+
+ /**
+ * @param oaurlprefix the oaurlprefix to set
+ */
+ public void setOaurlprefix(String oaurlprefix) {
+ this.oaurlprefix = oaurlprefix;
+ }
+
+ /**
+ * @return the bkuurl
+ */
+ public String getBkuurl() {
+ return bkuurl;
+ }
+
+ /**
+ * @param bkuurl the bkuurl to set
+ */
+ public void setBkuurl(String bkuurl) {
+ this.bkuurl = bkuurl;
+ }
+
+ /**
+ * @return the ssosession
+ */
+ public boolean isSsosession() {
+ return ssosession;
+ }
+
+ /**
+ * @param ssosession the ssosession to set
+ */
+ public void setSsosession(boolean ssosession) {
+ this.ssosession = ssosession;
+ }
+
+ /**
+ * @return the mandatelogin
+ */
+ public boolean isMandatelogin() {
+ return mandatelogin;
+ }
+
+ /**
+ * @param mandatelogin the mandatelogin to set
+ */
+ public void setMandatelogin(boolean mandatelogin) {
+ this.mandatelogin = mandatelogin;
+ }
+
+ /**
+ * @return the mandatetype
+ */
+ public String getMandatetype() {
+ return mandatetype;
+ }
+
+ /**
+ * @param mandatetype the mandatetype to set
+ */
+ public void setMandatetype(String mandatetype) {
+ this.mandatetype = mandatetype;
+ }
+
+ /**
+ * @return the mandatesubtype
+ */
+ public String getProtocolsubtype() {
+ return protocolsubtype;
+ }
+
+ /**
+ * @param mandatesubtype the mandatesubtype to set
+ */
+ public void setProtocolsubtype(String mandatesubtype) {
+ this.protocolsubtype = mandatesubtype;
+ }
+
+ /**
+ * @return the protocoltype
+ */
+ public String getProtocoltype() {
+ return protocoltype;
+ }
+
+ /**
+ * @param protocoltype the protocoltype to set
+ */
+ public void setProtocoltype(String protocoltype) {
+ this.protocoltype = protocoltype;
+ }
+
+ /**
+ * @return the errorcode
+ */
+ public String getErrorcode() {
+ return errorcode;
+ }
+
+ /**
+ * @param errorcode the errorcode to set
+ */
+ public void setErrorcode(String errorcode) {
+ this.errorcode = errorcode;
+ }
+
+ /**
+ * @return the errormessage
+ */
+ public String getErrormessage() {
+ return errormessage;
+ }
+
+ /**
+ * @param errormessage the errormessage to set
+ */
+ public void setErrormessage(String errormessage) {
+ this.errormessage = errormessage;
+ }
+
+ /**
+ * @return the businessservice
+ */
+ public boolean isBusinessservice() {
+ return businessservice;
+ }
+
+ /**
+ * @param businessservice the businessservice to set
+ */
+ public void setBusinessservice(boolean businessservice) {
+ this.businessservice = businessservice;
+ }
+
+ /**
+ * @return the oaID
+ */
+ public long getOaID() {
+ return oaID;
+ }
+
+ /**
+ * @param oaID the oaID to set
+ */
+ public void setOaID(long oaID) {
+ this.oaID = oaID;
+ }
+
+ /**
+ * @return the oafriendlyName
+ */
+ public String getOafriendlyName() {
+ return oafriendlyName;
+ }
+
+ /**
+ * @param oafriendlyName the oafriendlyName to set
+ */
+ public void setOafriendlyName(String oafriendlyName) {
+ this.oafriendlyName = oafriendlyName;
+ }
+
+ /**
+ * @return the oatarget
+ */
+ public String getOatarget() {
+ return oatarget;
+ }
+
+ /**
+ * @param oatarget the oatarget to set
+ */
+ public void setOatarget(String oatarget) {
+ this.oatarget = oatarget;
+ }
+
+ /**
+ * @return the bkutype
+ */
+ public String getBkutype() {
+ return bkutype;
+ }
+
+ /**
+ * @param bkutype the bkutype to set
+ */
+ public void setBkutype(String bkutype) {
+ this.bkutype = bkutype;
+ }
+
+ /**
+ * @return the mandatortype
+ */
+ public String getMandatortype() {
+ return mandatortype;
+ }
+
+ /**
+ * @param mandatortype the mandatortype to set
+ */
+ public void setMandatortype(String mandatortype) {
+ this.mandatortype = mandatortype;
+ }
+
+ /**
+ * @return the pv
+ */
+ public boolean isPv() {
+ return pv;
+ }
+
+ /**
+ * @param pv the pv to set
+ */
+ public void setPv(boolean pv) {
+ this.pv = pv;
+ }
+
+ /**
+ * @return the pvOID
+ */
+ public String getPvOID() {
+ return pvOID;
+ }
+
+ /**
+ * @param pvOID the pvOID to set
+ */
+ public void setPvOID(String pvOID) {
+ this.pvOID = pvOID;
+ }
+
+ /**
+ * @return the errortype
+ */
+ public String getErrortype() {
+ return errortype;
+ }
+
+ /**
+ * @param errortype the errortype to set
+ */
+ public void setErrortype(String errortype) {
+ this.errortype = errortype;
+ }
+
+
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
index 169d31aac..46484879d 100644
--- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
+++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ex/MOADatabaseException.java
@@ -1,3 +1,25 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
package at.gv.egovernment.moa.id.commons.db.ex;
public class MOADatabaseException extends Exception {
diff --git a/id/server/moa-id-commons/src/main/resources/config/hibernate.cfg.xml b/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
index 4841481b6..e40c8b8a9 100644
--- a/id/server/moa-id-commons/src/main/resources/config/hibernate.cfg.xml
+++ b/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
@@ -10,5 +10,6 @@
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore"/>
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore"/>
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore"/>
+ <mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.ExceptionStore"/>
</session-factory>
</hibernate-configuration> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml b/id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml
new file mode 100644
index 000000000..aa77a9c67
--- /dev/null
+++ b/id/server/moa-id-commons/src/main/resources/config/hibernate_statistic.cfg.xml
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <!-- MOA advanced statistic handling mapping files -->
+ <mapping class="at.gv.egovernment.moa.id.commons.db.dao.statistic.StatisticLog"/>
+ </session-factory>
+</hibernate-configuration> \ No newline at end of file
diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
index 06f0f0bcb..481f12091 100644
--- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
+++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd
@@ -18,6 +18,7 @@
<xsd:attribute name="friendlyName" type="xsd:string" use="optional"/>
<xsd:attribute name="target" type="xsd:string" use="optional"/>
<xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/>
+ <xsd:attribute name="removeBPKFromAuthBlock" type="xsd:boolean" use="optional" default="false"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
@@ -270,6 +271,8 @@
</xsd:complexType>
</xsd:element>
</xsd:sequence>
+ <xsd:attribute name="timestamp" type="xsd:dateTime"/>
+ <xsd:attribute name="pvp2refresh" type="xsd:dateTime"/>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="AuthComponentType">
@@ -448,6 +451,7 @@
<xsd:sequence>
<xsd:element name="Template" type="TemplateType" minOccurs="0" maxOccurs="3"/>
<xsd:element name="AditionalAuthBlockText" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="BKUSelectionCustomization" type="BKUSelectionCustomizationType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TemplateType">
@@ -496,6 +500,7 @@
<xsd:complexType name="OnlineApplicationType">
<xsd:sequence>
<xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isAdminRequired" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
<xsd:element name="AuthComponent_OA" minOccurs="0">
<xsd:annotation>
<xsd:documentation>enthält Parameter über die OA, die die
@@ -535,17 +540,8 @@
</xsd:element>
<xsd:element ref="OA_SAML1" minOccurs="0"/>
<xsd:element ref="OA_PVP2" minOccurs="0"/>
+ <xsd:element ref="OA_OAUTH20" minOccurs="0"/>
</xsd:sequence>
- <xsd:attribute name="slVersion" use="optional" default="1.1">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.1"/>
- <xsd:enumeration value="1.2"/>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="useIFrame" type="xsd:boolean" default="false"/>
- <xsd:attribute name="useUTC" type="xsd:boolean" default="true"/>
<!--xsd:element ref="pr:AbstractSimpleIdentification" minOccurs="0"
maxOccurs="1"/ -->
</xsd:complexType>
@@ -865,6 +861,7 @@
<xsd:element name="OA_SAML1">
<xsd:complexType>
<xsd:sequence>
+ <xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
<xsd:element name="provideStammzahl" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
<xsd:element name="provideAUTHBlock" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
<xsd:element name="provideIdentityLink" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>
@@ -876,6 +873,7 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+
<xsd:element name="OA_PVP2">
<xsd:complexType>
<xsd:sequence>
@@ -902,6 +900,15 @@
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="OA_OAUTH20">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="oAuthClientId" type="xsd:string"/>
+ <xsd:element name="oAuthClientSecret" type="xsd:string"/>
+ <xsd:element name="oAuthRedirectUri" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
<xsd:element name="IdentificationNumber">
<xsd:complexType>
<xsd:sequence>
@@ -935,17 +942,40 @@
<xsd:complexType name="UserDatabase">
<xsd:sequence>
<xsd:element name="bpk" type="xsd:string" minOccurs="0" maxOccurs="1"/>
- <xsd:element name="familyname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
- <xsd:element name="givenname" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="familyname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="givenname" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="institut" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="mail" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="phone" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="username" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="password" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="password_salt" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="userRequestTokken" type="xsd:string" minOccurs="0" maxOccurs="1"/>
<xsd:element name="isActive" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
<xsd:element name="isAdmin" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/>
- <xsd:element name="lastLogin" type="xsd:date" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="isUsernamePasswordAllowed" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isMandateUser" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isMailAddressVerified" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isAdminRequest" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="isPVP2Generated" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="lastLogin" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="OnlineApplication" type="OnlineApplication" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="BKUSelectionCustomizationType">
+ <xsd:sequence>
+ <xsd:element name="FontType" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="BackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="FrontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderBackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderFrontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="HeaderText" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonBackGroundColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonBackGroundColorFocus" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="ButtonFontColor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="AppletRedirectTarget" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="MandateLoginButton" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="OnlyMandateLoginAllowed" type="xsd:boolean" default="false" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
</xsd:schema>