First Commit from Source Code Reply

This commit is contained in:
vincenzofariello
2024-05-09 17:40:24 +02:00
parent 11e3b57c5b
commit 107a016cb9
35225 changed files with 1111346 additions and 1 deletions

View File

@@ -0,0 +1,216 @@
package it.valueteam.gnp.ws.fenp;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.jws.HandlerChain;
import javax.jws.WebService;
import dbcfx.soa.notificamancataacquisizione.x20190507.NotificaMancataAcquisizioneOLODonorDel35Response;
import it.valueteam.gnp.dao.db.hb.GnpFenpOut;
import it.valueteam.gnp.dao.db.hb.GnpFenpOutDAO;
import it.valueteam.gnp.dao.db.hb.GnpFenpRichiesteOut;
import it.valueteam.gnp.dao.db.hb.GnpFenpRichiesteOutDAO;
import it.valueteam.gnp.dao.db.hb.GnpFenpRichiesteOutStorico;
import it.valueteam.gnp.dao.db.hb.GnpFenpRichiesteOutStoricoDAO;
import it.valueteam.gnp.log.Loggable;
import it.valueteam.gnp.log.ProcessLogger;
import it.valueteam.gnp.obj.LogInfo;
import it.valueteam.gnp.obj.LogProcess;
import it.valueteam.gnp.utility.Resources;
import it.valueteam.gnp.ws.dbss.EsitoFrodiMgmtPortTypeImpl;
import weblogic.jws.WLHttpTransport;
/**
*
* NotificaMancataAcquisizionePortTypeImpl class implements web service endpoint interface NotificaMancataAcquisizionePortType
* R1E-19-0150 D35 NUMERAZIONI NATIVE OLO E GESTIONE FLUSSI NON ACQUISITI DA OLO DONOR
*
* */
@WebService(
serviceName="NotificaMancataAcquisizione-1.0",
targetNamespace="http://dbcfx/SOA/NotificaMancataAcquisizione",
endpointInterface="it.valueteam.gnp.ws.fenp.NotificaMancataAcquisizionePortType")
@WLHttpTransport(contextPath="wsfenp",serviceUri="NotificaMancataAcquisizione",portName="NotificaMancataAcquisizione")
@HandlerChain(file = "handler.config.xml", name = "wsNotificaMancataAcquisizioneHandlerChain")
public class NotificaMancataAcquisizionePortTypeImpl implements NotificaMancataAcquisizionePortType, Loggable{
protected ProcessLogger log;
private final static String codiceProcesso = "IC";
public NotificaMancataAcquisizionePortTypeImpl() {
System.out.println("Create Server WS [NotificaMancataAcquisizione] Class [NotificaMancataAcquisizionePortTypeImpl]");
try {
LogProcess logProcess = new LogProcess();
logProcess.setCodice(codiceProcesso);
logProcess.setProcess(this);
log = new ProcessLogger(logProcess);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Errore nella creazione del ProcessLogger, classe:" + EsitoFrodiMgmtPortTypeImpl.class + " - " + ex.toString());
}
}
public dbcfx.soa.notificamancataacquisizione.x20190507.NotificaMancataAcquisizioneOLODonorDel35Response notificaMancataAcquisizioneOLODonorDel35(it.telecomitalia.soa.soap.soapheader.holders.HeaderTypeHolder Header,dbcfx.soa.notificamancataacquisizione.x20190507.NotificaMancataAcquisizioneOLODonorDel35Request body)
{
log.write("9999", "START notificaMancataAcquisizioneOLODonorDel35: " +body.getFILE_NAME());
NotificaMancataAcquisizioneOLODonorDel35Response response=new NotificaMancataAcquisizioneOLODonorDel35Response();
//RETRIEVE FIELD REQUEST
String fileName=body.getFILE_NAME();
String motivazione=body.getMOTIVAZIONE();
Calendar ultimoTentativo=body.getULTIMO_TENTATIVO();
checkRequestField(response,fileName,motivazione,ultimoTentativo);
GnpFenpOut fenpOut=retrieveFenpOutByNomeFile(fileName,response);
if(response.getCODICE_ACK().equalsIgnoreCase("OK")) {
log.write("9999", "notificaMancataAcquisizioneOLODonorDel35 superati controlli: " +body.getFILE_NAME());
avviaProceduraRipristino(fenpOut,response,fileName,motivazione,ultimoTentativo);
}
log.write("9999", "END notificaMancataAcquisizioneOLODonorDel35: " +body.getFILE_NAME());
return response;
}
private void avviaProceduraRipristino(GnpFenpOut fenpOut,NotificaMancataAcquisizioneOLODonorDel35Response response,String fileName,String motivazione,Calendar ultimoTentativo) {
try {
ripristinaRichiesteServizioSoap(fenpOut,motivazione,ultimoTentativo);
} catch (Exception e) {
log.write("9999", "Errore applicativo: " +e.getMessage());
e.printStackTrace();
response.setCODICE_ACK("KO");
response.setDESCR_ACK("INTERNAL ERROR");
response.setCODICE_ERRORE("03");
}
}
private void checkRequestField(NotificaMancataAcquisizioneOLODonorDel35Response response,String fileName,String motivazione,Calendar ultimoTentativo) {
String resErro=null;
response.setCODICE_ACK("OK");
response.setDESCR_ACK("Operazione effettuata con esito positivo");
response.setCODICE_ERRORE("00");
if(fileName==null || fileName.isEmpty()) {
log.write("9999", "FileName non valorizzato o vuoto" +fileName);
resErro="FileName non valorizzato o vuoto; ";
}
if(motivazione==null || motivazione.isEmpty()) {
log.write("9999", "Motivazione non valorizzata o vuoto" +fileName);
if(resErro!=null) {
resErro=resErro+"Motivazione non valorizzata o vuoto; ";
}else {
resErro="Motivazione non valorizzata o vuoto; ";
}
}
if(ultimoTentativo==null) {
log.write("9999", "UltimoTentativo non valorizzato o vuoto" +fileName);
if(resErro!=null) {
resErro=resErro+"UltimoTentativo non valorizzato o vuoto; ";
}else {
resErro="UltimoTentativo non valorizzato o vuoto; ";
}
}
if(resErro!=null) {
response.setCODICE_ACK("KO");
response.setDESCR_ACK(resErro);
response.setCODICE_ERRORE("02");
}
}
private GnpFenpOut retrieveFenpOutByNomeFile(String nomeFile,NotificaMancataAcquisizioneOLODonorDel35Response response) {
GnpFenpOutDAO fenpOutDAO = new GnpFenpOutDAO();
GnpFenpOut res=null;
List<GnpFenpOut> richieste = fenpOutDAO.findByNomeFile(nomeFile);
log.write("9999", "richieste size: " +richieste.size());
if(richieste.isEmpty()) {
log.write("9999", "Nome file inesistente " +nomeFile);
response.setCODICE_ACK("KO");
response.setDESCR_ACK("Nome file inesistente");
response.setCODICE_ERRORE("01");
}else {
for(int i=0; i<richieste.size(); i++){
res =richieste.get(i);
log.write("9999", "INDIVIDUAZIONE DI ID_FILE: " +res.getIdfile()+" NOME_FILE: "+res.getNomeFile());
}
}
return res;
}
/**
* Questo metodo resetta le richieste per cui e' stato richiesto tramite
* il servizio Soap 'NotificaMancataAcquisizione' C6 2019
* R1E-19-0150 D35 NUMERAZIONI NATIVE OLO - GESTIONE FLUSSI NON ACQUISITI DA OLO DONOR
*
* @param nomefile - il nome file prodotto associato alle richieste da inviare a olo
*/
private void ripristinaRichiesteServizioSoap(GnpFenpOut fenpOut,String tipoKo,Calendar ultimoTentativo) throws Exception {
log.write("9999", "ripristinaRichiesteServizioSoap :" +fenpOut.getNomeFile());
GnpFenpRichiesteOutDAO richDao = new GnpFenpRichiesteOutDAO();
List richiesteToReset = richDao.findByProperty(GnpFenpRichiesteOutDAO.HB_NOMEFILE, fenpOut.getNomeFile());
for (Object aRichiesteToReset : richiesteToReset) {
GnpFenpRichiesteOut requestToReset = (GnpFenpRichiesteOut) aRichiesteToReset;
log.write("9999", "NomeFile:" +requestToReset.getNomeFile()+" Idrichiesta da rielaborare :" +requestToReset.getIdRichiesta());
//Aggiorna lo storico per tenerne traccia
aggiornaStoricoRichiesteFile(requestToReset,tipoKo,ultimoTentativo);
requestToReset.setDaProcessare((long) 1);
requestToReset.setDataInvioRichiesta(null);
requestToReset.setNomeFile(null);
richDao.merge(requestToReset);
}
}
/**
* Metodo per aggiornamento dati nello storico C6 2019
* R1E-19-0150 D35 NUMERAZIONI NATIVE OLO - GESTIONE FLUSSI NON ACQUISITI DA OLO DONOR
*/
private void aggiornaStoricoRichiesteFile(GnpFenpRichiesteOut requestToReset,String tipoKo,Calendar ultimoTentativo) {
log.write("9999", "START AggiornaStoricoRichiesteFile SOAP NomeFile:" +requestToReset.getNomeFile()+" Idrichiesta da rielaborare :" +requestToReset.getIdRichiesta());
GnpFenpRichiesteOutStoricoDAO outStorico=new GnpFenpRichiesteOutStoricoDAO();
GnpFenpRichiesteOutStorico richiesteStorico=outStorico.findByNomeFileAndIdRichiesta(requestToReset.getNomeFile(),requestToReset.getIdRichiesta());
richiesteStorico.setMotivazione(tipoKo);
richiesteStorico.setUltimoTentativo(ultimoTentativo.getTime());
richiesteStorico.setDataMancataAcquisizione(new Date());
richiesteStorico.setIdRichiesta(requestToReset.getIdRichiesta());
richiesteStorico.setNomeFile(requestToReset.getNomeFile());
outStorico.merge(richiesteStorico);
log.write("9999", "FINE AggiornaStoricoRichiesteFile SOAP NomeFile:" +requestToReset.getNomeFile()+" Idrichiesta da rielaborare :" +requestToReset.getIdRichiesta());
}
@Override
public LogInfo getLogInfo() throws Exception {
LogInfo logInfo = new LogInfo();
logInfo.setProcess(getClass().getName());
logInfo.setLogPath(Resources.getLogPath());
logInfo.setTypeInfo(Resources.getTypeInfo());
logInfo.setTypeDebug(Resources.getTypeDebug());
logInfo.setTypeError(Resources.getTypeError());
return logInfo;
}
}

View File

@@ -0,0 +1,51 @@
package it.valueteam.gnp.ws.fenp;
import java.io.ByteArrayOutputStream;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import it.valueteam.gnp.log.Loggable;
import it.valueteam.gnp.log.ProcessLogger;
import it.valueteam.gnp.obj.LogProcess;
import it.valueteam.gnp.systemcontroller.formatcontroller.crm.WSSOAPHandler;
public class NotificaMancataAcquisizioneSOAPHandler extends WSSOAPHandler implements Loggable {
protected ProcessLogger log;
private static final String bodyNamespaceURI = "http://dbcfx/SOA/EsitoCessazioneMgmt/2016-09-16";
public NotificaMancataAcquisizioneSOAPHandler() throws Exception {
LogProcess logProcess = new LogProcess();
logProcess.setCodice(codiceProcesso);
logProcess.setProcess(this);
log = new ProcessLogger(logProcess);
}
@Override
public boolean handleFault(MessageContext msgctx) {
SOAPMessageContext soapMsgCtx = (SOAPMessageContext) msgctx;
ByteArrayOutputStream payloadStringOut = new ByteArrayOutputStream();
try {
SOAPMessage message = soapMsgCtx.getMessage();
SOAPHeader header = message.getSOAPHeader();
String bid = getBid(header);
log.write("9999",bid+" - EsitoCessazioneMgmtSOAPHandler (Fault Handler) - " + new java.util.Date());
message.writeTo(payloadStringOut);
log.write("9999",bid+" - "+payloadStringOut.toString());
} catch (Exception ex) {
ex.printStackTrace();
}
return super.handleRequest(msgctx);
}
@Override
public boolean handleRequest(MessageContext msgctx) {
return super.handleRequest(msgctx);
}
}

View File

@@ -0,0 +1,9 @@
<jwshc:handler-config xmlns:jwshc="http://www.bea.com/xml/ns/jws" xmlns="http://java.sun.com/xml/ns/j2ee" >
<jwshc:handler-chain>
<jwshc:handler-chain-name>wsNotificaMancataAcquisizioneHandlerChain</jwshc:handler-chain-name>
<jwshc:handler>
<handler-name>handler1</handler-name>
<handler-class>it.valueteam.gnp.ws.fenp.NotificaMancataAcquisizioneSOAPHandler</handler-class>
</jwshc:handler>
</jwshc:handler-chain>
</jwshc:handler-config>