diff --git a/smp-server-library/database/create-Mysql.sql b/smp-server-library/database/create-Mysql.sql index 8e61c71df594d8ca6bfdad3eec6a5068e5770bfd..bbb9f1818dc2ca8e557262c1efc13c2e08151e1d 100644 --- a/smp-server-library/database/create-Mysql.sql +++ b/smp-server-library/database/create-Mysql.sql @@ -1,12 +1,9 @@ +-- Copyright 2018 European Commission | CEF eDelivery -- --- Copyright 2017 European Commission | CEF eDelivery --- --- 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"); +-- Licensed under the EUPL, Version 1.2 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: --- https://joinup.ec.europa.eu/software/page/eupl --- or file: LICENCE-EUPL-v1.1.pdf +-- You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf -- -- 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. diff --git a/smp-server-library/database/create-Oracle.sql b/smp-server-library/database/create-Oracle.sql index 3a2df8c6076f4e45f37d727b4475fcc7fc03b63a..0c53481557e5345d78148b6524fef9dce308275c 100644 --- a/smp-server-library/database/create-Oracle.sql +++ b/smp-server-library/database/create-Oracle.sql @@ -1,23 +1,35 @@ -- --- Copyright 2017 European Commission | CEF eDelivery +-- Copyright 2018 European Commission | CEF eDelivery -- --- 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"); +-- Licensed under the EUPL, Version 1.2 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: --- https://joinup.ec.europa.eu/software/page/eupl --- or file: LICENCE-EUPL-v1.1.pdf +-- You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf -- -- 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. +CREATE TABLE smp_domain ( + domainId VARCHAR(50), + bdmslClientCertHeader VARCHAR(4000), + bdmslClientCertAlias VARCHAR(50), + signatureCertAlias VARCHAR(50), + PRIMARY KEY(domainId), + CONSTRAINT check_max_one_auth CHECK ( + NOT (bdmslClientCertAlias IS NOT NULL AND bdmslClientCertHeader IS NOT NULL) + ) +); CREATE TABLE smp_service_group ( extension CLOB, businessIdentifier VARCHAR(50) NOT NULL, businessIdentifierScheme VARCHAR(100) NOT NULL, - PRIMARY KEY (businessIdentifier, businessIdentifierScheme) + domainId VARCHAR(50) DEFAULT 'default' NOT NULL, + PRIMARY KEY (businessIdentifier, businessIdentifierScheme), + CONSTRAINT + FK_srv_group_domain FOREIGN KEY (domainId) + REFERENCES smp_domain (domainId) ); CREATE TABLE smp_service_metadata ( @@ -55,3 +67,10 @@ CREATE TABLE smp_ownership ( businessIdentifier, businessIdentifierScheme) REFERENCES smp_service_group (businessIdentifier, businessIdentifierScheme) ); + + +INSERT INTO smp_domain(domainId) VALUES('default'); +--default admin user with password "changeit" +INSERT INTO smp_user(username, password, isadmin) VALUES ('smp_admin', '$2a$10$SZXMo7K/wA.ULWxH7uximOxeNk4mf3zU6nxJx/2VfKA19QlqwSpNO', '1'); + +commit; \ No newline at end of file diff --git a/smp-server-library/database/migration from 3.0.x to 4.0.0/oracle_3.0_to_4.0.sql b/smp-server-library/database/migration from 3.0.x to 4.0.0/oracle_3.0_to_4.0.sql new file mode 100644 index 0000000000000000000000000000000000000000..f7939f5dcebf7f802e490ee49e00bddb01d8558d --- /dev/null +++ b/smp-server-library/database/migration from 3.0.x to 4.0.0/oracle_3.0_to_4.0.sql @@ -0,0 +1,36 @@ +-- Copyright 2018 European Commission | CEF eDelivery +-- +-- Licensed under the EUPL, Version 1.2 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 attached in file: LICENCE-EUPL-v1.2.pdf +-- +-- 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. + +CREATE TABLE smp_domain ( + domainId VARCHAR(50), + bdmslClientCertHeader VARCHAR(4000), + bdmslClientCertAlias VARCHAR(50), + signatureCertAlias VARCHAR(50), + PRIMARY KEY(domainId), + CONSTRAINT check_max_one_auth CHECK ( + NOT (bdmslClientCertAlias IS NOT NULL AND bdmslClientCertHeader IS NOT NULL) + ) +); + +INSERT INTO smp_domain(domainId) VALUES('default'); + +ALTER TABLE smp_service_group ADD ( + domainId VARCHAR(50) DEFAULT 'default' NOT NULL +); + +ALTER TABLE smp_service_group ADD ( + CONSTRAINT + FK_srv_group_domain FOREIGN KEY (domainId) + REFERENCES smp_domain (domainId) +); + + +commit; \ No newline at end of file diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java index ca5a584308f5a4a04556290fcb53c5bd1d04736a..f9f53ff997c888dfdf9173f615e0f83af2c6c37b 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java @@ -18,7 +18,7 @@ package eu.europa.ec.edelivery.smp.data.model; */ public class CommonColumnsLengths { public static final int MAX_IDENTIFIER_SCHEME_LENGTH = 100; - public static final int MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH = 50; + public static final int MAX_IDENTIFIER_VALUE_LENGTH = 50; public static final int MAX_DOCUMENT_TYPE_IDENTIFIER_VALUE_LENGTH = 500; public static final int MAX_USERNAME_LENGTH = 256; } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBOwnershipId.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBOwnershipId.java index 76c0513ea1baea7301f321c0667eb5fda74e9609..0ec6768eb6b3a4ba000cbe95c83cf5139d78663b 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBOwnershipId.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBOwnershipId.java @@ -48,7 +48,7 @@ public class DBOwnershipId implements Serializable { return participantIdScheme; } - @Column(name = "businessIdentifier", nullable = false, length = CommonColumnsLengths.MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH) + @Column(name = "businessIdentifier", nullable = false, length = CommonColumnsLengths.MAX_IDENTIFIER_VALUE_LENGTH) public String getBusinessIdentifier() { return participantIdValue; } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupId.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupId.java index 5016f5f2033456792a363a3445d860b5279bb4eb..860d95e1f8523a2deadca2c7114ae4723d3d5256 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupId.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceGroupId.java @@ -21,7 +21,7 @@ import javax.persistence.Embeddable; import java.io.Serializable; import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_IDENTIFIER_SCHEME_LENGTH; -import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH; +import static eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths.MAX_IDENTIFIER_VALUE_LENGTH; @Embeddable @ToString @@ -46,7 +46,7 @@ public class DBServiceGroupId implements Serializable { return participantIdScheme; } - @Column(name = "businessIdentifier", nullable = false, length = MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH) + @Column(name = "businessIdentifier", nullable = false, length = MAX_IDENTIFIER_VALUE_LENGTH) public String getBusinessIdentifier() { return participantIdValue; } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java index 74f12d5880b40e14e4396c895f66d2ddede17c45..85daf17d13323be90755de0fa4fb12258819bacd 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java @@ -50,7 +50,7 @@ public class DBServiceMetadataId implements Serializable { return participantIdScheme; } - @Column(name = "businessIdentifier", nullable = false, length = MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH) + @Column(name = "businessIdentifier", nullable = false, length = MAX_IDENTIFIER_VALUE_LENGTH) public String getBusinessIdentifier() { return participantIdValue; }