525 lines
23 KiB
Java
525 lines
23 KiB
Java
package mnp.xml.dao;
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.GsonBuilder;
|
|
import mnp.database.hb.dto.MnpGispRetrieveOut;
|
|
import mnp.database.hb.dto.homezone.HzGispRetrieveOut;
|
|
import mnp.exception.xml.NotValidXMLException;
|
|
import mnp.objects.map.GispMap;
|
|
import mnp.utility.DateUtils;
|
|
import mnp.utility.XmlUtility;
|
|
import mnp.xml.dao.gisp.response.Response;
|
|
import mnp.xml.dao.gisp.retreive.Data;
|
|
import mnp.xml.dao.gisp.retreive.DatiFisso;
|
|
import mnp.xml.dao.gisp.retreive.Dati_commerciali;
|
|
import mnp.xml.dao.gisp.retreive.Info;
|
|
import mnp.xml.dao.gisp.retreive.Input;
|
|
import mnp.xml.dao.gisp.retreive.Output;
|
|
import mnp.xml.dao.gisp.retreive.OutputTypeSequence;
|
|
import mnp.xml.dao.gisp.retreive.Retrieve;
|
|
|
|
import org.exolab.castor.xml.MarshalException;
|
|
import org.exolab.castor.xml.ValidationException;
|
|
|
|
/**
|
|
* <p>Title: MNP</p>
|
|
* <p>Description: Mobile Number Portability</p>
|
|
* <p>Copyright: Copyright (c) 2005</p>
|
|
* <p>Company: ValueTeam - TeleAp</p>
|
|
* @author Carlo Poccia
|
|
* @version 1.0
|
|
*/
|
|
|
|
public class RetrieveGispXAO {
|
|
|
|
private static final String ATTRIBUTO_SERVIZI_ADDITONAL = "additional";
|
|
private static final String ATTRIBUTO_SERVIZI_SOTTOSERVIZIO = "sottoservizio";
|
|
|
|
private RetrieveGispXAO() {
|
|
}
|
|
|
|
|
|
/**
|
|
* Costriusce XML di notifica a GISP per la retrive su base utenza mobile
|
|
* @param retrieveGisp RetrieveGisp
|
|
* @return String
|
|
*/
|
|
public static String getXmlFromRetrieveGisp(MnpGispRetrieveOut retrieveGisp) throws Exception{
|
|
String xml = null;
|
|
|
|
Retrieve retrive = new Retrieve();
|
|
mnp.xml.dao.gisp.retreive.Info info = new mnp.xml.dao.gisp.retreive.Info();
|
|
retrive.setInfo(info);
|
|
info.setSystem("DBC");
|
|
|
|
java.util.Date now = new java.util.Date();
|
|
String snow = DateUtils.toString(now,"dd/MM/yyyy HH:mm:ss");
|
|
|
|
info.setSysdate(snow);
|
|
|
|
mnp.xml.dao.gisp.retreive.Data data = new mnp.xml.dao.gisp.retreive.Data();
|
|
retrive.setData(data);
|
|
Input input = new Input();
|
|
data.setInput(input);
|
|
input.setMsisdn(retrieveGisp.getMsisdn());
|
|
|
|
Output output = new Output();
|
|
data.setOutput(output);
|
|
OutputTypeSequence outputTypeSequence = new OutputTypeSequence();
|
|
data.getOutput().setOutputTypeSequence(outputTypeSequence);
|
|
mnp.xml.dao.gisp.retreive.Attributi attributi = new mnp.xml.dao.gisp.retreive.Attributi();
|
|
data.getOutput().getOutputTypeSequence().setAttributi(attributi);
|
|
|
|
mnp.xml.dao.gisp.retreive.Carta carta = new mnp.xml.dao.gisp.retreive.Carta();
|
|
data.getOutput().getOutputTypeSequence().setCarta(carta);
|
|
attributi.setStato(new String());
|
|
mnp.xml.dao.gisp.retreive.Dettaglio_stato dettaglio_stato = new mnp.xml.dao.gisp.retreive.Dettaglio_stato();
|
|
attributi.setDettaglio_stato(dettaglio_stato);
|
|
//manca cessazione_mnp
|
|
dettaglio_stato.setCessazione_mnp(new String());
|
|
// operatore_virtuale
|
|
attributi.setEsp(new String());
|
|
// Kit Luglio 08 - S.B. Tag descrizione profilo per MTV
|
|
attributi.setDescrizione_profilo(new String());
|
|
//C.P. kit aprile 09
|
|
attributi.setProfilo(new String());
|
|
//Kit Ottobre 07 - M.G. Tag per lo stato linea
|
|
mnp.xml.dao.gisp.retreive.Blocco blocco = new mnp.xml.dao.gisp.retreive.Blocco();
|
|
blocco.setAnagr(new String());
|
|
//kit luglio 09 - fraud, fs
|
|
blocco.setFraud(new String());
|
|
blocco.setFs(new String());
|
|
|
|
attributi.setBlocco(blocco);
|
|
//Kit Luglio 08 - M.G. Tag usage, tipologia
|
|
attributi.setUsage(new mnp.xml.dao.gisp.retreive.Usage());
|
|
attributi.setTipologia(new String());
|
|
Dati_commerciali datiCommerciali = new Dati_commerciali();
|
|
datiCommerciali.setCliente(new String());
|
|
datiCommerciali.setMarcaggio_cliente(new String());
|
|
attributi.setDati_commerciali(datiCommerciali);
|
|
|
|
//kit luglio 09 - prepagato - risorse di rete
|
|
attributi.setPrepagato(new String());
|
|
|
|
|
|
//TAG HOME ZONE
|
|
//D.S. Kit Dicembre 07
|
|
mnp.xml.dao.gisp.retreive.HomeZone homeZone = new mnp.xml.dao.gisp.retreive.HomeZone();
|
|
data.getOutput().getOutputTypeSequence().setHomeZone(homeZone);
|
|
//D.S. Fine
|
|
|
|
//TAG CARTA
|
|
carta.setIccId20(new String());
|
|
|
|
//TAG SERVIZI
|
|
//Kit Luglio 08 - M.G. Richiesta dei servizi associati all'utenza
|
|
mnp.xml.dao.gisp.retreive.Servizi servizi = new mnp.xml.dao.gisp.retreive.Servizi();
|
|
mnp.xml.dao.gisp.retreive.Servizio dual = new mnp.xml.dao.gisp.retreive.Servizio();
|
|
dual.setNome(GispMap.SERVIZIO_DUAL);
|
|
servizi.addServizio(dual);
|
|
mnp.xml.dao.gisp.retreive.Servizio dualplus = new mnp.xml.dao.gisp.retreive.Servizio();
|
|
dualplus.setNome(GispMap.SERVIZIO_DUALPLUS);
|
|
servizi.addServizio(dualplus);
|
|
mnp.xml.dao.gisp.retreive.Servizio dueInUno = new mnp.xml.dao.gisp.retreive.Servizio();
|
|
dueInUno.setNome(GispMap.SERVIZIO_2IN1);
|
|
servizi.addServizio(dueInUno);
|
|
mnp.xml.dao.gisp.retreive.Servizio cfgNaked = new mnp.xml.dao.gisp.retreive.Servizio();
|
|
cfgNaked.setNome(GispMap.SERVIZIO_NAKED);
|
|
servizi.addServizio(cfgNaked);
|
|
//Kit Luglio 09
|
|
mnp.xml.dao.gisp.retreive.Servizio cfgBear = new mnp.xml.dao.gisp.retreive.Servizio();
|
|
cfgBear.setNome(GispMap.SERVIZIO_BEAR);
|
|
servizi.addServizio(cfgBear);
|
|
data.getOutput().getOutputTypeSequence().setServizi(servizi);
|
|
|
|
//Kit Luglio 09
|
|
mnp.xml.dao.gisp.retreive.Risorse_rete risorseRete = new mnp.xml.dao.gisp.retreive.Risorse_rete();
|
|
risorseRete.setStato(new String());
|
|
risorseRete.setTipologia(new String());
|
|
risorseRete.setData_ultima_operazione(new String());
|
|
data.getOutput().getOutputTypeSequence().setRisorse_rete(risorseRete);
|
|
|
|
// Marshal
|
|
xml = XmlUtility.getXmlStringFromCastorXmlObject(retrive,true);
|
|
return xml;
|
|
}
|
|
|
|
|
|
/**
|
|
* Costriusce Json di notifica a SDP/ESO per la retrive request su base utenza mobile
|
|
* @param retrieveGisp RetrieveGisp
|
|
* @return String
|
|
*/
|
|
public static String getJsonFromRetrieveESO(MnpGispRetrieveOut retrieveGisp) throws Exception{
|
|
mnp.proxy.ws.sdp.client.Request request = new mnp.proxy.ws.sdp.client.Request();
|
|
mnp.proxy.ws.sdp.client.RequestInput input = new mnp.proxy.ws.sdp.client.RequestInput();
|
|
mnp.proxy.ws.sdp.client.RequestOutput output = new mnp.proxy.ws.sdp.client.RequestOutput();
|
|
mnp.proxy.ws.sdp.client.Attributi attributi = new mnp.proxy.ws.sdp.client.Attributi();
|
|
mnp.proxy.ws.sdp.client.Servizi servizi = new mnp.proxy.ws.sdp.client.Servizi();
|
|
mnp.proxy.ws.sdp.client.Carta carta = new mnp.proxy.ws.sdp.client.Carta();
|
|
mnp.proxy.ws.sdp.client.RisorseRete risorseRete = new mnp.proxy.ws.sdp.client.RisorseRete();
|
|
|
|
/******* Input -> msisdn *******/
|
|
input.setMsisdn(retrieveGisp.getMsisdn());
|
|
|
|
/******* Attributi *******/
|
|
//Attributi -> stato
|
|
attributi.setStato("string");
|
|
//AttributiDettaglioStato -> cessazione_mnp
|
|
mnp.proxy.ws.sdp.client.AttributiDettaglioStato dettaglioStato= new mnp.proxy.ws.sdp.client.AttributiDettaglioStato();
|
|
dettaglioStato.setCessazioneMnp("string");
|
|
//Attributi -> prepagato
|
|
attributi.setPrepagato("string");
|
|
//Attributi -> usage
|
|
attributi.setUsage(new mnp.proxy.ws.sdp.client.AttributiUsage());
|
|
//Attributi -> esp
|
|
attributi.setEsp("string");
|
|
//Attributi -> profilo
|
|
attributi.setProfilo("string");
|
|
//Attributi -> descrizioneProfilo
|
|
attributi.setDescrizioneProfilo("string");
|
|
//Attributi -> tipologia
|
|
attributi.setTipologia("string");
|
|
//Attributi -> blocco -> fs
|
|
mnp.proxy.ws.sdp.client.AttributiBlocco blocco = new mnp.proxy.ws.sdp.client.AttributiBlocco();
|
|
blocco.setFs("string");
|
|
blocco.setFraud("string");
|
|
blocco.setAnagr("string");
|
|
//Attributi -> dati_commerciali -> cliente
|
|
mnp.proxy.ws.sdp.client.AttributiDatiCommerciali datiCommerciali = new mnp.proxy.ws.sdp.client.AttributiDatiCommerciali();
|
|
datiCommerciali.setCliente("string");
|
|
datiCommerciali.setMarcaggioCliente("string");
|
|
|
|
/******* Servizi *******/
|
|
mnp.proxy.ws.sdp.client.ServiziServizio servizioBear = new mnp.proxy.ws.sdp.client.ServiziServizio();
|
|
servizioBear.name(GispMap.SERVIZIO_BEAR);
|
|
|
|
/******* Carta *******/
|
|
carta.setIccId20("string");
|
|
|
|
/******* Risorse Rete *******/
|
|
risorseRete.setStato("string");
|
|
risorseRete.setTipologia("string");
|
|
risorseRete.setDataUltimaOperazione("string");
|
|
|
|
/******* assegnazioni *******/
|
|
attributi.setDettaglioStato(dettaglioStato);
|
|
attributi.blocco(blocco);
|
|
attributi.datiCommerciali(datiCommerciali);
|
|
output.setAttributi(attributi);
|
|
servizi.addServizioItem(servizioBear);
|
|
output.setServizi(servizi);
|
|
output.setCarta(carta);
|
|
output.setRisorseRete(risorseRete);
|
|
request.setInput(input);
|
|
request.setOutput(output);
|
|
|
|
return new Gson().toJson(request);
|
|
}
|
|
|
|
|
|
/**
|
|
* Costriusce XML di notifica a GISP per la retrive su base utenza fissa
|
|
* @param hzGispRetrieveOut
|
|
* @return String
|
|
* @throws Exception
|
|
*/
|
|
public static String getXmlFromRetrieveGisp(HzGispRetrieveOut hzGispRetrieveOut) throws Exception {
|
|
//creo l'oggetto di retrieve --> tag retrieve che ha come figli i tag info e data
|
|
Retrieve retrieve = new Retrieve();
|
|
|
|
//creo l'oggetto info --> tag info
|
|
Info info = new mnp.xml.dao.gisp.retreive.Info();
|
|
info.setSystem(GispMap.SYSTEM_DBC);
|
|
java.util.Date now = new java.util.Date();
|
|
String snow = DateUtils.toString(now,"dd/MM/yyyy HH:mm:ss");
|
|
info.setSysdate(snow);
|
|
//aggiungo info alla retrieve
|
|
retrieve.setInfo(info);
|
|
|
|
//creo l'oggetto data --> tag data che ha come figli i tag input e output
|
|
Data data = new mnp.xml.dao.gisp.retreive.Data();
|
|
|
|
//creo l'oggetto input --> tag input
|
|
Input input = new Input();
|
|
input.setNumFisso(hzGispRetrieveOut.getDirectoryNumber());
|
|
//aggiungo input a data
|
|
data.setInput(input);
|
|
|
|
//creo l'oggetto output --> tag output
|
|
Output output = new Output();
|
|
//creo l'oggetto dati fisso --> tag dati fisso
|
|
DatiFisso datiFisso = new DatiFisso();
|
|
//aggiungo dati fisso ad output
|
|
output.setDatiFisso(datiFisso);
|
|
|
|
//aggiungo output a data
|
|
data.setOutput(output);
|
|
//aggiungo data a retrieve
|
|
retrieve.setData(data);
|
|
|
|
//Marshal
|
|
return XmlUtility.getXmlStringFromCastorXmlObject(retrieve,true);
|
|
}
|
|
|
|
|
|
/**
|
|
* Costriusce XML di notifica a GISP
|
|
* @param retrieveGisp MnpGispRetrieveOut
|
|
* @return String
|
|
*/
|
|
public static MnpGispRetrieveOut getRetrieveGispFromXmlResponse(String xmlResponse) throws NotValidXMLException,Exception{
|
|
MnpGispRetrieveOut retrieveGisp= new MnpGispRetrieveOut();
|
|
try {
|
|
// databinding con validazione
|
|
// UnMarshal
|
|
Response response = (Response) XmlUtility.getCastorXmlObjectFromXmlString(Response.class, xmlResponse, true);
|
|
if (response.isValid()) {
|
|
retrieveGisp.setRespCode(response.getInfo().getCode());
|
|
retrieveGisp.setRespMSG(response.getInfo().getMsg());
|
|
if ( (response.getData() != null) &&
|
|
(response.getData().getMsisdn() != null) &&
|
|
(response.getData().getMsisdn().getMsisdnTypeSequence() != null)) {
|
|
|
|
//TAG ATTRIBUTI
|
|
if (response.getData().getMsisdn().getMsisdnTypeSequence().getAttributi() != null) {
|
|
mnp.xml.dao.gisp.response.Attributi attributi = response.getData().getMsisdn().getMsisdnTypeSequence().getAttributi();
|
|
retrieveGisp.setStato(attributi.getStato());
|
|
//cessazione_mnp
|
|
retrieveGisp.setRespCessazioneMnp(attributi.getDettaglio_stato().getCessazione_mnp());
|
|
//operatore_virtuale
|
|
retrieveGisp.setRespOperatoreInterno(attributi.getEsp());
|
|
// Descrizione profilo
|
|
retrieveGisp.setDescProfilo(attributi.getDescrizione_profilo());
|
|
//C.P. Kit aprile 09
|
|
//profilo
|
|
retrieveGisp.setProfilo(attributi.getProfilo());
|
|
//blocco anagrafica
|
|
retrieveGisp.setAnagr(attributi.getBlocco().getAnagr());
|
|
retrieveGisp.setRespTipologia(attributi.getTipologia());
|
|
retrieveGisp.setRespValueUsage(attributi.getUsage().getValueUsage());
|
|
if (!retrieveGisp.getRespValueUsage().equals(GispMap.MAIN_USAGE)
|
|
|| !retrieveGisp.getRespValueUsage().equals(GispMap.TCB_PADRE_USAGE)){
|
|
retrieveGisp.setRespMainMsisdn(attributi.getUsage().getMain_msisdn());
|
|
}
|
|
retrieveGisp.setRespCfPiva(attributi.getDati_commerciali().getCliente());
|
|
retrieveGisp.setRespMarcaggio(attributi.getDati_commerciali().getMarcaggio_cliente());
|
|
//kit luglio 09
|
|
retrieveGisp.setRespPrepagato(attributi.getPrepagato());
|
|
retrieveGisp.setRespFs(attributi.getBlocco().getFs());
|
|
retrieveGisp.setRespFraud(attributi.getBlocco().getFraud());
|
|
|
|
}//chiude if attributi
|
|
|
|
//TAG HOME ZONE
|
|
if (response.getData().getMsisdn().getMsisdnTypeSequence().getHomeZone() != null) {
|
|
//D.S. Kit Dicembre 07
|
|
mnp.xml.dao.gisp.response.HomeZone homeZone = response.getData().getMsisdn().getMsisdnTypeSequence().getHomeZone();
|
|
retrieveGisp.setStateHZ(homeZone.getState());
|
|
retrieveGisp.setStatoSlaveHZ(homeZone.getStatoSlave());
|
|
//D.S. Fine
|
|
} //chiude tag home zone
|
|
|
|
//TAG CARTA
|
|
if (response.getData().getMsisdn().getMsisdnTypeSequence().getCarta() != null) {
|
|
mnp.xml.dao.gisp.response.Carta carta = response.getData().getMsisdn().getMsisdnTypeSequence().getCarta();
|
|
retrieveGisp.setIccid(carta.getIccId20());
|
|
} //chiude il tag carta
|
|
|
|
//TAG SERVIZI
|
|
if (response.getData().getMsisdn().getMsisdnTypeSequence().getServizi() != null) {
|
|
mnp.xml.dao.gisp.response.Servizi servizi = response.getData().getMsisdn().getMsisdnTypeSequence().getServizi();
|
|
mnp.xml.dao.gisp.response.Servizio[] elencoServizi = servizi.getServizio();
|
|
if (elencoServizi != null && elencoServizi.length > 0) {
|
|
//prendo solo il primo essendo i 3 servizi mutualmente esclusivi
|
|
retrieveGisp.setRespServizioAttivo(elencoServizi[0].getNome());
|
|
//prendo l'elenco degli attributi del servizio (i sottoservizi possono essere più di uno)
|
|
mnp.xml.dao.gisp.response.Attributi_servizi[] attributiServizi = elencoServizi[0].getAttributi_servizi();
|
|
//ciclo sull'elenco degli attributi-servizi
|
|
for (int i=0; i<attributiServizi.length; i++) {
|
|
//prendo per ogni attributo-servizio l'elenco degli attributi
|
|
mnp.xml.dao.gisp.response.Attributo[] elencoAttributi = attributiServizi[i].getAttributo();
|
|
//ciclo sull'elenco degli attributi
|
|
for (int j=0; j<elencoAttributi.length; j++) {
|
|
if (elencoAttributi[j].getName().equals(ATTRIBUTO_SERVIZI_ADDITONAL)) {
|
|
retrieveGisp.setRespAdditional(elencoAttributi[j].getContent());
|
|
}//kit lulgio 09 salviamo il nome del sotto servizio che per il servizio BEAR ha valori multipli
|
|
else if (elencoAttributi[j].getName().equals(ATTRIBUTO_SERVIZI_SOTTOSERVIZIO)) {
|
|
retrieveGisp.setRespSottoservizio(elencoAttributi[j].getContent());
|
|
}
|
|
}
|
|
}
|
|
retrieveGisp.setRespAdditional(elencoServizi[0].getAttributi_servizi()[0].getAttributo(1).getContent());
|
|
}
|
|
} //chiudi if servizi
|
|
|
|
//TAG RISORSE RETE - kit luglio 09
|
|
if (response.getData().getMsisdn().getMsisdnTypeSequence().getRisorse_rete() != null) {
|
|
mnp.xml.dao.gisp.response.Risorse_rete risorseRete = response.getData().getMsisdn().getMsisdnTypeSequence().getRisorse_rete();
|
|
retrieveGisp.setRespReteStato(risorseRete.getStato());
|
|
retrieveGisp.setRespReteTipologia(risorseRete.getTipologia());
|
|
retrieveGisp.setRespReteDataUltimaOper(risorseRete.getData_ultima_operazione());
|
|
}
|
|
//chiudi if risorse rete
|
|
|
|
}//chiude if msisdn
|
|
|
|
}//chiude if isValid
|
|
else {
|
|
throw new NotValidXMLException("XML response is not valid");
|
|
}
|
|
|
|
}
|
|
|
|
catch (ValidationException ex) {
|
|
ex.printStackTrace();
|
|
throw new NotValidXMLException(ex.toString());
|
|
}
|
|
catch (MarshalException ex) {
|
|
ex.printStackTrace();
|
|
throw new NotValidXMLException(ex.toString());
|
|
}
|
|
catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
throw ex;
|
|
}
|
|
return retrieveGisp;
|
|
}
|
|
|
|
/**
|
|
* Costriusce l'oggetto MnpGispRetrieveOut dalla response di SDP/ESO
|
|
* @param xmlResponse String
|
|
* @return String
|
|
*/
|
|
public static MnpGispRetrieveOut getRetrieveESOFromXmlResponse(String xmlResponse) throws NotValidXMLException,Exception{
|
|
MnpGispRetrieveOut retrieveGisp= new MnpGispRetrieveOut();
|
|
try {
|
|
// databinding con validazione
|
|
// UnMarshal
|
|
Gson gson = new GsonBuilder().create();
|
|
mnp.proxy.ws.sdp.client.Response response = gson.fromJson(xmlResponse, mnp.proxy.ws.sdp.client.Response.class);
|
|
|
|
retrieveGisp.setRespCode(response.getInfo().getCode());
|
|
retrieveGisp.setRespMSG(response.getInfo().getMsg());
|
|
|
|
//TAG ATTRIBUTI
|
|
if (response.getAttributi() != null) {
|
|
mnp.proxy.ws.sdp.client.Attributi attributi = response.getAttributi();
|
|
retrieveGisp.setStato(attributi.getStato());
|
|
//cessazione_mnp
|
|
retrieveGisp.setRespCessazioneMnp(attributi.getDettaglioStato().getCessazioneMnp());
|
|
//operatore_virtuale
|
|
retrieveGisp.setRespOperatoreInterno(attributi.getEsp());
|
|
// Descrizione profilo
|
|
retrieveGisp.setDescProfilo(attributi.getDescrizioneProfilo());
|
|
//profilo
|
|
retrieveGisp.setProfilo(attributi.getProfilo());
|
|
//blocco
|
|
retrieveGisp.setAnagr(attributi.getBlocco().getAnagr());
|
|
retrieveGisp.setRespFs(attributi.getBlocco().getFs());
|
|
retrieveGisp.setRespFraud(attributi.getBlocco().getFraud());
|
|
|
|
retrieveGisp.setRespTipologia(attributi.getTipologia());
|
|
retrieveGisp.setRespValueUsage(attributi.getUsage().getValue());
|
|
|
|
if (!retrieveGisp.getRespValueUsage().equals(GispMap.MAIN_USAGE)
|
|
|| !retrieveGisp.getRespValueUsage().equals(GispMap.TCB_PADRE_USAGE)){
|
|
retrieveGisp.setRespMainMsisdn(attributi.getUsage().getMainMsisdn());
|
|
}
|
|
//dati commerciali
|
|
retrieveGisp.setRespCfPiva(attributi.getDatiCommerciali().getCliente());
|
|
retrieveGisp.setRespMarcaggio(attributi.getDatiCommerciali().getMarcaggioCliente());
|
|
|
|
retrieveGisp.setRespPrepagato(attributi.getPrepagato());
|
|
}//chiude if attributi
|
|
|
|
//TAG CARTA
|
|
if (response.getCarta() != null) {
|
|
mnp.proxy.ws.sdp.client.Carta carta = response.getCarta();
|
|
retrieveGisp.setIccid(carta.getIccId20());
|
|
} //chiude il tag carta
|
|
|
|
//TAG SERVIZI
|
|
if (response.getServizi() != null) {
|
|
mnp.proxy.ws.sdp.client.Servizi servizi = response.getServizi();
|
|
mnp.proxy.ws.sdp.client.ServiziServizio[] elencoServizi = servizi.getServizio();
|
|
if (elencoServizi != null && elencoServizi.length > 0) {
|
|
//prendo solo il primo essendo i 3 servizi mutualmente esclusivi
|
|
retrieveGisp.setRespServizioAttivo(elencoServizi[0].getName());
|
|
//prendo l'elenco degli attributi del servizio (i sottoservizi possono essere più di uno)
|
|
mnp.proxy.ws.sdp.client.ServiziAttributiServizio attributiServizi = elencoServizi[0].getAttributiServizio();
|
|
retrieveGisp.setRespAdditional(attributiServizi.getAdditional());
|
|
retrieveGisp.setRespSottoservizio(attributiServizi.getSottoservizio());
|
|
// retrieveGisp.setRespAdditional(elencoServizi[0].getAttributi_servizi()[0].getAttributo(1).getContent());
|
|
}
|
|
} //chiudi if servizi
|
|
|
|
//TAG RISORSE RETE
|
|
if (response.getRisorseRete() != null) {
|
|
mnp.proxy.ws.sdp.client.RisorseRete risorseRete = response.getRisorseRete();
|
|
retrieveGisp.setRespReteStato(risorseRete.getStato());
|
|
retrieveGisp.setRespReteTipologia(risorseRete.getTipologia());
|
|
retrieveGisp.setRespReteDataUltimaOper(risorseRete.getDataUltimaOperazione());
|
|
}
|
|
|
|
}
|
|
catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
throw ex;
|
|
}
|
|
return retrieveGisp;
|
|
}
|
|
|
|
|
|
/**
|
|
* Ritorna un HzGispRetrieveOut contenente i dati della response
|
|
* @param xmlResponse
|
|
* @return
|
|
* @throws NotValidXMLException
|
|
* @throws Exception, NotValidXMLException,
|
|
*/
|
|
public static HzGispRetrieveOut getHZRetrieveGispFromXmlResponse(String xmlResponse) throws NotValidXMLException, Exception {
|
|
|
|
HzGispRetrieveOut retrieve = new HzGispRetrieveOut();
|
|
try {
|
|
// databinding con validazione
|
|
// UnMarshal
|
|
Response response = (Response) XmlUtility.getCastorXmlObjectFromXmlString(Response.class, xmlResponse, true);
|
|
if (response.isValid()) {
|
|
retrieve.setRespCode(response.getInfo().getCode());
|
|
retrieve.setRespMsg(response.getInfo().getMsg());
|
|
//controllo se alla response sono associati dati e se ai dati è associato un numero fisso
|
|
//e se al numero fisso sono associati dati
|
|
if ((response.getData() != null) && (response.getData().getNumFisso() != null)
|
|
&& (response.getData().getNumFisso().getDatiFisso() != null)) {
|
|
mnp.xml.dao.gisp.response.DatiFisso datiFisso = response.getData().getNumFisso().getDatiFisso();
|
|
retrieve.setRespFlagTim(new Character(datiFisso.getFlagTIM().charAt(0)));
|
|
retrieve.setRespStatoFisso(datiFisso.getStatoFisso());
|
|
//controllo se è associato un solo numero radiomobile all'utenza fissa
|
|
if (datiFisso.getNRMsisdn()!=null && Integer.parseInt(datiFisso.getNRMsisdn())==1
|
|
&& datiFisso.getRadiomobili()!=null && datiFisso.getRadiomobili().length==1) {
|
|
retrieve.setRespMsisdn(datiFisso.getRadiomobili()[0].getMsisdn());
|
|
retrieve.setRespTipoCliente(datiFisso.getRadiomobili()[0].getTipoCliente());
|
|
retrieve.setRespTipoMsisdn(datiFisso.getRadiomobili()[0].getTipoMsisdn());
|
|
}
|
|
}
|
|
}
|
|
} catch (ValidationException ex) {
|
|
ex.printStackTrace();
|
|
throw new NotValidXMLException(ex.toString());
|
|
} catch (MarshalException ex) {
|
|
ex.printStackTrace();
|
|
throw new NotValidXMLException(ex.toString());
|
|
} catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
throw ex;
|
|
}
|
|
return retrieve;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|