Home

Awesome

peppol-reporting

javadoc Maven Central

Peppol Reporting support library. Peppol Reporting is the process of collecting, aggregating and transmitting Peppol Reports to OpenPeppol.

This library supports the following reports:

This library does not deal with the transmission of Reports. That needs to be done with phase4 or another AS4 solution. See the phase4 Wiki for detailed guidance on integration with this project.

This library requires Java 11 and Maven to build.

How to use it

This library offers a Java domain model for EUSR and TSR reports.

Note: phase4 v2.2.2 and onwards has direct support for this project.

Overview images

Data collection on sending

Data collection on receiving

Report creation and transmission

Data collection

Data collection needs to happen into your Access Point instances.

The data for reporting needs to be collected in instances of class PeppolReportingItem. For each sent or received Peppol transmission, such a PeppolReportingItem needs to be collected, and persisted.

Each PeppolReportingItem consists of the following elements:

To facilitate this collection, the submodule peppol-reporting-api exists.

Data storage

The created reporting item must be stored somewhere, to be able to retrieve them later.

This project comes with different backends for storing PeppolReportingItem objects, each in a separate submodule. Each submodule is described below.

To choose a submodule, it needs to be added as a Maven dependency. The main logic is loaded via SPI. Please make sure to only use one submodule at a time - storing to multiple backends is currently not supported out of the box.

Alternatively you can implement your own Reporting backend implementation, by implementing the SPI interface com.helper.peppol.reporting.api.backend.IPeppolReportingBackendSPI defined in the peppol-reporting-api submodule.

Storage in MongoDB

Submodule peppol-reporting-backend-mongodb stores data in a MongoDB. This submodule was introduced in version 2.1.0.

It creates one collection called: reporting-items

It supports the following configuration properties:

Storage in Redis

Submodule peppol-reporting-backend-redis stores data in Redis. Make sure you use persistent storage for this one. This submodule was introduced in version 2.1.0.

The used Redis keys are:

It supports the following configuration properties:

Storage in CSV file

Submodule peppol-reporting-backend-csv stores data in a CSV file. This submodule was introduced in version 2.2.4.

It supports the following configuration properties:

Storage in SQL databases

Submodule peppol-reporting-backend-sql stores data in relational databases. This submodule was introduced in version 3.0.1.

It supports the following configuration properties:

Database change management is done with the Open Source version of Flyway. All the Flyway DDL scripts are available in the folder https://github.com/phax/peppol-reporting/tree/main/peppol-reporting-backend-sql/src/main/resources/db

It can be configured as followed:

By default it is not bound to any specific DB engine, so you need to provide the necessary driver dependency manually. PostgreSQL:

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>x.y.z</version>
    </dependency>

MySQL:

    <dependency>
      <groupId>com.mysql</groupId>
      <artifactId>mysql-connector-j</artifactId>
      <version>x.y.z</version>
    </dependency>

Storage in memory

Submodule peppol-reporting-backend-inmemory stores data in memory only and is not persistent. This submodule was introduced in version 2.1.1.

This module is mainly meant for testing purposes.

Data aggregation

To aggregate data for a single Reporting Period, all the matching PeppolReportingItem objects need to be collected first. All the matching items need to be fed into the respective report builder.

Via the builder EndUserStatisticsReport.builder (), the report of type EndUserStatisticsReportType can be created.

Via the builder TransactionStatisticsReport.builder (), the report of type TransactionStatisticsReportType can be created.

Report XML Serialization

The JAXB generated domain model classes reside in the packages com.helger.peppol.reporting.jaxb.eusr.v110 and com.helger.peppol.reporting.jaxb.tsr.v101. This domain model can be read from and written to XML documents via the marshaller classes EndUserStatisticsReport110Marshaller and TransactionStatisticsReport101Marshaller.

Report Validation

Additionally, the Schematron compatibility can be verified using the classes EndUserStatisticsReportValidator and TransactionStatisticsReportValidator. All checks are performed against the default Schematrons provided by OpenPeppol.

Glossary

Maven usage

Add the following to your pom.xml to use this artifact, replacing x.y.z with the real version:

<dependency>
  <groupId>com.helger.peppol</groupId>
  <artifactId>peppol-reporting</artifactId>
  <version>x.y.z</version>
</dependency>

Usage as Maven BOM:

<dependency>
  <groupId>com.helger.peppol</groupId>
  <artifactId>peppol-reporting-parent-pom</artifactId>
  <version>x.y.z</version>
  <type>pom</type>
  <scope>import</scope>
</dependency>

Note: all v1.x releases used the group ID com.helger only.

News and Noteworthy


My personal Coding Styleguide | It is appreciated if you star the GitHub project if you like it.