diff options
Diffstat (limited to 'id/server/moa-id-commons')
6 files changed, 31 insertions, 187 deletions
diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java index ca0a56049..cbbca12c5 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/ConfigurationProvider.java @@ -63,4 +63,11 @@ public interface ConfigurationProvider { public String getCertstoreDirectory(); public boolean isTrustmanagerrevoationchecking(); + + /** + * Get active Spring profiles from file based configuration + * + * @return Array of currently configurated Spring profiles + */ + public String[] getActiveProfiles(); } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/SessionDataStorageException.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/SessionDataStorageException.java index 9414556a2..caff67985 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/SessionDataStorageException.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/api/exceptions/SessionDataStorageException.java @@ -42,4 +42,13 @@ public class SessionDataStorageException extends MOAIDException { } + /** + * @param string + * @param object + * @param e + */ + public SessionDataStorageException(String string, Object[] object, Throwable e) { + super(string, object, e); + } + } 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 deleted file mode 100644 index 5cdd607ac..000000000 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/MOASessionDBUtils.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * 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.hibernate.HibernateException; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.hibernate.cfg.Configuration; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; -import at.gv.egovernment.moa.logging.Logger; - -@Transactional("sessionTransactionManager") -public class MOASessionDBUtils { - - - private SessionFactory sessionFactory; - - @Autowired - @Qualifier("sessionSessionFactory") - public void setSessionFactory(SessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } - - public void initHibernate(Configuration config, Properties hibernateProperties) { - - } - - /** - * 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 Session getCurrentSession() { - return sessionFactory.getCurrentSession(); - } - - public boolean saveOrUpdate(Object dbo) throws MOADatabaseException { - try { - Session session = sessionFactory.getCurrentSession(); - session.merge(dbo); - return true; - - } catch(HibernateException e) { - Logger.warn("Error during MOASession database saveOrUpdate.", e); - - throw new MOADatabaseException(e); - } - } - - public boolean delete(Object dbo) { - - try { - Session session = sessionFactory.getCurrentSession(); - session.delete(dbo); - return true; - - } catch(HibernateException e) { - Logger.warn("Error during MOASession database delete. Rollback."); - return false; - } - } - -} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java index e2f793edf..3928cf8c0 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import at.gv.egiz.components.configuration.api.ConfigurationException; import at.gv.egovernment.moa.id.commons.config.ConfigurationMigrationUtils; @@ -39,6 +40,7 @@ public class NewConfigurationDBRead { } + @Transactional public Map<String, String> getOnlineApplicationKeyValueWithId(String id, boolean backupVersion) { try { if (backupVersion) @@ -57,6 +59,7 @@ public class NewConfigurationDBRead { * * @return */ + @Transactional public List<OnlineApplication> getAllOnlineApplications() { Logger.trace("Get All OnlineApplications from database."); @@ -113,6 +116,7 @@ public class NewConfigurationDBRead { * * @return */ + @Transactional public List<OnlineApplication> getAllNewOnlineApplications() { Logger.trace("Get All New OnlineApplications from database."); @@ -139,6 +143,7 @@ public class NewConfigurationDBRead { * * @return */ + @Transactional public at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration getMOAIDConfiguration() { Logger.trace("Load MOAID Configuration from database."); Map<String, String> generalConfig; @@ -168,6 +173,7 @@ public class NewConfigurationDBRead { * * @return */ + @Transactional public List<OnlineApplication> getAllActiveOnlineApplications() { Logger.trace("Get All New OnlineApplications from database."); @@ -195,6 +201,7 @@ public class NewConfigurationDBRead { * @param id * @return */ + @Transactional public OnlineApplication getActiveOnlineApplication(String id) { Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); @@ -226,6 +233,7 @@ public class NewConfigurationDBRead { * @param dbid * @return */ + @Transactional public OnlineApplication getOnlineApplication(long dbid) { Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); @@ -248,6 +256,7 @@ public class NewConfigurationDBRead { * @param id * @return */ + @Transactional public List<OnlineApplication> getOnlineApplications(String id) { Logger.trace("Getting OnlineApplication with ID " + id + " from database."); @@ -273,6 +282,7 @@ public class NewConfigurationDBRead { * @param id * @return */ + @Transactional public OnlineApplication getOnlineApplication(String id) { Logger.trace("Getting OnlineApplication with ID " + id + " from database."); @@ -297,6 +307,7 @@ public class NewConfigurationDBRead { * @param id * @return */ + @Transactional public List<OnlineApplication> searchOnlineApplications(String id) { Logger.trace("Getting OnlineApplication with ID " + id + " from database."); 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 deleted file mode 100644 index 51bb0eb6d..000000000 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/StatisticLogDBUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * 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.hibernate.HibernateException; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.annotation.Transactional; - -import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; -import at.gv.egovernment.moa.logging.Logger; - -@Transactional("statisticLogTransactionManager") -public class StatisticLogDBUtils { - - private SessionFactory sessionFactory; - - @Autowired - @Qualifier("statisticLogSessionFactory") - public void setstatisticLogSessionFactory(SessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } - - - public static void initHibernate(Configuration config, Properties hibernateProperties) { - - } - - public boolean saveOrUpdate(Object dbo) throws MOADatabaseException { - - try { - Session session = sessionFactory.getCurrentSession(); - session.saveOrUpdate(dbo); - //session.persist(dbo); - return true; - - } catch(HibernateException e) { - Logger.warn("Error during StatisicLogger database saveOrUpdate.", e); - - throw new MOADatabaseException(e); - } - - } - - public boolean delete(Object dbo) { - try { - Session session = sessionFactory.getCurrentSession(); - session.delete(dbo); - return true; - - } catch(HibernateException e) { - Logger.warn("Error during StatisicLogger database delete. Rollback."); - return false; - } - } - - - public Session getCurrentSession() { - // TODO Auto-generated method stub - return sessionFactory.getCurrentSession(); - } - -} diff --git a/id/server/moa-id-commons/src/main/resources/statistic.logging.beans.xml b/id/server/moa-id-commons/src/main/resources/statistic.logging.beans.xml index 5f80c6439..9b00ff3cd 100644 --- a/id/server/moa-id-commons/src/main/resources/statistic.logging.beans.xml +++ b/id/server/moa-id-commons/src/main/resources/statistic.logging.beans.xml @@ -33,7 +33,7 @@ <property name="validationQuery" value="${advancedlogging.dbcp.validationQuery}" /> </bean> - <bean id="statisticLogSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> +<!-- <bean id="statisticLogSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="statisticLogDataSource"/> <property name="packagesToScan" value="at.gv.egovernment.moa.id.commons.db.dao.statistic" /> <property name="hibernateProperties"> @@ -47,11 +47,10 @@ <prop key="hibernate.transaction.auto_close_session">${advancedlogging.hibernate.transaction.auto_close_session}</prop> </props> </property> - </bean> - + </bean> --> + - <bean id="statisticLogDBUtils" class="at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils"> - </bean> + <!-- bean id="statisticLogDBUtils" class="at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils"/--> <bean name="statisticLogTransactionManager" id="statisticLogTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="statistic" /> |