Skip to content

Commit

Permalink
Issue #517
Browse files Browse the repository at this point in the history
Aggiunto microservizio per il giornale degli eventi, implementato
tramite librerie spring boot + jpa.
  • Loading branch information
pintorig committed Sep 5, 2022
1 parent 0ea3a0e commit 274e9d4
Show file tree
Hide file tree
Showing 48 changed files with 3,454 additions and 6 deletions.
17 changes: 17 additions & 0 deletions ear/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-gde</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-gde</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>

<dependency>
<groupId>it.govpay</groupId>
<artifactId>fonts-TitilliumWeb</artifactId>
Expand Down Expand Up @@ -215,6 +227,11 @@
<artifactId>api-jppapdp</artifactId>
<contextRoot>/${war-base-name}/backend/api/jppapdp</contextRoot>
</webModule>
<webModule>
<groupId>it.govpay</groupId>
<artifactId>api-gde</artifactId>
<contextRoot>/${war-base-name}/backend/api/gde</contextRoot>
</webModule>
</modules>
<version>6</version>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,6 @@
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
</exclusions>
</sub-deployment>
<sub-deployment name="api-gde-${project.version}.war">
</sub-deployment>
</jboss-deployment-structure>
18 changes: 18 additions & 0 deletions ear/src/main/application/properties/govpay.properties
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,24 @@ it.govpay.context.giornaleEventi.enabled=${it.govpay.context.giornaleEventi.enab
it.govpay.context.aggiornamentoValiditaMandatorio=${it.govpay.context.aggiornamentoValiditaMandatorio}


# GovPay Giornale Eventi

# Giornale eventi URL servizio
it.govpay.giornaleEventi.url=${it.govpay.giornaleEventi.url}

# Giornale eventi Http-Basic username
it.govpay.giornaleEventi.username=${it.govpay.giornaleEventi.username}

# Giornale eventi Http-Basic password
it.govpay.giornaleEventi.password=${it.govpay.giornaleEventi.password}

# Giornale eventi connection timeout
it.govpay.giornaleEventi.connectionTimeout=${it.govpay.giornaleEventi.connectionTimeout}

# Giornale eventi dimensione del pool di spedizione
it.govpay.giornaleEventi.dimensionePool=${it.govpay.giornaleEventi.dimensionePool}


# Govpay API BackOffice

# titolo applicazione
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,28 @@ public static GdeInterfaccia getConfigurazioneComponente(Componente componente,
case API_GOVPAY:
case API_HYPERSIC_APK:
return getConfigurazioneTracciatiNotificaPagamenti();
case GOVPAY:
return getConfigurazioneGovPayEventiInterni();
}

return null;
}

private static GdeInterfaccia getConfigurazioneGovPayEventiInterni() {

GdeInterfaccia eventiInterni = new GdeInterfaccia();
GdeEvento letture = new GdeEvento();
letture.setDump(DumpEnum.SEMPRE);
letture.setLog(LogEnum.SEMPRE);
eventiInterni.setLetture(letture);
GdeEvento scritture = new GdeEvento();
scritture.setDump(DumpEnum.SEMPRE);
scritture.setLog(LogEnum.SEMPRE);
eventiInterni.setScritture(scritture);

return eventiInterni;
}

private static GdeInterfaccia getConfigurazioneTracciatiNotificaPagamenti() {

GdeInterfaccia apiTracciatiNotificaPagamenti = new GdeInterfaccia();
Expand Down
52 changes: 52 additions & 0 deletions jars/core/src/main/java/it/govpay/core/utils/GovpayConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ public static GovpayConfig newInstance(InputStream is) throws Exception {

private String templateQuietanzaPagamento;

private String giornaleEventiUrl;
private String giornaleEventiUsername;
private String giornaleEventiPassword;
private Integer giornaleEventiConnectionTimeout;
private Integer giornaleEventiDimensionePool;

public GovpayConfig(InputStream is) throws Exception {
// Default values:
this.versioneAvviso = VersioneAvviso.v002;
Expand Down Expand Up @@ -235,6 +241,12 @@ public GovpayConfig(InputStream is) throws Exception {

this.templateProspettoRiscossioni = null;

this.giornaleEventiUrl = null;
this.giornaleEventiUsername = null;
this.giornaleEventiPassword = null;
this.giornaleEventiConnectionTimeout = 10000;
this.giornaleEventiDimensionePool = 15;

try {

// Recupero il property all'interno dell'EAR
Expand Down Expand Up @@ -746,6 +758,26 @@ public void readProperties() throws Exception {

this.templateQuietanzaPagamento = getProperty("it.govpay.reportistica.quietanzaPagamento.templateJasper", this.props, false, log);

this.giornaleEventiUrl = getProperty("it.govpay.giornaleEventi.url", this.props, false, log);
this.giornaleEventiUsername = getProperty("it.govpay.giornaleEventi.username", this.props, false, log);
this.giornaleEventiPassword = getProperty("it.govpay.giornaleEventi.password", this.props, false, log);

String giornaleEventiConnectionTimeoutString = getProperty("it.govpay.giornaleEventi.connectionTimeout", this.props, false, log);
try{
this.giornaleEventiConnectionTimeout = Integer.parseInt(giornaleEventiConnectionTimeoutString);
} catch(Throwable t) {
log.info("Proprieta \"it.govpay.giornaleEventi.connectionTimeout\" impostata con valore di default 180000");
this.giornaleEventiConnectionTimeout = 10000;
}

String giornaleEventiDimensionePoolString = getProperty("it.govpay.giornaleEventi.dimensionePool", this.props, false, log);
try{
this.giornaleEventiDimensionePool = Integer.parseInt(giornaleEventiDimensionePoolString);
} catch(Throwable t) {
log.info("Proprieta \"it.govpay.giornaleEventi.dimensionePool\" impostata con valore di default 15");
this.giornaleEventiDimensionePool = 15;
}

} catch (Exception e) {
log.error("Errore di inizializzazione: " + e.getMessage());
throw e;
Expand Down Expand Up @@ -1139,4 +1171,24 @@ public Integer getTimeoutInvioRPTModello3Millis() {
public Integer getNumeroMassimoGiorniRPTPendenti() {
return numeroMassimoGiorniRPTPendenti;
}

public String getGiornaleEventiUrl() {
return giornaleEventiUrl;
}

public String getGiornaleEventiUsername() {
return giornaleEventiUsername;
}

public String getGiornaleEventiPassword() {
return giornaleEventiPassword;
}

public Integer getGiornaleEventiConnectionTimeout() {
return giornaleEventiConnectionTimeout;
}

public Integer getGiornaleEventiDimensionePool() {
return giornaleEventiDimensionePool;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ public class ClientException extends Exception {
private Integer responseCode = null;
private byte[] responseContent = null;

public ClientException(String message, Exception e, Integer responseCode) {
public ClientException(String message, Throwable e, Integer responseCode) {
this(message, e, responseCode, null);
}

public ClientException(Exception e, Integer responseCode) {
public ClientException(Throwable e, Integer responseCode) {
this(e, responseCode, null);
}

Expand All @@ -21,15 +21,15 @@ public ClientException(String message, Exception e) {
super(message, e);
}

public ClientException(Exception e) {
public ClientException(Throwable e) {
super(e);
}

public ClientException(String string) {
super(string);
}

public ClientException(Exception e, Integer responseCode, byte[] responseContent) {
public ClientException(Throwable e, Integer responseCode, byte[] responseContent) {
super(e);
this.responseCode = responseCode;
this.responseContent = responseContent;
Expand All @@ -41,7 +41,7 @@ public ClientException(String string, Integer responseCode, byte[] responseConte
this.responseContent = responseContent;
}

public ClientException(String message, Exception e, Integer responseCode, byte[] responseContent) {
public ClientException(String message, Throwable e, Integer responseCode, byte[] responseContent) {
super(message, e);
this.responseCode = responseCode;
this.responseContent = responseContent;
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<!-- swagger -->
<swagger-codegen-maven-plugin.version>3.0.4-gov4j-3</swagger-codegen-maven-plugin.version>
<swagger.version>1.5.21</swagger.version>
<swagger.v3.version>2.0.3</swagger.v3.version>
<swagger.v3.version>2.1.12</swagger.v3.version>
<swagger.parser.version>2.0.2</swagger.parser.version>
<swagger.parser.v3.version>2.0.2</swagger.parser.v3.version>

Expand Down Expand Up @@ -330,6 +330,14 @@
<type>war</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-gde</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>it.govpay</groupId>
Expand Down
1 change: 1 addition & 0 deletions wars/api-gde/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
34 changes: 34 additions & 0 deletions wars/api-gde/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# 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 OpenAPI Generator 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
13 changes: 13 additions & 0 deletions wars/api-gde/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
target/generated-sources/java/it/govpay/gde/api/ApiUtil.java
target/generated-sources/java/it/govpay/gde/api/EventiApi.java
target/generated-sources/java/it/govpay/gde/api/model/CategoriaEvento.java
target/generated-sources/java/it/govpay/gde/api/model/ComponenteEvento.java
target/generated-sources/java/it/govpay/gde/api/model/DatiPagoPA.java
target/generated-sources/java/it/govpay/gde/api/model/EsitoEvento.java
target/generated-sources/java/it/govpay/gde/api/model/Evento.java
target/generated-sources/java/it/govpay/gde/api/model/EventoAllOf.java
target/generated-sources/java/it/govpay/gde/api/model/EventoIndex.java
target/generated-sources/java/it/govpay/gde/api/model/FaultBean.java
target/generated-sources/java/it/govpay/gde/api/model/ListaPaginata.java
target/generated-sources/java/it/govpay/gde/api/model/NuovoEvento.java
target/generated-sources/java/it/govpay/gde/api/model/RuoloEvento.java
1 change: 1 addition & 0 deletions wars/api-gde/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1.0
1 change: 1 addition & 0 deletions wars/api-gde/.openapi-generator/openapi.yaml.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b52db64db9639f91d403f7a54db563fd8dbabff6896c4960a15cb03178b4fdbc
27 changes: 27 additions & 0 deletions wars/api-gde/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

# OpenAPI generated API stub

Spring Framework stub


## Overview
This code was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
By using the [OpenAPI-Spec](https://openapis.org), you can easily generate an API stub.
This is an example of building API stub interfaces in Java using the Spring framework.

The stubs generated can be used in your existing Spring-MVC or Spring-Boot application to create controller endpoints
by adding ```@Controller``` classes that implement the interface. Eg:
```java
@Controller
public class PetController implements PetApi {
// implement all PetApi methods
}
```

You can also use the interface to create [Spring-Cloud Feign clients](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).Eg:
```java
@FeignClient(name="pet", url="http://petstore.swagger.io/v2")
public interface PetClient extends PetApi {

}
```
Loading

0 comments on commit 274e9d4

Please sign in to comment.