diff --git a/smp-docker/compose/weblogic-oracle/runCompose.sh b/smp-docker/compose/weblogic-oracle/runCompose.sh index c547b4cea1fceb1a2d69bb368debc16452b54ea7..5ce4a1945d0f8bac8088fc877fb9a7d9a69d4ac6 100755 --- a/smp-docker/compose/weblogic-oracle/runCompose.sh +++ b/smp-docker/compose/weblogic-oracle/runCompose.sh @@ -4,8 +4,11 @@ WORKING_DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" SMP_INIT_DATABASE="../../../smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl" +#SMP_INIT_DATABASE="/cef/test/smp-migration/smp-5.0/smp-4.2/database-scripts/mig/oracle10g.ddl" + #SMP_INIT_DATABASE_DATA="../../../smp-webapp/src/main/smp-setup/database-scripts/oracle10g-data.sql" SMP_INIT_DATABASE_DATA="../../../smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql" +#SMP_INIT_DATABASE_DATA="/cef/test/smp-migration/smp-5.0/smp-4.2/database-scripts/mig/data-mig.ddl" # soap ui data PREFIX="smp-wls12-orcl" SMP_VERSION= diff --git a/smp-resource-extensions/pom.xml b/smp-resource-extensions/pom.xml index 06ce67c04d063d8b765853c682dadbf02fe7411a..1691f67a12709b2b6cdf683d9313d269814d4ca5 100644 --- a/smp-resource-extensions/pom.xml +++ b/smp-resource-extensions/pom.xml @@ -26,5 +26,6 @@ <description>The sub-project contains SMP examples of API and SPI implementations. Currently, SPI payload validation example.</description> <modules> <module>oasis-smp-spi</module> + <!-- module>oasis-cppa3-spi</module --> </modules> </project> diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/SMPDatabaseConfig.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/SMPDatabaseConfig.java index 084f36cac13d1ab8f0bf0e83147b9d3cd8801098..fb63c99acd5c3942baf45f7369616b7ffae0f4b4 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/SMPDatabaseConfig.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/SMPDatabaseConfig.java @@ -16,9 +16,9 @@ package eu.europa.ec.edelivery.smp.config; import eu.europa.ec.edelivery.smp.config.init.DatabaseConnectionBeanCreator; import eu.europa.ec.edelivery.smp.logging.SMPLogger; import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.*; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.transaction.PlatformTransactionManager; @@ -42,25 +42,30 @@ public class SMPDatabaseConfig { final DatabaseConnectionBeanCreator databaseConnectionBeanCreator; public SMPDatabaseConfig() { - databaseConnectionBeanCreator = new DatabaseConnectionBeanCreator(SMPEnvironmentProperties.getInstance()); } - @Bean(name = "dataSource") + @Primary + @Bean(name = "smpDataSource") + @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) public DataSource getDataSource() { - LOG.debug("Create DomiSMP datasource"); + LOG.info("Create DomiSMP datasource"); return databaseConnectionBeanCreator.getDataSource(); } - @Bean - public LocalContainerEntityManagerFactoryBean smpEntityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { - LOG.debug("Create DomiSMP EntityManagerFactory"); + @Primary + @Bean(name = "smpEntityManagerFactory") + @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) + public LocalContainerEntityManagerFactoryBean smpEntityManagerFactory(@Qualifier("smpDataSource") DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { + LOG.info("Create DomiSMP EntityManagerFactory"); return databaseConnectionBeanCreator.smpEntityManagerFactory(dataSource, jpaVendorAdapter); } - @Bean - public PlatformTransactionManager smpTransactionManager(EntityManagerFactory emf) { - LOG.debug("Create DomiSMP TransactionManager"); + @Primary + @Bean(name = "transactionManager") + @Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON) + public PlatformTransactionManager smpTransactionManager(@Qualifier("smpEntityManagerFactory") EntityManagerFactory emf) { + LOG.info("Create DomiSMP TransactionManager"); return databaseConnectionBeanCreator.getSmpTransactionManager(emf); } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/DatabaseConnectionBeanCreator.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/DatabaseConnectionBeanCreator.java index 4dcaba2b8aeef82fc202f2c19429bbb1941e0472..5fd51fe30bff9d1a92d03a3424de51bb384810d3 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/DatabaseConnectionBeanCreator.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/DatabaseConnectionBeanCreator.java @@ -38,7 +38,6 @@ public class DatabaseConnectionBeanCreator { public DataSource getDataSource() { String jndiDatasourceName = databaseConnectionConfig.getDatabaseJNDI(); - if (StringUtils.isNotBlank(jndiDatasourceName)) { LOG.info("User datasource with JNDI: [{}] ", jndiDatasourceName); JndiObjectFactoryBean jndiDataSource = new JndiObjectFactoryBean(); @@ -72,6 +71,7 @@ public class DatabaseConnectionBeanCreator { prop.setProperty("org.hibernate.envers.store_data_at_delete", "true"); LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean(); + lef.setPersistenceUnitName("smpEntityManagerFactory"); lef.setDataSource(dataSource); lef.setJpaVendorAdapter(jpaVendorAdapter); lef.setPackagesToScan( diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/SMPExtensionInitializer.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/SMPExtensionInitializer.java index 3cabb54916cda9330f15c0d3dee11d4cdc18dfd4..28d5cc1eef5b81cd27d2a09ced881eafd6a171a0 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/SMPExtensionInitializer.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/init/SMPExtensionInitializer.java @@ -1,6 +1,7 @@ package eu.europa.ec.edelivery.smp.config.init; +import eu.europa.ec.edelivery.smp.data.dao.ConfigurationDao; import eu.europa.ec.edelivery.smp.data.dao.ExtensionDao; import eu.europa.ec.edelivery.smp.data.dao.ResourceDefDao; import eu.europa.ec.edelivery.smp.data.dao.SubresourceDefDao; @@ -42,13 +43,22 @@ public class SMPExtensionInitializer implements InitializingBean { protected final ResourceDefDao resourceDefDao; protected final SubresourceDefDao subresourceDefDao; + protected final ConfigurationDao configurationDao; - public SMPExtensionInitializer(ApplicationContext applicationContext, PlatformTransactionManager txManager, ExtensionDao extensionDao, ResourceDefDao resourceDefDao, SubresourceDefDao subresourceDefDao) { + + + public SMPExtensionInitializer(ApplicationContext applicationContext, + PlatformTransactionManager txManager, + ExtensionDao extensionDao, + ResourceDefDao resourceDefDao, + SubresourceDefDao subresourceDefDao, + ConfigurationDao configurationDao) { this.applicationContext = applicationContext; this.txManager = txManager; this.extensionDao = extensionDao; this.resourceDefDao = resourceDefDao; this.subresourceDefDao = subresourceDefDao; + this.configurationDao = configurationDao; } /** @@ -67,6 +77,8 @@ public class SMPExtensionInitializer implements InitializingBean { } public void validateExtensionData() { + LOG.info("Load properties from database!"); + configurationDao.reloadPropertiesFromDatabase(); // find all extension services Map<String, ExtensionInfo> registeredExtensions = applicationContext.getBeansOfType(ExtensionInfo.class); LOG.debug("Found registered extension count [{}]", registeredExtensions.size()); diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/BaseDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/BaseDao.java index cfed00e8771030bcf7a6fb246562d1c302416ac2..1f9a834d96ea8c404abd0e73a3d60b88d443e762 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/BaseDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/BaseDao.java @@ -25,7 +25,7 @@ import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; @@ -45,7 +45,7 @@ public abstract class BaseDao<E extends BaseEntity> { protected String defaultSortMethod; - @PersistenceContext + @PersistenceContext(unitName = "smpEntityManagerFactory") protected EntityManager memEManager; private final Class<E> entityClass; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ConfigurationDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ConfigurationDao.java index 4ff7c85e6168e659c69f84e27722037460ed70f0..e6fa9af0161b3ca293ef9ddea84041de4e798e7c 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ConfigurationDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ConfigurationDao.java @@ -54,7 +54,7 @@ import static eu.europa.ec.edelivery.smp.exceptions.ErrorCode.CONFIGURATION_ERRO * @since 4.2 */ @Repository(value = "configurationDao") -public class ConfigurationDao extends BaseDao<DBConfiguration> implements InitializingBean { +public class ConfigurationDao extends BaseDao<DBConfiguration> { private static final SMPLogger LOG = SMPLoggerFactory.getLogger(ConfigurationDao.class); boolean isRefreshProcess = false; @@ -68,28 +68,27 @@ public class ConfigurationDao extends BaseDao<DBConfiguration> implements Initia protected final SMPEnvironmentProperties environmentProperties = SMPEnvironmentProperties.getInstance(); protected final ApplicationContext applicationContext; - protected PlatformTransactionManager txManager; - public ConfigurationDao(ApplicationContext applicationContext, PlatformTransactionManager txManager) { + + public ConfigurationDao(ApplicationContext applicationContext) { this.applicationContext = applicationContext; - this.txManager = txManager; } /** * Validate and initialize database configurations - */ - public void afterPropertiesSet() { - LOG.debug("Reload DomiSMP properties"); + + public void afterPropertiesSetTEest() { + LOG.info("Reload DomiSMP properties"); // Transaction might not be yet initialized (@Transactional on this method does not help :) ). // Wrap the method to TransactionTemplate to make possible database property initialization TransactionTemplate tmpl = new TransactionTemplate(txManager); tmpl.execute(status -> { LOG.info("Start initial (re)load of the DomiSMP properties with transaction status object [{}]", status); - reloadPropertiesFromDatabasePrivate(); + refreshProperties(); return null; }); } - + */ /** * Searches for a configuration entity by its key and returns it if found. Returns an empty {@code Optional} if missing. * @@ -186,7 +185,7 @@ public class ConfigurationDao extends BaseDao<DBConfiguration> implements Initia return cachedProperties.getProperty(property, defValue); } - @Transactional + public <T extends Object> T getCachedPropertyValue(SMPPropertyEnum key) { if (lastUpdate == null) { // init properties diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/CredentialDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/CredentialDao.java index 858c541d71d573d2dbc19ce8cd4840250f499075..05a60a1884c4ba8fb2b7cd7c87ce5b5ff5c31bf5 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/CredentialDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/CredentialDao.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.time.OffsetDateTime; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/DomainDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/DomainDao.java index 99ffa95e72641ede1efd01a6a6da209e6829cc95..df61adf21acc81a12cc23cb39180c3f3b2697386 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/DomainDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/DomainDao.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/GroupDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/GroupDao.java index d8a761ae8900f124da8a8cf191e510d188e9a422..d69618d8f277903fcf5768862ef40848e0c8741a 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/GroupDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/GroupDao.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDao.java index 9cd8a65d40d2c0c9aabc01e94b0cfd8c7f6c187a..2152bff8f0724550f49964eb9fd7d87d582001aa 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDao.java @@ -30,7 +30,7 @@ import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; import javax.persistence.criteria.*; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDao.java index 4bd2a718f110d638211bacd56032b99a2ca7094a..4d75164c4309f500046a3f9244a8485c5a588d9b 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDao.java @@ -24,7 +24,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDefDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDefDao.java index 14af26228259ff50e11d7834f42507d7345489de..b7a08ad6b79349dabf9ccdf7baab80a761a63e3f 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDefDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/SubresourceDefDao.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/UserDao.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/UserDao.java index 8efd03184767c0e12ebab17d4e80f7728a442397..50115ee3d258590f3eddb9a94c4f826cafb9352b 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/UserDao.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/dao/UserDao.java @@ -26,7 +26,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.TypedQuery; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialService.java index 30dbd1261f4604947263da5dd272ca44ff1150f8..9edf83db69b32d458bb2d36e53709011ad3f7d8a 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialService.java @@ -29,7 +29,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.crypto.bcrypt.BCrypt; import org.springframework.stereotype.Service; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.security.cert.CertificateException; import java.security.cert.CertificateRevokedException; import java.security.cert.X509Certificate; @@ -70,7 +70,7 @@ public class CredentialService { this.alertService = alertService; } - @Transactional(dontRollbackOn = {RuntimeException.class}) + @Transactional(noRollbackForClassName = {"java.lang.RuntimeException"}) public Authentication authenticateByUsernamePassword(String username, String userCredentialToken) throws AuthenticationException { @@ -123,7 +123,7 @@ public class CredentialService { } - @Transactional(dontRollbackOn = {AuthenticationException.class, BadCredentialsException.class}) + @Transactional(noRollbackForClassName = {"org.springframework.security.core.AuthenticationException","org.springframework.security.authentication.BadCredentialsException"}) public Authentication authenticateByAuthenticationToken(String authenticationTokenId, String authenticationTokenValue) throws AuthenticationException { @@ -200,7 +200,7 @@ public class CredentialService { return false; } - @Transactional(dontRollbackOn = {AuthenticationException.class, BadCredentialsException.class}) + @Transactional(noRollbackForClassName = {"org.springframework.security.core.AuthenticationException","org.springframework.security.authentication.BadCredentialsException"}) public Authentication authenticateByCertificateToken(PreAuthenticatedCertificatePrincipal principal) { LOG.info("authenticateByCertificateToken:" + principal.getName()); diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java index cd1eb50d472efe1f779a04289f3fb7ec695efc8e..f1b0b2a2ffc10fbf77f6a3cfb8d42cd7f6367e5b 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceHandlerService.java @@ -29,7 +29,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.stereotype.Service; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.io.ByteArrayOutputStream; import java.util.List; diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceStorage.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceStorage.java index e38e58963fed86a0e0a27f6fa945795cae255e43..306eb5f674cf6fb4c4f108072ebbd93b630f857c 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceStorage.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/resource/ResourceStorage.java @@ -12,7 +12,7 @@ import eu.europa.ec.edelivery.smp.logging.SMPLogger; import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory; import org.springframework.stereotype.Service; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.Optional; /** diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/AbstractResourceDaoTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/AbstractResourceDaoTest.java index d27b6aaf625089deb73ad483d52991cf664c72c3..07d4908ce99816ad64dcc47d565ccda1374c8316 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/AbstractResourceDaoTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/AbstractResourceDaoTest.java @@ -9,7 +9,7 @@ import eu.europa.ec.edelivery.smp.testutil.TestDBUtils; import org.junit.Before; import org.springframework.beans.factory.annotation.Autowired; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.Optional; diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoMembershipIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoMembershipIntegrationTest.java index cd87005d2dd7ad48888da1f3ab54c45e8654e238..9addd96b9757d53a1a5788a8d26e87c8d82ea97d 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoMembershipIntegrationTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoMembershipIntegrationTest.java @@ -7,7 +7,7 @@ import eu.europa.ec.edelivery.smp.data.model.user.DBUser; import eu.europa.ec.edelivery.smp.testutil.TestConstants; import org.junit.Test; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.Optional; import static org.junit.Assert.*; diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoTest.java index c5bf8e6c18f54106731ca1604dad3944fe0b8828..2060f4e5fb573c764c7d73294011be6d70948d34 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/ResourceDaoTest.java @@ -17,7 +17,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Optional; diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java index a8f1e985efa897da73f61372c358fa3d9ce9c056..7045423cdf18164033645b274016a22302831835 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/data/dao/TestUtilsDao.java @@ -22,7 +22,7 @@ import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; -import javax.transaction.Transactional; +import org.springframework.transaction.annotation.Transactional; import static eu.europa.ec.edelivery.smp.testutil.TestConstants.*; import static eu.europa.ec.edelivery.smp.testutil.TestDBUtils.*; diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SMPWebAppConfig.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SMPWebAppConfig.java index 16635a5de1172ad76ec088da7efe0b4c2c1dee63..1d0ec9ed026fb034cbfa27846e90eb7ae9bba5bf 100644 --- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SMPWebAppConfig.java +++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SMPWebAppConfig.java @@ -49,7 +49,6 @@ import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE; "eu.europa.ec.smp.spi",}) @Import({GlobalMethodSecurityConfig.class, ServiceErrorControllerAdvice.class, - SMPDatabaseConfig.class, ServicesBeansConfiguration.class}) public class SMPWebAppConfig implements WebMvcConfigurer { private static final Logger LOG = LoggerFactory.getLogger(SMPWebAppConfig.class); diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-cleanup.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-cleanup.sql new file mode 100644 index 0000000000000000000000000000000000000000..a5c281768afb54fae0c8ce202199139ba3577a6d --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-cleanup.sql @@ -0,0 +1,25 @@ +drop table if exists BCK_ALERT; +drop table if exists BCK_ALERT_AUD; +drop table if exists BCK_ALERT_PROPERTY; +drop table if exists BCK_ALERT_PROPERTY_AUD; +drop table if exists BCK_CERTIFICATE; +drop table if exists BCK_CERTIFICATE_AUD; +drop table if exists BCK_CONFIGURATION; +drop table if exists BCK_CONFIGURATION_AUD; +drop table if exists BCK_DOMAIN; +drop table if exists BCK_DOMAIN_AUD; +drop table if exists BCK_OWNERSHIP; +drop table if exists BCK_OWNERSHIP_AUD; +drop table if exists BCK_REV_INFO; +drop table if exists BCK_SERVICE_GROUP; +drop table if exists BCK_SERVICE_GROUP_AUD; +drop table if exists BCK_SERVICE_GROUP_DOMAIN; +drop table if exists BCK_SERVICE_GROUP_DOMAIN_AUD; +drop table if exists BCK_SERVICE_METADATA; +drop table if exists BCK_SERVICE_METADATA_AUD; +drop table if exists BCK_SERVICE_METADATA_XML; +drop table if exists BCK_SERVICE_METADATA_XML_AUD; +drop table if exists BCK_SG_EXTENSION; +drop table if exists BCK_SG_EXTENSION_AUD; +drop table if exists BCK_USER; +drop table if exists BCK_USER_AUD; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-rollback.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-rollback.sql new file mode 100644 index 0000000000000000000000000000000000000000..d6a8682788b9265944ce4904443ad0375e55785b --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/mysql5innoDb-4.2_to_5.0-rollback.sql @@ -0,0 +1,236 @@ +alter table SMP_ALERT_AUD drop foreign key FKrw0qnto448ojlirpfmfntd8v2; +alter table SMP_ALERT_PROPERTY drop foreign key FK15r37w3r5ty5f6074ykr2o4i6; +alter table SMP_ALERT_PROPERTY_AUD drop foreign key FKod33qjx87ih1a0skxl2sgddar; +alter table SMP_CERTIFICATE drop foreign key FK25b9apuupvmjp18wnn2b2gfg8; +alter table SMP_CERTIFICATE_AUD drop foreign key FKnrwm8en8vv10li8ihwnurwd9e; +alter table SMP_CONFIGURATION_AUD drop foreign key FKd4yhbdlusovfbdti1fjkuxp9m; +alter table SMP_CREDENTIAL drop foreign key FK89it2lyqvi2bl9bettx66n8n1; +alter table SMP_CREDENTIAL_AUD drop foreign key FKqjh6vxvb5tg0tvbkvi3k3xhe6; +alter table SMP_DOCUMENT_AUD drop foreign key FKh9epnme26i271eixtvrpqejvi; +alter table SMP_DOCUMENT_VERSION drop foreign key FKalsuoqx4csyp9mygvng911do; +alter table SMP_DOCUMENT_VERSION_AUD drop foreign key FK4glqiu73939kpyyb6bhw822k3; +alter table SMP_DOMAIN_AUD drop foreign key FK35qm8xmi74kfenugeonijodsg; +alter table SMP_DOMAIN_MEMBER drop foreign key FK1tdwy9oiyrk6tl4mk0fakhkf5; +alter table SMP_DOMAIN_MEMBER drop foreign key FKino2nvj74wc755nyn5mo260qi; +alter table SMP_DOMAIN_MEMBER_AUD drop foreign key FKijiv1avufqo9iu5u0cj4v3pv7; +alter table SMP_DOMAIN_RESOURCE_DEF drop foreign key FK563xw5tjw4rlr32va9g17cdsq; +alter table SMP_DOMAIN_RESOURCE_DEF drop foreign key FKtppp16v40ll2ch3ly8xusb8hi; +alter table SMP_DOMAIN_RESOURCE_DEF_AUD drop foreign key FKpujj9vb097i5w4loa3dxww2nj; +alter table SMP_EXTENSION_AUD drop foreign key FKke7f9wbwvp1bmnlqh9hrfm0r; +alter table SMP_GROUP drop foreign key FKjeomxyxjueaiyt7f0he0ls7vm; +alter table SMP_GROUP_AUD drop foreign key FKeik3quor2dxho7bmyoxc2ug9o; +alter table SMP_GROUP_MEMBER drop foreign key FK3y21chrphgx1dytux0p19btxe; +alter table SMP_GROUP_MEMBER drop foreign key FK8ue5gj1rx6gyiqp19dscp85ut; +alter table SMP_GROUP_MEMBER_AUD drop foreign key FK5pmorcyhwkaysh0a8xm99x6a8; +alter table SMP_RESOURCE drop foreign key FKkc5a6okrvq7dv87itfp7i1vmv; +alter table SMP_RESOURCE drop foreign key FK24mw8fiua39nh8rnobhgmujri; +alter table SMP_RESOURCE drop foreign key FKft55kasui36i77inf0wh8utv5; +alter table SMP_RESOURCE_AUD drop foreign key FKlbbfltxw6qmph5w3i8c9qf6kb; +alter table SMP_RESOURCE_DEF drop foreign key FKruu7v6uig9h333ihv34haw3ob; +alter table SMP_RESOURCE_DEF_AUD drop foreign key FKapswkgbdm9s4wwhx2cjduoniw; +alter table SMP_RESOURCE_MEMBER drop foreign key FKrci5jlgnckwo1mhq2rvmfaptw; +alter table SMP_RESOURCE_MEMBER drop foreign key FKs6jx68jxlx4xfdtxy20f3s6lu; +alter table SMP_RESOURCE_MEMBER_AUD drop foreign key FKknykp2wcby9fxk234yaaix1pe; +alter table SMP_SUBRESOURCE drop foreign key FK7y1ydnq350mbs3c8yrq2fhnsk; +alter table SMP_SUBRESOURCE drop foreign key FK7clbsapruvhkcqgekfxs8prex; +alter table SMP_SUBRESOURCE drop foreign key FKq3wmyy4ieoenuu1s55237qu9k; +alter table SMP_SUBRESOURCE_AUD drop foreign key FKffihyo233ldee8nejbkyclrov; +alter table SMP_SUBRESOURCE_DEF drop foreign key FKbjqilcym6p3pptva2s4d1gw8o; +alter table SMP_SUBRESOURCE_DEF_AUD drop foreign key FK1dd2l0ujtncg9u7hl3c4rte63; +alter table SMP_USER_AUD drop foreign key FK2786r5minnkai3d22b191iiiq; +-- drop new tables +drop table if exists SMP_ALERT; +drop table if exists SMP_ALERT_AUD; +drop table if exists SMP_ALERT_PROPERTY; +drop table if exists SMP_ALERT_PROPERTY_AUD; +drop table if exists SMP_CERTIFICATE; +drop table if exists SMP_CERTIFICATE_AUD; +drop table if exists SMP_CONFIGURATION; +drop table if exists SMP_CONFIGURATION_AUD; +drop table if exists SMP_CREDENTIAL; +drop table if exists SMP_CREDENTIAL_AUD; +drop table if exists SMP_DOCUMENT; +drop table if exists SMP_DOCUMENT_AUD; +drop table if exists SMP_DOCUMENT_VERSION; +drop table if exists SMP_DOCUMENT_VERSION_AUD; +drop table if exists SMP_DOMAIN; +drop table if exists SMP_DOMAIN_AUD; +drop table if exists SMP_DOMAIN_MEMBER; +drop table if exists SMP_DOMAIN_MEMBER_AUD; +drop table if exists SMP_DOMAIN_RESOURCE_DEF; +drop table if exists SMP_DOMAIN_RESOURCE_DEF_AUD; +drop table if exists SMP_EXTENSION; +drop table if exists SMP_EXTENSION_AUD; +drop table if exists SMP_GROUP; +drop table if exists SMP_GROUP_AUD; +drop table if exists SMP_GROUP_MEMBER; +drop table if exists SMP_GROUP_MEMBER_AUD; +drop table if exists SMP_RESOURCE; +drop table if exists SMP_RESOURCE_AUD; +drop table if exists SMP_RESOURCE_DEF; +drop table if exists SMP_RESOURCE_DEF_AUD; +drop table if exists SMP_RESOURCE_MEMBER; +drop table if exists SMP_RESOURCE_MEMBER_AUD; +drop table if exists SMP_REV_INFO; +drop table if exists SMP_SUBRESOURCE; +drop table if exists SMP_SUBRESOURCE_AUD; +drop table if exists SMP_SUBRESOURCE_DEF; +drop table if exists SMP_SUBRESOURCE_DEF_AUD; +drop table if exists SMP_USER; +drop table if exists SMP_USER_AUD; +-- rename backup tables +RENAME TABLE BCK_ALERT TO SMP_ALERT; +RENAME TABLE BCK_ALERT_AUD TO SMP_ALERT_AUD; +RENAME TABLE BCK_ALERT_PROPERTY TO SMP_ALERT_PROPERTY; +RENAME TABLE BCK_ALERT_PROPERTY_AUD TO SMP_ALERT_PROPERTY_AUD; +RENAME TABLE BCK_CERTIFICATE TO SMP_CERTIFICATE; +RENAME TABLE BCK_CERTIFICATE_AUD TO SMP_CERTIFICATE_AUD; +RENAME TABLE BCK_CONFIGURATION TO SMP_CONFIGURATION; +RENAME TABLE BCK_CONFIGURATION_AUD TO SMP_CONFIGURATION_AUD; +RENAME TABLE BCK_DOMAIN TO SMP_DOMAIN; +RENAME TABLE BCK_DOMAIN_AUD TO SMP_DOMAIN_AUD; +RENAME TABLE BCK_OWNERSHIP TO SMP_OWNERSHIP; +RENAME TABLE BCK_OWNERSHIP_AUD TO SMP_OWNERSHIP_AUD; +RENAME TABLE BCK_REV_INFO TO SMP_REV_INFO; +RENAME TABLE BCK_SERVICE_GROUP TO SMP_SERVICE_GROUP; +RENAME TABLE BCK_SERVICE_GROUP_AUD TO SMP_SERVICE_GROUP_AUD; +RENAME TABLE BCK_SERVICE_GROUP_DOMAIN TO SMP_SERVICE_GROUP_DOMAIN; +RENAME TABLE BCK_SERVICE_GROUP_DOMAIN_AUD TO SMP_SERVICE_GROUP_DOMAIN_AUD; +RENAME TABLE BCK_SERVICE_METADATA TO SMP_SERVICE_METADATA; +RENAME TABLE BCK_SERVICE_METADATA_AUD TO SMP_SERVICE_METADATA_AUD; +RENAME TABLE BCK_SERVICE_METADATA_XML TO SMP_SERVICE_METADATA_XML; +RENAME TABLE BCK_SERVICE_METADATA_XML_AUD TO SMP_SERVICE_METADATA_XML_AUD; +RENAME TABLE BCK_SG_EXTENSION TO SMP_SG_EXTENSION; +RENAME TABLE BCK_SG_EXTENSION_AUD TO SMP_SG_EXTENSION_AUD; +RENAME TABLE BCK_USER TO SMP_USER; +RENAME TABLE BCK_USER_AUD TO SMP_USER_AUD; +-- setup indexes and constraints +alter table SMP_CERTIFICATE + add constraint UK_3x3rvf6hkim9fg16caurkgg6f unique (CERTIFICATE_ID); + +alter table SMP_DOMAIN + add constraint UK_djrwqd4luj5i7w4l7fueuaqbj unique (DOMAIN_CODE); + +alter table SMP_DOMAIN + add constraint UK_likb3jn0nlxlekaws0xx10uqc unique (SML_SUBDOMAIN); +create index SMP_SG_PART_ID_IDX on SMP_SERVICE_GROUP (PARTICIPANT_IDENTIFIER); +create index SMP_SG_PART_SCH_IDX on SMP_SERVICE_GROUP (PARTICIPANT_SCHEME); + +alter table SMP_SERVICE_GROUP + add constraint SMP_SG_UNIQ_PARTC_IDX unique (PARTICIPANT_SCHEME, PARTICIPANT_IDENTIFIER); +create index SMP_SMD_DOC_ID_IDX on SMP_SERVICE_METADATA (DOCUMENT_IDENTIFIER); +create index SMP_SMD_DOC_SCH_IDX on SMP_SERVICE_METADATA (DOCUMENT_SCHEME); + +alter table SMP_SERVICE_METADATA + add constraint SMP_MT_UNIQ_SG_DOC_IDX unique (FK_SG_DOM_ID, DOCUMENT_IDENTIFIER, DOCUMENT_SCHEME); + +alter table SMP_USER + add constraint UK_tk9bjsmd2mevgt3b997i6pl27 unique (ACCESS_TOKEN_ID); + +alter table SMP_USER + add constraint UK_rt1f0anklfo05lt0my05fqq6 unique (USERNAME); + +alter table SMP_ALERT_AUD + add constraint FKrw0qnto448ojlirpfmfntd8v2 + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_ALERT_PROPERTY + add constraint FK15r37w3r5ty5f6074ykr2o4i6 + foreign key (FK_ALERT_ID) + references SMP_ALERT (ID); + +alter table SMP_ALERT_PROPERTY_AUD + add constraint FKod33qjx87ih1a0skxl2sgddar + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_CERTIFICATE + add constraint FKayqgpj5ot3o8vrpduul7sstta + foreign key (ID) + references SMP_USER (ID); + +alter table SMP_CERTIFICATE_AUD + add constraint FKnrwm8en8vv10li8ihwnurwd9e + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_CONFIGURATION_AUD + add constraint FKd4yhbdlusovfbdti1fjkuxp9m + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_DOMAIN_AUD + add constraint FK35qm8xmi74kfenugeonijodsg + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_OWNERSHIP + add constraint FKrnqwq06lbfwciup4rj8nvjpmy + foreign key (FK_USER_ID) + references SMP_USER (ID); + +alter table SMP_OWNERSHIP + add constraint FKgexq5n6ftsid8ehqljvjh8p4i + foreign key (FK_SG_ID) + references SMP_SERVICE_GROUP (ID); + +alter table SMP_OWNERSHIP_AUD + add constraint FK1lqynlbk8ow1ouxetf5wybk3k + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_SERVICE_GROUP_AUD + add constraint FKj3caimhegwyav1scpwrxoslef + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_SERVICE_GROUP_DOMAIN + add constraint FKo186xtefda6avl5p1tuqchp3n + foreign key (FK_DOMAIN_ID) + references SMP_DOMAIN (ID); + +alter table SMP_SERVICE_GROUP_DOMAIN + add constraint FKgcvhnk2n34d3c6jhni5l3s3x3 + foreign key (FK_SG_ID) + references SMP_SERVICE_GROUP (ID); + +alter table SMP_SERVICE_GROUP_DOMAIN_AUD + add constraint FK6uc9r0eqw16baooxtmqjkih0j + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_SERVICE_METADATA + add constraint FKfvcml6b8x7kn80m30h8pxs7jl + foreign key (FK_SG_DOM_ID) + references SMP_SERVICE_GROUP_DOMAIN (ID); + +alter table SMP_SERVICE_METADATA_AUD + add constraint FKbqr9pdnik1qxx2hi0xn4n7f61 + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_SERVICE_METADATA_XML + add constraint FK4b1x06xlavcgbjnuilgksi7nm + foreign key (ID) + references SMP_SERVICE_METADATA (ID); + +alter table SMP_SERVICE_METADATA_XML_AUD + add constraint FKevatmlvvwoxfnjxkvmokkencb + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_SG_EXTENSION + add constraint FKtf0mfonugp2jbkqo2o142chib + foreign key (ID) + references SMP_SERVICE_GROUP (ID); + +alter table SMP_SG_EXTENSION_AUD + add constraint FKmdo9v2422adwyebvl34qa3ap6 + foreign key (REV) + references SMP_REV_INFO (id); + +alter table SMP_USER_AUD + add constraint FK2786r5minnkai3d22b191iiiq + foreign key (REV) + references SMP_REV_INFO (id); diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-cleanup.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-cleanup.sql new file mode 100644 index 0000000000000000000000000000000000000000..95ab507ea994329f766ff6a0709d743f0f200422 --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-cleanup.sql @@ -0,0 +1,28 @@ +drop table BCK_ALERT cascade constraints; +drop table BCK_ALERT_AUD cascade constraints; +drop table BCK_ALERT_PROPERTY cascade constraints; +drop table BCK_ALERT_PROPERTY_AUD cascade constraints; +drop table BCK_CERTIFICATE cascade constraints; +drop table BCK_CERTIFICATE_AUD cascade constraints; +drop table BCK_CONFIGURATION cascade constraints; +drop table BCK_CONFIGURATION_AUD cascade constraints; +drop table BCK_DOMAIN cascade constraints; +drop table BCK_DOMAIN_AUD cascade constraints; +drop table BCK_OWNERSHIP cascade constraints; +drop table BCK_OWNERSHIP_AUD cascade constraints; +drop table BCK_REV_INFO cascade constraints; +drop table BCK_SERVICE_GROUP cascade constraints; +drop table BCK_SERVICE_GROUP_AUD cascade constraints; +drop table BCK_SERVICE_GROUP_DOMAIN cascade constraints; +drop table BCK_SERVICE_GROUP_DOMAIN_AUD cascade constraints; +drop table BCK_SERVICE_METADATA cascade constraints; +drop table BCK_SERVICE_METADATA_AUD cascade constraints; +drop table BCK_SERVICE_METADATA_XML cascade constraints; +drop table BCK_SERVICE_METADATA_XML_AUD cascade constraints; +drop table BCK_SG_EXTENSION cascade constraints; +drop table BCK_SG_EXTENSION_AUD cascade constraints; +drop table BCK_USER cascade constraints; +drop table BCK_USER_AUD cascade constraints; +-- the only unused sequence +drop sequence SMP_SERVICE_GROUP_DOMAIN_SEQ; +drop sequence SMP_SERVICE_GROUP_SEQ; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-rollback.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-rollback.sql new file mode 100644 index 0000000000000000000000000000000000000000..3364ad3ca662f522dd9d7cfecd49a4d5f77a55a6 --- /dev/null +++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-rollback.sql @@ -0,0 +1,210 @@ +-- drop new tables +drop table SMP_ALERT cascade constraints; +drop table SMP_ALERT_AUD cascade constraints; +drop table SMP_ALERT_PROPERTY cascade constraints; +drop table SMP_ALERT_PROPERTY_AUD cascade constraints; +drop table SMP_CERTIFICATE cascade constraints; +drop table SMP_CERTIFICATE_AUD cascade constraints; +drop table SMP_CONFIGURATION cascade constraints; +drop table SMP_CONFIGURATION_AUD cascade constraints; +drop table SMP_CREDENTIAL cascade constraints; +drop table SMP_CREDENTIAL_AUD cascade constraints; +drop table SMP_DOCUMENT cascade constraints; +drop table SMP_DOCUMENT_AUD cascade constraints; +drop table SMP_DOCUMENT_VERSION cascade constraints; +drop table SMP_DOCUMENT_VERSION_AUD cascade constraints; +drop table SMP_DOMAIN cascade constraints; +drop table SMP_DOMAIN_AUD cascade constraints; +drop table SMP_DOMAIN_MEMBER cascade constraints; +drop table SMP_DOMAIN_MEMBER_AUD cascade constraints; +drop table SMP_DOMAIN_RESOURCE_DEF cascade constraints; +drop table SMP_DOMAIN_RESOURCE_DEF_AUD cascade constraints; +drop table SMP_EXTENSION cascade constraints; +drop table SMP_EXTENSION_AUD cascade constraints; +drop table SMP_GROUP cascade constraints; +drop table SMP_GROUP_AUD cascade constraints; +drop table SMP_GROUP_MEMBER cascade constraints; +drop table SMP_GROUP_MEMBER_AUD cascade constraints; +drop table SMP_RESOURCE cascade constraints; +drop table SMP_RESOURCE_AUD cascade constraints; +drop table SMP_RESOURCE_DEF cascade constraints; +drop table SMP_RESOURCE_DEF_AUD cascade constraints; +drop table SMP_RESOURCE_MEMBER cascade constraints; +drop table SMP_RESOURCE_MEMBER_AUD cascade constraints; +drop table SMP_REV_INFO cascade constraints; +drop table SMP_SUBRESOURCE cascade constraints; +drop table SMP_SUBRESOURCE_AUD cascade constraints; +drop table SMP_SUBRESOURCE_DEF cascade constraints; +drop table SMP_SUBRESOURCE_DEF_AUD cascade constraints; +drop table SMP_USER cascade constraints; +drop table SMP_USER_AUD cascade constraints; +-- rename tables +ALTER TABLE BCK_ALERT RENAME TO SMP_ALERT; +ALTER TABLE BCK_ALERT_AUD RENAME TO SMP_ALERT_AUD; +ALTER TABLE BCK_ALERT_PROPERTY RENAME TO SMP_ALERT_PROPERTY; +ALTER TABLE BCK_ALERT_PROPERTY_AUD RENAME TO SMP_ALERT_PROPERTY_AUD; +ALTER TABLE BCK_CERTIFICATE RENAME TO SMP_CERTIFICATE; +ALTER TABLE BCK_CERTIFICATE_AUD RENAME TO SMP_CERTIFICATE_AUD; +ALTER TABLE BCK_CONFIGURATION RENAME TO SMP_CONFIGURATION; +ALTER TABLE BCK_CONFIGURATION_AUD RENAME TO SMP_CONFIGURATION_AUD; +ALTER TABLE BCK_DOMAIN RENAME TO SMP_DOMAIN; +ALTER TABLE BCK_DOMAIN_AUD RENAME TO SMP_DOMAIN_AUD; +ALTER TABLE BCK_OWNERSHIP RENAME TO SMP_OWNERSHIP; +ALTER TABLE BCK_OWNERSHIP_AUD RENAME TO SMP_OWNERSHIP_AUD; +ALTER TABLE BCK_REV_INFO RENAME TO SMP_REV_INFO; +ALTER TABLE BCK_SERVICE_GROUP RENAME TO SMP_SERVICE_GROUP; +ALTER TABLE BCK_SERVICE_GROUP_AUD RENAME TO SMP_SERVICE_GROUP_AUD; +ALTER TABLE BCK_SERVICE_GROUP_DOMAIN RENAME TO SMP_SERVICE_GROUP_DOMAIN; +ALTER TABLE BCK_SERVICE_GROUP_DOMAIN_AUD RENAME TO SMP_SERVICE_GROUP_DOMAIN_AUD; +ALTER TABLE BCK_SERVICE_METADATA RENAME TO SMP_SERVICE_METADATA; +ALTER TABLE BCK_SERVICE_METADATA_AUD RENAME TO SMP_SERVICE_METADATA_AUD; +ALTER TABLE BCK_SERVICE_METADATA_XML RENAME TO SMP_SERVICE_METADATA_XML; +ALTER TABLE BCK_SERVICE_METADATA_XML_AUD RENAME TO SMP_SERVICE_METADATA_XML_AUD; +ALTER TABLE BCK_SG_EXTENSION RENAME TO SMP_SG_EXTENSION; +ALTER TABLE BCK_SG_EXTENSION_AUD RENAME TO SMP_SG_EXTENSION_AUD; +ALTER TABLE BCK_USER RENAME TO SMP_USER; +ALTER TABLE BCK_USER_AUD RENAME TO SMP_USER_AUD; +-- set indexes + alter table SMP_CERTIFICATE + add constraint UK_3x3rvf6hkim9fg16caurkgg6f unique (CERTIFICATE_ID); + +alter table SMP_DOMAIN + add constraint UK_djrwqd4luj5i7w4l7fueuaqbj unique (DOMAIN_CODE); + +alter table SMP_DOMAIN + add constraint UK_likb3jn0nlxlekaws0xx10uqc unique (SML_SUBDOMAIN); +create index SMP_SG_PART_ID_IDX on SMP_SERVICE_GROUP (PARTICIPANT_IDENTIFIER); +create index SMP_SG_PART_SCH_IDX on SMP_SERVICE_GROUP (PARTICIPANT_SCHEME); + +alter table SMP_SERVICE_GROUP + add constraint SMP_SG_UNIQ_PARTC_IDX unique (PARTICIPANT_SCHEME, PARTICIPANT_IDENTIFIER); +create index SMP_SMD_DOC_ID_IDX on SMP_SERVICE_METADATA (DOCUMENT_IDENTIFIER); +create index SMP_SMD_DOC_SCH_IDX on SMP_SERVICE_METADATA (DOCUMENT_SCHEME); + +alter table SMP_SERVICE_METADATA + add constraint SMP_MT_UNIQ_SG_DOC_IDX unique (FK_SG_DOM_ID, DOCUMENT_IDENTIFIER, DOCUMENT_SCHEME); + +alter table SMP_USER + add constraint UK_tk9bjsmd2mevgt3b997i6pl27 unique (ACCESS_TOKEN_ID); + +alter table SMP_USER + add constraint UK_rt1f0anklfo05lt0my05fqq6 unique (USERNAME); + +alter table SMP_ALERT_AUD + add constraint FKrw0qnto448ojlirpfmfntd8v2 + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_ALERT_PROPERTY + add constraint FK15r37w3r5ty5f6074ykr2o4i6 + foreign key (FK_ALERT_ID) + references SMP_ALERT; + +alter table SMP_ALERT_PROPERTY_AUD + add constraint FKod33qjx87ih1a0skxl2sgddar + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_CERTIFICATE + add constraint FKayqgpj5ot3o8vrpduul7sstta + foreign key (ID) + references SMP_USER; + +alter table SMP_CERTIFICATE_AUD + add constraint FKnrwm8en8vv10li8ihwnurwd9e + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_CONFIGURATION_AUD + add constraint FKd4yhbdlusovfbdti1fjkuxp9m + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_DOMAIN_AUD + add constraint FK35qm8xmi74kfenugeonijodsg + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_OWNERSHIP + add constraint FKrnqwq06lbfwciup4rj8nvjpmy + foreign key (FK_USER_ID) + references SMP_USER; + +alter table SMP_OWNERSHIP + add constraint FKgexq5n6ftsid8ehqljvjh8p4i + foreign key (FK_SG_ID) + references SMP_SERVICE_GROUP; + +alter table SMP_OWNERSHIP_AUD + add constraint FK1lqynlbk8ow1ouxetf5wybk3k + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_SERVICE_GROUP_AUD + add constraint FKj3caimhegwyav1scpwrxoslef + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_SERVICE_GROUP_DOMAIN + add constraint FKo186xtefda6avl5p1tuqchp3n + foreign key (FK_DOMAIN_ID) + references SMP_DOMAIN; + +alter table SMP_SERVICE_GROUP_DOMAIN + add constraint FKgcvhnk2n34d3c6jhni5l3s3x3 + foreign key (FK_SG_ID) + references SMP_SERVICE_GROUP; + +alter table SMP_SERVICE_GROUP_DOMAIN_AUD + add constraint FK6uc9r0eqw16baooxtmqjkih0j + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_SERVICE_METADATA + add constraint FKfvcml6b8x7kn80m30h8pxs7jl + foreign key (FK_SG_DOM_ID) + references SMP_SERVICE_GROUP_DOMAIN; + +alter table SMP_SERVICE_METADATA_AUD + add constraint FKbqr9pdnik1qxx2hi0xn4n7f61 + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_SERVICE_METADATA_XML + add constraint FK4b1x06xlavcgbjnuilgksi7nm + foreign key (ID) + references SMP_SERVICE_METADATA; + +alter table SMP_SERVICE_METADATA_XML_AUD + add constraint FKevatmlvvwoxfnjxkvmokkencb + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_SG_EXTENSION + add constraint FKtf0mfonugp2jbkqo2o142chib + foreign key (ID) + references SMP_SERVICE_GROUP; + +alter table SMP_SG_EXTENSION_AUD + add constraint FKmdo9v2422adwyebvl34qa3ap6 + foreign key (REV) + references SMP_REV_INFO; + +alter table SMP_USER_AUD + add constraint FK2786r5minnkai3d22b191iiiq + foreign key (REV) + references SMP_REV_INFO; + +drop sequence SMP_CREDENTIAL_SEQ; +drop sequence SMP_DOCUMENT_SEQ; +drop sequence SMP_DOCUMENT_VERSION_SEQ; +drop sequence SMP_DOMAIN_MEMBER_SEQ; +drop sequence SMP_GROUP_MEMBER_SEQ; +drop sequence SMP_RESOURCE_MEMBER_SEQ; +drop sequence SMP_EXTENSION_SEQ; +drop sequence SMP_RESOURCE_DEF_SEQ; +drop sequence SMP_SUBRESOURCE_DEF_SEQ; +drop sequence SMP_DOMAIN_RESOURCE_DEF_SEQ; +drop sequence SMP_GROUP_SEQ; +drop sequence SMP_RESOURCE_SEQ; +rename SMP_SUBRESOURCE_SEQ TO SMP_SERVICE_METADATA_SEQ; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-step_01.sql b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-step_01.sql index 3216459f1c3b75a0ba838c69f9bc9dbe049b7796..20d1fef6cf8d908017f94cb16e82cdf7b7694fa5 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-step_01.sql +++ b/smp-webapp/src/main/smp-setup/database-scripts/migration from 4.2 to 5.0/oracle10g-4.2_to_5.0-step_01.sql @@ -33,31 +33,31 @@ alter table SMP_SG_EXTENSION_AUD drop constraint FKmdo9v2422adwyebvl34qa3ap6; alter table SMP_USER_AUD drop constraint FK2786r5minnkai3d22b191iiiq; -- backup tables - ALTER TABLE SMP_ALERT RENAME TO BCK_ALERT; - ALTER TABLE SMP_ALERT_AUD RENAME TO BCK_ALERT_AUD; - ALTER TABLE SMP_ALERT_PROPERTY RENAME TO BCK_ALERT_PROPERTY; - ALTER TABLE SMP_ALERT_PROPERTY_AUD RENAME TO BCK_ALERT_PROPERTY_AUD; - ALTER TABLE SMP_CERTIFICATE RENAME TO BCK_CERTIFICATE; - ALTER TABLE SMP_CERTIFICATE_AUD RENAME TO BCK_CERTIFICATE_AUD; - ALTER TABLE SMP_CONFIGURATION RENAME TO BCK_CONFIGURATION; - ALTER TABLE SMP_CONFIGURATION_AUD RENAME TO BCK_CONFIGURATION_AUD; - ALTER TABLE SMP_DOMAIN RENAME TO BCK_DOMAIN; - ALTER TABLE SMP_DOMAIN_AUD RENAME TO BCK_DOMAIN_AUD; - ALTER TABLE SMP_OWNERSHIP RENAME TO BCK_OWNERSHIP; - ALTER TABLE SMP_OWNERSHIP_AUD RENAME TO BCK_OWNERSHIP_AUD; - ALTER TABLE SMP_REV_INFO RENAME TO BCK_REV_INFO; - ALTER TABLE SMP_SERVICE_GROUP RENAME TO BCK_SERVICE_GROUP; - ALTER TABLE SMP_SERVICE_GROUP_AUD RENAME TO BCK_SERVICE_GROUP_AUD; - ALTER TABLE SMP_SERVICE_GROUP_DOMAIN RENAME TO BCK_SERVICE_GROUP_DOMAIN; - ALTER TABLE SMP_SERVICE_GROUP_DOMAIN_AUD RENAME TO BCK_SERVICE_GROUP_DOMAIN_AUD; - ALTER TABLE SMP_SERVICE_METADATA RENAME TO BCK_SERVICE_METADATA; - ALTER TABLE SMP_SERVICE_METADATA_AUD RENAME TO BCK_SERVICE_METADATA_AUD; - ALTER TABLE SMP_SERVICE_METADATA_XML RENAME TO BCK_SERVICE_METADATA_XML; - ALTER TABLE SMP_SERVICE_METADATA_XML_AUD RENAME TO BCK_SERVICE_METADATA_XML_AUD; - ALTER TABLE SMP_SG_EXTENSION RENAME TO BCK_SG_EXTENSION; - ALTER TABLE SMP_SG_EXTENSION_AUD RENAME TO BCK_SG_EXTENSION_AUD; - ALTER TABLE SMP_USER RENAME TO BCK_USER; - ALTER TABLE SMP_USER_AUD RENAME TO BCK_USER_AUD; +ALTER TABLE SMP_ALERT RENAME TO BCK_ALERT; +ALTER TABLE SMP_ALERT_AUD RENAME TO BCK_ALERT_AUD; +ALTER TABLE SMP_ALERT_PROPERTY RENAME TO BCK_ALERT_PROPERTY; +ALTER TABLE SMP_ALERT_PROPERTY_AUD RENAME TO BCK_ALERT_PROPERTY_AUD; +ALTER TABLE SMP_CERTIFICATE RENAME TO BCK_CERTIFICATE; +ALTER TABLE SMP_CERTIFICATE_AUD RENAME TO BCK_CERTIFICATE_AUD; +ALTER TABLE SMP_CONFIGURATION RENAME TO BCK_CONFIGURATION; +ALTER TABLE SMP_CONFIGURATION_AUD RENAME TO BCK_CONFIGURATION_AUD; +ALTER TABLE SMP_DOMAIN RENAME TO BCK_DOMAIN; +ALTER TABLE SMP_DOMAIN_AUD RENAME TO BCK_DOMAIN_AUD; +ALTER TABLE SMP_OWNERSHIP RENAME TO BCK_OWNERSHIP; +ALTER TABLE SMP_OWNERSHIP_AUD RENAME TO BCK_OWNERSHIP_AUD; +ALTER TABLE SMP_REV_INFO RENAME TO BCK_REV_INFO; +ALTER TABLE SMP_SERVICE_GROUP RENAME TO BCK_SERVICE_GROUP; +ALTER TABLE SMP_SERVICE_GROUP_AUD RENAME TO BCK_SERVICE_GROUP_AUD; +ALTER TABLE SMP_SERVICE_GROUP_DOMAIN RENAME TO BCK_SERVICE_GROUP_DOMAIN; +ALTER TABLE SMP_SERVICE_GROUP_DOMAIN_AUD RENAME TO BCK_SERVICE_GROUP_DOMAIN_AUD; +ALTER TABLE SMP_SERVICE_METADATA RENAME TO BCK_SERVICE_METADATA; +ALTER TABLE SMP_SERVICE_METADATA_AUD RENAME TO BCK_SERVICE_METADATA_AUD; +ALTER TABLE SMP_SERVICE_METADATA_XML RENAME TO BCK_SERVICE_METADATA_XML; +ALTER TABLE SMP_SERVICE_METADATA_XML_AUD RENAME TO BCK_SERVICE_METADATA_XML_AUD; +ALTER TABLE SMP_SG_EXTENSION RENAME TO BCK_SG_EXTENSION; +ALTER TABLE SMP_SG_EXTENSION_AUD RENAME TO BCK_SG_EXTENSION_AUD; +ALTER TABLE SMP_USER RENAME TO BCK_USER; +ALTER TABLE SMP_USER_AUD RENAME TO BCK_USER_AUD; -- create new sequences create sequence SMP_CREDENTIAL_SEQ start with 1 increment by 1; @@ -77,13 +77,14 @@ declare begin select SMP_SERVICE_GROUP_DOMAIN_SEQ.nextval into l_new_seq from dual; select SMP_DOMAIN_SEQ.nextval into l_new_seqDom from dual; - execute immediate 'create sequence SMP_DOMAIN_RESOURCE_DEF_SEQ start with ' || l_new_seq || ' increment by 1'; + execute immediate 'create sequence SMP_RESOURCE_SEQ start with ' || l_new_seq || ' increment by 1'; + execute immediate 'create sequence SMP_DOMAIN_RESOURCE_DEF_SEQ start with ' || l_new_seqDom || ' increment by 1'; execute immediate 'create sequence SMP_GROUP_SEQ start with ' || l_new_seqDom || ' increment by 1'; end; / --SMP_SERVICE_GROUP_DOMAIN_SEQ -rename SMP_SERVICE_GROUP_SEQ TO SMP_RESOURCE_SEQ; +--rename SMP_SERVICE_GROUP_SEQ TO SMP_RESOURCE_SEQ; rename SMP_SERVICE_METADATA_SEQ TO SMP_SUBRESOURCE_SEQ; diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl index d4e8af153a8f1ea5fd7895b17b9362e3b77619b2..f84fe2e93c33606b68dd2dab7964b2dc10bedbc7 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb-drop.ddl @@ -1,5 +1,5 @@ -- ------------------------------------------------------------------------ --- This file was generated by hibernate for SMP version 5.0-SNAPSHOT. +-- This file was generated by hibernate for SMP version 5.0-RC2-SNAPSHOT. -- ------------------------------------------------------------------------ diff --git a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl index eca731eb51360ac34b7d523abe532c36153cf871..895165eda6558643afa3779ec623c77eec95e32d 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/mysql5innodb.ddl @@ -1,5 +1,5 @@ -- ------------------------------------------------------------------------ --- This file was generated by hibernate for SMP version 5.0-SNAPSHOT. +-- This file was generated by hibernate for SMP version 5.0-RC2-SNAPSHOT. -- ------------------------------------------------------------------------ diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl index 952ef7b688b5eb6ca3abb21bfbf939cee9b6cb44..37eb165dff16c7b8273b2f297bb24763b2594587 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g-drop.ddl @@ -1,5 +1,5 @@ -- ------------------------------------------------------------------------ --- This file was generated by hibernate for SMP version 5.0-SNAPSHOT. +-- This file was generated by hibernate for SMP version 5.0-RC2-SNAPSHOT. -- ------------------------------------------------------------------------ diff --git a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl index 09b563d16c4bd90f3a8911b8f3ead87986a289f5..e01f9113313dabffe370377717ab8b166f5abf9d 100644 --- a/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl +++ b/smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl @@ -1,5 +1,5 @@ -- ------------------------------------------------------------------------ --- This file was generated by hibernate for SMP version 5.0-SNAPSHOT. +-- This file was generated by hibernate for SMP version 5.0-RC2-SNAPSHOT. -- ------------------------------------------------------------------------ create sequence SMP_ALERT_PROP_SEQ start with 1 increment by 1; diff --git a/smp-webapp/src/main/webapp/WEB-INF/weblogic.xml b/smp-webapp/src/main/webapp/WEB-INF/weblogic.xml index 15a5a759f4ef63a85713655cc1d6898277c6e1cc..b95125410d7e440148269b633ef540e7a2356698 100644 --- a/smp-webapp/src/main/webapp/WEB-INF/weblogic.xml +++ b/smp-webapp/src/main/webapp/WEB-INF/weblogic.xml @@ -19,6 +19,8 @@ <!-- used by Hibernate and JPA --> <package-name>javax.persistence.*</package-name> <package-name>javassist.*</package-name> + <package-name>org.hibernate.*</package-name> + <package-name>org.springframework.*</package-name> <!-- used for logging --> <package-name>org.slf4j.*</package-name> @@ -34,4 +36,4 @@ <resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name> </prefer-application-resources> </container-descriptor> -</weblogic-web-app> \ No newline at end of file +</weblogic-web-app>