Skip to content

Commit

Permalink
Issue #526
Browse files Browse the repository at this point in the history
Realizzati servizi active_payments e get_rt.
  • Loading branch information
pintorig committed Sep 19, 2022
1 parent 4404b9f commit b836811
Show file tree
Hide file tree
Showing 41 changed files with 3,911 additions and 4 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-netpay</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-netpay</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-netpay</artifactId>
<contextRoot>/${war-base-name}/backend/api/netpay</contextRoot>
</webModule>
</modules>
<version>6</version>
</configuration>
Expand Down
15 changes: 15 additions & 0 deletions ear/src/main/application/META-INF/jboss-deployment-structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,19 @@
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
</exclusions>
</sub-deployment>
<sub-deployment
name="api-netpay-${project.version}.war">
<exclusions>
<module name="org.apache.cxf" />
<module name="org.springframework.spring" />
<module name="org.slf4j" />
<module name="org.apache.log4j" />
<module name="org.apache.commons.logging" />
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module
name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
19 changes: 16 additions & 3 deletions jars/orm/src/main/java/it/govpay/bd/pagamento/RptBD.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,27 @@ public Rpt getRpt(String codDominio, String iuv, String ccp, boolean deep) throw
if(this.isAtomica()) {
this.setupConnection(this.getIdTransaction());
}

RPT rptVO = null;
IExpression exp = this.getRptService().newExpression();
exp.equals(RPT.model().COD_DOMINIO, codDominio);
exp.equals(RPT.model().IUV, iuv);
exp.equals(RPT.model().CCP, ccp);
RPT rptVO = this.getRptService().find(exp);

if(StringUtils.isNotBlank(ccp)) {
exp.equals(RPT.model().CCP, ccp);
rptVO = this.getRptService().find(exp);
} else {
IPaginatedExpression pagExp = this.getRptService().toPaginatedExpression(exp);
pagExp.limit(1);
pagExp.addOrder(RPT.model().DATA_MSG_RICHIESTA, SortOrder.DESC);
List<RPT> findAll = this.getRptService().findAll(pagExp);
if(findAll.size() == 0)
throw new NotFoundException("RPT non trovata.");

rptVO = findAll.get(0);
}
Rpt dto = RptConverter.toDTO(rptVO);


popolaRpt(deep, dto);

return dto;
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<spring.ldap.version>2.4.1</spring.ldap.version>

<!-- joda time -->
<joda-time.version>2.10</joda-time.version>
<joda-time.version>2.10.8</joda-time.version>

<!-- Commons -->
<commons-jcs-core.version>2.2</commons-jcs-core.version>
Expand Down Expand Up @@ -364,6 +364,14 @@
<type>war</type>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-netpay</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-netpay/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
159 changes: 159 additions & 0 deletions wars/api-netpay/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?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.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>it.govpay</groupId>
<artifactId>api-netpay</artifactId>
<packaging>war</packaging>
<name>GovPay - wars - REST API Net@Pay</name>
<version>3.7.0</version>

<properties>
<java.version>1.8</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>

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

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

<!-- cxf version -->
<cxf.version>3.2.6</cxf.version>
</properties>

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

<dependency>
<groupId>it.govpay</groupId>
<artifactId>api-commons</artifactId>
<type>jar</type>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</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>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<webResource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</webResource>
<webResource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<include>web.xml</include>
<targetPath>WEB-INF</targetPath>
</webResource>
<webResource>
<directory>src/main/resources/spring-jaxrs</directory>
<filtering>true</filtering>
<include>applicationContext-jaxrs-*.xml</include>
<targetPath>WEB-INF</targetPath>
</webResource>
<webResource>
<directory>src/main/resources/spring-sec</directory>
<filtering>true</filtering>
<include>*-applicationContext-security.xml</include>
<targetPath>WEB-INF</targetPath>
</webResource>
</webResources>
<!-- <webXml>src/main/resources/web.xml</webXml> -->
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>properties/</Class-Path>
<Dependencies>jdk.unsupported</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package it.govpay.netpay.listener;

import java.io.InputStream;
import java.net.URL;
import java.util.UUID;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.openspcoop2.utils.LoggerWrapperFactory;
import org.openspcoop2.utils.UtilsException;
import org.openspcoop2.utils.service.context.IContext;
import org.openspcoop2.utils.service.context.MD5Constants;
import org.slf4j.Logger;
import org.slf4j.MDC;

import it.govpay.core.utils.GovpayConfig;
import it.govpay.core.utils.GpContext;
import it.govpay.core.utils.InitConstants;
import it.govpay.core.utils.LabelAvvisiProperties;
import it.govpay.core.utils.SeveritaProperties;
import it.govpay.core.utils.StartupUtils;

public class InitListener implements ServletContextListener{

private static Logger log = null;
private static boolean initialized = false;
private String warName = "GovPay-API-Netpay";
private String tipoServizioGovpay = GpContext.TIPO_SERVIZIO_GOVPAY_JSON;
private String dominioAnagraficaManager = "it.govpay.cache.anagrafica.netpay";

public static boolean isInitialized() {
return InitListener.initialized;
}

@Override
public void contextInitialized(ServletContextEvent sce) {
// Commit id
String commit = (InitConstants.GOVPAY_BUILD_NUMBER.length() > 7) ? InitConstants.GOVPAY_BUILD_NUMBER.substring(0, 7) : InitConstants.GOVPAY_BUILD_NUMBER;

InputStream govpayPropertiesIS = InitListener.class.getResourceAsStream(GovpayConfig.PROPERTIES_FILE);
URL log4j2URL = InitListener.class.getResource(GovpayConfig.LOG4J2_XML_FILE);
InputStream msgDiagnosticiIS = InitListener.class.getResourceAsStream(GovpayConfig.MSG_DIAGNOSTICI_PROPERTIES_FILE);
InputStream mappingSeveritaErroriPropertiesIS = InitListener.class.getResourceAsStream(SeveritaProperties.MAPPING_SEVERITA_ERRORI_PROPERTIES_FILE);
InputStream avvisiLabelPropertiesIS = InitListener.class.getResourceAsStream(LabelAvvisiProperties.PROPERTIES_FILE);
IContext ctx = StartupUtils.startup(log, warName, InitConstants.GOVPAY_VERSION, commit, govpayPropertiesIS, log4j2URL, msgDiagnosticiIS, tipoServizioGovpay, mappingSeveritaErroriPropertiesIS, avvisiLabelPropertiesIS);

try {
log = LoggerWrapperFactory.getLogger("boot");
StartupUtils.startupServices(log, warName, InitConstants.GOVPAY_VERSION, commit, ctx, dominioAnagraficaManager, GovpayConfig.getInstance());
} catch (RuntimeException e) {
log.error("Inizializzazione fallita", e);
try {
ctx.getApplicationLogger().log();
} catch (UtilsException e1) {
log.error("Errore durante il log dell'operazione: "+e1.getMessage(), e1);
}
throw e;
} catch (Exception e) {
log.error("Inizializzazione fallita", e);
try {
ctx.getApplicationLogger().log();
} catch (UtilsException e1) {
log.error("Errore durante il log dell'operazione: "+e1.getMessage(), e1);
}
throw new RuntimeException("Inizializzazione "+StartupUtils.getGovpayVersion(warName, InitConstants.GOVPAY_VERSION, commit)+" fallita.", e);
}

try {
ctx.getApplicationLogger().log();
} catch (UtilsException e) {
log.error("Errore durante il log dell'operazione: "+e.getMessage(), e);
}

log.info("Inizializzazione "+StartupUtils.getGovpayVersion(warName, InitConstants.GOVPAY_VERSION, commit)+" completata con successo.");
initialized = true;
}


@Override
public void contextDestroyed(ServletContextEvent sce) {
// Commit id
String commit = (InitConstants.GOVPAY_BUILD_NUMBER.length() > 7) ? InitConstants.GOVPAY_BUILD_NUMBER.substring(0, 7) : InitConstants.GOVPAY_BUILD_NUMBER;

MDC.put(MD5Constants.OPERATION_ID, "Shutdown");
MDC.put(MD5Constants.TRANSACTION_ID, UUID.randomUUID().toString() );

log.info("Shutdown "+StartupUtils.getGovpayVersion(warName, InitConstants.GOVPAY_VERSION, commit)+" in corso...");

// log.info("De-registrazione delle cache ...");
// AnagraficaManager.unregister();
// log.info("De-registrazione delle cache completato");
//
// log.info("Shutdown del Connection Manager ...");
// try {
// ConnectionManager.shutdown();
// log.info("Shutdown del Connection Manager completato.");
// } catch (Exception e) {
// log.warn("Errore nello shutdown del Connection Manager: " + e);
// }

log.info("Shutdown "+StartupUtils.getGovpayVersion(warName, InitConstants.GOVPAY_VERSION, commit)+" completato.");
}
}
Loading

0 comments on commit b836811

Please sign in to comment.