Skip to content

Commit

Permalink
Issue #517
Browse files Browse the repository at this point in the history
Sostituito salvataggio su db degli eventi con invocazione del nuovo
microservizio di salvataggio
  • Loading branch information
pintorig committed Jul 27, 2022
1 parent a3c0817 commit 6536b4c
Show file tree
Hide file tree
Showing 29 changed files with 1,686 additions and 691 deletions.
87 changes: 87 additions & 0 deletions jars/client-api-gde/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# exclude jar for gradle wrapper
!gradle/wrapper/*.jar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# build files
**/target
target
.gradle
build
.classpath
.openapi-generator/
.project
.settings/
.travis.yml
build.gradle
build.sbt
git_push.sh
gradle.properties
gradle/
gradlew
gradlew.bat
settings.gradle
.github/
api/
docs/



# custom property filters
#/src/main/resources/filters/*

# maven version backups
pom.xml.versionsBackup

# compiled output
/dist
/tmp
/out-tsc
/target
/bin
_build

# swagger
.swagger-codegen

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
37 changes: 37 additions & 0 deletions jars/client-api-gde/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

# GEN
# IMPL
# TEST
**/**/*Test.java
**/*DocumentationConfig.java
**/OpenAPI2SpringBoot.java
pom.xml
README.md
src/**/*
**/*ApiController.java
.gitignore


203 changes: 203 additions & 0 deletions jars/client-api-gde/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.2</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>it.govpay</groupId>
<artifactId>client-api-gde</artifactId>
<packaging>jar</packaging>
<name>GovPay - jars - Client REST API Giornale degli Eventi</name>
<version>4.0.0</version>

<properties>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>

<!-- Versioni plugin maven -->
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
<maven.war.plugin.version>3.2.3</maven.war.plugin.version>

<rel-to-parent>../..</rel-to-parent>
<filter-file>${rel-to-parent}/src/main/resources/filters/${env}.filter.properties</filter-file>

<!-- Swagger-codegen -->
<openapi.tool.codegen.version>6.0.0</openapi.tool.codegen.version>

<!-- Mpastruct -->
<mapstruct.version>1.5.1.Final</mapstruct.version>

<!-- Lombok version -->
<org.projectlombok.version>1.18.24</org.projectlombok.version>

<!-- Swagger-annotations -->
<swagger.version>2.1.2</swagger.version>
<swagger-annotations.version>1.6.2</swagger-annotations.version>

<!-- jackson-databind-nullable -->
<jackson.databind.nullable.version>0.2.1</jackson.databind.nullable.version>

<!-- annotazione bean generati notnull -->
<jsr305.version>3.0.2</jsr305.version>

</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>

<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>${jackson.databind.nullable.version}</version>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
</dependency>

</dependencies>

<build>
<filters>
<filter>${filter-file}</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi.tool.codegen.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<id>generate-sources-client-govpay-gde-v1</id>
<phase>generate-sources</phase>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<generatorName>java</generatorName>
<configOptions>
<booleanGetterPrefix>is</booleanGetterPrefix>
<dateLibrary>java8</dateLibrary>
<library>webclient</library>
<serializationLibrary>jackson</serializationLibrary>
<sourceFolder>target/generated-sources/java/</sourceFolder>
<apiPackage>it.govpay.gde.v1.api</apiPackage>
<invokerPackage>it.govpay.gde.v1.api.impl</invokerPackage>
<modelPackage>it.govpay.gde.v1.model</modelPackage>
<useAnnotatedBasePath>true</useAnnotatedBasePath>
<useBeanValidation>false</useBeanValidation>
</configOptions>
<output>${project.basedir}/target</output>
<interfaceOnly>true</interfaceOnly>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
35 changes: 35 additions & 0 deletions jars/client-api-gde/src/main/java/it/govpay/gde/GdeInvoker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package it.govpay.gde;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.reactive.function.client.WebClientResponseException;

import it.govpay.gde.v1.api.GdeControllerApi;
import it.govpay.gde.v1.api.impl.ApiClient;
import it.govpay.gde.v1.model.NuovoEvento;

public class GdeInvoker {

private static Logger logger = LoggerFactory.getLogger(GdeInvoker.class);

private GdeControllerApi gdeApi;

public GdeInvoker(String gdeUrl){
ApiClient apiClient = new ApiClient();
apiClient.setBasePath(gdeUrl);
gdeApi = new GdeControllerApi(apiClient );
}

public void salvaEvento(NuovoEvento nuovoEvento) {

try {
logger.debug("AAAAAA Spedizione Evento in modalita' asincrona");
this.gdeApi.addEvento(nuovoEvento )
.subscribe(response -> logger.debug("AAAAAA Response: " + response));

logger.debug("AAAAAA Spedizione Evento in modalita' asincrona, ok");
}catch (WebClientResponseException e) {
logger.error("AAAAAA Errore durante l'invocazione GDE: " + e.getMessage(),e);
}
}
}
Loading

0 comments on commit 6536b4c

Please sign in to comment.