diff --git a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_2_9.java b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_2_9.java index eb5acd41..32e21aa5 100644 --- a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_2_9.java +++ b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_2_9.java @@ -44,7 +44,7 @@ public final class PeppolItalyValidation2_2_9 public static final String VERSION_STR = "2.2.9"; // Standard - private static final String GROUP_ID = "it.peppol"; + public static final String GROUP_ID = "it.peppol"; public static final DVRCoordinate VID_DESPATCH_ADVICE = PhiveRulesHelper.createCoordinate (GROUP_ID, "despatch-advice", VERSION_STR); diff --git a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_3_0.java b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_3_0.java index 29a81ea2..77021710 100644 --- a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_3_0.java +++ b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation2_3_0.java @@ -44,7 +44,7 @@ public final class PeppolItalyValidation2_3_0 public static final String VERSION_STR = "2.3.0"; // Standard - private static final String GROUP_ID = "it.peppol"; + public static final String GROUP_ID = "it.peppol"; public static final DVRCoordinate VID_DESPATCH_ADVICE = PhiveRulesHelper.createCoordinate (GROUP_ID, "despatch-advice", diff --git a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_0_2.java b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_0_2.java index 33dee59a..af8627c4 100644 --- a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_0_2.java +++ b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_0_2.java @@ -43,7 +43,7 @@ public final class PeppolItalyValidation3_0_2 public static final String VERSION_STR = "3.0.2"; // Standard - private static final String GROUP_ID = "it.peppol"; + public static final String GROUP_ID = "it.peppol"; public static final DVRCoordinate VID_CREDIT_NOTE = PhiveRulesHelper.createCoordinate (GROUP_ID, "creditnote", diff --git a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_1_0.java b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_1_0.java index b979fa29..d6d21768 100644 --- a/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_1_0.java +++ b/phive-rules-peppol-italy/src/main/java/com/helger/phive/peppol/italy/PeppolItalyValidation3_1_0.java @@ -43,7 +43,7 @@ public final class PeppolItalyValidation3_1_0 public static final String VERSION_STR = "3.1.0"; // Standard - private static final String GROUP_ID = "it.peppol"; + public static final String GROUP_ID = "it.peppol"; public static final DVRCoordinate VID_CREDIT_NOTE = PhiveRulesHelper.createCoordinate (GROUP_ID, "creditnote", diff --git a/phive-rules-xrechnung/src/main/java/com/helger/phive/xrechnung/XRechnungValidation.java b/phive-rules-xrechnung/src/main/java/com/helger/phive/xrechnung/XRechnungValidation.java index 3d34ae03..ba13268a 100644 --- a/phive-rules-xrechnung/src/main/java/com/helger/phive/xrechnung/XRechnungValidation.java +++ b/phive-rules-xrechnung/src/main/java/com/helger/phive/xrechnung/XRechnungValidation.java @@ -19,13 +19,16 @@ import javax.annotation.Nonnull; import javax.annotation.concurrent.Immutable; -import com.helger.cii.d16b.CCIID16B; import com.helger.commons.ValueEnforcer; +import com.helger.commons.annotation.ReturnsMutableCopy; +import com.helger.commons.collection.impl.CommonsArrayList; import com.helger.commons.collection.impl.CommonsHashMap; +import com.helger.commons.collection.impl.ICommonsList; import com.helger.commons.collection.impl.ICommonsMap; import com.helger.commons.error.level.EErrorLevel; import com.helger.commons.io.resource.ClassPathResource; import com.helger.diver.api.coord.DVRCoordinate; +import com.helger.phive.api.execute.IValidationExecutor; import com.helger.phive.api.executorset.IValidationExecutorSet; import com.helger.phive.api.executorset.IValidationExecutorSetRegistry; import com.helger.phive.api.executorset.ValidationExecutorSet; @@ -34,9 +37,8 @@ import com.helger.phive.rules.api.PhiveRulesHelper; import com.helger.phive.rules.api.PhiveRulesUBLHelper; import com.helger.phive.xml.schematron.CustomErrorDetails; +import com.helger.phive.xml.schematron.ValidationExecutorSchematron; import com.helger.phive.xml.source.IValidationSourceXML; -import com.helger.phive.xml.xsd.ValidationExecutorXSD; -import com.helger.ubl21.UBL21Marshaller; /** * Generic XRechnung validation configuration. It is based on the EN16931 @@ -203,6 +205,22 @@ private static ClassLoader _getCL () return XRechnungValidation.class.getClassLoader (); } + @Nonnull + @ReturnsMutableCopy + private static ICommonsList > _getListWithCustomErrorDetails (@Nonnull final IValidationExecutorSet aSrc, + @Nonnull final ICommonsMap aCustomErrors) + { + // Same Schematrons as base VES, but modified customization + final ICommonsList > ret = new CommonsArrayList <> (aSrc.executors () + .size () + 1); + for (final var aItem : aSrc) + if (aItem instanceof ValidationExecutorSchematron) + ret.add (((ValidationExecutorSchematron) aItem).getClone ().addCustomErrorDetails (aCustomErrors)); + else + ret.add (aItem); + return ret; + } + /** * Register all standard XRechnung validation execution sets to the provided * registry. Make sure to register the EN16931 artefacts before you register @@ -329,307 +347,409 @@ public static void initXRechnung (@Nonnull final IValidationExecutorSetRegistry aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-24", CustomErrorDetails.of (EErrorLevel.INFO)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_200, - "XRechnung CII " + - VID_XRECHNUNG_CII_200.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_132_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "2.0.0/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_200, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_200.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_132_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.0.0/XRechnung-UBL-validation-CreditNote.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_200, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_200.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_132_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.0.0/XRechnung-UBL-validation-Invoice.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII132, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "2.0.0/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_200, + "XRechnung CII " + + VID_XRECHNUNG_CII_200.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote132, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.0.0/XRechnung-UBL-validation-CreditNote.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_200, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_200.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice132, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.0.0/XRechnung-UBL-validation-Invoice.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_200, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_200.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } } // v2.0.1 (based on rule release 1.5.0) { + final IValidationExecutorSet aVESCII133 = aRegistry.getOfID (EN16931Validation.VID_CII_133); + final IValidationExecutorSet aVESUBLCreditNote133 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_133); + final IValidationExecutorSet aVESUBLInvoice133 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_133); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-01", CustomErrorDetails.of (EErrorLevel.INFO)); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-24", CustomErrorDetails.of (EErrorLevel.INFO)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_201, - "XRechnung CII " + - VID_XRECHNUNG_CII_201.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_133_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "2.0.1/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_201, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_201.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_133_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.0.1/XRechnung-UBL-validation-CreditNote.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_201, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_201.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_133_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.0.1/XRechnung-UBL-validation-Invoice.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII133, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "2.0.1/XRechnung-CII-validation.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_201, + "XRechnung CII " + + VID_XRECHNUNG_CII_201.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote133, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.0.1/XRechnung-UBL-validation-CreditNote.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_201, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_201.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice133, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.0.1/XRechnung-UBL-validation-Invoice.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_201, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_201.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } } // v2.1.1 (based on rule release 1.6.0) // Based on the EN16931 rules in this fork: // https://github.com/phax/eInvoicing-EN16931/releases/tag/validation-1.3.6a { + final IValidationExecutorSet aVESCII136a = aRegistry.getOfID (EN16931Validation.VID_CII_136A); + final IValidationExecutorSet aVESUBLCreditNote136a = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_136A); + final IValidationExecutorSet aVESUBLInvoice136a = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_136A); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-01", CustomErrorDetails.of (EErrorLevel.INFO)); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-24", CustomErrorDetails.of (EErrorLevel.INFO)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_211, - "XRechnung CII " + - VID_XRECHNUNG_CII_211.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_136A_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "2.1.1/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_211, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_211.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_136A_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.1.1/XRechnung-UBL-validation-CreditNote.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_211, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_211.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_136A_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.1.1/XRechnung-UBL-validation-Invoice.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII136a, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "2.1.1/XRechnung-CII-validation.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_211, + "XRechnung CII " + + VID_XRECHNUNG_CII_211.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote136a, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.1.1/XRechnung-UBL-validation-CreditNote.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_211, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_211.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice136a, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.1.1/XRechnung-UBL-validation-Invoice.xslt", + _getCL ()))); + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_211, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_211.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } } // v2.2.0 (based on rule release 1.7.1) // Uses CEN release 1.3.7 { + final IValidationExecutorSet aVESCII137 = aRegistry.getOfID (EN16931Validation.VID_CII_137); + final IValidationExecutorSet aVESUBLCreditNote137 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_137); + final IValidationExecutorSet aVESUBLInvoice137 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_137); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-01", CustomErrorDetails.of (EErrorLevel.INFO)); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_220, - "XRechnung CII " + - VID_XRECHNUNG_CII_220.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_137_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "2.2.0/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_220, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_220.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_137_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.2.0/XRechnung-UBL-validation-CreditNote.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_220, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_220.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_137_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.2.0/XRechnung-UBL-validation-Invoice.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII137, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "2.2.0/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_220, + "XRechnung CII " + + VID_XRECHNUNG_CII_220.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote137, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.2.0/XRechnung-UBL-validation-CreditNote.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_220, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_220.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice137, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.2.0/XRechnung-UBL-validation-Invoice.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_220, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_220.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } } // v2.3.1 (based on rule release 1.8.1) // Uses CEN rules 1.3.9 { + final IValidationExecutorSet aVESCII139 = aRegistry.getOfID (EN16931Validation.VID_CII_139); + final IValidationExecutorSet aVESUBLCreditNote139 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_139); + final IValidationExecutorSet aVESUBLInvoice139 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_139); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_231, - "XRechnung CII " + - VID_XRECHNUNG_CII_231.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_139_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "2.3.1/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_231, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_231.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_139_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.3.1/XRechnung-UBL-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_231, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_231.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_139_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "2.3.1/XRechnung-UBL-validation.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII139, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "2.3.1/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_231, + "XRechnung CII " + + VID_XRECHNUNG_CII_231.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote139, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.3.1/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_231, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_231.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice139, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "2.3.1/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_231, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_231.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bDeprecated), + aNewList)); + } } // v3.0.0 (based on rule release 2.0.0) // Uses CEN rules 1.3.10 { + final IValidationExecutorSet aVESCII1310 = aRegistry.getOfID (EN16931Validation.VID_CII_1310); + final IValidationExecutorSet aVESUBLCreditNote1310 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_1310); + final IValidationExecutorSet aVESUBLInvoice1310 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_1310); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_300, - "XRechnung CII " + - VID_XRECHNUNG_CII_300.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_1310_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "3.0.0/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_300, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_300.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1310_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.0/XRechnung-UBL-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_300, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_300.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1310_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.0/XRechnung-UBL-validation.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII1310, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "3.0.0/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_300, + "XRechnung CII " + + VID_XRECHNUNG_CII_300.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote1310, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.0/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_300, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_300.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice1310, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.0/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_300, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_300.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } } // v3.0.1 (based on rule release 2.0.2) // Uses CEN rules 1.3.11 { + final IValidationExecutorSet aVESCII1311 = aRegistry.getOfID (EN16931Validation.VID_CII_1311); + final IValidationExecutorSet aVESUBLCreditNote1311 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_1311); + final IValidationExecutorSet aVESUBLInvoice1311 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_1311); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_301, - "XRechnung CII " + - VID_XRECHNUNG_CII_301.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_1311_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "3.0.1/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_301, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_301.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1311_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.1/XRechnung-UBL-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_301, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_301.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1311_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.1/XRechnung-UBL-validation.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII1311, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "3.0.1/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_301, + "XRechnung CII " + + VID_XRECHNUNG_CII_301.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote1311, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.1/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_301, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_301.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice1311, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.1/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_301, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_301.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } } // v3.0.2 (based on rule release 2.1.0) // Uses CEN rules 1.3.12 { + final IValidationExecutorSet aVESCII1312 = aRegistry.getOfID (EN16931Validation.VID_CII_1312); + final IValidationExecutorSet aVESUBLCreditNote1312 = aRegistry.getOfID (EN16931Validation.VID_UBL_CREDIT_NOTE_1312); + final IValidationExecutorSet aVESUBLInvoice1312 = aRegistry.getOfID (EN16931Validation.VID_UBL_INVOICE_1312); + final ICommonsMap aCustomErrorLevels = new CommonsHashMap <> (); aCustomErrorLevels.put ("BR-CL-23", CustomErrorDetails.of (EErrorLevel.WARN)); aCustomErrorLevels.put ("BR-CL-21", CustomErrorDetails.of (EErrorLevel.WARN)); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_302, - "XRechnung CII " + - VID_XRECHNUNG_CII_302.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (CCIID16B.getXSDResource ()), - PhiveRulesUBLHelper.createXSLT_CII_D16B (EN16931Validation.INVOICE_CII_1312_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + - "3.0.2/XRechnung-CII-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_302, - "XRechnung UBL Credit Note " + - VID_XRECHNUNG_UBL_CREDITNOTE_302.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1312_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.2/XRechnung-UBL-validation.xslt", - _getCL ())))); - aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_302, - "XRechnung UBL Invoice " + - VID_XRECHNUNG_UBL_INVOICE_302.getVersionString (), - PhiveRulesHelper.createSimpleStatus (bNotDeprecated), - ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()), - PhiveRulesUBLHelper.createXSLT_UBL21 (EN16931Validation.INVOICE_UBL_1312_XSLT) - .addCustomErrorDetails (aCustomErrorLevels), - PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + - "3.0.2/XRechnung-UBL-validation.xslt", - _getCL ())))); + + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESCII1312, + aCustomErrorLevels); + aNewList.add (PhiveRulesCIIHelper.createXSLT_CII_D16B (new ClassPathResource (sPrefix + + "3.0.2/XRechnung-CII-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_CII_302, + "XRechnung CII " + + VID_XRECHNUNG_CII_302.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLCreditNote1312, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.2/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_CREDITNOTE_302, + "XRechnung UBL Credit Note " + + VID_XRECHNUNG_UBL_CREDITNOTE_302.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } + { + final ICommonsList > aNewList = _getListWithCustomErrorDetails (aVESUBLInvoice1312, + aCustomErrorLevels); + aNewList.add (PhiveRulesUBLHelper.createXSLT_UBL21 (new ClassPathResource (sPrefix + + "3.0.2/XRechnung-UBL-validation.xslt", + _getCL ()))); + + aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_XRECHNUNG_UBL_INVOICE_302, + "XRechnung UBL Invoice " + + VID_XRECHNUNG_UBL_INVOICE_302.getVersionString (), + PhiveRulesHelper.createSimpleStatus (bNotDeprecated), + aNewList)); + } } } } diff --git a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/ValidationExecutionManagerFuncTest.java b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/ValidationExecutionManagerFuncTest.java index 9dfaf05c..27897ade 100644 --- a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/ValidationExecutionManagerFuncTest.java +++ b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/ValidationExecutionManagerFuncTest.java @@ -30,6 +30,7 @@ import com.helger.phive.api.executorset.IValidationExecutorSet; import com.helger.phive.api.mock.TestFile; import com.helger.phive.api.result.ValidationResultList; +import com.helger.phive.api.validity.IValidityDeterminator; import com.helger.phive.xml.source.IValidationSourceXML; import com.helger.phive.xml.source.ValidationSourceXML; import com.helger.phive.xrechnung.mock.CTestFiles; @@ -64,7 +65,10 @@ public void testApplyCompleteValidation () // Read as desired type final IValidationSourceXML aSource = ValidationSourceXML.create (aTestFile.getResource ().getPath (), aNode); - final ValidationResultList aErrors = ValidationExecutionManager.executeValidation (aExecutors, aSource, Locale.US); + final ValidationResultList aErrors = ValidationExecutionManager.executeValidation (IValidityDeterminator.getDefault (), + aExecutors, + aSource, + Locale.US); if (aTestFile.isGoodCase ()) assertTrue (aErrors.getAllErrors ().toString (), aErrors.containsNoError ()); else diff --git a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/XRechnungValidationTest.java b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/XRechnungValidationTest.java index 98fb9025..146f4e73 100644 --- a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/XRechnungValidationTest.java +++ b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/XRechnungValidationTest.java @@ -21,15 +21,11 @@ import org.junit.Test; import com.helger.commons.io.resource.IReadableResource; -import com.helger.phive.api.EValidationType; -import com.helger.phive.api.artefact.IValidationArtefact; import com.helger.phive.api.execute.IValidationExecutor; import com.helger.phive.api.executorset.IValidationExecutorSet; +import com.helger.phive.rules.api.PhiveRulesTestHelper; import com.helger.phive.xml.source.IValidationSourceXML; import com.helger.phive.xrechnung.mock.CTestFiles; -import com.helger.schematron.pure.SchematronResourcePure; -import com.helger.schematron.sch.SchematronResourceSCH; -import com.helger.schematron.xslt.SchematronResourceXSLT; /** * Test class for class {@link XRechnungValidation}. @@ -54,19 +50,6 @@ public void testSchematronsValid () { for (final IValidationExecutorSet aVES : CTestFiles.VES_REGISTRY.getAll ()) for (final IValidationExecutor aVE : aVES) - { - final IValidationArtefact aVA = aVE.getValidationArtefact (); - final IReadableResource aRes = aVA.getRuleResource (); - - // Check that the passed Schematron is valid - if (aVA.getValidationArtefactType () == EValidationType.SCHEMATRON_PURE) - assertTrue (aRes.toString (), new SchematronResourcePure (aRes).isValidSchematron ()); - else - if (aVA.getValidationArtefactType () == EValidationType.SCHEMATRON_SCH) - assertTrue (aRes.toString (), new SchematronResourceSCH (aRes).isValidSchematron ()); - else - if (aVA.getValidationArtefactType () == EValidationType.SCHEMATRON_XSLT) - assertTrue (aRes.toString (), new SchematronResourceXSLT (aRes).isValidSchematron ()); - } + assertTrue (PhiveRulesTestHelper.isContentCorrect (aVE)); } } diff --git a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/mock/CTestFiles.java b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/mock/CTestFiles.java index 131f1fc7..f4914109 100644 --- a/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/mock/CTestFiles.java +++ b/phive-rules-xrechnung/src/test/java/com/helger/phive/xrechnung/mock/CTestFiles.java @@ -27,7 +27,7 @@ import com.helger.commons.collection.impl.ICommonsList; import com.helger.commons.io.resource.ClassPathResource; import com.helger.commons.io.resource.IReadableResource; -import com.helger.diver.api.version.VESID; +import com.helger.diver.api.coord.DVRCoordinate; import com.helger.phive.api.executorset.ValidationExecutorSetRegistry; import com.helger.phive.api.mock.TestFile; import com.helger.phive.en16931.EN16931Validation; @@ -53,49 +53,49 @@ private CTestFiles () public static ICommonsList getAllTestFiles () { final ICommonsList ret = new CommonsArrayList <> (); - for (final VESID aESID : new VESID [] { XRechnungValidation.VID_XRECHNUNG_CII_302, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_302, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_302, + for (final DVRCoordinate aESID : new DVRCoordinate [] { XRechnungValidation.VID_XRECHNUNG_CII_302, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_302, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_302, - XRechnungValidation.VID_XRECHNUNG_CII_301, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_301, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_301, + XRechnungValidation.VID_XRECHNUNG_CII_301, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_301, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_301, - XRechnungValidation.VID_XRECHNUNG_CII_300, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_300, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_300, + XRechnungValidation.VID_XRECHNUNG_CII_300, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_300, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_300, - XRechnungValidation.VID_XRECHNUNG_CII_231, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_231, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_231, + XRechnungValidation.VID_XRECHNUNG_CII_231, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_231, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_231, - XRechnungValidation.VID_XRECHNUNG_CII_220, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_220, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_220, + XRechnungValidation.VID_XRECHNUNG_CII_220, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_220, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_220, - XRechnungValidation.VID_XRECHNUNG_CII_120, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_120, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_120, + XRechnungValidation.VID_XRECHNUNG_CII_120, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_120, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_120, - XRechnungValidation.VID_XRECHNUNG_CII_121, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_121, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_121, + XRechnungValidation.VID_XRECHNUNG_CII_121, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_121, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_121, - XRechnungValidation.VID_XRECHNUNG_CII_122, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_122, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_122, + XRechnungValidation.VID_XRECHNUNG_CII_122, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_122, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_122, - XRechnungValidation.VID_XRECHNUNG_CII_200, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_200, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_200, + XRechnungValidation.VID_XRECHNUNG_CII_200, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_200, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_200, - XRechnungValidation.VID_XRECHNUNG_CII_201, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_201, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_201, + XRechnungValidation.VID_XRECHNUNG_CII_201, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_201, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_201, - XRechnungValidation.VID_XRECHNUNG_CII_211, - XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_211, - XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_211, }) + XRechnungValidation.VID_XRECHNUNG_CII_211, + XRechnungValidation.VID_XRECHNUNG_UBL_CREDITNOTE_211, + XRechnungValidation.VID_XRECHNUNG_UBL_INVOICE_211, }) for (final IReadableResource aRes : getAllMatchingTestFiles (aESID)) { assertTrue ("Not existing test file: " + aRes.getPath (), aRes.exists ()); @@ -106,7 +106,7 @@ public static ICommonsList getAllTestFiles () @Nonnull @ReturnsMutableCopy - public static ICommonsList getAllMatchingTestFiles (@Nonnull final VESID aVESID) + public static ICommonsList getAllMatchingTestFiles (@Nonnull final DVRCoordinate aVESID) { ValueEnforcer.notNull (aVESID, "VESID");