├── docs └── validation-pyramid.png ├── phive-xml ├── src │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ └── com.helger.schematron.svrl.ISVRLLocationBeautifierSPI │ │ │ └── NOTICE │ │ └── java │ │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── xml │ │ │ ├── schematron │ │ │ ├── ESchematronOutput.java │ │ │ ├── LocationBeautifierSPI.java │ │ │ ├── ESchematronEngine.java │ │ │ ├── SchematronNamespaceBeautifier.java │ │ │ └── CustomErrorDetails.java │ │ │ └── source │ │ │ ├── ValidationSourceXMLReadableResource.java │ │ │ └── IValidationSourceXML.java │ ├── etc │ │ └── license-template.txt │ └── test │ │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── xml │ │ │ ├── SPITest.java │ │ │ └── schematron │ │ │ └── CustomErrorDetailsTest.java │ │ └── resources │ │ └── simplelogger.properties ├── findbugs-exclude.xml └── pom.xml ├── .gitignore ├── phive-ves-engine ├── src │ ├── test │ │ ├── resources │ │ │ └── ves │ │ │ │ ├── test2 │ │ │ │ ├── UBL-2.1-xsdrt.zip │ │ │ │ └── xsd.ves │ │ │ │ ├── test1 │ │ │ │ ├── mini-valid.xml │ │ │ │ ├── mini1.sch │ │ │ │ ├── mini2.sch │ │ │ │ ├── sch3.status │ │ │ │ ├── mini.xsd │ │ │ │ ├── xsd.ves │ │ │ │ ├── sch1.ves │ │ │ │ ├── sch2.ves │ │ │ │ ├── sch3.ves │ │ │ │ └── sch4-snapshot.ves │ │ │ │ └── test3 │ │ │ │ ├── mini.xsd │ │ │ │ ├── xsd1.ves │ │ │ │ └── xsd2.ves │ │ └── java │ │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── ves │ │ │ └── engine │ │ │ └── SPITest.java │ ├── main │ │ ├── resources │ │ │ └── NOTICE │ │ └── java │ │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── ves │ │ │ └── engine │ │ │ └── load │ │ │ ├── VESLoadingException.java │ │ │ ├── IVESSpecificDeferredLoader.java │ │ │ ├── catalog │ │ │ ├── EVESCatalogType.java │ │ │ ├── VESCatalogEntry.java │ │ │ └── VESCatalog.java │ │ │ ├── IVESAsyncLoader.java │ │ │ ├── IVESLoaderXSD.java │ │ │ ├── IVESLoaderEdifact.java │ │ │ ├── IVESLoaderSchematron.java │ │ │ └── VESValidationResult.java │ └── etc │ │ └── license-template.txt └── findbugs-exclude.xml ├── phive-api ├── src │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── services │ │ │ │ │ └── com.helger.diver.api.version.spi.IDVRPseudoVersionRegistrarSPI │ │ │ └── NOTICE │ │ └── java │ │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── api │ │ │ ├── source │ │ │ ├── IValidationSourceBinary.java │ │ │ ├── IValidationSource.java │ │ │ └── ValidationSourceBinary.java │ │ │ ├── execute │ │ │ ├── IValidationExecutorCacheSupport.java │ │ │ └── IValidationExecutionManager.java │ │ │ ├── validity │ │ │ ├── ValidityDeterminatorRegistry.java │ │ │ ├── EExtendedValidity.java │ │ │ └── IValidityDeterminator.java │ │ │ ├── IValidationType.java │ │ │ ├── artefact │ │ │ ├── IValidationArtefact.java │ │ │ └── ValidationArtefact.java │ │ │ ├── EValidationBaseType.java │ │ │ ├── executorset │ │ │ ├── status │ │ │ │ ├── EValidationExecutorStatusType.java │ │ │ │ ├── ValidationExecutorSetStatusHistoryItem.java │ │ │ │ └── IValidationExecutorSetStatus.java │ │ │ ├── IValidationExecutorSet.java │ │ │ └── IValidationExecutorSetMutable.java │ │ │ ├── executor │ │ │ └── IValidationExecutor.java │ │ │ ├── diver │ │ │ └── IGenericPseudoVersionResolver.java │ │ │ ├── mock │ │ │ └── PhiveTestFile.java │ │ │ ├── config │ │ │ └── PhivePseudoVersionRegistrarSPIImpl.java │ │ │ ├── ValidationType.java │ │ │ └── EValidationType.java │ ├── etc │ │ └── license-template.txt │ └── test │ │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── api │ │ │ ├── SPITest.java │ │ │ ├── EValidationTypeTest.java │ │ │ ├── executorset │ │ │ └── status │ │ │ │ ├── EValidationExecutorStatusTypeTest.java │ │ │ │ └── ValidationExecutorSetStatusTest.java │ │ │ └── artefact │ │ │ └── ValidationArtefactTest.java │ │ └── resources │ │ └── simplelogger.properties ├── findbugs-exclude.xml └── pom.xml ├── phive-result ├── src │ ├── main │ │ ├── resources │ │ │ └── NOTICE │ │ └── java │ │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── result │ │ │ └── IValidationSourceRestorer.java │ ├── etc │ │ └── license-template.txt │ └── test │ │ ├── resources │ │ ├── test │ │ │ ├── schema1.xml │ │ │ └── schema1.xsd │ │ └── simplelogger.properties │ │ └── java │ │ └── com │ │ └── helger │ │ └── phive │ │ └── result │ │ ├── SPITest.java │ │ └── exception │ │ └── PhiveRestoredExceptionTest.java ├── findbugs-exclude.xml └── pom.xml ├── phive-ves-model ├── src │ ├── main │ │ ├── resources │ │ │ └── NOTICE │ │ ├── java │ │ │ └── com │ │ │ │ └── helger │ │ │ │ └── phive │ │ │ │ └── ves │ │ │ │ └── model │ │ │ │ └── v1 │ │ │ │ ├── VES1Marshaller.java │ │ │ │ ├── VESStatus1Marshaller.java │ │ │ │ ├── CVES1.java │ │ │ │ └── EVESSyntax.java │ │ └── jaxb │ │ │ └── bindings.xjb │ ├── etc │ │ └── license-template.txt │ └── test │ │ ├── java │ │ └── com │ │ │ └── helger │ │ │ └── phive │ │ │ └── ves │ │ │ └── model │ │ │ ├── v1 │ │ │ ├── CVES1Test.java │ │ │ ├── VES1MarshallerTest.java │ │ │ └── VESStatus1MarshallerTest.java │ │ │ └── SPITest.java │ │ └── resources │ │ ├── ves │ │ └── v1 │ │ │ ├── ves-edifact-desadv-d01b.xml │ │ │ ├── ves-xsd-ubl-creditnote-2.1.xml │ │ │ ├── ves-sch-peppol-bis-billing-ubl-invoice-2023.05.xml │ │ │ ├── ves-sch-xrechnung-ubl-invoice-2.3.1.xml │ │ │ ├── ves-sch-en16931-ubl-creditnote-1.3.10.xml │ │ │ ├── ves-xsd-ubl-invoice-2.1.xml │ │ │ └── ves-sch-en16931-ubl-invoice-1.3.10.xml │ │ └── vesstatus │ │ └── v1 │ │ └── ves-sch-peppol-bis-billing-ubl-invoice-2023.05.xml └── findbugs-exclude.xml ├── src └── etc │ └── license-template.txt ├── .github └── workflows │ └── maven.yml └── CODE_OF_CONDUCT.md /docs/validation-pyramid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phive/HEAD/docs/validation-pyramid.png -------------------------------------------------------------------------------- /phive-xml/src/main/resources/META-INF/services/com.helger.schematron.svrl.ISVRLLocationBeautifierSPI: -------------------------------------------------------------------------------- 1 | com.helger.phive.xml.schematron.LocationBeautifierSPI 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | *.pmd 3 | *.iml 4 | .idea/ 5 | .settings/ 6 | .project 7 | .classpath 8 | ~*.xlsx 9 | zz 10 | phive-engine/ 11 | phive-json/ 12 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test2/UBL-2.1-xsdrt.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phax/phive/HEAD/phive-ves-engine/src/test/resources/ves/test2/UBL-2.1-xsdrt.zip -------------------------------------------------------------------------------- /phive-api/src/main/resources/META-INF/services/com.helger.diver.api.version.spi.IDVRPseudoVersionRegistrarSPI: -------------------------------------------------------------------------------- 1 | com.helger.phive.api.config.PhivePseudoVersionRegistrarSPIImpl 2 | -------------------------------------------------------------------------------- /phive-api/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phive-result/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phive-xml/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/resources/NOTICE: -------------------------------------------------------------------------------- 1 | ============================================================================= 2 | = NOTICE file corresponding to section 4d of the Apache License Version 2.0 = 3 | ============================================================================= 4 | This product includes Open Source Software developed by 5 | Philip Helger - https://www.helger.com/ 6 | -------------------------------------------------------------------------------- /src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-api/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-xml/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-result/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-ves-model/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2023-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-ves-engine/src/etc/license-template.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2023-2025 Philip Helger (www.helger.com) 2 | philip[at]helger[dot]com 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. -------------------------------------------------------------------------------- /phive-api/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-xml/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-result/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-ves-engine/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-ves-model/findbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/mini-valid.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | ber Hallo 22 | 23 | -------------------------------------------------------------------------------- /phive-result/src/test/resources/test/schema1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/mini1.sch: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | Ich kaufe ein 'a' 24 | 25 | 26 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/mini2.sch: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | Text ohne Hallo geht gar nicht 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /phive-api/src/test/java/com/helger/phive/api/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.unittestext.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-xml/src/test/java/com/helger/phive/xml/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.unittestext.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-result/src/test/java/com/helger/phive/result/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.result; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.unittestext.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/java/com/helger/phive/ves/model/v1/CVES1Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import static org.junit.Assert.assertTrue; 20 | 21 | import org.junit.Test; 22 | 23 | /** 24 | * Test class for class {@link CVES1}. 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class CVES1Test 29 | { 30 | @Test 31 | public void testBasic () 32 | { 33 | assertTrue (CVES1.XSD_RES.exists ()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/java/com/helger/phive/ves/model/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.unittestext.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/java/com/helger/phive/ves/engine/SPITest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine; 18 | 19 | import org.junit.Test; 20 | 21 | import com.helger.unittestext.SPITestHelper; 22 | 23 | /** 24 | * Test SPI definitions 25 | * 26 | * @author Philip Helger 27 | */ 28 | public final class SPITest 29 | { 30 | @Test 31 | public void testBasic () throws Exception 32 | { 33 | SPITestHelper.testIfAllSPIImplementationsAreValid (); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/sch3.status: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_sch 23 | 3.0 24 | 25 | 2023-08-30T17:10:05+02:00 26 | 27 | 28 | 2023-08-07T00:00:00+02:00 29 | 30 | 31 | Initial version 32 | 33 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/source/IValidationSourceBinary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.source; 18 | 19 | import org.jspecify.annotations.Nullable; 20 | 21 | import com.helger.base.array.bytes.ByteArrayWrapper; 22 | 23 | /** 24 | * Binary validation source. 25 | * 26 | * @author Philip Helger 27 | * @since 6.0.3 28 | */ 29 | public interface IValidationSourceBinary extends IValidationSource 30 | { 31 | String VALIDATION_SOURCE_TYPE = "binary"; 32 | 33 | /** 34 | * @return The bytes to be validated. May be null. 35 | */ 36 | @Nullable 37 | ByteArrayWrapper getBytes (); 38 | } 39 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/mini.xsd: -------------------------------------------------------------------------------- 1 | 2 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test3/mini.xsd: -------------------------------------------------------------------------------- 1 | 2 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /phive-result/src/test/resources/test/schema1.xsd: -------------------------------------------------------------------------------- 1 | 2 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESLoadingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | /** 22 | * Specific exception when VES loading fails (e.g. on lazy requirement 23 | * resolution) 24 | * 25 | * @author Philip Helger 26 | */ 27 | public class VESLoadingException extends RuntimeException 28 | { 29 | public VESLoadingException (@NonNull final String sMsg) 30 | { 31 | super (sMsg); 32 | } 33 | 34 | public VESLoadingException (@NonNull final String sMsg, @NonNull final Exception aCause) 35 | { 36 | super (sMsg, aCause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/xsd.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_xsd 23 | 1.0 24 | 25 | phive XSD test 1.0 26 | 27 | 28 | 29 | com.helger.phive.test 30 | mini 31 | 1.0 32 | xsd 33 | 34 | 35 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/java/com/helger/phive/ves/model/v1/VES1Marshaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import com.helger.collection.commons.CommonsArrayList; 20 | import com.helger.jaxb.GenericJAXBMarshaller; 21 | import com.helger.phive.ves.v10.ObjectFactory; 22 | import com.helger.phive.ves.v10.VesType; 23 | 24 | /** 25 | * A marshaller to read VES v1 declarations. 26 | * 27 | * @author Philip Helger 28 | */ 29 | public class VES1Marshaller extends GenericJAXBMarshaller 30 | { 31 | public VES1Marshaller () 32 | { 33 | super (VesType.class, new CommonsArrayList <> (CVES1.XSD_RES), new ObjectFactory ()::createVes); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-edifact-desadv-d01b.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.edifact 22 | test-desadv-d01b 23 | 1.4.0 24 | 25 | Test binding for DESADV D01B 26 | 27 | 28 | 29 | D01B 30 | DESADV 31 | EANCOM 32 | CUSTOMER 33 | 34 | 37 | 38 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test2/xsd.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test2 22 | test_xsd 23 | 1 24 | 25 | phive XSD test with ZIP 26 | 27 | 28 | 29 | com.helger.phive.test2 30 | UBL-xsdrt 31 | 2.1 32 | zip 33 | 34 | 35 | 36 |
xsdrt/maindoc/UBL-Invoice-2.1.xsd
37 |
38 |
39 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/vesstatus/v1/ves-sch-peppol-bis-billing-ubl-invoice-2023.05.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | org.peppol.billing 22 | ubl-invoice 23 | 2023.5 24 | 25 | 26 | 2023-08-30T17:10:05+02:00 27 | 28 | 29 | 2023-08-07T00:00:00+02:00 30 | 31 | 32 | Initial version 33 | 34 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/sch1.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_sch 23 | 1.0 24 | 25 | phive SCH test 26 | 27 | 28 | 29 | 30 | 31 | com.helger.phive.test 32 | mini-sch1 33 | 2023.8 34 | sch 35 | 36 | 37 | iso-schematron 38 | 39 | 40 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test3/xsd1.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test3 22 | xsd1 23 | 1.0 24 | 25 | bla 26 | 27 | 28 | com.helger.phive.test3 29 | xsd2 30 | 1.0 31 | 32 | 33 | 34 | 35 | com.helger.phive.test3 36 | mini 37 | 1.0 38 | xsd 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test3/xsd2.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test3 22 | xsd2 23 | 1.0 24 | 25 | foo 26 | 27 | 28 | com.helger.phive.test3 29 | xsd1 30 | 1.0 31 | 32 | 33 | 34 | 35 | com.helger.phive.test3 36 | mini 37 | 1.0 38 | xsd 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/java/com/helger/phive/ves/model/v1/VESStatus1Marshaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import com.helger.collection.commons.CommonsArrayList; 20 | import com.helger.jaxb.GenericJAXBMarshaller; 21 | import com.helger.phive.ves.v10.ObjectFactory; 22 | import com.helger.phive.ves.v10.VesStatusType; 23 | 24 | /** 25 | * A marshaller to read VES Status v1 declarations. 26 | * 27 | * @author Philip Helger 28 | */ 29 | public class VESStatus1Marshaller extends GenericJAXBMarshaller 30 | { 31 | public VESStatus1Marshaller () 32 | { 33 | super (VesStatusType.class, new CommonsArrayList <> (CVES1.XSD_RES), new ObjectFactory ()::createStatus); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-xsd-ubl-creditnote-2.1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | org.oasis-open.ubl 22 | creditnote 23 | 2.1 24 | 25 | OASIS UBL 2.1 CreditNote 26 | 27 | 28 | 29 | 30 | org.oasis-open 31 | ubl 32 | 2.1 33 | zip 34 | 35 | 36 |
xsdrt/maindoc/UBL-CreditNote-2.1.xsd
37 |
38 |
39 | -------------------------------------------------------------------------------- /phive-api/src/test/java/com/helger/phive/api/EValidationTypeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import static org.junit.Assert.assertSame; 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import org.junit.Test; 23 | 24 | import com.helger.base.string.StringHelper; 25 | 26 | /** 27 | * Test class for class {@link EValidationType}. 28 | * 29 | * @author Philip Helger 30 | */ 31 | public final class EValidationTypeTest 32 | { 33 | @Test 34 | public void testBasic () 35 | { 36 | for (final EValidationType e : EValidationType.values ()) 37 | { 38 | assertTrue (StringHelper.isNotEmpty (e.getID ())); 39 | assertSame (e, EValidationType.getFromIDOrNull (e.getID ())); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESSpecificDeferredLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.diagnostics.error.list.ErrorList; 22 | 23 | /** 24 | * Internal helper interface 25 | * 26 | * @author Philip Helger 27 | */ 28 | @FunctionalInterface 29 | interface IVESSpecificDeferredLoader 30 | { 31 | /** 32 | * Load a VESID asynchronously 33 | * 34 | * @param aErrorList 35 | * The error list to be filled. May not be null. 36 | * @return The loaded VES object. Never null. 37 | */ 38 | @NonNull 39 | LoadedVES deferredLoad (@NonNull ErrorList aErrorList); 40 | } 41 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path 3 | 4 | name: Maven deploy Snapshots 5 | 6 | on: 7 | push: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | java: [ 17, 21, 25 ] 15 | name: Java ${{ matrix.java }} build 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Set up JDK ${{ matrix.java }} 20 | uses: actions/setup-java@v4 21 | with: 22 | java-version: ${{ matrix.java }} 23 | distribution: 'adopt' 24 | server-id: central 25 | server-username: MAVEN_USERNAME 26 | server-password: MAVEN_PASSWORD 27 | 28 | - name: Cache local Maven repository 29 | uses: actions/cache@v4 30 | with: 31 | path: ~/.m2/repository 32 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 33 | restore-keys: | 34 | ${{ runner.os }}-maven- 35 | 36 | - name: Publish to the Maven Central Repository 37 | run: mvn --batch-mode --update-snapshots -P release-snapshot deploy 38 | if: matrix.java == 17 39 | env: 40 | MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 41 | MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 42 | 43 | - name: Maven Build 44 | run: mvn --batch-mode --update-snapshots install 45 | if: matrix.java != 17 46 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/java/com/helger/phive/ves/model/v1/CVES1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import com.helger.annotation.concurrent.Immutable; 20 | import com.helger.io.resource.ClassPathResource; 21 | 22 | /** 23 | * Constants for the VES1 data model 24 | * 25 | * @author Philip Helger 26 | */ 27 | @Immutable 28 | public final class CVES1 29 | { 30 | /** 31 | * The namespace URI of the VES1 XML data model 32 | */ 33 | public static final String NAMESPACE_URI = "urn:com:helger:phive:ves:v1.0"; 34 | 35 | /** 36 | * The XML Schema path to validate against. 37 | */ 38 | public static final ClassPathResource XSD_RES = new ClassPathResource ("schemas/ves/ves-1.0.xsd", 39 | CVES1.class.getClassLoader ()); 40 | 41 | private CVES1 () 42 | {} 43 | } 44 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/sch2.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_sch 23 | 2.0 24 | 25 | phive SCH test with requires 26 | 27 | 28 | com.helger.phive.test 29 | test_xsd 30 | 1.0 31 | 32 | 33 | 34 | 35 | com.helger.phive.test 36 | mini-sch1 37 | 2023.8 38 | sch 39 | 40 | 41 | iso-schematron 42 | 43 | 44 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/sch3.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_sch 23 | 3.0 24 | 25 | phive SCH test with nested SCH requires 26 | 27 | 28 | com.helger.phive.test 29 | test_sch 30 | 2.0 31 | 32 | 33 | 34 | 35 | com.helger.phive.test 36 | mini-sch2 37 | 2023.8 38 | sch 39 | 40 | 41 | iso-schematron 42 | 43 | 44 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-sch-peppol-bis-billing-ubl-invoice-2023.05.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | org.peppol.billing 22 | ubl-invoice 23 | 2023.5 24 | 25 | Peppol BIS Billing UBL Invoice May 2023 26 | 2023-05-06 27 | 28 | 29 | eu.cen.en16931 30 | ubl-invoice 31 | 1.3.10 32 | 33 | 34 | 35 | 36 | org.peppol.billing 37 | ubl 38 | 2023.5 39 | xslt 40 | 41 | 42 | iso-schematron 43 | 44 | -------------------------------------------------------------------------------- /phive-ves-engine/src/test/resources/ves/test1/sch4-snapshot.ves: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | com.helger.phive.test 22 | test_sch 23 | 4.0-SNAPSHOT 24 | 25 | phive SCH test with nested SCH requires 26 | 27 | 28 | com.helger.phive.test 29 | test_sch 30 | 2.0 31 | 32 | 33 | 34 | 35 | com.helger.phive.test 36 | mini-sch2 37 | 2023.8 38 | sch 39 | 40 | 41 | iso-schematron 42 | 43 | 44 | -------------------------------------------------------------------------------- /phive-api/src/test/java/com/helger/phive/api/executorset/status/EValidationExecutorStatusTypeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset.status; 18 | 19 | import static org.junit.Assert.assertNull; 20 | import static org.junit.Assert.assertSame; 21 | import static org.junit.Assert.assertTrue; 22 | 23 | import org.junit.Test; 24 | 25 | import com.helger.base.string.StringHelper; 26 | 27 | /** 28 | * Test class for class {@link EValidationExecutorStatusType}. 29 | * 30 | * @author Philip Helger 31 | */ 32 | public final class EValidationExecutorStatusTypeTest 33 | { 34 | @Test 35 | public void testBasic () 36 | { 37 | for (final EValidationExecutorStatusType e : EValidationExecutorStatusType.values ()) 38 | { 39 | assertTrue (StringHelper.isNotEmpty (e.getID ())); 40 | assertSame (e, EValidationExecutorStatusType.getFromIDOrNull (e.getID ())); 41 | } 42 | 43 | assertNull (EValidationExecutorStatusType.getFromIDOrNull ("blafoo")); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/catalog/EVESCatalogType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load.catalog; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Catalog entry type 28 | * 29 | * @author Philip Helger 30 | */ 31 | public enum EVESCatalogType implements IHasID 32 | { 33 | PUBLIC ("public"), 34 | SYSTEM ("system"); 35 | 36 | private final String m_sID; 37 | 38 | EVESCatalogType (@NonNull @Nonempty final String sID) 39 | { 40 | m_sID = sID; 41 | } 42 | 43 | @NonNull 44 | @Nonempty 45 | public String getID () 46 | { 47 | return m_sID; 48 | } 49 | 50 | @Nullable 51 | public static EVESCatalogType getFromIDOrNull (@Nullable final String sID) 52 | { 53 | return EnumHelper.getFromIDOrNull (EVESCatalogType.class, sID); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/schematron/ESchematronOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Defines the potential Schematron output types. 28 | * 29 | * @author Philip Helger 30 | */ 31 | public enum ESchematronOutput implements IHasID 32 | { 33 | SVRL ("svrl"), 34 | OIOUBL ("oioubl"); 35 | 36 | private final String m_sID; 37 | 38 | ESchematronOutput (@NonNull @Nonempty final String sID) 39 | { 40 | m_sID = sID; 41 | } 42 | 43 | @NonNull 44 | @Nonempty 45 | public String getID () 46 | { 47 | return m_sID; 48 | } 49 | 50 | @Nullable 51 | public static ESchematronOutput getFromIDOrNull (@Nullable final String sID) 52 | { 53 | return EnumHelper.getFromIDOrNull (ESchematronOutput.class, sID); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESAsyncLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.diver.api.coord.DVRCoordinate; 23 | import com.helger.diver.repo.IRepoStorageReadItem; 24 | 25 | /** 26 | * Interface for an asynchronous on-demand loader for resources. 27 | * 28 | * @author Philip Helger 29 | */ 30 | public interface IVESAsyncLoader 31 | { 32 | /** 33 | * Load the resource with the provided VESID. 34 | * 35 | * @param aVESID 36 | * The VESID to load. May not be null. 37 | * @param sFileExt 38 | * The file extension to load. Must neither be null nor 39 | * empty. Must start with a dot (.). 40 | * @return null if loading the resource behind the VESID failed 41 | * (e.g. because no such resource exists). 42 | */ 43 | @Nullable 44 | IRepoStorageReadItem loadResource (@NonNull DVRCoordinate aVESID, @NonNull String sFileExt); 45 | } 46 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-sch-xrechnung-ubl-invoice-2.3.1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | de.kosit 22 | xrechnung23 23 | 1.8.1 24 | 25 | KoSIT XRechnung 2.3.x ruleset 1.8.1 26 | 27 | 28 | eu.cen.en16931 29 | ubl-invoice 30 | 1.3.10 31 | 32 | 33 | 34 | BR-CL-21 35 | warn 36 | 37 | 38 | BR-CL-23 39 | warn 40 | 41 | 42 | 43 | 44 | 45 | 46 | de.kosit 47 | xrechnung-ubl 48 | 1.8.1 49 | xslt 50 | 51 | 52 | iso-schematron 53 | 54 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/java/com/helger/phive/ves/model/v1/EVESSyntax.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Contains the overall supported syntaxes for the VES model 28 | * 29 | * @author Philip Helger 30 | */ 31 | public enum EVESSyntax implements IHasID 32 | { 33 | /** 34 | * XML Schema 35 | */ 36 | XSD ("xsd"), 37 | /** 38 | * Schematron 39 | */ 40 | SCHEMATRON ("schematron"), 41 | /** 42 | * Edifact 43 | */ 44 | EDIFACT ("edifact"); 45 | 46 | private final String m_sID; 47 | 48 | EVESSyntax (@NonNull @Nonempty final String sID) 49 | { 50 | m_sID = sID; 51 | } 52 | 53 | @NonNull 54 | @Nonempty 55 | public String getID () 56 | { 57 | return m_sID; 58 | } 59 | 60 | @Nullable 61 | public static EVESSyntax getFromIDOrNull (@Nullable final String sID) 62 | { 63 | return EnumHelper.getFromIDOrNull (EVESSyntax.class, sID); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/schematron/LocationBeautifierSPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.style.IsSPIImplementation; 23 | import com.helger.annotation.style.UsedViaReflection; 24 | import com.helger.schematron.svrl.ISVRLLocationBeautifierSPI; 25 | 26 | /** 27 | * This is a {@link SchematronNamespaceBeautifier} implementation of the 28 | * {@link ISVRLLocationBeautifierSPI} implementation. 29 | * 30 | * @author Philip Helger 31 | */ 32 | @IsSPIImplementation 33 | public class LocationBeautifierSPI implements ISVRLLocationBeautifierSPI 34 | { 35 | @Deprecated (forRemoval = false) 36 | @UsedViaReflection 37 | public LocationBeautifierSPI () 38 | {} 39 | 40 | @Nullable 41 | public String getReplacementText (@NonNull final String sNamespaceURI, @NonNull final String sLocalName) 42 | { 43 | final String sPrefix = SchematronNamespaceBeautifier.getMapping (sNamespaceURI); 44 | if (sPrefix == null) 45 | return null; 46 | 47 | return sPrefix + ":" + sLocalName; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/java/com/helger/phive/ves/model/v1/VES1MarshallerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | 21 | import java.io.File; 22 | 23 | import org.junit.Test; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.helger.io.file.FileSystemIterator; 28 | import com.helger.io.file.IFileFilter; 29 | import com.helger.phive.ves.v10.VesType; 30 | 31 | /** 32 | * Test class for class {@link VES1Marshaller}. 33 | * 34 | * @author Philip Helger 35 | */ 36 | public final class VES1MarshallerTest 37 | { 38 | private static final Logger LOGGER = LoggerFactory.getLogger (VES1MarshallerTest.class); 39 | private static final String TEST_BASE_PATH = "src/test/resources/ves/v1/"; 40 | 41 | @Test 42 | public void testReadGoodExamples () 43 | { 44 | final VES1Marshaller m = new VES1Marshaller (); 45 | for (final File f : new FileSystemIterator (new File (TEST_BASE_PATH)).withFilter (IFileFilter.filenameEndsWith (".xml"))) 46 | { 47 | LOGGER.info ("Reading " + f.getName ()); 48 | final VesType aVES = m.read (f); 49 | assertNotNull (aVES); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/execute/IValidationExecutorCacheSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.execute; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | /** 22 | * Interface for validation executors that support caching. Each implementation 23 | * of IValidationExecutor is free to also implement this interface. 24 | * 25 | * @author Philip Helger 26 | * @since 3.1.1 27 | */ 28 | public interface IValidationExecutorCacheSupport 29 | { 30 | /** By default caching should be enabled. */ 31 | boolean DEFAULT_CACHE = true; 32 | 33 | /** 34 | * @return true if caching is enabled, false if not. 35 | */ 36 | boolean isCacheArtefact (); 37 | 38 | /** 39 | * Enable or disable caching. 40 | * 41 | * @param bCacheArtefact 42 | * true to enable caching, false to disable 43 | * it. 44 | * @return this for chaining 45 | */ 46 | @NonNull 47 | IValidationExecutorCacheSupport setCacheArtefact (boolean bCacheArtefact); 48 | 49 | /** 50 | * If caching of this artefact is enabled, ensure it is in the cache. 51 | * 52 | * @since 7.1.1 53 | */ 54 | void ensureItemIsInCache (); 55 | } 56 | -------------------------------------------------------------------------------- /phive-ves-model/src/main/jaxb/bindings.xjb: -------------------------------------------------------------------------------- 1 | 2 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/java/com/helger/phive/ves/model/v1/VESStatus1MarshallerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.model.v1; 18 | 19 | import static org.junit.Assert.assertNotNull; 20 | 21 | import java.io.File; 22 | 23 | import org.junit.Test; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import com.helger.io.file.FileSystemIterator; 28 | import com.helger.io.file.IFileFilter; 29 | import com.helger.phive.ves.v10.VesStatusType; 30 | 31 | /** 32 | * Test class for class {@link VESStatus1Marshaller}. 33 | * 34 | * @author Philip Helger 35 | */ 36 | public final class VESStatus1MarshallerTest 37 | { 38 | private static final Logger LOGGER = LoggerFactory.getLogger (VESStatus1MarshallerTest.class); 39 | private static final String TEST_BASE_PATH = "src/test/resources/vesstatus/v1/"; 40 | 41 | @Test 42 | public void testReadGoodExamples () 43 | { 44 | final VESStatus1Marshaller m = new VESStatus1Marshaller (); 45 | for (final File f : new FileSystemIterator (new File (TEST_BASE_PATH)).withFilter (IFileFilter.filenameEndsWith (".xml"))) 46 | { 47 | LOGGER.info ("Reading " + f.getName ()); 48 | final VesStatusType aVESStatus = m.read (f); 49 | assertNotNull (aVESStatus); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/validity/ValidityDeterminatorRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.validity; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.concurrent.Immutable; 22 | import com.helger.base.enforce.ValueEnforcer; 23 | import com.helger.diagnostics.error.list.IErrorList; 24 | 25 | /** 26 | * Helper class for validity determination implementations 27 | * 28 | * @author Philip Helger 29 | * @since 10.1.0 30 | */ 31 | @Immutable 32 | public final class ValidityDeterminatorRegistry 33 | { 34 | private ValidityDeterminatorRegistry () 35 | {} 36 | 37 | /** 38 | * Calculate the validity of an error list like this: if at least one entry of 39 | * error level "error" or more severe is contained, the overall validity is 40 | * invalid. 41 | * 42 | * @param aErrorList 43 | * The error list to scan. May not be null. 44 | * @return Never null. 45 | */ 46 | @NonNull 47 | public static EExtendedValidity getValidityOneErrorInvalid (@NonNull final IErrorList aErrorList) 48 | { 49 | ValueEnforcer.notNull (aErrorList, "ErrorList"); 50 | return aErrorList.containsAtLeastOneError () ? EExtendedValidity.INVALID : EExtendedValidity.VALID; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/IValidationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.style.MustImplementEqualsAndHashcode; 22 | import com.helger.base.id.IHasID; 23 | import com.helger.base.name.IHasName; 24 | 25 | /** 26 | * Interface for a validation type. That basically is a combination of syntax, 27 | * rule language and result layout. 28 | * 29 | * @author Philip Helger 30 | * @since 7.1.0 31 | * @see EValidationType 32 | */ 33 | @MustImplementEqualsAndHashcode 34 | public interface IValidationType extends IHasID , IHasName 35 | { 36 | /** 37 | * @return The validation based type. Never null. 38 | */ 39 | @NonNull 40 | EValidationBaseType getBaseType (); 41 | 42 | /** 43 | * @return true to stop validation if an error occurs when using 44 | * this validation type. This is helpful to avoid running Schematron 45 | * validations when the XML/XSD validations already failed. 46 | */ 47 | boolean isStopValidationOnError (); 48 | 49 | /** 50 | * @return true if the application of this validation type 51 | * requires additional context parameters. 52 | */ 53 | boolean isContextRequired (); 54 | } 55 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/schematron/ESchematronEngine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Defines the Schematron engine to be used. 28 | * 29 | * @author Philip Helger 30 | * @deprecated Use the same name enumeration from ph-schematron 31 | */ 32 | @Deprecated (forRemoval = true, since = "11.1.1") 33 | public enum ESchematronEngine implements IHasID 34 | { 35 | PURE (com.helger.schematron.ESchematronEngine.PURE.getID ()), 36 | ISO_SCHEMATRON (com.helger.schematron.ESchematronEngine.ISO_SCHEMATRON.getID ()), 37 | SCHXSLT (com.helger.schematron.ESchematronEngine.SCHXSLT1.getID ()); 38 | 39 | private final String m_sID; 40 | 41 | ESchematronEngine (@NonNull @Nonempty final String sID) 42 | { 43 | m_sID = sID; 44 | } 45 | 46 | @NonNull 47 | @Nonempty 48 | public String getID () 49 | { 50 | return m_sID; 51 | } 52 | 53 | @Nullable 54 | public static ESchematronEngine getFromIDOrNull (@Nullable final String sID) 55 | { 56 | return EnumHelper.getFromIDOrNull (ESchematronEngine.class, sID); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/artefact/IValidationArtefact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.artefact; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.style.MustImplementEqualsAndHashcode; 22 | import com.helger.io.resource.IReadableResource; 23 | import com.helger.phive.api.IValidationType; 24 | 25 | /** 26 | * Base interface for a validation artefact, consisting of a type and a readable 27 | * resource. 28 | * 29 | * @author Philip Helger 30 | */ 31 | @MustImplementEqualsAndHashcode 32 | public interface IValidationArtefact 33 | { 34 | /** 35 | * @return The validation artefact type - XSD or Schematron or so. May not be 36 | * null. 37 | */ 38 | @NonNull 39 | IValidationType getValidationType (); 40 | 41 | /** 42 | * @return The resource that contains the rules depending on the type (like 43 | * XSD or Schematron). Never null. 44 | * @see #getValidationType() 45 | */ 46 | @NonNull 47 | IReadableResource getRuleResource (); 48 | 49 | /** 50 | * @return The path of the rule resource to use. Defaults to 51 | * getRuleResource().getPath (). Never null. 52 | * @since 6.0.4 53 | */ 54 | @NonNull 55 | default String getRuleResourcePath () 56 | { 57 | return getRuleResource ().getPath (); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /phive-result/src/main/java/com/helger/phive/result/IValidationSourceRestorer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.result; 18 | 19 | import org.jspecify.annotations.Nullable; 20 | 21 | import com.helger.phive.api.source.IValidationSource; 22 | 23 | /** 24 | * Callback interface to restore a {@link IValidationSource} from deserialized 25 | * parameters. 26 | * 27 | * @author Philip Helger 28 | * @since 10.1.0 29 | */ 30 | public interface IValidationSourceRestorer 31 | { 32 | /** 33 | * Restore a validation source 34 | * 35 | * @param sValidationSourceTypeID 36 | * The validation source type ID. Must be non-null to be 37 | * able to restore something. 38 | * @param sSystemID 39 | * The system ID of the validation source. May be null. 40 | * @param bIsPartialSource 41 | * true if it is a partial source, false if 42 | * it is complete. 43 | * @param aPayloadBytes 44 | * The payload bytes to restore the source from. Must be 45 | * non-null to be able to restore something. 46 | * @return null if restore failed 47 | */ 48 | @Nullable 49 | IValidationSource restoreValidationSource (@Nullable String sValidationSourceTypeID, 50 | @Nullable String sSystemID, 51 | boolean bIsPartialSource, 52 | @Nullable byte [] aPayloadBytes); 53 | } 54 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/source/ValidationSourceXMLReadableResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.source; 18 | 19 | import javax.xml.transform.Source; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | 23 | import com.helger.base.tostring.ToStringGenerator; 24 | import com.helger.io.resource.IReadableResource; 25 | import com.helger.xml.serialize.read.DOMReader; 26 | import com.helger.xml.transform.TransformSourceFactory; 27 | 28 | /** 29 | * Special ValidationSourceXML based on a complete {@link IReadableResource}. 30 | * 31 | * @author Philip Helger 32 | * @since 10.1.0 33 | */ 34 | public class ValidationSourceXMLReadableResource extends ValidationSourceXML 35 | { 36 | private final IReadableResource m_aResource; 37 | 38 | public ValidationSourceXMLReadableResource (@NonNull final IReadableResource aResource) 39 | { 40 | // Read on demand only 41 | super (aResource.getPath (), () -> DOMReader.readXMLDOM (aResource), false); 42 | m_aResource = aResource; 43 | } 44 | 45 | @NonNull 46 | public final IReadableResource getResource () 47 | { 48 | return m_aResource; 49 | } 50 | 51 | @Override 52 | @NonNull 53 | public Source getAsTransformSource () 54 | { 55 | // Use resource as TransformSource to get error line and column 56 | return TransformSourceFactory.create (m_aResource); 57 | } 58 | 59 | @Override 60 | public String toString () 61 | { 62 | return ToStringGenerator.getDerived (super.toString ()).append ("Resource", m_aResource).getToString (); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /phive-api/src/test/java/com/helger/phive/api/executorset/status/ValidationExecutorSetStatusTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset.status; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | import static org.junit.Assert.assertNull; 21 | import static org.junit.Assert.assertSame; 22 | 23 | import java.time.OffsetDateTime; 24 | 25 | import org.junit.Test; 26 | 27 | import com.helger.datetime.helper.PDTFactory; 28 | import com.helger.unittest.support.TestHelper; 29 | 30 | /** 31 | * Test class for class {@link ValidationExecutorSetStatus}. 32 | * 33 | * @author Philip Helger 34 | */ 35 | public final class ValidationExecutorSetStatusTest 36 | { 37 | @Test 38 | public void testEmpty () 39 | { 40 | final OffsetDateTime aNow = PDTFactory.getCurrentOffsetDateTimeMillisOnlyUTC (); 41 | final ValidationExecutorSetStatus aStatus = ValidationExecutorSetStatus.createValidAt (aNow); 42 | assertEquals (aNow, aStatus.getStatusLastModification ()); 43 | assertSame (EValidationExecutorStatusType.VALID, aStatus.getType ()); 44 | assertNull (aStatus.getValidFrom ()); 45 | assertNull (aStatus.getValidTo ()); 46 | assertNull (aStatus.getDeprecationReason ()); 47 | assertNull (aStatus.getReplacementVESID ()); 48 | 49 | TestHelper.testDefaultImplementationWithEqualContentObject (aStatus, 50 | ValidationExecutorSetStatus.createValidAt (aNow)); 51 | TestHelper.testDefaultImplementationWithDifferentContentObject (aStatus, 52 | ValidationExecutorSetStatus.createValidAt (aNow.plusMinutes (1))); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-sch-en16931-ubl-creditnote-1.3.10.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | eu.cen.en16931 22 | ubl-creditnote 23 | 1.3.10 24 | 25 | EN16931 UBL CreditNote 26 | 2023-04-11 27 | 28 | 30 | 31 | org.oasis-open.ubl 32 | creditnote 33 | 2.1 34 | 35 | 36 | 37 | 38 | 39 | eu.cen.en16931 40 | ubl 41 | 1.3.10 42 | xslt 43 | 44 | iso-schematron 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-xsd-ubl-invoice-2.1.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | org.oasis-open.ubl 22 | invoice 23 | 2.1 24 | 25 | OASIS UBL 2.1 Invoice 26 | 27 | 28 | 29 | org.oasis-open 30 | ubl 31 | 2.1 32 | zip 33 | 34 | 35 |
xsdrt/maindoc/UBL-Invoice-2.1.xsd
36 | 37 | 40 | 41 | 42 | org.w3.xsd 43 | xmldsig-core 44 | 1.0 45 | xsd 46 | 47 | 48 | 51 | 52 | 53 | org.gs1 54 | sbdh 55 | 1.2 56 | xsd 57 | 58 | 59 | 60 | 63 |
64 |
65 | -------------------------------------------------------------------------------- /phive-api/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # SLF4J's SimpleLogger configuration file 19 | # Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. 20 | 21 | # Default logging detail level for all instances of SimpleLogger. 22 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 23 | # If not specified, defaults to "info". 24 | org.slf4j.simpleLogger.defaultLogLevel=info 25 | 26 | # Logging detail level for a SimpleLogger instance named "xxxxx". 27 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 28 | # If not specified, the default logging detail level is used. 29 | #org.slf4j.simpleLogger.log.xxxxx= 30 | 31 | # Set to true if you want the current date and time to be included in output messages. 32 | # Default is false, and will output the number of milliseconds elapsed since startup. 33 | org.slf4j.simpleLogger.showDateTime=false 34 | 35 | # The date and time format to be used in the output messages. 36 | # The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. 37 | # If the format is not specified or is invalid, the default format is used. 38 | # The default format is yyyy-MM-dd HH:mm:ss:SSS Z. 39 | #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z 40 | 41 | # Set to true if you want to output the current thread name. 42 | # Defaults to true. 43 | #org.slf4j.simpleLogger.showThreadName=true 44 | 45 | # Set to true if you want the Logger instance name to be included in output messages. 46 | # Defaults to true. 47 | #org.slf4j.simpleLogger.showLogName=true 48 | 49 | # Set to true if you want the last component of the name to be included in output messages. 50 | # Defaults to false. 51 | #org.slf4j.simpleLogger.showShortLogName=false 52 | -------------------------------------------------------------------------------- /phive-xml/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # SLF4J's SimpleLogger configuration file 19 | # Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. 20 | 21 | # Default logging detail level for all instances of SimpleLogger. 22 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 23 | # If not specified, defaults to "info". 24 | org.slf4j.simpleLogger.defaultLogLevel=info 25 | 26 | # Logging detail level for a SimpleLogger instance named "xxxxx". 27 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 28 | # If not specified, the default logging detail level is used. 29 | #org.slf4j.simpleLogger.log.xxxxx= 30 | 31 | # Set to true if you want the current date and time to be included in output messages. 32 | # Default is false, and will output the number of milliseconds elapsed since startup. 33 | org.slf4j.simpleLogger.showDateTime=false 34 | 35 | # The date and time format to be used in the output messages. 36 | # The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. 37 | # If the format is not specified or is invalid, the default format is used. 38 | # The default format is yyyy-MM-dd HH:mm:ss:SSS Z. 39 | #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z 40 | 41 | # Set to true if you want to output the current thread name. 42 | # Defaults to true. 43 | #org.slf4j.simpleLogger.showThreadName=true 44 | 45 | # Set to true if you want the Logger instance name to be included in output messages. 46 | # Defaults to true. 47 | #org.slf4j.simpleLogger.showLogName=true 48 | 49 | # Set to true if you want the last component of the name to be included in output messages. 50 | # Defaults to false. 51 | #org.slf4j.simpleLogger.showShortLogName=false 52 | -------------------------------------------------------------------------------- /phive-result/src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | # philip[at]helger[dot]com 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # SLF4J's SimpleLogger configuration file 19 | # Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. 20 | 21 | # Default logging detail level for all instances of SimpleLogger. 22 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 23 | # If not specified, defaults to "info". 24 | org.slf4j.simpleLogger.defaultLogLevel=info 25 | 26 | # Logging detail level for a SimpleLogger instance named "xxxxx". 27 | # Must be one of ("trace", "debug", "info", "warn", or "error"). 28 | # If not specified, the default logging detail level is used. 29 | #org.slf4j.simpleLogger.log.xxxxx= 30 | 31 | # Set to true if you want the current date and time to be included in output messages. 32 | # Default is false, and will output the number of milliseconds elapsed since startup. 33 | org.slf4j.simpleLogger.showDateTime=false 34 | 35 | # The date and time format to be used in the output messages. 36 | # The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. 37 | # If the format is not specified or is invalid, the default format is used. 38 | # The default format is yyyy-MM-dd HH:mm:ss:SSS Z. 39 | #org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z 40 | 41 | # Set to true if you want to output the current thread name. 42 | # Defaults to true. 43 | #org.slf4j.simpleLogger.showThreadName=true 44 | 45 | # Set to true if you want the Logger instance name to be included in output messages. 46 | # Defaults to true. 47 | #org.slf4j.simpleLogger.showLogName=true 48 | 49 | # Set to true if you want the last component of the name to be included in output messages. 50 | # Defaults to false. 51 | #org.slf4j.simpleLogger.showShortLogName=false 52 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/EValidationBaseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | import com.helger.base.name.IHasName; 26 | 27 | /** 28 | * Enum with all predefined validation based types. 29 | * 30 | * @author Philip Helger 31 | */ 32 | public enum EValidationBaseType implements IHasID , IHasName 33 | { 34 | XML ("xml", "XML"), 35 | XSD ("xsd", "XML Schema"), 36 | SCHEMATRON ("sch", "Schematron"), 37 | EDIFACT ("edifact", "EDIFACT"), 38 | PDF ("pdf", "PDF"), 39 | OTHER ("other", "Other"); 40 | 41 | private final String m_sID; 42 | private final String m_sName; 43 | 44 | EValidationBaseType (@NonNull @Nonempty final String sID, @NonNull @Nonempty final String sName) 45 | { 46 | m_sID = sID; 47 | m_sName = sName; 48 | } 49 | 50 | @NonNull 51 | @Nonempty 52 | public String getID () 53 | { 54 | return m_sID; 55 | } 56 | 57 | @NonNull 58 | @Nonempty 59 | public String getName () 60 | { 61 | return m_sName; 62 | } 63 | 64 | public boolean isXML () 65 | { 66 | return this == XML; 67 | } 68 | 69 | public boolean isXSD () 70 | { 71 | return this == XSD; 72 | } 73 | 74 | public boolean isSchematron () 75 | { 76 | return this == SCHEMATRON; 77 | } 78 | 79 | public boolean isEdifact () 80 | { 81 | return this == EDIFACT; 82 | } 83 | 84 | @Nullable 85 | public static EValidationBaseType getFromIDOrNull (@Nullable final String sID) 86 | { 87 | return EnumHelper.getFromIDOrNull (EValidationBaseType.class, sID); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/schematron/SchematronNamespaceBeautifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.concurrent.GuardedBy; 23 | import com.helger.annotation.concurrent.ThreadSafe; 24 | import com.helger.base.concurrent.SimpleReadWriteLock; 25 | import com.helger.xml.namespace.IIterableNamespaceContext; 26 | import com.helger.xml.namespace.MapBasedNamespaceContext; 27 | 28 | /** 29 | * This class contains namespace prefixes for Schematron error messages 30 | * 31 | * @author Philip Helger 32 | */ 33 | @ThreadSafe 34 | public final class SchematronNamespaceBeautifier 35 | { 36 | private static final SimpleReadWriteLock RW_LOCK = new SimpleReadWriteLock (); 37 | @GuardedBy ("RW_LOCK") 38 | private static final MapBasedNamespaceContext NS_CTX = new MapBasedNamespaceContext (); 39 | 40 | private SchematronNamespaceBeautifier () 41 | {} 42 | 43 | public static void addMapping (@NonNull final String sPrefix, @NonNull final String sNamespaceURI) 44 | { 45 | // Allow overwrite! 46 | RW_LOCK.writeLocked ( () -> NS_CTX.setMapping (sPrefix, sNamespaceURI)); 47 | } 48 | 49 | public static void addMappings (@Nullable final IIterableNamespaceContext aOther) 50 | { 51 | // Allow overwrite! 52 | if (aOther != null) 53 | RW_LOCK.writeLocked ( () -> NS_CTX.setMappings (aOther)); 54 | } 55 | 56 | public static void removeAllMappings () 57 | { 58 | RW_LOCK.writeLocked (NS_CTX::clear); 59 | } 60 | 61 | @Nullable 62 | public static String getMapping (@Nullable final String sNamespaceURI) 63 | { 64 | return RW_LOCK.readLockedGet ( () -> NS_CTX.getPrefix (sNamespaceURI)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/source/IValidationSourceXML.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.source; 18 | 19 | import javax.xml.transform.Source; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | import org.w3c.dom.Node; 24 | 25 | import com.helger.phive.api.source.IValidationSource; 26 | import com.helger.xml.XMLHelper; 27 | import com.helger.xml.transform.TransformSourceFactory; 28 | 29 | /** 30 | * XML validation source interface. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public interface IValidationSourceXML extends IValidationSource 35 | { 36 | String VALIDATION_SOURCE_TYPE = "xml"; 37 | 38 | /** 39 | * @return The source node to be validated. This may either be the whole DOM 40 | * Document or a single DOM Element. May be null. 41 | */ 42 | @Nullable 43 | Node getNode (); 44 | 45 | /** 46 | * @return This validation source as a `javax.xml.transform.Source`. Never 47 | * null. 48 | * @throws IllegalStateException 49 | * If no transform source object can be created. 50 | */ 51 | @NonNull 52 | default Source getAsTransformSource () 53 | { 54 | final Node aNode = getNode (); 55 | if (aNode == null) 56 | throw new IllegalStateException ("No input Node is present!"); 57 | 58 | final Source ret; 59 | if (isPartialSource ()) 60 | ret = TransformSourceFactory.create (aNode); 61 | else 62 | { 63 | // Always use the Document node! Otherwise this may lead to weird XSLT 64 | // errors 65 | ret = TransformSourceFactory.create (XMLHelper.getOwnerDocument (aNode)); 66 | } 67 | if (ret == null) 68 | throw new IllegalStateException ("No valid input Node is present!"); 69 | 70 | ret.setSystemId (getSystemID ()); 71 | return ret; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executorset/status/EValidationExecutorStatusType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset.status; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Defines the overall status of a validation executor. 28 | * 29 | * @author Philip Helger 30 | * @since 9.2.0 31 | */ 32 | public enum EValidationExecutorStatusType implements IHasID 33 | { 34 | /** 35 | * The executor is explicitly deprecated. Most likely a replacement is 36 | * available. 37 | */ 38 | DEPRECATED ("deprecated"), 39 | /** 40 | * The executor has a validity period that starts in the future. 41 | */ 42 | NOT_YET_ACTIVE ("notyetactive"), 43 | /** 44 | * The executor has a validity period that ended in the past. 45 | */ 46 | EXPIRED ("expired"), 47 | /** 48 | * The executor is valid. 49 | */ 50 | VALID ("valid"); 51 | 52 | private final String m_sID; 53 | 54 | EValidationExecutorStatusType (@NonNull @Nonempty final String sID) 55 | { 56 | m_sID = sID; 57 | } 58 | 59 | @NonNull 60 | @Nonempty 61 | public String getID () 62 | { 63 | return m_sID; 64 | } 65 | 66 | /** 67 | * @return true if the status type is deprecated, 68 | * false if not. 69 | */ 70 | public boolean isDeprecated () 71 | { 72 | return this == DEPRECATED; 73 | } 74 | 75 | public boolean isValid () 76 | { 77 | return this == VALID; 78 | } 79 | 80 | @Nullable 81 | public static EValidationExecutorStatusType getFromIDOrNull (@Nullable final String sID) 82 | { 83 | return EnumHelper.getFromIDOrNull (EValidationExecutorStatusType.class, sID); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.style.ReturnsMutableCopy; 22 | import com.helger.annotation.style.ReturnsMutableObject; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.name.IHasDisplayName; 25 | import com.helger.collection.commons.ICommonsIterable; 26 | import com.helger.collection.commons.ICommonsList; 27 | import com.helger.diver.api.coord.DVRCoordinate; 28 | import com.helger.phive.api.executor.IValidationExecutor; 29 | import com.helger.phive.api.executorset.status.IValidationExecutorSetStatus; 30 | import com.helger.phive.api.source.IValidationSource; 31 | 32 | /** 33 | * Read-only interface for a named list of {@link IValidationExecutor}. 34 | * 35 | * @author Philip Helger 36 | * @param 37 | * The validation source type to be used. 38 | */ 39 | public interface IValidationExecutorSet extends 40 | IHasID , 41 | IHasDisplayName, 42 | ICommonsIterable > 43 | { 44 | /** 45 | * @return A list with all validation executors. Never null but 46 | * maybe empty. 47 | */ 48 | @NonNull 49 | @ReturnsMutableObject 50 | ICommonsList > executors (); 51 | 52 | /** 53 | * @return A list with all validation executors. Never null but 54 | * maybe empty. 55 | */ 56 | @NonNull 57 | @ReturnsMutableCopy 58 | ICommonsList > getAllExecutors (); 59 | 60 | /** 61 | * @return The VES status. Never null. 62 | */ 63 | @NonNull 64 | IValidationExecutorSetStatus getStatus (); 65 | } 66 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/source/IValidationSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.source; 18 | 19 | import java.io.IOException; 20 | import java.io.OutputStream; 21 | 22 | import org.jspecify.annotations.NonNull; 23 | import org.jspecify.annotations.Nullable; 24 | 25 | import com.helger.annotation.Nonempty; 26 | import com.helger.annotation.WillNotClose; 27 | import com.helger.base.string.StringHelper; 28 | 29 | /** 30 | * Abstract validation source interface. This represents an object to be validated. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public interface IValidationSource 35 | { 36 | /** 37 | * @return The validation source type ID. Neither null nor empty. 38 | * @since 10.1.0 39 | */ 40 | @NonNull 41 | @Nonempty 42 | String getValidationSourceTypeID (); 43 | 44 | /** 45 | * @return true if a system ID is present, false if not. 46 | * @since 10.1.0 47 | */ 48 | default boolean hasSystemID () 49 | { 50 | return StringHelper.isNotEmpty (getSystemID ()); 51 | } 52 | 53 | /** 54 | * @return The system ID (e.g. filename) of the source to be validated. May be null. 55 | */ 56 | @Nullable 57 | String getSystemID (); 58 | 59 | /** 60 | * @return true if this source is partial and false if the whole 61 | * Document should be used. If it is partial there must be a way to define the necessary 62 | * part(s) in the implementation. 63 | */ 64 | boolean isPartialSource (); 65 | 66 | /** 67 | * Write the content of the validation source to the provided OutputStream. 68 | * 69 | * @param aOS 70 | * The output stream to write to. May not be null. 71 | * @throws IOException 72 | * In case writing fails 73 | * @since 10.1.0 74 | */ 75 | void writeTo (@NonNull @WillNotClose OutputStream aOS) throws IOException; 76 | } 77 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executor/IValidationExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executor; 18 | 19 | import java.util.Locale; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.annotation.style.MustImplementEqualsAndHashcode; 25 | import com.helger.base.clone.ICloneable; 26 | import com.helger.phive.api.artefact.IValidationArtefact; 27 | import com.helger.phive.api.result.ValidationResult; 28 | import com.helger.phive.api.source.IValidationSource; 29 | 30 | /** 31 | * Base interface for performing validation of a single document based on the 32 | * rules of a single validation artefact. 33 | * 34 | * @author Philip Helger 35 | * @param 36 | * The validation source type to be used. 37 | */ 38 | @MustImplementEqualsAndHashcode 39 | public interface IValidationExecutor extends 40 | ICloneable > 41 | { 42 | /** 43 | * @return The validation artefact used to validate the document. Never 44 | * null. 45 | */ 46 | @NonNull 47 | IValidationArtefact getValidationArtefact (); 48 | 49 | /** 50 | * @return true if a negative validation stops further 51 | * validations. 52 | * @since 5.3.1; previously on validation type level only 53 | */ 54 | boolean isStopValidationOnError (); 55 | 56 | /** 57 | * Perform validation of the provided source. 58 | * 59 | * @param aSource 60 | * Source to be validated. May not be null. 61 | * @param aLocale 62 | * The locale to use for error messages if applicable. May be 63 | * null in which case the system default locale is used. 64 | * @return Never null. 65 | */ 66 | @NonNull 67 | ValidationResult applyValidation (@NonNull SOURCETYPE aSource, @Nullable Locale aLocale); 68 | } 69 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/diver/IGenericPseudoVersionResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.diver; 18 | 19 | import java.time.OffsetDateTime; 20 | import java.util.Set; 21 | 22 | import org.jspecify.annotations.NonNull; 23 | import org.jspecify.annotations.Nullable; 24 | 25 | import com.helger.annotation.Nonempty; 26 | import com.helger.diver.api.version.IDVRPseudoVersion; 27 | 28 | /** 29 | * Generic pseudo version resolver interface 30 | * 31 | * @author Philip Helger 32 | * @param 33 | * The type to which is resolved 34 | * @since 10.1.1 35 | */ 36 | public interface IGenericPseudoVersionResolver 37 | { 38 | /** 39 | * Get the element that matches the provided group ID, artifact ID and pseudo 40 | * version. 41 | * 42 | * @param aPseudoVersion 43 | * The pseudo version to resolve. May not be null. 44 | * @param sGroupID 45 | * VES Group ID to use. May neither be null nor empty. 46 | * @param sArtifactID 47 | * VES Artefact ID to use. May neither be null nor empty. 48 | * @param aVersionsToIgnore 49 | * An optional set of Version numbers not to consider. This may be used 50 | * to exclude certain versions from being returned. May be 51 | * null. 52 | * @param aCheckDateTim 53 | * The effective date for which a check should be performed. May be 54 | * null to indicate "current date time". 55 | * @return null if resolution fails 56 | */ 57 | @Nullable 58 | RESULTTYPE resolvePseudoVersion (@NonNull IDVRPseudoVersion aPseudoVersion, 59 | @NonNull @Nonempty String sGroupID, 60 | @NonNull @Nonempty String sArtifactID, 61 | @Nullable Set aVersionsToIgnore, 62 | @Nullable OffsetDateTime aCheckDateTim); 63 | } 64 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderXSD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.diagnostics.error.list.ErrorList; 23 | import com.helger.diver.repo.IRepoStorageBase; 24 | import com.helger.phive.api.executor.IValidationExecutor; 25 | import com.helger.phive.ves.v10.VesXsdType; 26 | import com.helger.phive.xml.source.IValidationSourceXML; 27 | 28 | /** 29 | * This interface is used by {@link VESLoader} create an {@link IValidationExecutor} from the VES 30 | * XSD requirements. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public interface IVESLoaderXSD 35 | { 36 | /** 37 | * Load an XSD validation from a VES. 38 | * 39 | * @param aRepo 40 | * The repository to load the data from. May not be null. 41 | * @param aXSD 42 | * The JAXB VES XSD object with the details. May not be null. 43 | * @param aLoadingRequiredVES 44 | * In case the loading was recursively triggered via a "requires" (=include), this is the 45 | * data of the requirements. May be null. 46 | * @param aErrorList 47 | * The error list to be filled. May not be null. 48 | * @param aAsyncLoader 49 | * The callback to be invoked, if loading this artefacts needs to trigger the loading of 50 | * another artefact. 51 | * @return The validation executor to be used. May not be null. 52 | */ 53 | @NonNull 54 | IValidationExecutor loadXSD (@NonNull IRepoStorageBase aRepo, 55 | @NonNull VesXsdType aXSD, 56 | LoadedVES.@Nullable RequiredVES aLoadingRequiredVES, 57 | @NonNull ErrorList aErrorList, 58 | @NonNull IVESAsyncLoader aAsyncLoader); 59 | } 60 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executorset/IValidationExecutorSetMutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.misc.ChangeNextMajorRelease; 22 | import com.helger.base.state.EChange; 23 | import com.helger.phive.api.executor.IValidationExecutor; 24 | import com.helger.phive.api.source.IValidationSource; 25 | 26 | /** 27 | * Define a common interface for {@link IValidationExecutorSet} with modifying 28 | * methods. 29 | * 30 | * @author Philip Helger 31 | * @param 32 | * The validation source type to be used. 33 | * @since 10.1.0 34 | */ 35 | public interface IValidationExecutorSetMutable extends 36 | IValidationExecutorSet 37 | { 38 | /** 39 | * Add a single executor. 40 | * 41 | * @param aExecutor 42 | * The executor to be added. May not be null. 43 | * @return this for chaining 44 | */ 45 | @NonNull 46 | IValidationExecutorSetMutable addExecutor (@NonNull IValidationExecutor aExecutor); 47 | 48 | /** 49 | * Set the cache status to all contained validation executors, that implement 50 | * the IValidationExecutorCacheSupport interface. 51 | * 52 | * @param bCache 53 | * true to enable caching, false to disable 54 | * it. 55 | */ 56 | @ChangeNextMajorRelease ("Change return type to this type") 57 | void setValidationExecutorDoCache (boolean bCache); 58 | 59 | /** 60 | * As some {@link IValidationExecutor} instances may contain a hard reference 61 | * to a {@link ClassLoader} this methods removes all executors and allows for 62 | * them to be garbage collected.
63 | * New executors may be added afterwards but this method is mainly meant for 64 | * safe cleanup. 65 | * 66 | * @return {@link EChange} 67 | */ 68 | @NonNull 69 | EChange removeAllExecutors (); 70 | } 71 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/validity/EExtendedValidity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.validity; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.id.IHasID; 24 | import com.helger.base.lang.EnumHelper; 25 | 26 | /** 27 | * Extended validity to indicate whether a result is either 28 | *
    29 | *
  • The rule set was not executed, it was ignored
  • 30 | *
  • The rule set is 100% valid
  • 31 | *
  • The rule set is 100% invalid
  • 32 | *
  • It's not clear and it needs later evaluation
  • 33 | *
34 | * 35 | * @author Philip Helger 36 | * @since 10.0.0 37 | */ 38 | public enum EExtendedValidity implements IHasID 39 | { 40 | /** Validation layer was skipped/ignored */ 41 | SKIPPED ("skipped"), 42 | /** Document matches rules on this layer */ 43 | VALID ("valid"), 44 | /** Document does not match rules on this layer */ 45 | INVALID ("invalid"), 46 | /** 47 | * It's not clear whether the document matches the rules on this layer or not 48 | */ 49 | UNCLEAR ("unclear"); 50 | 51 | private final String m_sID; 52 | 53 | EExtendedValidity (@NonNull @Nonempty final String sID) 54 | { 55 | m_sID = sID; 56 | } 57 | 58 | @NonNull 59 | @Nonempty 60 | public String getID () 61 | { 62 | return m_sID; 63 | } 64 | 65 | public boolean isSkipped () 66 | { 67 | return this == SKIPPED; 68 | } 69 | 70 | public boolean isValid () 71 | { 72 | return this == VALID; 73 | } 74 | 75 | public boolean isInvalid () 76 | { 77 | return this == INVALID; 78 | } 79 | 80 | public boolean isUnclear () 81 | { 82 | return this == UNCLEAR; 83 | } 84 | 85 | public boolean isDefined () 86 | { 87 | return this == VALID || this == INVALID; 88 | } 89 | 90 | @Nullable 91 | public static EExtendedValidity getFromIDOrNull (@Nullable final String sID) 92 | { 93 | return EnumHelper.getFromIDOrNull (EExtendedValidity.class, sID); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /phive-ves-model/src/test/resources/ves/v1/ves-sch-en16931-ubl-invoice-1.3.10.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | eu.cen.en16931 22 | ubl-invoice 23 | 1.3.10 24 | 25 | EN16931 UBL Invoice 26 | 2023-04-11 27 | 28 | 30 | 31 | org.oasis-open.ubl 32 | invoice 33 | 2.1 34 | 35 | 36 | 37 | 38 | eu.cen.en16931 39 | ubl 40 | 1.3.10 41 | xslt 42 | 43 | iso-schematron 44 | 47 | 58 | 63 | 71 | 72 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderEdifact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.diagnostics.error.list.ErrorList; 23 | import com.helger.diver.repo.IRepoStorageBase; 24 | import com.helger.phive.api.executor.IValidationExecutor; 25 | import com.helger.phive.api.source.IValidationSourceBinary; 26 | import com.helger.phive.ves.v10.VesEdifactType; 27 | 28 | /** 29 | * This interface is used by {@link VESLoader} create an {@link IValidationExecutor} from the VES 30 | * Edifact requirements. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public interface IVESLoaderEdifact 35 | { 36 | /** 37 | * Load an Edifact validation from a VES. 38 | * 39 | * @param aRepo 40 | * The repository to load the data from. May not be null. 41 | * @param aEDI 42 | * The JAXB VES Edifact object with the details. May not be null. 43 | * @param aLoadingRequiredVES 44 | * In case the loading was recursively triggered via a "requires" (=include), this is the 45 | * data of the requirements. May be null. 46 | * @param aErrorList 47 | * The error list to be filled. May not be null. 48 | * @param aAsyncLoader 49 | * The callback to be invoked, if loading this artefacts needs to trigger the loading of 50 | * another artefact. 51 | * @return The validation executor to be used. May not be null. 52 | */ 53 | @NonNull 54 | IValidationExecutor loadEdifact (@NonNull IRepoStorageBase aRepo, 55 | @NonNull VesEdifactType aEDI, 56 | LoadedVES.@Nullable RequiredVES aLoadingRequiredVES, 57 | @NonNull ErrorList aErrorList, 58 | @NonNull IVESAsyncLoader aAsyncLoader); 59 | } 60 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/validity/IValidityDeterminator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.validity; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.diagnostics.error.list.IErrorList; 23 | import com.helger.phive.api.executor.IValidationExecutor; 24 | import com.helger.phive.api.source.IValidationSource; 25 | 26 | /** 27 | * Generic interface for a decision provider for validation results. 28 | * 29 | * @author Philip Helger 30 | * @since 10.0.0 31 | * @param 32 | * The validation source type to use. 33 | */ 34 | public interface IValidityDeterminator 35 | { 36 | /** 37 | * Get the validity of the provided error list. 38 | * 39 | * @param aExecutor 40 | * The validation executor for which the validity state should be 41 | * determined. This gives access to the underlying rule resource and 42 | * the respective validation type. May be null. 43 | * @param aErrorList 44 | * The error list to be evaluated. May not be null but 45 | * empty. 46 | * @return Never null. 47 | */ 48 | @NonNull 49 | EExtendedValidity getValidity (@Nullable IValidationExecutor aExecutor, @NonNull IErrorList aErrorList); 50 | 51 | /** 52 | * @return A validity determinator that marks entries with at least one error 53 | * as INVALID and others as VALID. It contains no uncertainty. 54 | * @see ValidityDeterminatorRegistry#getValidityOneErrorInvalid(IErrorList) 55 | */ 56 | static IValidityDeterminator createCertainOneErrorInvalid () 57 | { 58 | return (vex, errList) -> ValidityDeterminatorRegistry.getValidityOneErrorInvalid (errList); 59 | } 60 | 61 | /** 62 | * @return The default determinator. It's 63 | * {@link #createCertainOneErrorInvalid()} 64 | */ 65 | @NonNull 66 | static IValidityDeterminator createDefault () 67 | { 68 | return createCertainOneErrorInvalid (); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /phive-xml/src/test/java/com/helger/phive/xml/schematron/CustomErrorDetailsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | import static org.junit.Assert.assertFalse; 21 | import static org.junit.Assert.assertNull; 22 | import static org.junit.Assert.assertSame; 23 | import static org.junit.Assert.assertTrue; 24 | 25 | import org.junit.Test; 26 | 27 | import com.helger.diagnostics.error.level.EErrorLevel; 28 | 29 | /** 30 | * Test class for class {@link CustomErrorDetails}. 31 | * 32 | * @author Philip Helger 33 | */ 34 | public class CustomErrorDetailsTest 35 | { 36 | @Test 37 | public void testBasicWithAll () 38 | { 39 | final CustomErrorDetails a = new CustomErrorDetails (EErrorLevel.WARN, "pre", "suff"); 40 | assertSame (EErrorLevel.WARN, a.getErrorLevel ()); 41 | assertTrue (a.hasErrorTextPrefix ()); 42 | assertEquals ("pre", a.getErrorTextPrefix ()); 43 | assertTrue (a.hasErrorTextSuffix ()); 44 | assertEquals ("suff", a.getErrorTextSuffix ()); 45 | assertTrue (a.hasErrorTextPrefixOrSuffix ()); 46 | assertEquals ("preXsuff", a.getWithErrorTextPrefixAndSuffixApplied ("X")); 47 | } 48 | 49 | @Test 50 | public void testBasicMin () 51 | { 52 | final CustomErrorDetails a = new CustomErrorDetails (EErrorLevel.WARN, null, null); 53 | assertSame (EErrorLevel.WARN, a.getErrorLevel ()); 54 | assertFalse (a.hasErrorTextPrefix ()); 55 | assertNull (a.getErrorTextPrefix ()); 56 | assertFalse (a.hasErrorTextSuffix ()); 57 | assertNull (a.getErrorTextSuffix ()); 58 | assertFalse (a.hasErrorTextPrefixOrSuffix ()); 59 | assertEquals ("X", a.getWithErrorTextPrefixAndSuffixApplied ("X")); 60 | } 61 | 62 | @Test 63 | public void testBasicSpecifics () 64 | { 65 | CustomErrorDetails a = new CustomErrorDetails (EErrorLevel.WARN, "pre", null); 66 | assertTrue (a.hasErrorTextPrefixOrSuffix ()); 67 | assertEquals ("preX", a.getWithErrorTextPrefixAndSuffixApplied ("X")); 68 | 69 | a = new CustomErrorDetails (EErrorLevel.WARN, null, "suff"); 70 | assertTrue (a.hasErrorTextPrefixOrSuffix ()); 71 | assertEquals ("Xsuff", a.getWithErrorTextPrefixAndSuffixApplied ("X")); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/catalog/VESCatalogEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load.catalog; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.Nonempty; 22 | import com.helger.annotation.concurrent.Immutable; 23 | import com.helger.base.enforce.ValueEnforcer; 24 | import com.helger.base.id.IHasID; 25 | import com.helger.base.tostring.ToStringGenerator; 26 | import com.helger.diver.repo.RepoStorageKeyOfArtefact; 27 | 28 | /** 29 | * Represent a single XML catalog entry 30 | * 31 | * @author Philip Helger 32 | */ 33 | @Immutable 34 | public final class VESCatalogEntry implements IHasID 35 | { 36 | private final EVESCatalogType m_eType; 37 | private final String m_sUriOrID; 38 | private final RepoStorageKeyOfArtefact m_aResourceKey; 39 | 40 | public VESCatalogEntry (@NonNull final EVESCatalogType eType, 41 | @NonNull @Nonempty final String sUriOrID, 42 | @NonNull final RepoStorageKeyOfArtefact aResourceKey) 43 | { 44 | ValueEnforcer.notNull (eType, "Type"); 45 | ValueEnforcer.notEmpty (sUriOrID, "ID"); 46 | ValueEnforcer.notNull (aResourceKey, "Key"); 47 | m_eType = eType; 48 | m_sUriOrID = sUriOrID; 49 | m_aResourceKey = aResourceKey; 50 | } 51 | 52 | /** 53 | * @return The catalog entry type. Never null. 54 | */ 55 | @NonNull 56 | public EVESCatalogType getType () 57 | { 58 | return m_eType; 59 | } 60 | 61 | /** 62 | * @return The catalog ID or URI. Neither null nor empty. 63 | */ 64 | @NonNull 65 | @Nonempty 66 | public String getID () 67 | { 68 | return m_sUriOrID; 69 | } 70 | 71 | /** 72 | * @return The repository key. Never null. 73 | */ 74 | @NonNull 75 | public RepoStorageKeyOfArtefact getRepoStorageKey () 76 | { 77 | return m_aResourceKey; 78 | } 79 | 80 | @Override 81 | public String toString () 82 | { 83 | return new ToStringGenerator (null).append ("Type", m_eType) 84 | .append ("UriOrID", m_sUriOrID) 85 | .append ("ResourceKey", m_aResourceKey) 86 | .getToString (); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/IVESLoaderSchematron.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import java.util.List; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.collection.commons.ICommonsList; 25 | import com.helger.diagnostics.error.list.ErrorList; 26 | import com.helger.diver.repo.IRepoStorageBase; 27 | import com.helger.phive.api.executor.IValidationExecutor; 28 | import com.helger.phive.ves.v10.VesSchematronType; 29 | import com.helger.phive.xml.source.IValidationSourceXML; 30 | 31 | /** 32 | * This interface is used by {@link VESLoader} create an {@link IValidationExecutor} from the VES 33 | * Schematron requirements. 34 | * 35 | * @author Philip Helger 36 | */ 37 | public interface IVESLoaderSchematron 38 | { 39 | /** 40 | * Load a Schematron validation from a VES. 41 | * 42 | * @param aRepo 43 | * The repository to load the data from. May not be null. 44 | * @param aSCHList 45 | * The JAXB VES Schematron objects with the details. Order is important. May not be 46 | * null. 47 | * @param aLoadingRequiredVES 48 | * In case the loading was recursively triggered via a "requires" (=include), this is the 49 | * data of the requirements. May be null. 50 | * @param aErrorList 51 | * The error list to be filled. May not be null. 52 | * @param aAsyncLoader 53 | * The callback to be invoked, if loading this artefacts needs to trigger the loading of 54 | * another artefact. 55 | * @return The validation executors to be used. May not be null and not be empty. 56 | */ 57 | @NonNull 58 | ICommonsList > loadSchematrons (@NonNull IRepoStorageBase aRepo, 59 | @NonNull List aSCHList, 60 | LoadedVES.@Nullable RequiredVES aLoadingRequiredVES, 61 | @NonNull ErrorList aErrorList, 62 | @NonNull IVESAsyncLoader aAsyncLoader); 63 | } 64 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executorset/status/ValidationExecutorSetStatusHistoryItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset.status; 18 | 19 | import java.time.OffsetDateTime; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.annotation.Nonempty; 25 | import com.helger.annotation.concurrent.Immutable; 26 | import com.helger.base.enforce.ValueEnforcer; 27 | import com.helger.base.tostring.ToStringGenerator; 28 | 29 | /** 30 | * This class contains a single history item of a VES status 31 | * 32 | * @author Philip Helger 33 | * @since 9.2.0 34 | */ 35 | @Immutable 36 | public class ValidationExecutorSetStatusHistoryItem 37 | { 38 | private final OffsetDateTime m_aChangeDateTime; 39 | private final String m_sAuthor; 40 | private final String m_sChangeCode; 41 | private final String m_sText; 42 | 43 | public ValidationExecutorSetStatusHistoryItem (@NonNull final OffsetDateTime aChangeDateTime, 44 | @NonNull @Nonempty final String sAuthor, 45 | @Nullable final String sChangeCode, 46 | @NonNull @Nonempty final String sText) 47 | { 48 | ValueEnforcer.notNull (aChangeDateTime, "ChangeDateTime"); 49 | ValueEnforcer.notEmpty (sAuthor, "Author"); 50 | ValueEnforcer.notEmpty (sText, "Text"); 51 | m_aChangeDateTime = aChangeDateTime; 52 | m_sAuthor = sAuthor; 53 | m_sChangeCode = sChangeCode; 54 | m_sText = sText; 55 | } 56 | 57 | @NonNull 58 | public final OffsetDateTime getChangeDateTime () 59 | { 60 | return m_aChangeDateTime; 61 | } 62 | 63 | @NonNull 64 | @Nonempty 65 | public String getAuthor () 66 | { 67 | return m_sAuthor; 68 | } 69 | 70 | @Nullable 71 | public String getChangeCode () 72 | { 73 | return m_sChangeCode; 74 | } 75 | 76 | @NonNull 77 | @Nonempty 78 | public String getText () 79 | { 80 | return m_sText; 81 | } 82 | 83 | @Override 84 | public String toString () 85 | { 86 | return new ToStringGenerator (null).append ("ChangeDateTime", m_aChangeDateTime) 87 | .append ("Author", m_sAuthor) 88 | .append ("ChangeCode", m_sChangeCode) 89 | .append ("Text", m_sText) 90 | .getToString (); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /phive-result/src/test/java/com/helger/phive/result/exception/PhiveRestoredExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.result.exception; 18 | 19 | import static org.junit.Assert.assertEquals; 20 | import static org.junit.Assert.assertNotNull; 21 | import static org.junit.Assert.assertNull; 22 | import static org.junit.Assert.assertTrue; 23 | 24 | import org.junit.Test; 25 | 26 | import com.helger.json.IJsonObject; 27 | import com.helger.phive.result.json.PhiveJsonHelper; 28 | import com.helger.unittest.support.TestHelper; 29 | 30 | /** 31 | * Test class for class {@link PhiveRestoredException}. 32 | * 33 | * @author Philip Helger 34 | */ 35 | public final class PhiveRestoredExceptionTest 36 | { 37 | @Test 38 | public void testBasic () 39 | { 40 | final Exception ex = new IllegalArgumentException ("bla foo"); 41 | 42 | // to Json 43 | final IJsonObject aObj = PhiveJsonHelper.getJsonStackTrace (ex); 44 | assertNotNull (aObj); 45 | 46 | // from Json 47 | final PhiveRestoredException aRSS = PhiveRestoredException.createFromJson (aObj); 48 | assertNotNull (aRSS); 49 | assertEquals ("java.lang.IllegalArgumentException", aRSS.getClassName ()); 50 | assertEquals ("bla foo", aRSS.getMessage ()); 51 | assertTrue (aRSS.getAllStackTraceLines ().isNotEmpty ()); 52 | // Name of this method must occur 53 | assertTrue (aRSS.getAllStackTraceLines ().containsAny (x -> x.contains ("testBasic"))); 54 | 55 | final IJsonObject aObj2 = aRSS.getAsJson (); 56 | assertNotNull (aObj2); 57 | 58 | TestHelper.testDefaultImplementationWithEqualContentObject (aObj, aObj2); 59 | } 60 | 61 | @Test 62 | public void testNoMessage () 63 | { 64 | final Exception ex = new IllegalArgumentException (); 65 | 66 | // to Json 67 | final IJsonObject aObj = PhiveJsonHelper.getJsonStackTrace (ex); 68 | assertNotNull (aObj); 69 | 70 | // from Json 71 | final PhiveRestoredException aRSS = PhiveRestoredException.createFromJson (aObj); 72 | assertNotNull (aRSS); 73 | assertEquals ("java.lang.IllegalArgumentException", aRSS.getClassName ()); 74 | assertNull (aRSS.getMessage ()); 75 | assertTrue (aRSS.getAllStackTraceLines ().isNotEmpty ()); 76 | // Name of this method must occur 77 | assertTrue (aRSS.getAllStackTraceLines ().containsAny (x -> x.contains ("testNoMessage"))); 78 | 79 | final IJsonObject aObj2 = aRSS.getAsJson (); 80 | assertNotNull (aObj2); 81 | 82 | TestHelper.testDefaultImplementationWithEqualContentObject (aObj, aObj2); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/artefact/ValidationArtefact.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.artefact; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.concurrent.Immutable; 22 | import com.helger.base.enforce.ValueEnforcer; 23 | import com.helger.base.hashcode.HashCodeGenerator; 24 | import com.helger.base.tostring.ToStringGenerator; 25 | import com.helger.io.resource.IReadableResource; 26 | import com.helger.phive.api.IValidationType; 27 | 28 | /** 29 | * Stand-alone implementation of {@link IValidationArtefact} 30 | * 31 | * @author Philip Helger 32 | */ 33 | @Immutable 34 | public class ValidationArtefact implements IValidationArtefact 35 | { 36 | private final IValidationType m_aValidationArtefactType; 37 | private final IReadableResource m_aResource; 38 | 39 | /** 40 | * Constructor. 41 | * 42 | * @param eValidationArtefactType 43 | * Validation artefact type. May not be null. 44 | * @param aResource 45 | * The resource this reflects. May not be null. 46 | */ 47 | public ValidationArtefact (@NonNull final IValidationType eValidationArtefactType, @NonNull final IReadableResource aResource) 48 | { 49 | m_aValidationArtefactType = ValueEnforcer.notNull (eValidationArtefactType, "ValidationArtefactType"); 50 | m_aResource = ValueEnforcer.notNull (aResource, "Resource"); 51 | } 52 | 53 | @NonNull 54 | public IValidationType getValidationType () 55 | { 56 | return m_aValidationArtefactType; 57 | } 58 | 59 | @NonNull 60 | public IReadableResource getRuleResource () 61 | { 62 | return m_aResource; 63 | } 64 | 65 | @Override 66 | public boolean equals (final Object o) 67 | { 68 | if (o == this) 69 | return true; 70 | if (o == null || !getClass ().equals (o.getClass ())) 71 | return false; 72 | final ValidationArtefact rhs = (ValidationArtefact) o; 73 | return m_aValidationArtefactType.equals (rhs.m_aValidationArtefactType) && m_aResource.equals (rhs.m_aResource); 74 | } 75 | 76 | @Override 77 | public int hashCode () 78 | { 79 | return new HashCodeGenerator (this).append (m_aValidationArtefactType).append (m_aResource).getHashCode (); 80 | } 81 | 82 | @Override 83 | public String toString () 84 | { 85 | return new ToStringGenerator (this).append ("ValidationArtefactType", m_aValidationArtefactType) 86 | .append ("Resource", m_aResource) 87 | .getToString (); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/mock/PhiveTestFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.mock; 18 | 19 | import java.util.Set; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.annotation.concurrent.Immutable; 25 | import com.helger.annotation.style.ReturnsMutableCopy; 26 | import com.helger.base.enforce.ValueEnforcer; 27 | import com.helger.collection.commons.CommonsHashSet; 28 | import com.helger.collection.commons.ICommonsSet; 29 | import com.helger.diver.api.coord.DVRCoordinate; 30 | import com.helger.io.resource.IReadableResource; 31 | 32 | /** 33 | * This class describes a simple test file: the path where it resides and the 34 | * validation ID to be used. 35 | * 36 | * @author Philip Helger 37 | */ 38 | @Immutable 39 | public class PhiveTestFile 40 | { 41 | private final IReadableResource m_aResource; 42 | private final DVRCoordinate m_aVESID; 43 | private final ICommonsSet m_aExpectedErrorIDs; 44 | 45 | public PhiveTestFile (@NonNull final IReadableResource aResource, 46 | @NonNull final DVRCoordinate aVESID, 47 | @Nullable final Set aExpectedErrorIDs) 48 | { 49 | m_aResource = ValueEnforcer.notNull (aResource, "Resource"); 50 | m_aVESID = ValueEnforcer.notNull (aVESID, "VESID"); 51 | m_aExpectedErrorIDs = new CommonsHashSet <> (aExpectedErrorIDs); 52 | } 53 | 54 | /** 55 | * @return The readable resource as passed in the constructor. Never 56 | * null. 57 | */ 58 | @NonNull 59 | public IReadableResource getResource () 60 | { 61 | return m_aResource; 62 | } 63 | 64 | /** 65 | * @return The VES ID passed in the constructor. Never null. 66 | */ 67 | @NonNull 68 | public DVRCoordinate getVESID () 69 | { 70 | return m_aVESID; 71 | } 72 | 73 | public boolean isGoodCase () 74 | { 75 | return m_aExpectedErrorIDs.isEmpty (); 76 | } 77 | 78 | public boolean isBadCase () 79 | { 80 | return m_aExpectedErrorIDs.isNotEmpty (); 81 | } 82 | 83 | @NonNull 84 | @ReturnsMutableCopy 85 | public ICommonsSet getAllExpectedErrorIDs () 86 | { 87 | return m_aExpectedErrorIDs.getClone (); 88 | } 89 | 90 | @NonNull 91 | public static PhiveTestFile createGoodCase (@NonNull final IReadableResource aResource, 92 | @NonNull final DVRCoordinate aVESID) 93 | { 94 | // Good case: no error 95 | return new PhiveTestFile (aResource, aVESID, null); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/catalog/VESCatalog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load.catalog; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.concurrent.NotThreadSafe; 23 | import com.helger.base.enforce.ValueEnforcer; 24 | import com.helger.base.iface.IHasSize; 25 | import com.helger.base.state.EChange; 26 | import com.helger.base.string.StringHelper; 27 | import com.helger.base.tostring.ToStringGenerator; 28 | import com.helger.collection.commons.CommonsLinkedHashMap; 29 | import com.helger.collection.commons.ICommonsOrderedMap; 30 | 31 | /** 32 | * List of {@link VESCatalogEntry} objects with sanity access methods 33 | * 34 | * @author Philip Helger 35 | */ 36 | @NotThreadSafe 37 | public final class VESCatalog implements IHasSize 38 | { 39 | // Maintain order 40 | private final ICommonsOrderedMap m_aEntries = new CommonsLinkedHashMap <> (); 41 | 42 | public VESCatalog () 43 | {} 44 | 45 | @NonNull 46 | public EChange addEntry (@NonNull final VESCatalogEntry aEntry) 47 | { 48 | ValueEnforcer.notNull (aEntry, "Entry"); 49 | 50 | final String sID = aEntry.getType ().getID () + ":" + aEntry.getID (); 51 | if (m_aEntries.containsKey (sID)) 52 | return EChange.UNCHANGED; 53 | 54 | m_aEntries.put (sID, aEntry); 55 | return EChange.CHANGED; 56 | } 57 | 58 | public int size () 59 | { 60 | return m_aEntries.size (); 61 | } 62 | 63 | public boolean isEmpty () 64 | { 65 | return m_aEntries.isEmpty (); 66 | } 67 | 68 | @Nullable 69 | public VESCatalogEntry findEntryByUri (@Nullable final String sNamespaceURI) 70 | { 71 | if (StringHelper.isNotEmpty (sNamespaceURI)) 72 | for (final VESCatalogEntry aEntry : m_aEntries.values ()) 73 | if (aEntry.getType () == EVESCatalogType.PUBLIC) 74 | if (sNamespaceURI.equals (aEntry.getID ())) 75 | return aEntry; 76 | return null; 77 | } 78 | 79 | @Nullable 80 | public VESCatalogEntry findEntryBySystemID (@Nullable final String sSystemId) 81 | { 82 | if (StringHelper.isNotEmpty (sSystemId)) 83 | for (final VESCatalogEntry aEntry : m_aEntries.values ()) 84 | if (aEntry.getType () == EVESCatalogType.SYSTEM) 85 | if (sSystemId.equals (aEntry.getID ())) 86 | return aEntry; 87 | return null; 88 | } 89 | 90 | @Override 91 | public String toString () 92 | { 93 | return new ToStringGenerator (null).append ("Entries", m_aEntries).getToString (); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at codeofconduct@helger.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /phive-api/src/test/java/com/helger/phive/api/artefact/ValidationArtefactTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.artefact; 18 | 19 | import static org.junit.Assert.assertSame; 20 | 21 | import java.nio.charset.StandardCharsets; 22 | 23 | import org.junit.Test; 24 | 25 | import com.helger.io.resource.IReadableResource; 26 | import com.helger.io.resource.inmemory.ReadableResourceByteArray; 27 | import com.helger.phive.api.EValidationBaseType; 28 | import com.helger.phive.api.IValidationType; 29 | import com.helger.phive.api.ValidationType; 30 | import com.helger.unittest.support.TestHelper; 31 | 32 | /** 33 | * Test class for class {@link ValidationArtefact}. 34 | * 35 | * @author Philip Helger 36 | */ 37 | public final class ValidationArtefactTest 38 | { 39 | private static final IValidationType VT = new ValidationType ("mock", 40 | EValidationBaseType.PDF, 41 | "Mock VT", 42 | false, 43 | false); 44 | 45 | @Test 46 | public void testBasic () 47 | { 48 | final IReadableResource aRes = new ReadableResourceByteArray ("validation".getBytes (StandardCharsets.UTF_8)); 49 | final IValidationArtefact aVA = new ValidationArtefact (VT, aRes); 50 | assertSame (VT, aVA.getValidationType ()); 51 | assertSame (aRes, aVA.getRuleResource ()); 52 | 53 | TestHelper.testDefaultImplementationWithEqualContentObject (aVA, new ValidationArtefact (VT, aRes)); 54 | TestHelper.testDefaultImplementationWithDifferentContentObject (aVA, 55 | new ValidationArtefact (new ValidationType ("mock", 56 | EValidationBaseType.PDF, 57 | "Other Mock VT", 58 | false, 59 | false), 60 | aRes)); 61 | TestHelper.testDefaultImplementationWithDifferentContentObject (aVA, 62 | new ValidationArtefact (VT, 63 | new ReadableResourceByteArray ("other validation".getBytes (StandardCharsets.UTF_8)))); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /phive-xml/src/main/java/com/helger/phive/xml/schematron/CustomErrorDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.xml.schematron; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.concurrent.Immutable; 23 | import com.helger.base.enforce.ValueEnforcer; 24 | import com.helger.base.string.StringHelper; 25 | import com.helger.base.tostring.ToStringGenerator; 26 | import com.helger.diagnostics.error.level.IErrorLevel; 27 | 28 | /** 29 | * This class contains the details for a single custom error. 30 | * 31 | * @author Philip Helger 32 | */ 33 | @Immutable 34 | public final class CustomErrorDetails 35 | { 36 | private final IErrorLevel m_aErrorLevel; 37 | private final String m_sErrorTextPrefix; 38 | private final String m_sErrorTextSuffix; 39 | 40 | public CustomErrorDetails (@NonNull final IErrorLevel aErrorLevel, 41 | @Nullable final String sErrorTextPrefix, 42 | @Nullable final String sErrorTextSuffix) 43 | { 44 | ValueEnforcer.notNull (aErrorLevel, "ErrorLevel"); 45 | m_aErrorLevel = aErrorLevel; 46 | m_sErrorTextPrefix = sErrorTextPrefix; 47 | m_sErrorTextSuffix = sErrorTextSuffix; 48 | } 49 | 50 | @NonNull 51 | public IErrorLevel getErrorLevel () 52 | { 53 | return m_aErrorLevel; 54 | } 55 | 56 | public boolean hasErrorTextPrefix () 57 | { 58 | return StringHelper.isNotEmpty (m_sErrorTextPrefix); 59 | } 60 | 61 | @Nullable 62 | public String getErrorTextPrefix () 63 | { 64 | return m_sErrorTextPrefix; 65 | } 66 | 67 | public boolean hasErrorTextSuffix () 68 | { 69 | return StringHelper.isNotEmpty (m_sErrorTextSuffix); 70 | } 71 | 72 | @Nullable 73 | public String getErrorTextSuffix () 74 | { 75 | return m_sErrorTextSuffix; 76 | } 77 | 78 | public boolean hasErrorTextPrefixOrSuffix () 79 | { 80 | return hasErrorTextPrefix () || hasErrorTextSuffix (); 81 | } 82 | 83 | @NonNull 84 | public String getWithErrorTextPrefixAndSuffixApplied (@NonNull final String s) 85 | { 86 | String ret; 87 | if (hasErrorTextPrefix ()) 88 | ret = m_sErrorTextPrefix + s; 89 | else 90 | ret = s; 91 | if (hasErrorTextSuffix ()) 92 | ret = ret + m_sErrorTextSuffix; 93 | return ret; 94 | } 95 | 96 | @Override 97 | public String toString () 98 | { 99 | return new ToStringGenerator (null).append ("ErrorLevel", m_aErrorLevel) 100 | .appendIfNotNull ("ErrorTextPrefix", m_sErrorTextPrefix) 101 | .appendIfNotNull ("ErrorTextSuffix", m_sErrorTextSuffix) 102 | .getToString (); 103 | } 104 | 105 | @NonNull 106 | public static CustomErrorDetails of (@NonNull final IErrorLevel aErrorLevel) 107 | { 108 | return new CustomErrorDetails (aErrorLevel, null, null); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /phive-result/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | 23 | com.helger.phive 24 | phive-parent-pom 25 | 11.1.2-SNAPSHOT 26 | 27 | phive-result 28 | bundle 29 | phive-result 30 | phive - Philip Helger Integrative Validation Engine - Validation Result support (incl. JSON binding) 31 | https://github.com/phax/phive/phive-result 32 | 2020 33 | 34 | 35 | 36 | Apache 2 37 | http://www.apache.org/licenses/LICENSE-2.0 38 | repo 39 | 40 | 41 | 42 | 43 | Philip Helger 44 | http://www.helger.com 45 | 46 | 47 | 48 | 49 | philip 50 | Philip Helger 51 | ph(at)helger.com 52 | http://www.helger.com 53 | 54 | 55 | 56 | 57 | 58 | com.helger.commons 59 | ph-jaxb 60 | 61 | 62 | com.helger.commons 63 | ph-json 64 | 65 | 66 | com.helger.phive 67 | phive-api 68 | 69 | 70 | com.helger.phive 71 | phive-xml 72 | 73 | 74 | 75 | org.slf4j 76 | slf4j-simple 77 | test 78 | 79 | 80 | com.helger.commons 81 | ph-unittest-support-ext 82 | test 83 | 84 | 85 | 86 | 87 | 88 | 89 | org.apache.felix 90 | maven-bundle-plugin 91 | true 92 | 93 | 94 | com.helger.phive.result 95 | 96 | com.helger.phive.result, 97 | com.helger.phive.result.exception, 98 | com.helger.phive.result.json, 99 | com.helger.phive.result.xml 100 | 101 | !org.jspecify.annotations.*,* 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/config/PhivePseudoVersionRegistrarSPIImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.config; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.style.IsSPIImplementation; 22 | import com.helger.annotation.style.UsedViaReflection; 23 | import com.helger.base.version.Version; 24 | import com.helger.diver.api.version.DVRPseudoVersion; 25 | import com.helger.diver.api.version.DVRPseudoVersionRegistry; 26 | import com.helger.diver.api.version.IDVRPseudoVersion; 27 | import com.helger.diver.api.version.IDVRPseudoVersionComparable; 28 | import com.helger.diver.api.version.IDVRPseudoVersionRegistry; 29 | import com.helger.diver.api.version.spi.IDVRPseudoVersionRegistrarSPI; 30 | 31 | /** 32 | * Default pseudo version registrar 33 | * 34 | * @author Philip Helger 35 | */ 36 | @IsSPIImplementation 37 | public final class PhivePseudoVersionRegistrarSPIImpl implements IDVRPseudoVersionRegistrarSPI 38 | { 39 | /** 40 | * Latest active indicates the latest version that is valid at a provided point in time (including 41 | * snapshots). 42 | */ 43 | public static final IDVRPseudoVersion LATEST_ACTIVE; 44 | static 45 | { 46 | LATEST_ACTIVE = new DVRPseudoVersion ("latest-active", new IDVRPseudoVersionComparable () 47 | { 48 | public int compareToPseudoVersion (@NonNull final IDVRPseudoVersion aOtherPseudoVersion) 49 | { 50 | // Only LATEST and LATEST_RELEASE are greater 51 | if (aOtherPseudoVersion.equals (DVRPseudoVersionRegistry.LATEST) || 52 | aOtherPseudoVersion.equals (DVRPseudoVersionRegistry.LATEST_RELEASE)) 53 | return -1; 54 | 55 | // LATEST_ACTIVE is always greater 56 | return +1; 57 | } 58 | 59 | public int compareToVersion (@NonNull final Version aStaticVersion) 60 | { 61 | // LATEST_ACTIVE is always greater 62 | return +1; 63 | } 64 | }); 65 | } 66 | 67 | /** 68 | * Latest active release indicates the latest version that is valid at a provided point in time 69 | * (excluding snapshots). 70 | */ 71 | public static final IDVRPseudoVersion LATEST_RELEASE_ACTIVE; 72 | static 73 | { 74 | LATEST_RELEASE_ACTIVE = new DVRPseudoVersion ("latest-release-active", new IDVRPseudoVersionComparable () 75 | { 76 | public int compareToPseudoVersion (@NonNull final IDVRPseudoVersion aOtherPseudoVersion) 77 | { 78 | // Only LATEST, LATEST_RELEASE and LATEST_ACTIVE are greater 79 | if (aOtherPseudoVersion.equals (DVRPseudoVersionRegistry.LATEST) || 80 | aOtherPseudoVersion.equals (DVRPseudoVersionRegistry.LATEST_RELEASE) || 81 | aOtherPseudoVersion.equals (LATEST_ACTIVE)) 82 | return -1; 83 | 84 | // LATEST_RELEASE_ACTIVE is always greater 85 | return +1; 86 | } 87 | 88 | public int compareToVersion (@NonNull final Version aStaticVersion) 89 | { 90 | // LATEST_RELEASE_ACTIVE is always greater 91 | return +1; 92 | } 93 | }); 94 | } 95 | 96 | @Deprecated (forRemoval = false) 97 | @UsedViaReflection 98 | public PhivePseudoVersionRegistrarSPIImpl () 99 | {} 100 | 101 | public void registerPseudoVersions (@NonNull final IDVRPseudoVersionRegistry aRegistry) 102 | { 103 | aRegistry.registerPseudoVersion (LATEST_ACTIVE); 104 | aRegistry.registerPseudoVersion (LATEST_RELEASE_ACTIVE); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/source/ValidationSourceBinary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.source; 18 | 19 | import java.io.IOException; 20 | import java.io.OutputStream; 21 | 22 | import org.jspecify.annotations.NonNull; 23 | import org.jspecify.annotations.Nullable; 24 | 25 | import com.helger.annotation.Nonempty; 26 | import com.helger.annotation.WillNotClose; 27 | import com.helger.base.array.bytes.ByteArrayWrapper; 28 | import com.helger.base.enforce.ValueEnforcer; 29 | import com.helger.base.tostring.ToStringGenerator; 30 | 31 | /** 32 | * Default implementation of {@link IValidationSourceBinary}. 33 | * 34 | * @author Philip Helger 35 | * @since 7.1.2 36 | */ 37 | public class ValidationSourceBinary implements IValidationSourceBinary 38 | { 39 | private final String m_sSystemID; 40 | private final boolean m_bPartialSource; 41 | private final ByteArrayWrapper m_aBAW; 42 | 43 | protected ValidationSourceBinary (@Nullable final String sSystemID, 44 | @NonNull final ByteArrayWrapper aBAW, 45 | final boolean bPartialSource) 46 | { 47 | ValueEnforcer.notNull (aBAW, "BAW"); 48 | m_sSystemID = sSystemID; 49 | m_aBAW = aBAW; 50 | m_bPartialSource = bPartialSource; 51 | } 52 | 53 | @NonNull 54 | @Nonempty 55 | public String getValidationSourceTypeID () 56 | { 57 | return VALIDATION_SOURCE_TYPE; 58 | } 59 | 60 | @Nullable 61 | public String getSystemID () 62 | { 63 | return m_sSystemID; 64 | } 65 | 66 | public boolean isPartialSource () 67 | { 68 | return m_bPartialSource; 69 | } 70 | 71 | @Nullable 72 | public ByteArrayWrapper getBytes () 73 | { 74 | return m_aBAW; 75 | } 76 | 77 | public void writeTo (@NonNull @WillNotClose final OutputStream aOS) throws IOException 78 | { 79 | // Just forward 80 | m_aBAW.writeTo (aOS); 81 | } 82 | 83 | @Override 84 | public String toString () 85 | { 86 | return new ToStringGenerator (this).append ("SystemID", m_sSystemID) 87 | .append ("PartialSource", m_bPartialSource) 88 | .append ("ByteArrayWrapper", m_aBAW) 89 | .getToString (); 90 | } 91 | 92 | /** 93 | * Create a complete validation source from an existing byte array. 94 | * 95 | * @param sSystemID 96 | * System ID to use. May be null. 97 | * @param aBytes 98 | * The bytes to use. May not be null. 99 | * @return Never null. 100 | */ 101 | @NonNull 102 | public static ValidationSourceBinary create (@Nullable final String sSystemID, @NonNull final byte [] aBytes) 103 | { 104 | ValueEnforcer.notNull (aBytes, "Bytes"); 105 | return new ValidationSourceBinary (sSystemID, new ByteArrayWrapper (aBytes, false), false); 106 | } 107 | 108 | /** 109 | * Create a partial validation source from an existing byte array. 110 | * 111 | * @param sSystemID 112 | * System ID to use. May be null. 113 | * @param aBytes 114 | * The bytes to use. May not be null. 115 | * @return Never null. 116 | * @since 10.1.0 117 | */ 118 | @NonNull 119 | public static ValidationSourceBinary createPartial (@Nullable final String sSystemID, @NonNull final byte [] aBytes) 120 | { 121 | ValueEnforcer.notNull (aBytes, "Bytes"); 122 | return new ValidationSourceBinary (sSystemID, new ByteArrayWrapper (aBytes, false), true); 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/ValidationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | 21 | import com.helger.annotation.Nonempty; 22 | import com.helger.annotation.concurrent.Immutable; 23 | import com.helger.base.enforce.ValueEnforcer; 24 | import com.helger.base.hashcode.HashCodeGenerator; 25 | import com.helger.base.tostring.ToStringGenerator; 26 | 27 | /** 28 | * The default implementation of custom {@link IValidationType}. 29 | * 30 | * @author Philip Helger 31 | * @since 7.1.0 32 | */ 33 | @Immutable 34 | public class ValidationType implements IValidationType 35 | { 36 | private final String m_sID; 37 | private final EValidationBaseType m_eBaseType; 38 | private final String m_sName; 39 | private final boolean m_bStopValidationOnError; 40 | private final boolean m_bContextRequired; 41 | 42 | public ValidationType (@NonNull @Nonempty final String sID, 43 | @NonNull final EValidationBaseType eBaseType, 44 | @NonNull @Nonempty final String sName, 45 | final boolean bStopValidationOnError, 46 | final boolean bContextRequired) 47 | { 48 | ValueEnforcer.notEmpty (sID, "ID"); 49 | ValueEnforcer.notNull (eBaseType, "BaseType"); 50 | ValueEnforcer.notEmpty (sName, "Name"); 51 | m_sID = sID; 52 | m_eBaseType = eBaseType; 53 | m_sName = sName; 54 | m_bStopValidationOnError = bStopValidationOnError; 55 | m_bContextRequired = bContextRequired; 56 | } 57 | 58 | @NonNull 59 | @Nonempty 60 | public String getID () 61 | { 62 | return m_sID; 63 | } 64 | 65 | @NonNull 66 | public EValidationBaseType getBaseType () 67 | { 68 | return m_eBaseType; 69 | } 70 | 71 | @NonNull 72 | @Nonempty 73 | public String getName () 74 | { 75 | return m_sName; 76 | } 77 | 78 | public boolean isStopValidationOnError () 79 | { 80 | return m_bStopValidationOnError; 81 | } 82 | 83 | public boolean isContextRequired () 84 | { 85 | return m_bContextRequired; 86 | } 87 | 88 | @Override 89 | public boolean equals (final Object o) 90 | { 91 | if (o == this) 92 | return true; 93 | if (o == null || !getClass ().equals (o.getClass ())) 94 | return false; 95 | final ValidationType rhs = (ValidationType) o; 96 | return m_sID.equals (rhs.m_sID) && 97 | m_eBaseType.equals (rhs.m_eBaseType) && 98 | m_sName.equals (rhs.m_sName) && 99 | m_bStopValidationOnError == rhs.m_bStopValidationOnError && 100 | m_bContextRequired == rhs.m_bContextRequired; 101 | } 102 | 103 | @Override 104 | public int hashCode () 105 | { 106 | return new HashCodeGenerator (this).append (m_sID) 107 | .append (m_eBaseType) 108 | .append (m_sName) 109 | .append (m_bStopValidationOnError) 110 | .append (m_bContextRequired) 111 | .getHashCode (); 112 | } 113 | 114 | @Override 115 | public String toString () 116 | { 117 | return new ToStringGenerator (this).append ("ID", m_sID) 118 | .append ("BaseType", m_eBaseType) 119 | .append ("Name", m_sName) 120 | .append ("StopValidationOnError", m_bStopValidationOnError) 121 | .append ("ContextRequired", m_bContextRequired) 122 | .getToString (); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /phive-xml/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | 23 | com.helger.phive 24 | phive-parent-pom 25 | 11.1.2-SNAPSHOT 26 | 27 | phive-xml 28 | bundle 29 | phive-xml 30 | phive - Philip Helger Integrative Validation Engine - XML validation 31 | https://github.com/phax/phive/phive-xml 32 | 2016 33 | 34 | 35 | 36 | Apache 2 37 | http://www.apache.org/licenses/LICENSE-2.0 38 | repo 39 | 40 | 41 | 42 | 43 | Philip Helger 44 | http://www.helger.com 45 | 46 | 47 | 48 | 49 | philip 50 | Philip Helger 51 | ph(at)helger.com 52 | http://www.helger.com 53 | 54 | 55 | 56 | 57 | 58 | com.helger.commons 59 | ph-jaxb 60 | 61 | 62 | com.helger.schematron 63 | ph-schematron-xslt 64 | 65 | 66 | com.helger.schematron 67 | ph-schematron-schxslt 68 | 69 | 70 | com.helger.schematron 71 | ph-schematron-schxslt2 72 | 73 | 74 | com.helger.schematron 75 | ph-schematron-pure 76 | 77 | 78 | com.helger.phive 79 | phive-api 80 | 81 | 82 | 83 | org.slf4j 84 | slf4j-simple 85 | test 86 | 87 | 88 | com.helger.commons 89 | ph-unittest-support-ext 90 | test 91 | 92 | 93 | 94 | 95 | 96 | 97 | org.apache.felix 98 | maven-bundle-plugin 99 | true 100 | 101 | 102 | com.helger.phive.xml 103 | 104 | com.helger.phive.xml.schematron, 105 | com.helger.phive.xml.source, 106 | com.helger.phive.xml.xsd 107 | 108 | !org.jspecify.annotations.*,* 109 | osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" 110 | osgi.serviceloader; osgi.serviceloader=com.helger.schematron.svrl.ISVRLLocationBeautifierSPI 111 | 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /phive-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 4.0.0 22 | 23 | com.helger.phive 24 | phive-parent-pom 25 | 11.1.2-SNAPSHOT 26 | 27 | phive-api 28 | bundle 29 | phive-api 30 | phive - Philip Helger Integrative Validation Engine API 31 | https://github.com/phax/phive/phive-api 32 | 2016 33 | 34 | 35 | Apache 2 36 | http://www.apache.org/licenses/LICENSE-2.0 37 | repo 38 | 39 | 40 | 41 | 42 | Philip Helger 43 | http://www.helger.com 44 | 45 | 46 | 47 | 48 | philip 49 | Philip Helger 50 | ph(at)helger.com 51 | http://www.helger.com 52 | 53 | 54 | 55 | 56 | 57 | com.helger.commons 58 | ph-io 59 | 60 | 61 | com.helger.commons 62 | ph-diagnostics 63 | 64 | 65 | com.helger.commons 66 | ph-datetime 67 | 68 | 69 | com.helger.diver 70 | ph-diver-api 71 | 72 | 73 | 74 | org.slf4j 75 | slf4j-simple 76 | test 77 | 78 | 79 | com.helger.commons 80 | ph-unittest-support-ext 81 | test 82 | 83 | 84 | 85 | 86 | 87 | 88 | org.apache.felix 89 | maven-bundle-plugin 90 | true 91 | 92 | 93 | com.helger.phive.api 94 | com.helger.phive.api, 95 | com.helger.phive.api.artefact, 96 | com.helger.phive.api.diver, 97 | com.helger.phive.api.execute, 98 | com.helger.phive.api.executor, 99 | com.helger.phive.api.executorset, 100 | com.helger.phive.api.executorset.status, 101 | com.helger.phive.api.mock, 102 | com.helger.phive.api.result, 103 | com.helger.phive.api.source, 104 | com.helger.phive.api.validity 105 | !org.jspecify.annotations.*,* 106 | osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" 107 | osgi.serviceloader; osgi.serviceloader=com.helger.diver.api.version.spi.IDVRPseudoVersionRegistrarSPI 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/EValidationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api; 18 | 19 | import org.jspecify.annotations.NonNull; 20 | import org.jspecify.annotations.Nullable; 21 | 22 | import com.helger.annotation.Nonempty; 23 | import com.helger.base.lang.EnumHelper; 24 | 25 | /** 26 | * Enum with all predefined validation types. Depending on this type, different implementation logic 27 | * must be used! 28 | * 29 | * @author Philip Helger 30 | */ 31 | public enum EValidationType implements IValidationType 32 | { 33 | /** 34 | * Validate XML syntax by parsing without assigned XSDs. This is the wellformedness check. 35 | */ 36 | XML ("xml", EValidationBaseType.XML, "XML Syntax"), 37 | /** Validate XML against the rules of an XML Schema (XSD) */ 38 | XSD ("xsd", EValidationBaseType.XSD, "XML Schema"), 39 | /** 40 | * Validate part of an XML against the rules of an XML Schema (XSD) - e.g. for extension/plugins. 41 | * The context object needed for this type is an 42 | * ValidationExecutorXSDPartial.ContextData. 43 | */ 44 | PARTIAL_XSD ("partial-xsd", EValidationBaseType.XSD, "Partial XML Schema"), 45 | /** 46 | * Pure Java implementation of Schematron - can only handle XPath 2 (was originally called 47 | * SCHEMATRON) 48 | */ 49 | SCHEMATRON_PURE ("schematron-pure", EValidationBaseType.SCHEMATRON, "Schematron (pure; XPath-only)"), 50 | /** 51 | * Schematron implementation that must convert the SCH to XSLT before validation 52 | */ 53 | SCHEMATRON_SCH ("schematron-sch", EValidationBaseType.SCHEMATRON, "Schematron (SCH; ISO XSLT2)"), 54 | /** 55 | * Schematron validation to convert SCH to XSLT with SchXslt v1 56 | * 57 | * @since 7.0.0 58 | */ 59 | SCHEMATRON_SCHXSLT ("schematron-schxslt-xslt2", EValidationBaseType.SCHEMATRON, "Schematron (SchXslt XSLT2)"), 60 | /** 61 | * Schematron validation to convert SCH to XSLT with SchXslt v2 62 | * 63 | * @since 11.1.1 64 | */ 65 | SCHEMATRON_SCHXSLT2 ("schematron-schxslt2", EValidationBaseType.SCHEMATRON, "Schematron (SchXslt2)"), 66 | /** 67 | * Schematron validation with a pre-build XSLT file (e.g. from the Maven plugin) 68 | */ 69 | SCHEMATRON_XSLT ("schematron-xslt", EValidationBaseType.SCHEMATRON, "Schematron (ISO XSLT2)"), 70 | /** 71 | * Schematron validation with a pre-build XSLT file (e.g. from the Maven plugin) with different 72 | * output (for OIOUBL only) 73 | */ 74 | SCHEMATRON_OIOUBL ("schematron-xslt-oioubl", EValidationBaseType.SCHEMATRON, "Schematron (OIOUBL XSLT)"); 75 | 76 | private final String m_sID; 77 | private final EValidationBaseType m_eBaseType; 78 | private final String m_sName; 79 | 80 | EValidationType (@NonNull @Nonempty final String sID, 81 | @NonNull final EValidationBaseType eBaseType, 82 | @NonNull @Nonempty final String sName) 83 | { 84 | m_sID = sID; 85 | m_eBaseType = eBaseType; 86 | m_sName = sName; 87 | } 88 | 89 | @NonNull 90 | @Nonempty 91 | public String getID () 92 | { 93 | return m_sID; 94 | } 95 | 96 | @NonNull 97 | public EValidationBaseType getBaseType () 98 | { 99 | return m_eBaseType; 100 | } 101 | 102 | @NonNull 103 | @Nonempty 104 | public String getName () 105 | { 106 | return m_sName; 107 | } 108 | 109 | public boolean isStopValidationOnError () 110 | { 111 | return m_eBaseType.isXML () || m_eBaseType.isXSD (); 112 | } 113 | 114 | public boolean isContextRequired () 115 | { 116 | return this == PARTIAL_XSD; 117 | } 118 | 119 | @Nullable 120 | public static EValidationType getFromIDOrNull (@Nullable final String sID) 121 | { 122 | return EnumHelper.getFromIDOrNull (EValidationType.class, sID); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /phive-ves-engine/src/main/java/com/helger/phive/ves/engine/load/VESValidationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.ves.engine.load; 18 | 19 | import java.time.Duration; 20 | import java.time.OffsetDateTime; 21 | 22 | import org.jspecify.annotations.NonNull; 23 | 24 | import com.helger.annotation.concurrent.NotThreadSafe; 25 | import com.helger.annotation.style.ReturnsMutableObject; 26 | import com.helger.base.enforce.ValueEnforcer; 27 | import com.helger.diver.api.coord.DVRCoordinate; 28 | import com.helger.phive.api.result.ValidationResultList; 29 | import com.helger.phive.api.source.IValidationSource; 30 | 31 | /** 32 | * This class contains the collected validation results, including metadata on 33 | * the execution. 34 | * 35 | * @author Philip Helger 36 | */ 37 | @NotThreadSafe 38 | public final class VESValidationResult 39 | { 40 | private final DVRCoordinate m_aVESID; 41 | private final IValidationSource m_aValidationSource; 42 | private final OffsetDateTime m_aStartDateTime; 43 | private final Duration m_aLoadingDuration; 44 | private final Duration m_aValidationDuration; 45 | private final ValidationResultList m_aValidationResultList; 46 | 47 | /** 48 | * Constructor 49 | * 50 | * @param aVESID 51 | * The VESID that was validated. May not be null. 52 | * @param aValidationSource 53 | * The source that was validated. May not be null. 54 | * @param aStartDateTime 55 | * When did it all start. This is the timestamp when loading begins. 56 | * May not be null. 57 | * @param aLoadingDuration 58 | * The loading duration. May not be null. 59 | * @param aValidationDuration 60 | * The duration of the validation itself. May not be null. 61 | * @param aValidationResultList 62 | * The validation result list. May not be null. 63 | */ 64 | public VESValidationResult (@NonNull final DVRCoordinate aVESID, 65 | @NonNull final IValidationSource aValidationSource, 66 | @NonNull final OffsetDateTime aStartDateTime, 67 | @NonNull final Duration aLoadingDuration, 68 | @NonNull final Duration aValidationDuration, 69 | @NonNull final ValidationResultList aValidationResultList) 70 | { 71 | ValueEnforcer.notNull (aVESID, "VESID"); 72 | ValueEnforcer.notNull (aValidationSource, "ValidationSource"); 73 | ValueEnforcer.notNull (aStartDateTime, "StartDateTime"); 74 | ValueEnforcer.notNull (aLoadingDuration, "LoadingDuration"); 75 | ValueEnforcer.notNull (aValidationDuration, "ValidationDuration"); 76 | ValueEnforcer.notNull (aValidationResultList, "ValidationResultList"); 77 | m_aVESID = aVESID; 78 | m_aValidationSource = aValidationSource; 79 | m_aStartDateTime = aStartDateTime; 80 | m_aLoadingDuration = aLoadingDuration; 81 | m_aValidationDuration = aValidationDuration; 82 | m_aValidationResultList = aValidationResultList; 83 | } 84 | 85 | @NonNull 86 | public DVRCoordinate getVESID () 87 | { 88 | return m_aVESID; 89 | } 90 | 91 | @NonNull 92 | public IValidationSource getValidationSource () 93 | { 94 | return m_aValidationSource; 95 | } 96 | 97 | @NonNull 98 | public OffsetDateTime getStartDateTime () 99 | { 100 | return m_aStartDateTime; 101 | } 102 | 103 | @NonNull 104 | public Duration getLoadingDuration () 105 | { 106 | return m_aLoadingDuration; 107 | } 108 | 109 | @NonNull 110 | public Duration getValidationDuration () 111 | { 112 | return m_aValidationDuration; 113 | } 114 | 115 | @NonNull 116 | @ReturnsMutableObject 117 | public ValidationResultList getValidationResultList () 118 | { 119 | return m_aValidationResultList; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/executorset/status/IValidationExecutorSetStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.executorset.status; 18 | 19 | import java.time.OffsetDateTime; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.annotation.Nonempty; 25 | import com.helger.annotation.style.ReturnsMutableCopy; 26 | import com.helger.annotation.style.ReturnsMutableObject; 27 | import com.helger.base.string.StringHelper; 28 | import com.helger.collection.commons.ICommonsList; 29 | import com.helger.datetime.helper.PDTFactory; 30 | import com.helger.diver.api.coord.DVRCoordinate; 31 | 32 | /** 33 | * Defines the status of a VES. 34 | * 35 | * @author Philip Helger 36 | * @since 9.2.0 37 | */ 38 | public interface IValidationExecutorSetStatus 39 | { 40 | /** 41 | * @return The date and time of the last modification of this status. Precision is limited to 42 | * milliseconds. May never be null. 43 | */ 44 | @NonNull 45 | OffsetDateTime getStatusLastModification (); 46 | 47 | /** 48 | * @return The effective status type. May not be null. 49 | */ 50 | @NonNull 51 | EValidationExecutorStatusType getType (); 52 | 53 | /** 54 | * @return true if the status type is deprecated, false if not. 55 | */ 56 | default boolean isDeprecated () 57 | { 58 | return getType ().isDeprecated (); 59 | } 60 | 61 | default boolean hasValidFrom () 62 | { 63 | return getValidFrom () != null; 64 | } 65 | 66 | /** 67 | * @return The date and time from which this artefact is valid. Precision is limited to 68 | * milliseconds. May be null to indicate "since forever". 69 | */ 70 | @Nullable 71 | OffsetDateTime getValidFrom (); 72 | 73 | default boolean hasValidTo () 74 | { 75 | return getValidTo () != null; 76 | } 77 | 78 | /** 79 | * @return The date and time until which this artefact is valid. Precision is limited to 80 | * milliseconds. May be null to indicate "forever". 81 | */ 82 | @Nullable 83 | OffsetDateTime getValidTo (); 84 | 85 | default boolean isValidPerNow () 86 | { 87 | return isValidPer (PDTFactory.getCurrentOffsetDateTime ()); 88 | } 89 | 90 | default boolean isValidPer (@NonNull final OffsetDateTime aDT) 91 | { 92 | if (hasValidFrom () && aDT.isBefore (getValidFrom ())) 93 | return false; 94 | if (hasValidTo () && aDT.isAfter (getValidTo ())) 95 | return false; 96 | return true; 97 | } 98 | 99 | default boolean hasDeprecationReason () 100 | { 101 | return StringHelper.isNotEmpty (getDeprecationReason ()); 102 | } 103 | 104 | /** 105 | * @return If this is deprecated, this field may contain a human readable description. May be 106 | * null. 107 | */ 108 | @Nullable 109 | String getDeprecationReason (); 110 | 111 | /** 112 | * @return true if a replacement VESID is present, false if not. 113 | */ 114 | default boolean hasReplacementVESID () 115 | { 116 | return getReplacementVESID () != null; 117 | } 118 | 119 | /** 120 | * @return The replacement VESID to be used. May be null. If this artefact is 121 | * deprecated and a later version exists, the latest version is always considered the 122 | * appropriate replacement. However if group ID or artefact ID changed, it needs to be 123 | * explicitly provided here as a replacement VESID. 124 | */ 125 | @Nullable 126 | DVRCoordinate getReplacementVESID (); 127 | 128 | @NonNull 129 | @Nonempty 130 | @ReturnsMutableObject 131 | ICommonsList historyItems (); 132 | 133 | @NonNull 134 | @Nonempty 135 | @ReturnsMutableCopy 136 | ICommonsList getAllHistoryItems (); 137 | } 138 | -------------------------------------------------------------------------------- /phive-api/src/main/java/com/helger/phive/api/execute/IValidationExecutionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2025 Philip Helger (www.helger.com) 3 | * philip[at]helger[dot]com 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.helger.phive.api.execute; 18 | 19 | import java.util.Locale; 20 | 21 | import org.jspecify.annotations.NonNull; 22 | import org.jspecify.annotations.Nullable; 23 | 24 | import com.helger.base.state.EValidity; 25 | import com.helger.phive.api.result.ValidationResultList; 26 | import com.helger.phive.api.source.IValidationSource; 27 | import com.helger.phive.api.validity.IValidityDeterminator; 28 | 29 | /** 30 | * Interface for an execution manager that applies a set of rules onto an object 31 | * to be validated (validation source). 32 | * 33 | * @author Philip Helger 34 | * @param 35 | * The validation source type to be used. 36 | */ 37 | public interface IValidationExecutionManager 38 | { 39 | /** 40 | * @return The validity determinator to be used. Never null. 41 | */ 42 | @NonNull 43 | IValidityDeterminator getValidityDeterminator (); 44 | 45 | /** 46 | * Perform a validation with all the contained executors and the system 47 | * default locale. 48 | * 49 | * @param aSource 50 | * The source artefact to be validated. May not be null. 51 | * contained executor a result is added to the result list. 52 | * @return The validation result list. Never null. For each 53 | * contained executor a result is added to the result list. 54 | * @see #executeValidation(IValidationSource, ValidationResultList, Locale) 55 | */ 56 | @NonNull 57 | default ValidationResultList executeValidation (@NonNull final SOURCETYPE aSource) 58 | { 59 | return executeValidation (aSource, (Locale) null); 60 | } 61 | 62 | /** 63 | * Perform a validation with all the contained executors. 64 | * 65 | * @param aSource 66 | * The source artefact to be validated. May not be null. 67 | * @param aLocale 68 | * Custom locale to use e.g. for error messages. May be 69 | * null to use the system default locale. 70 | * @return The validation result list. Never null. For each 71 | * contained executor a result is added to the result list. 72 | * @see #executeValidation(IValidationSource, ValidationResultList, Locale) 73 | */ 74 | @NonNull 75 | default ValidationResultList executeValidation (@NonNull final SOURCETYPE aSource, @Nullable final Locale aLocale) 76 | { 77 | final ValidationResultList ret = new ValidationResultList (aSource); 78 | executeValidation (aSource, ret, aLocale); 79 | return ret; 80 | } 81 | 82 | /** 83 | * Perform a validation with all the contained executors. 84 | * 85 | * @param aSource 86 | * The source artefact to be validated. May not be null. 87 | * @param aValidationResults 88 | * The result list to be filled. May not be null. Note: 89 | * this list is NOT altered before start. For each contained executor a 90 | * result is added to the result list. 91 | * @param aLocale 92 | * Custom locale to use e.g. for error messages. May be 93 | * null to use the system default locale. 94 | * @see #executeValidation(IValidationSource, Locale) 95 | */ 96 | void executeValidation (@NonNull SOURCETYPE aSource, 97 | @NonNull ValidationResultList aValidationResults, 98 | @Nullable Locale aLocale); 99 | 100 | /** 101 | * Perform a fast validation that stops on the first error. 102 | * 103 | * @param aSource 104 | * The source artefact to be validated. May not be null. 105 | * @return {@link EValidity#VALID} if the document is valid, 106 | * {@link EValidity#INVALID} if the document is invalid. Never 107 | * null. 108 | */ 109 | @NonNull 110 | EValidity executeFastValidation (@NonNull SOURCETYPE aSource); 111 | } 112 | --------------------------------------------------------------------------------