Skip to content

Commit

Permalink
Added support for Peppol Italy rules 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Sep 5, 2024
1 parent b34d05d commit e40ea2a
Show file tree
Hide file tree
Showing 187 changed files with 143,530 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ I hope that with the introduction of PINT, the versioning problem will be solved

# News and noteworthy

* v3.1.13 - work in progress
* Added support for Peppol Italy rules 3.1.0 (AGID Credit Note, Despatch Advice, Invoice, Order, Order Agreement and Order Response)
* v3.1.12 - 2024-07-29
* Updated to phive 9.2.2
* Added Peppol PINT rules 1.0.2
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 15 additions & 11 deletions phive-rules-peppol-italy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<agid-rules.version>3.1.0</agid-rules.version>
</properties>

<build>
<plugins>
Expand Down Expand Up @@ -102,22 +106,22 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm016-3.0-despatch-advice/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/${agid-rules.version}/peppolbis-trdm016-3.0-despatch-advice/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/despatch-advice</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/${agid-rules.version}/despatch-advice</xsltDirectory>
</configuration>
</execution>
-->
<!--
<!--
<execution>
<id>invoice</id>
<goals>
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-en16931-ubl-3.0-invoice/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/${agid-rules.version}/peppolbis-en16931-ubl-3.0-invoice/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/invoice</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/${agid-rules.version}/invoice</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -128,9 +132,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm001-3.0-order/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/${agid-rules.version}/peppolbis-trdm001-3.0-order/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/${agid-rules.version}/order</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -141,9 +145,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm110-3.0-order-agreement/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/${agid-rules.version}/peppolbis-trdm110-3.0-order-agreement/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order-agreement</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/${agid-rules.version}/order-agreement</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -154,9 +158,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm076-3.0-order-response/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/${agid-rules.version}/peppolbis-trdm076-3.0-order-response/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order-response</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/${agid-rules.version}/order-response</xsltDirectory>
</configuration>
</execution>
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidat
PeppolItalyValidation2_2_9.init (aRegistry);
PeppolItalyValidation2_3_0.init (aRegistry);
PeppolItalyValidation3_0_2.init (aRegistry);
PeppolItalyValidation3_1_0.init (aRegistry);
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* Copyright (C) 2014-2024 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.phive.peppol.italy;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

import com.helger.commons.ValueEnforcer;
import com.helger.commons.io.resource.ClassPathResource;
import com.helger.commons.io.resource.IReadableResource;
import com.helger.diver.api.version.VESID;
import com.helger.phive.api.executorset.IValidationExecutorSetRegistry;
import com.helger.phive.api.executorset.ValidationExecutorSet;
import com.helger.phive.api.executorset.status.IValidationExecutorSetStatus;
import com.helger.phive.api.executorset.status.ValidationExecutorSetStatus;
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;
import com.helger.xml.namespace.IIterableNamespaceContext;

/**
* Italian Peppol validation artefacts based on BIS 3.0.17.
*
* @author Philip Helger
*/
@Immutable
public final class PeppolItalyValidation3_1_0
{
// Standard resources
public static final String VERSION_STR = "3.1.0";

// Standard
private static final String GROUP_ID = "it.peppol";

public static final VESID VID_CREDIT_NOTE = new VESID (GROUP_ID, "creditnote", VERSION_STR);
public static final VESID VID_DESPATCH_ADVICE = new VESID (GROUP_ID, "despatch-advice", VERSION_STR);
public static final VESID VID_INVOICE = new VESID (GROUP_ID, "invoice", VERSION_STR);
public static final VESID VID_ORDER = new VESID (GROUP_ID, "order", VERSION_STR);
public static final VESID VID_ORDER_AGREEMENT = new VESID (GROUP_ID, "order-agreement", VERSION_STR);
public static final VESID VID_ORDER_RESPONSE = new VESID (GROUP_ID, "order-response", VERSION_STR);

@Nonnull
private static ClassLoader _getCL ()
{
return PeppolItalyValidation3_1_0.class.getClassLoader ();
}

private static final String PREFIX_XSLT = "external/schematron/peppol-italy/" + VERSION_STR + "/";

private static final IReadableResource DESPATCH_ADVICE = new ClassPathResource (PREFIX_XSLT +
"despatch-advice/AGID-PEPPOL-T16.xslt",
_getCL ());
private static final IReadableResource INVOICE = new ClassPathResource (PREFIX_XSLT + "invoice/AGID-EN16931-UBL.xslt",
_getCL ());
private static final IReadableResource ORDER = new ClassPathResource (PREFIX_XSLT + "order/AGID-PEPPOL-T01.xslt",
_getCL ());
private static final IReadableResource ORDER_AGREEMENT = new ClassPathResource (PREFIX_XSLT +
"order-agreement/AGID-PEPPOL-T110.xslt",
_getCL ());
private static final IReadableResource ORDER_RESPONSE = new ClassPathResource (PREFIX_XSLT +
"order-response/AGID-PEPPOL-T76.xslt",
_getCL ());

private PeppolItalyValidation3_1_0 ()
{}

@Nonnull
private static ValidationExecutorSchematron _createXSLT (@Nonnull final IReadableResource aRes,
@Nonnull final IIterableNamespaceContext aNamespaceContext)
{
return ValidationExecutorSchematron.createXSLT (aRes, aNamespaceContext);
}

@Nonnull
private static IValidationExecutorSetStatus _createStatus (final boolean bIsDeprecated)
{
return ValidationExecutorSetStatus.createDeprecatedNow (bIsDeprecated);
}

public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidationSourceXML> aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");

final String sVersion = " (" + VERSION_STR + ")";
final String sAkaVersionBIS = " (for BIS 3.0.17)";

final boolean bNotDeprecated = false;

aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_DESPATCH_ADVICE,
"AGID Peppol Despatch Advice" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllDespatchAdviceXSDs ()),
_createXSLT (DESPATCH_ADVICE,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.despatchAdvice ()
.getRootElementNamespaceURI ()))));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_INVOICE,
"AGID Peppol Invoice" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()),
_createXSLT (INVOICE,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.invoice ()
.getRootElementNamespaceURI ()))));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_CREDIT_NOTE,
"AGID Peppol Credit Note" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()),
_createXSLT (INVOICE,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.creditNote ()
.getRootElementNamespaceURI ()))));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER,
"AGID Peppol Order" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderXSDs ()),
_createXSLT (ORDER,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.order ()
.getRootElementNamespaceURI ()))));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER_AGREEMENT,
"AGID Peppol Order Agreement" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderResponseXSDs ()),
_createXSLT (ORDER_AGREEMENT,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.orderResponse ()
.getRootElementNamespaceURI ()))));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER_RESPONSE,
"AGID Peppol Order Response" +
sVersion +
sAkaVersionBIS,
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderResponseXSDs ()),
_createXSLT (ORDER_RESPONSE,
PeppolItalyValidation.createUBLNSContext (UBL21Marshaller.orderResponse ()
.getRootElementNamespaceURI ()))));
}
}
Loading

0 comments on commit e40ea2a

Please sign in to comment.