First Commit - Source Code from Reply
This commit is contained in:
54
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/FileGenerator.java
Normal file
54
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/FileGenerator.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package base;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
import mnp.database.dao.SistemiInterniDAO;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class FileGenerator extends SimGenerator{
|
||||
|
||||
protected SistemiInterniDAO sisDao = null;
|
||||
protected String testId = "";
|
||||
|
||||
//obj. di cache per i TEST automatici
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public FileGenerator(String testId) {
|
||||
this.testId = testId;
|
||||
this.sisDao = new SistemiInterniDAO();
|
||||
}
|
||||
|
||||
abstract public void generateFiles(Vector params) throws Exception;
|
||||
|
||||
|
||||
// public void setTestId(String testId) {
|
||||
// this.testId = testId;
|
||||
// }
|
||||
/**
|
||||
* Svuota la directory in cui deve salvare i file generati
|
||||
* @param path String
|
||||
*/
|
||||
public void svuotaDirectory(String path) {
|
||||
File file = new File(path);
|
||||
File[] list = file.listFiles();
|
||||
|
||||
if ((list != null ) && list.length != 0) {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
File f1 = list[i];
|
||||
boolean success = f1.delete();
|
||||
if (!success)
|
||||
System.out.println("Errore nella cancellazione del file " + f1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
113
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/ProtectionManager.java
Normal file
113
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/ProtectionManager.java
Normal file
@@ -0,0 +1,113 @@
|
||||
package base;
|
||||
|
||||
import conf.SimConfFile;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESedeKeySpec;
|
||||
import java.security.Key;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* User: germano.giudici
|
||||
* Date: 6-apr-2009
|
||||
*/
|
||||
public class ProtectionManager {
|
||||
private static Date date;
|
||||
static final String TRIPLE_DES_CHIPER = "DESede/ECB/PKCS5Padding";
|
||||
static final String TRIPLE_DES_KEY = "DESede";
|
||||
static String passphrase = "generate a key of course";
|
||||
static Key chiave3DES;
|
||||
|
||||
|
||||
public static void check() {
|
||||
boolean ret = true;
|
||||
try {
|
||||
if (date == null) {
|
||||
String activationKey = null;
|
||||
try {
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("ATTIVAZIONE");
|
||||
activationKey = properties.getProperty("activationkey");
|
||||
} catch (Throwable e) {
|
||||
System.out.println("##################################################");
|
||||
System.out.println("IL FILE PROPERTIES PER LA CHIAVE DI ATTIVAZIONE NON E' STATO TROVATO");
|
||||
System.out.println("##################################################");
|
||||
}
|
||||
if (activationKey == null) {
|
||||
activationKey = System.getProperty("dbc.activationkey");
|
||||
}
|
||||
createKey();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
date = simpleDateFormat.parse(decripta3DES(activationKey));
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("dd-MM-yyyy");
|
||||
System.out.println("##################################################");
|
||||
System.out.println("SCADENZA CHIAVE: " + simpleDateFormat1.format(date));
|
||||
System.out.println("##################################################");
|
||||
if (System.currentTimeMillis() > date.getTime()) {
|
||||
ret = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ret = false;
|
||||
}
|
||||
if (!ret) {
|
||||
throw new SecurityException("La chiave inserita non e' valida");
|
||||
}
|
||||
}
|
||||
|
||||
public static String cripta3DES(String value) throws Exception{
|
||||
byte[] res = null;
|
||||
Cipher cipher = Cipher.getInstance(TRIPLE_DES_CHIPER);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, chiave3DES);
|
||||
byte[] val = value.getBytes();
|
||||
res = new byte[cipher.getOutputSize(val.length)];
|
||||
int size = cipher.update(val, 0, val.length, res, 0);
|
||||
size += cipher.doFinal(res,size);
|
||||
return toString(res,res.length);
|
||||
}
|
||||
|
||||
public static String decripta3DES(String value) throws Exception{
|
||||
Cipher cipher = Cipher.getInstance(TRIPLE_DES_CHIPER);
|
||||
cipher.init(Cipher.DECRYPT_MODE, chiave3DES);
|
||||
return new String(cipher.doFinal(toByteArray(value)));
|
||||
}
|
||||
|
||||
private static void createKey() throws Exception{
|
||||
DESedeKeySpec spec = null;
|
||||
spec = new DESedeKeySpec(passphrase.getBytes());
|
||||
chiave3DES = SecretKeyFactory.getInstance(TRIPLE_DES_KEY).generateSecret(spec);
|
||||
}
|
||||
|
||||
private static final byte[] toByteArray(String string) throws Exception{
|
||||
BASE64Decoder decoder = new BASE64Decoder();
|
||||
byte[] raw = decoder.decodeBuffer(string);
|
||||
return raw;
|
||||
}
|
||||
|
||||
private static final String toString(byte[] bytes,int length) {
|
||||
BASE64Encoder encoder = new BASE64Encoder();
|
||||
String base64 = encoder.encode(bytes);
|
||||
return base64;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* args[1]= data scadenza nel formato yyyy.MM.dd
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args){
|
||||
try {
|
||||
createKey();
|
||||
String newKey = cripta3DES(args[0]);
|
||||
System.out.println("nuova chiave\n" + newKey);
|
||||
System.out.println("\nscadenza (yyyy.MM.dd): " + decripta3DES(newKey));
|
||||
} catch (Throwable e) {
|
||||
System.out.println("Invocare con data nel formato yyyy.MM.dd");
|
||||
}
|
||||
}
|
||||
}
|
||||
568
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/SimGenerator.java
Normal file
568
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/SimGenerator.java
Normal file
@@ -0,0 +1,568 @@
|
||||
/*
|
||||
* Created on Jan 24, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package base;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import conf.SimConfFile;
|
||||
|
||||
import mnp.utility.DateUtils;
|
||||
|
||||
import db.ManagerDAO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class SimGenerator
|
||||
extends SimLogger {
|
||||
|
||||
protected Random rand = new Random();
|
||||
protected int generaNumeroConPunto = SimConfFile.getInstance().ReadSection(
|
||||
"General").getProperty("Seed").indexOf(".");
|
||||
protected int index = Integer.parseInt(SimConfFile.getInstance().ReadSection(
|
||||
"General").getProperty("Seed").replace('.', '0'));
|
||||
protected String prefisso = SimConfFile.getInstance().ReadSection("General").
|
||||
getProperty("prefisso");
|
||||
|
||||
protected String[] gruppi = {
|
||||
"MNP_SVI", "MNP_DSP", "MNP_TIM"};
|
||||
protected String[] ots = {
|
||||
"C", "CN", "NE", "NO", "LO", "S1", "S2"};
|
||||
protected ManagerDAO managerDAO = null;
|
||||
|
||||
protected String listaNomi[] = {
|
||||
"ANDREA", "GIOVANNI", "AMBRA", "CLAUDIO", "IVAN", "SARA", "ELENA",
|
||||
"GIORGIO", "DIEGO", "ANTONELLA"};
|
||||
protected String listaCognomi[] = {
|
||||
"UNGARO", "AMICI", "PARATI", "GARBELLI", "PIZZOLANTE", "SCARPELLINI",
|
||||
"FIORE", "TAGLIENTE", "NUNNERI", "RENDE"};
|
||||
|
||||
protected String listaLocalita[] = {
|
||||
"ROMA", "MILANO", "NAPOLI", "BARI", "ISERNIA", "TORINO",
|
||||
"VERONA", "FIRENZE", "BOLOGNA", "PALERMO"};
|
||||
|
||||
protected String olo[] = {
|
||||
"WIND", "OPIV", "H3GI"
|
||||
};
|
||||
protected String prefissi[] = {
|
||||
"333", "334", "335", "338", "339", "330", "336", "337", "360", "366",
|
||||
"368", "340", "347", "348", "349", "346", "328", "329", "320", "380",
|
||||
"388", "389", "391", "392", "393", "327", "345", "373"};
|
||||
|
||||
public SimpleDateFormat utility_date_format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd");
|
||||
public SimpleDateFormat cutover_date_format = null;
|
||||
public boolean accodata = false;
|
||||
private String codice_dealer;
|
||||
|
||||
private String cod_profilo_tariffario;
|
||||
private String desc_profilo_tariffario;
|
||||
private String tipoOperazione;
|
||||
private String flagTC;
|
||||
private String idContratto;
|
||||
|
||||
private String flagFurto;
|
||||
private String flagPrevalidazione;
|
||||
private String progettoAdHoc;
|
||||
private String codGruppo;
|
||||
private String msisdnParliSubito;
|
||||
|
||||
public void setAccodata(boolean flag) {
|
||||
accodata = flag;
|
||||
}
|
||||
|
||||
public String getDataCutover() {
|
||||
|
||||
String co = utility_date_format.format(new Date());
|
||||
|
||||
try {
|
||||
if (accodata) {
|
||||
co = DateUtils.aggiungiGiorniLavorativi(co, 7);
|
||||
}
|
||||
Date d = utility_date_format.parse(co);
|
||||
co = cutover_date_format.format(d);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return co;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce i PREFISSI in modo random
|
||||
* @return String
|
||||
*/
|
||||
protected String randomPrefisso() {
|
||||
if ( (prefisso != null) && (!prefisso.equals(""))) {
|
||||
return prefisso;
|
||||
}
|
||||
else {
|
||||
int i = rand.nextInt(prefissi.length);
|
||||
return prefissi[i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiunge tanti zeri come prefisso fino a maxLen
|
||||
* @param number String
|
||||
* @param maxLen int
|
||||
* @return String
|
||||
*/
|
||||
protected String addZero(String number, int maxLen) {
|
||||
int len = number.length();
|
||||
while (len < maxLen) {
|
||||
number = "0" + number;
|
||||
len++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggiunge tanti spazi fino a maxLen
|
||||
* @param number String
|
||||
* @param maxLen int
|
||||
* @return String
|
||||
*/
|
||||
protected String addBlack(String text, int maxLen) {
|
||||
int len = text.length();
|
||||
while (len < maxLen) {
|
||||
text = " " + text;
|
||||
len++;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce WIND, H3GI o OPIV in modo random
|
||||
* @return String
|
||||
*/
|
||||
protected String randomCodiceOperatoreOLO() {
|
||||
String[] list = {
|
||||
"WIND", "OPIV", "H3GI"};
|
||||
int i = rand.nextInt(3);
|
||||
return list[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce WIND, H3GI o OPIV in modo distribuito
|
||||
* @return String
|
||||
*/
|
||||
protected String getCodiceOperatoreOLO(int min, int max) {
|
||||
|
||||
int delta = max - min;
|
||||
//System.out.println("min: " + min + " max: "+ max + " index: " + index + " delta:" + (delta * 0.33));
|
||||
String[] list = {
|
||||
"WIND", "OPIV", "H3GI"};
|
||||
/*
|
||||
if (index <= min + (delta * 0.25)) {
|
||||
return "WIND";
|
||||
}
|
||||
else if (index <= min + (delta * 0.50)) {
|
||||
return "OPIV";
|
||||
}
|
||||
else if (index <= min + (delta * 0.75)) {
|
||||
return "H3GI";
|
||||
}
|
||||
else {
|
||||
return "LMIT";
|
||||
}*/
|
||||
|
||||
if (index <= min + (delta * 0.33)) {
|
||||
return "WIND";
|
||||
}
|
||||
else if (index <= min + (delta * 0.66)) {
|
||||
return "OPIV";
|
||||
}
|
||||
else {
|
||||
return "H3GI";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruisce l'MSISDN
|
||||
* @param exTim String
|
||||
* @return String
|
||||
*/
|
||||
protected String getMSISDN(String exTim) {
|
||||
String prefix = null;
|
||||
if (exTim.equalsIgnoreCase("EX_TIM")) {
|
||||
prefix = "335";
|
||||
}
|
||||
else {
|
||||
prefix = randomPrefisso();
|
||||
|
||||
}
|
||||
String numero = addZero(Integer.toString(index), 7);
|
||||
String _msisdn = "39" + prefix + numero;
|
||||
return _msisdn;
|
||||
}
|
||||
|
||||
protected String getMSISDN(String exTim, boolean international) {
|
||||
|
||||
if (international){
|
||||
return getMSISDN(exTim);
|
||||
}
|
||||
else{
|
||||
String prefix = null;
|
||||
if (exTim.equalsIgnoreCase("EX_TIM")) {
|
||||
prefix = "335";
|
||||
}
|
||||
else {
|
||||
prefix = randomPrefisso();
|
||||
|
||||
}
|
||||
String numero = addZero(Integer.toString(index), 7);
|
||||
String _msisdn = prefix + numero;
|
||||
return _msisdn;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Costruisce il N di telefono
|
||||
* @return String
|
||||
*/
|
||||
/*protected String getTelefono() {
|
||||
String numero = addZero(Integer.toString(index),7);
|
||||
return numero;
|
||||
}*/
|
||||
protected String getTelefono() {
|
||||
String numero = Integer.toString(index);
|
||||
if (generaNumeroConPunto >= 0) {
|
||||
numero = numero.substring(0, generaNumeroConPunto) + "." +
|
||||
numero.substring(generaNumeroConPunto + 1);
|
||||
}
|
||||
;
|
||||
numero = addZero(numero, 7);
|
||||
return numero;
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruisce l'ICCID
|
||||
* @return String
|
||||
*/
|
||||
protected String getIccdSerialNumber() {
|
||||
return addZero(Integer.toString(index), 19);
|
||||
}
|
||||
|
||||
protected String getCodiceFiscalePartitaIVA() {
|
||||
return "SRTMCC75C52A345Q";
|
||||
}
|
||||
|
||||
protected String getServiceOrder() {
|
||||
return "SVC_ORDER_" + index;
|
||||
}
|
||||
|
||||
protected String getAssetUses() {
|
||||
return "ASSET_USES_" + index;
|
||||
}
|
||||
|
||||
protected String getTipoDocumento() {
|
||||
return "PA";
|
||||
}
|
||||
|
||||
protected String getNumeroDocumento() {
|
||||
return "AQ5633392Z";
|
||||
}
|
||||
|
||||
protected String getImsi() {
|
||||
return addZero(Integer.toString(index), 15);
|
||||
}
|
||||
|
||||
protected String getCodiceRichiestaBit() {
|
||||
return addZero(Integer.toString(index), 18);
|
||||
}
|
||||
|
||||
protected String getCodiceServiceOrder() {
|
||||
return addZero(Integer.toString(index), 15);
|
||||
}
|
||||
|
||||
protected String getCodiceRichiestaRecipient() {
|
||||
return addZero(Integer.toString(index), 18);
|
||||
}
|
||||
|
||||
protected String getCodicePrePost(String sel, int min, int max) {
|
||||
String val = "";
|
||||
if (sel.toUpperCase().equals("MISTO")) {
|
||||
val = getPrePost(min, max);
|
||||
}
|
||||
else
|
||||
if (sel.toUpperCase().equals("PRP")) {
|
||||
val = "PRP";
|
||||
}
|
||||
else {
|
||||
val = "POP";
|
||||
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
protected String getTipoOperazione(int min, int max) {
|
||||
String val;
|
||||
int delta = max - min;
|
||||
if (index < min + (delta * 0.50)) {
|
||||
val = "ADN";
|
||||
}
|
||||
else {
|
||||
val = "FNP";
|
||||
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
protected String randomFlagYN() {
|
||||
String ret = "N";
|
||||
int i = rand.nextInt();
|
||||
if(i%2==0) ret = "Y";
|
||||
return ret;
|
||||
}
|
||||
protected String randomNomeCliente() {
|
||||
int i = rand.nextInt(10);
|
||||
return listaNomi[i];
|
||||
}
|
||||
|
||||
protected String randomCognomeCliente() {
|
||||
int i = rand.nextInt(10);
|
||||
return listaCognomi[i];
|
||||
}
|
||||
|
||||
protected String getPrePost(int min, int max) {
|
||||
|
||||
//System.out.println("min: " + min_properties + " max: "+ max_properties + " index: " + index);
|
||||
int delta = max - min;
|
||||
|
||||
if (index <= min + (delta * 0.5)) {
|
||||
return "PRP";
|
||||
}
|
||||
else {
|
||||
return "POP";
|
||||
}
|
||||
}
|
||||
|
||||
protected String randomPrePost() {
|
||||
int i = rand.nextInt(2);
|
||||
if (index == 0) {
|
||||
return "PRP";
|
||||
}
|
||||
else {
|
||||
return "POP";
|
||||
}
|
||||
}
|
||||
|
||||
protected void setCodiceGruppi(String _codGruppi) {
|
||||
Vector v = new Vector();
|
||||
StringTokenizer tokens = new StringTokenizer(_codGruppi, ";");
|
||||
|
||||
while (tokens.hasMoreTokens()) {
|
||||
String token = (String) tokens.nextElement();
|
||||
if ( (token.length() <= 12)) {
|
||||
v.addElement(token);
|
||||
}
|
||||
}
|
||||
gruppi = new String[v.size()];
|
||||
gruppi = (String[]) v.toArray(gruppi);
|
||||
}
|
||||
|
||||
protected String getCodiceGruppo() {
|
||||
int i = rand.nextInt(gruppi.length);
|
||||
return gruppi[i];
|
||||
}
|
||||
|
||||
protected String getOT() {
|
||||
int i = rand.nextInt(ots.length);
|
||||
return ots[i];
|
||||
}
|
||||
|
||||
protected void incrementaIndiceRichieste() {
|
||||
index++;
|
||||
}
|
||||
|
||||
public void savePhoneSeed() {
|
||||
//SimConfFile.getInstance().WriteInteger("General","Seed",index);
|
||||
SimConfFile.getInstance().WriteString("General", "Seed", getTelefono());
|
||||
SimConfFile.getInstance().UpdateFile();
|
||||
}
|
||||
|
||||
public void setCodice_dealer(String codice_dealer) {
|
||||
this.codice_dealer = codice_dealer;
|
||||
}
|
||||
|
||||
public String getCodice_dealer() {
|
||||
return codice_dealer;
|
||||
}
|
||||
|
||||
public String getCod_profilo_tariffario() {
|
||||
return cod_profilo_tariffario;
|
||||
}
|
||||
|
||||
public void setCod_profilo_tariffario(String cod_profilo_tariffario) {
|
||||
this.cod_profilo_tariffario = cod_profilo_tariffario;
|
||||
}
|
||||
|
||||
public String getDesc_profilo_tariffario() {
|
||||
return desc_profilo_tariffario;
|
||||
}
|
||||
|
||||
public void setDesc_profilo_tariffario(String desc_profilo_tariffario) {
|
||||
this.desc_profilo_tariffario = desc_profilo_tariffario;
|
||||
}
|
||||
|
||||
public String getCodiceComune() {
|
||||
return "86170";
|
||||
}
|
||||
|
||||
public String getDenominazioneSociale() {
|
||||
return "Denominazione Sociale";
|
||||
}
|
||||
|
||||
public String randomLocalita() {
|
||||
int i = rand.nextInt(10);
|
||||
return listaLocalita[i];
|
||||
}
|
||||
|
||||
public String randomNumeroCivico() {
|
||||
int i = rand.nextInt(200);
|
||||
return String.valueOf(i);
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return "NOTE";
|
||||
}
|
||||
|
||||
public String getVia() {
|
||||
return "Via Indirizzo";
|
||||
}
|
||||
|
||||
protected String randomTelefono(int prefissoLength) {
|
||||
String telefono = "";
|
||||
for (int i = 0; i < 10-prefissoLength; i++) {
|
||||
int num = rand.nextInt(9);
|
||||
telefono += num;
|
||||
}
|
||||
return telefono;
|
||||
}
|
||||
|
||||
/**
|
||||
* ritorna un elemento casuale della list
|
||||
*
|
||||
* @param list List
|
||||
* @return Elemento casuale della lista
|
||||
*/
|
||||
protected Object randomElementByList(List list) {
|
||||
return list.get(rand.nextInt(list.size()));
|
||||
}
|
||||
/**
|
||||
* Setta il tipoOperazione passato dall'esterno per la generazione
|
||||
* di una richiesta MSP Extension
|
||||
* @param codOrd String
|
||||
*/
|
||||
public void setTipoOperazioneMspExtension(String tipoOperazione){
|
||||
this.tipoOperazione=tipoOperazione;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setta il tipoOperazione passato dall'esterno per la generazione
|
||||
* di una richiesta MSP MTV
|
||||
* @param codOrd String
|
||||
*/
|
||||
public void setTipoOperazione(String tipoOperazione){
|
||||
this.tipoOperazione=tipoOperazione;
|
||||
}
|
||||
|
||||
/**
|
||||
* ritorna il tipoOperazione per la generazione
|
||||
* di una richiesta MSP Extension
|
||||
* @param codOrd String
|
||||
*/
|
||||
public String getTipoOperazioneMspExtension(){
|
||||
return this.tipoOperazione;
|
||||
}
|
||||
|
||||
/**
|
||||
* ritorna il tipoOperazione per la generazione
|
||||
* di una richiesta MSP MTV
|
||||
* @param codOrd String
|
||||
*/
|
||||
public String getTipoOperazione(){
|
||||
return this.tipoOperazione;
|
||||
}
|
||||
|
||||
protected String getCodiceOrdineMspExtension(){
|
||||
return "123CodicOrdi456";
|
||||
|
||||
}
|
||||
|
||||
public String getFlagTC() {
|
||||
return flagTC;
|
||||
}
|
||||
|
||||
public void setFlagTC(String flagTC) {
|
||||
this.flagTC = flagTC;
|
||||
}
|
||||
|
||||
public String getIdContratto() {
|
||||
return idContratto;
|
||||
}
|
||||
|
||||
public void setIdContratto(String idContratto) {
|
||||
this.idContratto = idContratto;
|
||||
}
|
||||
|
||||
protected String getFlagFurto() {
|
||||
return flagFurto;
|
||||
}
|
||||
|
||||
public void setFlagFurto(String flagFurto) {
|
||||
this.flagFurto = flagFurto;
|
||||
}
|
||||
|
||||
public String getFlagPrevalidazione() {
|
||||
return flagPrevalidazione;
|
||||
}
|
||||
|
||||
public void setFlagPrevalidazione(String flagPrevalidazione) {
|
||||
this.flagPrevalidazione = flagPrevalidazione;
|
||||
}
|
||||
|
||||
public String getProgettoAdHoc() {
|
||||
return progettoAdHoc;
|
||||
}
|
||||
|
||||
public void setProgettoAdHoc(String progettoAdHoc) {
|
||||
this.progettoAdHoc = progettoAdHoc;
|
||||
}
|
||||
|
||||
public String getCodGruppo() {
|
||||
return codGruppo;
|
||||
}
|
||||
|
||||
public void setCodGruppo(String codGruppo) {
|
||||
this.codGruppo = codGruppo;
|
||||
}
|
||||
|
||||
protected String getMsisdnParliSubito() {
|
||||
return msisdnParliSubito;
|
||||
}
|
||||
|
||||
public void setMsisdnParliSubito(String msisdnParliSubito) {
|
||||
this.msisdnParliSubito = msisdnParliSubito;
|
||||
}
|
||||
|
||||
}
|
||||
28
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/SimLogger.java
Normal file
28
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/base/SimLogger.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package base;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class SimLogger {
|
||||
|
||||
final static int MAX_OUTPUT_LINE_LENGTH = 400;
|
||||
//----------------------------------------------------------------------------
|
||||
// Utility Methods
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
public static void log(String message) {
|
||||
if (message == null) {
|
||||
System.out.println("-- null");
|
||||
return ;
|
||||
}
|
||||
if (message.length() > MAX_OUTPUT_LINE_LENGTH) {
|
||||
System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) + " ...");
|
||||
}
|
||||
else {
|
||||
System.out.println("-- " + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package client;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mnp.objects.TipoFile;
|
||||
import xml.XMLAcknowledgeGenerator;
|
||||
import xml.XMLAttivazioneGenerator;
|
||||
import xml.XMLCessazioneGenerator;
|
||||
import xml.XMLEspletamentoGenerator;
|
||||
import xml.XMLPortingGenerator;
|
||||
import xml.XMLPresaincaricoGenerator;
|
||||
import xml.XMLProgettoAdHocGenerator;
|
||||
import xml.XMLSbloccoCreditoAnomaloGenerator;
|
||||
import xml.XMLSbloccoImportoGenerator;
|
||||
import xml.XMLTrasferimentoCreditoGenerator;
|
||||
import xml.XMLValidazioneGenerator;
|
||||
import base.FileGenerator;
|
||||
import base.ProtectionManager;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ClientAOMGenerator {
|
||||
|
||||
public ClientAOMGenerator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il file definito dai parametri di input
|
||||
* @param argv String[]
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean generate(String[] argv) throws Exception {
|
||||
boolean val = false;
|
||||
String testId = argv[0];
|
||||
int tipo_file = Integer.parseInt(argv[1]);
|
||||
|
||||
Vector params = new Vector();
|
||||
|
||||
FileGenerator generator = null;
|
||||
switch (tipo_file) {
|
||||
case TipoFile.ATTIVAZIONE:
|
||||
params.add(argv[2]); // numero di file XML da generare file: <=100
|
||||
params.add(argv[3]); // numero di richieste per file: <=30
|
||||
params.add(argv[4]); // Codice operatore Recipient: OPIV, WIND, H3GI, MISTO
|
||||
params.add(argv[5]); // Contratto: PRP, POP, MISTO
|
||||
params.add(argv[6]); // Codice operatore Donating: TIMG, TIMT, MISTO
|
||||
params.add(argv[7]); // Codice Analogico Digitale: A, D, MISTO
|
||||
params.add(argv[8]); // Indica se il file deve contenere richieste duplicate: DUP, NODUP
|
||||
params.add(argv[9]); // Codice operatore Donating virtuale: uno dei codici virtuali della tabella mnp_anagrafica_operatori
|
||||
params.add(argv[10]); // Codice operatore Recipient virtuale: uno dei codici virtuali della tabella mnp_anagrafica_operatori
|
||||
params.add(argv[11]); // Flag trasferimento credito: Y,N
|
||||
params.add(argv[12]); //Flag prevalidazione Y, N
|
||||
params.add(argv[13]); //Flag furto Y, N
|
||||
params.add(argv[14]); //addizionale1
|
||||
if (argv.length > 15) {
|
||||
params.add(argv[15]); //tipo utenza (opzionale)
|
||||
}
|
||||
|
||||
generator = new XMLAttivazioneGenerator(testId);
|
||||
break;
|
||||
case TipoFile.ATTIVAZIONE_HOC:
|
||||
params.add(argv[2]); // numero di file XML da generare file: <=100
|
||||
params.add(argv[3]); // numero di richieste per file: <=30
|
||||
params.add(argv[4]); // Codice operatore Recipient: OPIV, WIND, H3GI, MISTO
|
||||
params.add(argv[5]); // Contratto: PRP, POP, MISTO
|
||||
params.add(argv[6]); // Codice operatore Donating: TIMG, TIMT, MISTO
|
||||
params.add(argv[7]); // Codice Analogico Digitale: A, D, MISTO
|
||||
params.add(argv[8]); // Elenco Codici Gruppo: cod1;cod2; ...;codn
|
||||
params.add(argv[9]); // donor virtuale
|
||||
params.add(argv[10]); // recipient virtuale
|
||||
params.add(argv[11]); // flag trasferimento credito Y,N
|
||||
params.add(argv[12]); //Flag prevalidazione Y, N, NULL
|
||||
params.add(argv[13]); //Flag furto Y, N, NULL
|
||||
|
||||
generator = new XMLProgettoAdHocGenerator(testId);
|
||||
break;
|
||||
case TipoFile.PRESAINCARICO:
|
||||
params.add(argv[2]); // Stato richiesta notifica: 3,6,7,8,9
|
||||
params.add(argv[3]); // Indica se il file <20> relativo a prj hoc: PROGETTI_HOC,NO_PROGETTO_HOC
|
||||
|
||||
generator = new XMLPresaincaricoGenerator(testId);
|
||||
break;
|
||||
case TipoFile.VALIDAZIONE:
|
||||
params.add(argv[2]); // Stato richiesta notifica: 0,1,2,10
|
||||
params.add(argv[3]); // 0 se Stato Richiesta Notifica=0 oppure 10,
|
||||
//(1-10,13-14) se Stato Richiesta Notifica=1,
|
||||
//(11-12) se Stato Richiesta Notifica=2
|
||||
|
||||
generator = new XMLValidazioneGenerator(testId);
|
||||
break;
|
||||
case TipoFile.ESPLETAMENTO:
|
||||
params.add(argv[2]); // Stato richiesta notifica: 4,5
|
||||
params.add(argv[3]); // tipo di processo
|
||||
generator = new XMLEspletamentoGenerator(testId);
|
||||
break;
|
||||
case TipoFile.PORTING:
|
||||
params.add(argv[2]); // numero di file XML da generare file: <=100
|
||||
params.add(argv[3]); // numero di richieste per file: <=30
|
||||
params.add(argv[4]); // Codice operatore Recipient: OPIV, WIND, H3GI
|
||||
params.add(argv[5]); // Codice operatore Donating: OPIV, WIND, H3GI
|
||||
params.add(argv[6]); // Data cut over: DATA_CUT_OVER_OGGI, DATA_CUT_OVER_MINORE_OGGI
|
||||
params.add(argv[7]); // Codice operatore Donating virtuale: uno dei codici virtuali della tabella mnp_anagrafica_operatori
|
||||
params.add(argv[8]); // Codice operatore Recipient virtuale: uno dei codici virtuali della tabella mnp_anagrafica_operatori
|
||||
params.add(argv[9]); // flag tc
|
||||
generator = new XMLPortingGenerator(testId);
|
||||
break;
|
||||
case TipoFile.CESSAZIONE:
|
||||
params.add(argv[2]); // numero di file XML da generare file: <=100
|
||||
params.add(argv[3]); // numero di richieste per file: <=30
|
||||
params.add(argv[4]); // Codice operatore Recipient: OPIV, WIND, H3GI
|
||||
params.add(argv[5]); // Tipo numerazione: EX_TIM, NON_EX_TIM
|
||||
params.add(argv[6]); // Codice operatore Recipient virtuale: uno dei codici virtuali della tabella mnp_anagrafica_operatori
|
||||
generator = new XMLCessazioneGenerator(testId);
|
||||
break;
|
||||
case TipoFile.ACK:
|
||||
params.add(argv[2]); // Risultato: OK, KO
|
||||
generator = new XMLAcknowledgeGenerator(testId);
|
||||
break;
|
||||
case TipoFile.TRASFERIMENTOCREDITO: // trasferimento credito
|
||||
params.add(argv[2]); // CODICE OPERATORE DONATING
|
||||
params.add(argv[3]); // CREDITO IMPORTO
|
||||
params.add(argv[4]); // FLAG CREDITO ANOMALO
|
||||
generator = new XMLTrasferimentoCreditoGenerator(testId);
|
||||
break;
|
||||
case TipoFile.SBLOCCOIMPORTO:
|
||||
params.add(argv[2]); // CODICE OPERATORE DONATING
|
||||
params.add(argv[3]); // CREDITO IMPORTO
|
||||
generator = new XMLSbloccoImportoGenerator(testId);
|
||||
break;
|
||||
case TipoFile.SBLOCCOCREDITOANOMALO:
|
||||
params.add(argv[2]); // CODICE OPERATORE DONATING
|
||||
params.add(argv[3]); // CREDITO IMPORTO
|
||||
generator = new XMLSbloccoCreditoAnomaloGenerator(testId);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("[ ERRORE ] Parametri di lancio errati");
|
||||
}
|
||||
//generator.setTestId(testId);
|
||||
generator.generateFiles(params);
|
||||
generator.savePhoneSeed();
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main
|
||||
* @param argv String[]
|
||||
*/
|
||||
static public void main(String[] argv) {
|
||||
|
||||
ProtectionManager.check();
|
||||
ClientAOMGenerator clientGen = new ClientAOMGenerator();
|
||||
try {
|
||||
clientGen.generate(argv);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package client;
|
||||
|
||||
import xml.*;
|
||||
import mnp.objects.*;
|
||||
import simFlatFile.*;
|
||||
import base.ProtectionManager;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ClientAOMSender {
|
||||
public ClientAOMSender() {
|
||||
}
|
||||
|
||||
private void send(String[] argv) throws Exception {
|
||||
String testId = argv[0];
|
||||
int tipoFile = Integer.parseInt(argv[1]);
|
||||
switch (tipoFile) {
|
||||
case TipoFile.ATTIVAZIONE:
|
||||
case TipoFile.ATTIVAZIONE_HOC:
|
||||
case TipoFile.PRESAINCARICO:
|
||||
case TipoFile.VALIDAZIONE:
|
||||
case TipoFile.ESPLETAMENTO:
|
||||
case TipoFile.PORTING:
|
||||
case TipoFile.CESSAZIONE:
|
||||
case TipoFile.ACK:
|
||||
case TipoFile.TRASFERIMENTOCREDITO:
|
||||
case TipoFile.SBLOCCOIMPORTO:
|
||||
case TipoFile.SBLOCCOCREDITOANOMALO:
|
||||
XMLSender xmlSender = new XMLSender();
|
||||
xmlSender.sendXML(testId, tipoFile);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static public void main(String[] argv) {
|
||||
ProtectionManager.check();
|
||||
|
||||
ClientAOMSender clientSend = new ClientAOMSender();
|
||||
try {
|
||||
clientSend.send(argv);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
106
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientDBSS.java
Normal file
106
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientDBSS.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package client;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import conf.SimConfFile;
|
||||
import it.telecomitalia.soa.soap.soapheader.HeaderType;
|
||||
import dbcmnp.soa.mobilenumberportabilitymgmt.x20150511.PortInRequest;
|
||||
|
||||
import it.telecomitalia.soa.soap.soapheader.InteractionDateType;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmt10;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmt10_Impl;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmtPortType;
|
||||
import mnp.utility.UUIDHelper;
|
||||
|
||||
import javax.xml.rpc.Stub;
|
||||
|
||||
public class ClientDBSS {
|
||||
|
||||
private static final String SourceSystem = "DBSS-COM";
|
||||
private static final int defaultTimeout = 30000;
|
||||
private static final String dateFormat = "yyyy-MM-dd";
|
||||
private static final String timeFormat = "HH:mm:ss";
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
try {
|
||||
|
||||
if (args.length != 8) {
|
||||
throw new IllegalArgumentException("Errore nei parametri");
|
||||
}
|
||||
|
||||
Properties p = new Properties();
|
||||
|
||||
p.setProperty("tipo_spedizione", "01");
|
||||
|
||||
String num_richieste = args[0];
|
||||
p.setProperty("num_richieste", num_richieste);
|
||||
|
||||
String pre_postpagato = args[1]; //Pre post pagato, PRP,POP
|
||||
p.setProperty("pre_postpagato", pre_postpagato);
|
||||
|
||||
String iccid = args[2];
|
||||
if (!"NULL".equalsIgnoreCase(args[2])) {
|
||||
p.setProperty("iccid", iccid);
|
||||
}
|
||||
|
||||
String flag_furto = args[3];
|
||||
p.setProperty("flag_furto", flag_furto);
|
||||
|
||||
String msisdn_parli_subito = args[4];
|
||||
p.setProperty("msisdn_parli_subito", msisdn_parli_subito);
|
||||
|
||||
String operatore = args[5];
|
||||
p.setProperty("operatore", operatore);
|
||||
|
||||
String segment_category = args[6];
|
||||
p.setProperty("segment_category", segment_category);
|
||||
|
||||
String codice_dealer = args[7];
|
||||
if (!"NULL".equalsIgnoreCase(codice_dealer)) {
|
||||
p.setProperty("codice_dealer", codice_dealer);
|
||||
}
|
||||
|
||||
int numRic = Integer.parseInt(num_richieste);
|
||||
PortInRequest[] tracciati = new ClientDBSSGenerator().generate(numRic, p);
|
||||
|
||||
HeaderType header = new HeaderType();
|
||||
|
||||
if (tracciati == null || tracciati.length == 0) {
|
||||
System.out.println("Nessun tracciato recuperato");
|
||||
return;
|
||||
}
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("DBSS");
|
||||
String url = properties.getProperty("dbssWsUrl");
|
||||
MobileNumberPortabilityMgmt10 service = new MobileNumberPortabilityMgmt10_Impl();
|
||||
MobileNumberPortabilityMgmtPortType port = service.getMobileNumberPortabilityMgmt();
|
||||
|
||||
((Stub)port)._setProperty("javax.xml.rpc.service.endpoint.address", url);
|
||||
|
||||
((Stub)port)._setProperty("weblogic.wsee.transport.connection.timeout",defaultTimeout);
|
||||
|
||||
header.setSourceSystem(SourceSystem);
|
||||
|
||||
for (PortInRequest aTracciati : tracciati) {
|
||||
Date date = new Date();
|
||||
String d = new SimpleDateFormat(dateFormat).format(date);
|
||||
String t = new SimpleDateFormat(timeFormat).format(date);
|
||||
InteractionDateType intDate = new InteractionDateType();
|
||||
intDate.setDate(d);
|
||||
intDate.setTime(t);
|
||||
header.setInteractionDate(intDate);
|
||||
|
||||
header.setBusinessID(UUIDHelper.generateBusinessID());
|
||||
header.setMessageID(UUIDHelper.generateBusinessID());
|
||||
header.setTransactionID(UUIDHelper.generateBusinessID());
|
||||
|
||||
port.portIn(header, aTracciati);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
System.out.println("ClientDBSS failed ex: " + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package client;
|
||||
|
||||
import conf.CanaleVenditaBit;
|
||||
import conf.ProfiliTariffari;
|
||||
import base.SimGenerator;
|
||||
import dbcmnp.soa.mobilenumberportabilitymgmt.x20150511.*;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ClientDBSSGenerator extends SimGenerator {
|
||||
|
||||
public final static String blanks =
|
||||
" ";
|
||||
public String data_richiesta_format_string ="yyyy-MM-dd";
|
||||
public SimpleDateFormat data_richiesta_format =new SimpleDateFormat(data_richiesta_format_string);
|
||||
public String data_invio_richiesta_format_string ="yyyy-MM-dd";
|
||||
public SimpleDateFormat data_invio_richiesta_format =new SimpleDateFormat(data_invio_richiesta_format_string);
|
||||
|
||||
|
||||
public PortInRequest[] generate(int n, Properties p) {
|
||||
log("Testing ClientDBSSGenerator n: " + n);
|
||||
PortInRequest[] tracciati = new PortInRequest[n];
|
||||
|
||||
cutover_date_format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
ProfiliTariffari.nextProfiloTariffario("BIT");
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
PortInRequest req = new PortInRequest();
|
||||
|
||||
req.setTIPO_SPEDIZIONE(TipoSpedizioneTYPE.fromString(p.getProperty("tipo_spedizione")));
|
||||
|
||||
String prePostPagato = p.getProperty("pre_postpagato");
|
||||
req.setCOD_PRE_POST(CodPrePostTYPE.fromString(prePostPagato));
|
||||
|
||||
String op = p.getProperty("operatore");
|
||||
if (op == null || op.equalsIgnoreCase("NULL")) {
|
||||
req.setDONATING_COD_OP(getCodiceOperatoreOLO(1, n));
|
||||
}
|
||||
else {
|
||||
req.setDONATING_COD_OP(p.getProperty("operatore"));
|
||||
}
|
||||
|
||||
req.setICC_ID_OLO(p.getProperty("iccid"));
|
||||
|
||||
req.setCOD_SERVICE_ORDER(getCodiceServiceOrder());
|
||||
req.setASSET_USES(getAssetUses());
|
||||
req.setORDER_ITEM_ID( getRandomString(30, false) );
|
||||
|
||||
req.setMSISDN_PARLI_SUBITO(p.getProperty("msisdn_parli_subito"));
|
||||
|
||||
String prefisso =randomPrefisso();
|
||||
String telefono =getTelefono();
|
||||
|
||||
req.setSIMBA_PREFISSO_TIM(prefisso);
|
||||
req.setSIMBA_NUMERO_TIM(telefono);
|
||||
req.setSIMBA_PREFISSO_OLO("39"+prefisso);
|
||||
req.setSIMBA_NUMERO_OLO(telefono);
|
||||
|
||||
String flagFurtoStr = p.getProperty("flag_furto");
|
||||
FlagTYPE flagFurto = FlagTYPE.fromString(flagFurtoStr);
|
||||
req.setFLAG_FURTO(flagFurto);
|
||||
|
||||
if ("PRP".equals(prePostPagato) && "N".equals(flagFurtoStr)) {
|
||||
String iccid = p.getProperty("iccid");
|
||||
if (iccid == null || iccid.equalsIgnoreCase("NULL")) {
|
||||
throw new IllegalArgumentException("Errore nei parametri: icc_id_olo obbligatorio se cod_pre_prost = PRP e flag_furto = N");
|
||||
}
|
||||
}
|
||||
|
||||
if ("POP".equalsIgnoreCase(prePostPagato)) {
|
||||
req.setCOD_FIS_CLI_OLO(getCodiceFiscalePartitaIVA());
|
||||
}
|
||||
|
||||
String segmentCategory = p.getProperty("segment_category");
|
||||
if (!"CO".equals(segmentCategory) && !"BU".equals(segmentCategory)) {
|
||||
throw new IllegalArgumentException("Errore nei parametri: segment_category deve avere valore = BU o CO");
|
||||
}
|
||||
req.setSEGMENT_CATEGORY(SegmentCategoryTYPE.fromString(segmentCategory));
|
||||
|
||||
String codiceDealer = p.getProperty("codice_dealer");
|
||||
|
||||
if (codiceDealer != null) {
|
||||
req.setCODICE_DEALER(codiceDealer);
|
||||
}
|
||||
|
||||
req.setTIPO_DOC_IDENTITA(TipoDocumentoTYPE.fromString(getTipoDocumento()));
|
||||
req.setNUM_DOC_IDENTITA(getNumeroDocumento());
|
||||
req.setDATA_RICHIESTA(data_richiesta_format.format(new Date()));
|
||||
req.setCOD_CONTRATTO(getCodiceGruppo());
|
||||
req.setOT_COD(getOT());
|
||||
|
||||
//setto nome e cognome oppure denominazione in modo casuale con pari probabilita'
|
||||
String nome = randomNomeCliente();
|
||||
if (Math.random() * 100 > 0.5) {
|
||||
req.setNOME_CLIENTE_PF(nome);
|
||||
req.setCOGNOME_CLIENTE_PF(randomCognomeCliente());
|
||||
req.setCLIENTE_INTESTATARIO_ID(nome + " " + req.getCOGNOME_CLIENTE_PF());
|
||||
}
|
||||
else {
|
||||
req.setDENOMINAZIONE_PG(nome + " S.P.A.");
|
||||
req.setCLIENTE_INTESTATARIO_ID(nome + " S.P.A." );
|
||||
}
|
||||
|
||||
req.setDATA_CUT_OVER(getDataCutover());
|
||||
req.setSIMBA_IMSI_TIM(getImsi());
|
||||
req.setDATA_RICHIESTA(data_invio_richiesta_format.format(new Date()));
|
||||
|
||||
req.setREQUEST_ID(getRandomString(12, false));
|
||||
|
||||
req.setDATA_EFF_VALIDAZIONE(data_invio_richiesta_format.format(new Date()));
|
||||
req.setCODOFFERTA(ProfiliTariffari.getCodiceOfferta());
|
||||
req.setDESOFFERTA(ProfiliTariffari.getDescrizioneOfferta());
|
||||
req.setIDACCORDO(ProfiliTariffari.getCodiceAccordo());
|
||||
req.setDENACCORDO(ProfiliTariffari.getDescrizioneAccordo());
|
||||
req.setCODPROFILOTAR(ProfiliTariffari.getCodiceProfilo());
|
||||
req.setDESPROFILOTAR(ProfiliTariffari.getDescrizioneProfilo());
|
||||
|
||||
req.setDESCCANALEVENDITA(CanaleVenditaBit.getNextDescrizioneCanaleVendita());
|
||||
|
||||
String flagRiaccrStr = "Y";
|
||||
if (Math.random() * 100 > 0.5) {
|
||||
flagRiaccrStr = "N";
|
||||
}
|
||||
|
||||
FlagTYPE flagRiaccredito = FlagTYPE.fromString(flagRiaccrStr);
|
||||
req.setFLAG_RIACCREDITO(flagRiaccredito);
|
||||
|
||||
tracciati[i] = req;
|
||||
}
|
||||
log("Testing ClientDBSSGenerator end ");
|
||||
return tracciati;
|
||||
|
||||
}
|
||||
|
||||
static String getRandomString(int length, boolean lowerCase){
|
||||
Random rand = new Random();
|
||||
StringBuffer tempStr = new StringBuffer();
|
||||
tempStr.append("");
|
||||
for (int i = 0; i < length; i++) {
|
||||
int c = rand.nextInt(122 - 48) + 48;
|
||||
if((c >= 58 && c <= 64) || (c >= 91 && c <= 96)){
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
tempStr.append((char)c);
|
||||
}
|
||||
return lowerCase ? tempStr.toString().toLowerCase() : tempStr.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
118
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientDBSSTFC.java
Normal file
118
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientDBSSTFC.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package client;
|
||||
|
||||
import conf.SimConfFile;
|
||||
import dbcmnp.soa.mobilenumberportabilitymgmt.x20150511.PortOutCreditRequest;
|
||||
import dbcmnp.soa.mobilenumberportabilitymgmt.x20150511.TipoEventoTYPE;
|
||||
|
||||
import it.telecomitalia.soa.soap.soapheader.HeaderType;
|
||||
import it.telecomitalia.soa.soap.soapheader.InteractionDateType;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmt10;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmt10_Impl;
|
||||
import it.valueteam.mnp.ws.dbss.client.MobileNumberPortabilityMgmtPortType;
|
||||
import mnp.utility.UUIDHelper;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.xml.rpc.Stub;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
public class ClientDBSSTFC {
|
||||
|
||||
private static final int NUM_PAR = 4;
|
||||
private static final String SOURCE_SYSTEM = "DBSS-COM";
|
||||
private static final int DEFAULT_TIMEOUT = 30000;
|
||||
private static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
private static final String TIME_FORMAT = "HH:mm:ss";
|
||||
private static final String CREDITO_PATTERN = "[0-9]{1,5}.[0-9]{2}";
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
try {
|
||||
|
||||
if (args.length != NUM_PAR) {
|
||||
throw new IllegalArgumentException("Errore nei parametri");
|
||||
}
|
||||
|
||||
String idRIchiesta = args[0];
|
||||
String orderItemId = args[1];
|
||||
String importoCreditoResiduo = args[2];
|
||||
String tipoEvento = args[3];
|
||||
|
||||
if (idRIchiesta.length() > 23) {
|
||||
System.out.println("ClientDBSSTFC: id richiesta - lunghezza errata");
|
||||
return;
|
||||
}
|
||||
|
||||
if (orderItemId.length() > 30) {
|
||||
System.out.println("ClientDBSSTFC: order item id - lunghezza errata");
|
||||
return;
|
||||
}
|
||||
|
||||
Pattern r = Pattern.compile(CREDITO_PATTERN);
|
||||
Matcher m = r.matcher(importoCreditoResiduo);
|
||||
if (!m.find()) {
|
||||
System.out.println("ClientDBSSTFC: credito residuo - formato errato");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"01".equals(tipoEvento) && !"03".equals(tipoEvento)) {
|
||||
System.out.println("ClientDBSSTFC: tipo evento - valore errato");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("01".equals(tipoEvento) && !"NULL".equals(orderItemId)) {
|
||||
System.out.println("ClientDBSSTFC: order item deve essere NULL per tipo evento = 01");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("03".equals(tipoEvento) && "NULL".equals(orderItemId)) {
|
||||
System.out.println("ClientDBSSTFC: order item non puo' essere NULL per tipo evento = 03");
|
||||
return;
|
||||
}
|
||||
|
||||
if (orderItemId.equals("NULL")) {
|
||||
orderItemId = ClientDBSSGenerator.getRandomString(30, false);
|
||||
}
|
||||
|
||||
PortOutCreditRequest reqBody = new PortOutCreditRequest();
|
||||
reqBody.setIMPORTO_CREDITO_RESIDUO(importoCreditoResiduo);
|
||||
reqBody.setTIPO_EVENTO(TipoEventoTYPE.fromString(tipoEvento));
|
||||
reqBody.setID_RICHIESTA_DBC(idRIchiesta);
|
||||
reqBody.setORDER_ITEM_ID(orderItemId);
|
||||
|
||||
HeaderType reqHeader = new HeaderType();
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("DBSS");
|
||||
String url = properties.getProperty("dbssWsUrl");
|
||||
MobileNumberPortabilityMgmt10 service = new MobileNumberPortabilityMgmt10_Impl();
|
||||
MobileNumberPortabilityMgmtPortType port = service.getMobileNumberPortabilityMgmt();
|
||||
|
||||
((Stub) port)._setProperty("javax.xml.rpc.service.endpoint.address", url);
|
||||
|
||||
((Stub) port)._setProperty("weblogic.wsee.transport.connection.timeout", DEFAULT_TIMEOUT);
|
||||
|
||||
reqHeader.setSourceSystem(SOURCE_SYSTEM);
|
||||
|
||||
Date date = new Date();
|
||||
String d = new SimpleDateFormat(DATE_FORMAT).format(date);
|
||||
String t = new SimpleDateFormat(TIME_FORMAT).format(date);
|
||||
InteractionDateType intDate = new InteractionDateType();
|
||||
intDate.setDate(d);
|
||||
intDate.setTime(t);
|
||||
reqHeader.setInteractionDate(intDate);
|
||||
|
||||
reqHeader.setBusinessID(UUIDHelper.generateBusinessID());
|
||||
reqHeader.setMessageID(UUIDHelper.generateBusinessID());
|
||||
reqHeader.setTransactionID(UUIDHelper.generateBusinessID());
|
||||
|
||||
port.portOutCredit(reqHeader, reqBody);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
System.out.println("ClientDBSSTFC failed ex: " + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package client;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import mnp.objects.TipoFlusso;
|
||||
import simFlatFile.MSSFileGenerator;
|
||||
import base.FileGenerator;
|
||||
import base.ProtectionManager;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ClientFlatGenerator {
|
||||
|
||||
public ClientFlatGenerator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il file definito dai parametri di input
|
||||
* @param argv String[]
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean generate(String[] argv) throws Exception {
|
||||
boolean val = false;
|
||||
String testId = argv[0];
|
||||
int tipo_file = Integer.parseInt(argv[1]);
|
||||
|
||||
Vector params = new Vector();
|
||||
|
||||
FileGenerator generator = null;
|
||||
switch (tipo_file) {
|
||||
case TipoFlusso.MSS_CESSAZIONE_IN:
|
||||
params.add(argv[2]); // Processo: DONOR, RECIPIENT, PORTING, CESSAZIONE, CESSAZIONE_PORTING, ANNULLAMNETO_CESS_PORT
|
||||
params.add(argv[3]); // Tipo Record
|
||||
params.add(argv[4]); // Tipo utenza: TIM, NOTIM, DEFAULT
|
||||
params.add(argv[5]); // Num richieste
|
||||
generator = new MSSFileGenerator(testId);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("[ ERRORE ] Parametri di lancio errati");
|
||||
}
|
||||
//generator.setTestId(testId);
|
||||
generator.generateFiles(params);
|
||||
generator.savePhoneSeed();
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main
|
||||
* @param argv String[]
|
||||
*/
|
||||
static public void main(String[] argv) {
|
||||
ProtectionManager.check();
|
||||
ClientFlatGenerator clientGen = new ClientFlatGenerator();
|
||||
try {
|
||||
clientGen.generate(argv);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package client;
|
||||
|
||||
import mnp.objects.TipoFlusso;
|
||||
import simFlatFile.FileFlatSender;
|
||||
import base.ProtectionManager;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ClientFlatSender {
|
||||
public ClientFlatSender() {
|
||||
}
|
||||
|
||||
private void send(String[] argv) throws Exception {
|
||||
String testId = argv[0];
|
||||
int tipoFile = Integer.parseInt(argv[1]);
|
||||
switch (tipoFile) {
|
||||
case TipoFlusso.MSS_CESSAZIONE_IN:
|
||||
FileFlatSender fileSender = new FileFlatSender();
|
||||
fileSender.sendFlatFile(testId, tipoFile, argv[2]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static public void main(String[] argv) {
|
||||
ProtectionManager.check();
|
||||
|
||||
ClientFlatSender clientSend = new ClientFlatSender();
|
||||
try {
|
||||
clientSend.send(argv);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package client;
|
||||
|
||||
//import simFlatFile.HZPitagoraFileGenerator;
|
||||
import obj.StatoMap;
|
||||
import base.ProtectionManager;
|
||||
|
||||
public class ClientHZSender {
|
||||
|
||||
public ClientHZSender() {
|
||||
}
|
||||
|
||||
public static final void main(String[] args) {
|
||||
ProtectionManager.check();
|
||||
System.out.println("INIZIO GENERAZIONE FLUSSO PITAGORA");
|
||||
if (args.length != 8 && args.length != 3)
|
||||
throw new IllegalArgumentException("Numero parametri errato!");
|
||||
|
||||
if (args.length == 8){
|
||||
for (int i = 0; i < args.length; i++){
|
||||
if ("null".equalsIgnoreCase(args[i]))
|
||||
args[i] = null;
|
||||
}
|
||||
|
||||
if (!StatoMap.validateStato(args))
|
||||
throw new IllegalArgumentException("parametri errati!");
|
||||
|
||||
if (!StatoMap.validateEsito(args))
|
||||
throw new IllegalArgumentException("parametri errati!");
|
||||
|
||||
if (!StatoMap.validateStatoEsito(args))
|
||||
throw new IllegalArgumentException("parametri errati!");
|
||||
|
||||
//todo da sostituire con FENP
|
||||
//HZPitagoraFileGenerator fileGenerator = new HZPitagoraFileGenerator();
|
||||
System.out.println("MAIN: GENERO FILE");
|
||||
// try {
|
||||
// fileGenerator.generateFile(args);
|
||||
// }
|
||||
// catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
System.out.println("FINE GENERAZIONE FLUSSO PITAGORA");
|
||||
}else if (args.length == 3){
|
||||
//todo da sostituire con FENP
|
||||
//HZPitagoraFileGenerator fileGenerator = new HZPitagoraFileGenerator();
|
||||
// System.out.println("MAIN: GENERO FLUSSO PITAGORA DI CESSAZIONE PER PASSAGGIO ALTRO OLO");
|
||||
// try {
|
||||
// fileGenerator.generateFileCessPerPassaggioAltroOlo(args);
|
||||
// }
|
||||
// catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
System.out.println("FINE GENERAZIONE FLUSSO PITAGORA DI CESSAZIONE PER PASSAGGIO ALTRO OLO");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package client;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
import obj.TipoFlusso;
|
||||
|
||||
import proxy.jms.MessageHandler;
|
||||
import xml.*;
|
||||
import base.ProtectionManager;
|
||||
|
||||
public class ClientIBAsincSender {
|
||||
|
||||
|
||||
private XMLGeneratorIF generator;
|
||||
private String[] tracciati;
|
||||
|
||||
|
||||
public ClientIBAsincSender(XMLGeneratorIF generator) {
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*
|
||||
* ATTIVAZIONE
|
||||
* args[0] tipo flusso: ATTIVAZIONE
|
||||
* args[1] Numero richieste
|
||||
* args[2] Pre post pagato: PRP,POP,MISTO
|
||||
* args[3] DONATING: WIND,OPIV,H3GI,MISTO, TIMG (per RV)
|
||||
* args[4] accodata: ACCODATA, NO_ACCODATA
|
||||
* args[5] prefisso: NULL, prefisso
|
||||
* args[6] telefono: NULL, telefono
|
||||
* args[7] iccid: NULL, iccid
|
||||
*
|
||||
* VALIDAZIONE
|
||||
* args[0] tipo flusso: VALIDAZIONE
|
||||
* args[1] esito: ACCETTATA, RIFIUTATA
|
||||
* args[2] causale: 1,...,13,NULL
|
||||
* args[3] tipo processo: D (donor standard), V (donor virtuale)
|
||||
* args[4] id richiesta: NULL, id richiesta
|
||||
* @throws Exception
|
||||
*
|
||||
* RISPOSTA DI CESSAZIONE/ATTIVAZIONE
|
||||
* (da usare se fallisce la risposta automatica mediante
|
||||
* IBConnector)
|
||||
* args[0] tipo flusso: RISP_CESSAZIONE || RISP_ATTIVAZIONE
|
||||
* args[1] esito: 001||002||003
|
||||
* args[2] tipo processo: D (donor) se [tipo flusso]=RISP_CESSAZIONE,
|
||||
* R(recipient) o W (recipient virtuale) se [tipo flusso]=RISP_ATTIVAZIONE
|
||||
* C cessazione
|
||||
* P Proting terze Parte
|
||||
*
|
||||
*
|
||||
* NOTIFICA DI CESSAZIONE / ATTIVAZIONE
|
||||
* args[0] tipo flusso: NOT_CESSAZIONE || NOT_ATTIVAZIONE
|
||||
* args[1] esito: 081 (Cessazione Rec Virtuale) se args[0] NOT_CESSAZIONE,
|
||||
* 082 (Cessazione Donor Virtuale) se args[0] NOT_CESSAZIONE,
|
||||
* 083 (Attivazione Donor Virtuale) se args[0] NOT_ATTIVAZIONE
|
||||
* args[2] id richiesta: non obbligatoria, se non presente sono
|
||||
* considerate tutte le richieste possibili
|
||||
*
|
||||
*
|
||||
* UPDATE DCO MVNO DONOR Prjhoc
|
||||
* args[0] tipo flusso: UPDATEDCO
|
||||
* args[1] nuova DCO (AAAAMMGG)
|
||||
*/
|
||||
public static void main(String args[]) throws Exception {
|
||||
ProtectionManager.check();
|
||||
ClientIBAsincSender sender=null;
|
||||
if (args.length == 0){
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.ATTIVAZIONE)) {
|
||||
sender = new ClientIBAsincSender(new XMLMvnoPortingInGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.VALIDAZIONE)) {
|
||||
sender = new ClientIBAsincSender(new XMLMvnoValGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.RISP_CESSAZIONE) || args[0].equals(TipoFlusso.RISP_ATTIVAZIONE)) {
|
||||
sender = new ClientIBAsincSender(new XMLGispResponseGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.NOT_CESSAZIONE) || args[0].equals(TipoFlusso.NOT_ATTIVAZIONE)) {
|
||||
sender = new ClientIBAsincSender(new XMLGispNotificationGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.NOTIFICA_MVNO_TC)) {
|
||||
sender = new ClientIBAsincSender(new XMLMvnoNotificaTcGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.NOTIFICA_MSP_TC)) {
|
||||
sender = new ClientIBAsincSender(new XMLNotificaMspTcGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.NOTIFICA_MSPCOOP_TC)) {
|
||||
sender = new ClientIBAsincSender(new XMLNotificaMspCoopTcGenerator());
|
||||
}
|
||||
else if (args[0].equals(TipoFlusso.UPDATEDCO_MVNO)) {
|
||||
sender = new ClientIBAsincSender(new XMLMvnoUpdateDCOGenerator());
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("Tipo Flusso errato: " + args[0]);
|
||||
sender.setTracciati(sender.getGenerator().generateXml(args));
|
||||
String tipoFlusso = args[0];
|
||||
sender.sendXML(tipoFlusso);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void sendXML(String tipoFlusso) throws Exception {
|
||||
|
||||
Map params = MessageHandler.getParams(tipoFlusso);
|
||||
|
||||
if (tracciati.length==0) {
|
||||
System.out.println("Nessun flusso di " +tipoFlusso+ " da inviare");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < tracciati.length; i++) {
|
||||
System.out.println(tracciati[i]);
|
||||
try {
|
||||
MessageHandler.getInstance().sendMessage(tracciati[i],
|
||||
(String) params.get(MessageHandler.QUEUE_NAME),
|
||||
(String) params.get(MessageHandler.ID_SYSTEM),
|
||||
(String) params.get(MessageHandler.ID_SERVICE));
|
||||
this.getGenerator().postGenerate();
|
||||
} catch (JMSException je) {
|
||||
je.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the generator
|
||||
*/
|
||||
public XMLGeneratorIF getGenerator() {
|
||||
return generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tracciati
|
||||
*/
|
||||
public String[] getTracciati() {
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tracciati the tracciati to set
|
||||
*/
|
||||
public void setTracciati(String[] tracciati) {
|
||||
this.tracciati = tracciati;
|
||||
}
|
||||
}
|
||||
116
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBHZSender.java
Normal file
116
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBHZSender.java
Normal file
@@ -0,0 +1,116 @@
|
||||
package client;
|
||||
|
||||
import xml.XMLBitGenerator;
|
||||
import xml.XMLDbcfxGenerator;
|
||||
import xml.XMLGeneratorIF;
|
||||
import xml.XMLGispGenerator;
|
||||
import obj.SystemMap;
|
||||
import xml.XMLCrmcGenerator;
|
||||
import infobus.IBHZClient;
|
||||
import base.ProtectionManager;
|
||||
|
||||
public class ClientIBHZSender {
|
||||
|
||||
private static XMLGeneratorIF generator;
|
||||
|
||||
public ClientIBHZSender() {
|
||||
}
|
||||
|
||||
/**
|
||||
* tipi sistema:
|
||||
* MSC,1
|
||||
* CRMC_FE,2
|
||||
*
|
||||
*/
|
||||
public static final void main(String[] args) {
|
||||
ProtectionManager.check();
|
||||
if(args.length != 8 && args.length != 4)
|
||||
throw new IllegalArgumentException("Numero parametri insufficienti!");
|
||||
try{
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("parametro " + i + ": " + args[i]);
|
||||
if ("null".equalsIgnoreCase(args[i]))
|
||||
args[i] = null;
|
||||
}
|
||||
|
||||
|
||||
int tipoSistema = getTipoSistema(args[0]);
|
||||
String[] argument = new String[args.length-1];
|
||||
System.arraycopy(args,1,argument,0,args.length-1);
|
||||
System.out.println("TIPO SISTEMA: " + tipoSistema + ".. ");
|
||||
switch(tipoSistema){
|
||||
case SystemMap.SISTEMA_MSC:{
|
||||
generator = new XMLCrmcGenerator();
|
||||
String[] xml = generator.generateXml(argument);
|
||||
IBHZClient ibhzClient = new IBHZClient();
|
||||
for (int i=0; i<xml.length; i++) {
|
||||
ibhzClient.sendCRMCRequest(xml[i], SystemMap.SISTEMA_MSC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SystemMap.SISTEMA_CRMC_FE:{
|
||||
generator = new XMLCrmcGenerator();
|
||||
String[] xml = generator.generateXml(argument);
|
||||
IBHZClient ibhzClient = new IBHZClient();
|
||||
for (int i=0; i<xml.length; i++) {
|
||||
ibhzClient.sendCRMCRequest(xml[i], SystemMap.SISTEMA_CRMC_FE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SystemMap.SISTEMA_BIT:{
|
||||
generator = new XMLBitGenerator();
|
||||
String[] xml = generator.generateXml(argument);
|
||||
IBHZClient ibhzClient = new IBHZClient();
|
||||
for (int i=0; i<xml.length; i++) {
|
||||
ibhzClient.sendCRMCRequest(xml[i], SystemMap.SISTEMA_BIT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SystemMap.SISTEMA_GISP:{
|
||||
generator = new XMLGispGenerator();
|
||||
String[] xml = generator.generateXml(argument);
|
||||
IBHZClient ibhzClient = new IBHZClient();
|
||||
for (int i=0; i<xml.length; i++) {
|
||||
ibhzClient.sendCRMCRequest(xml[i], SystemMap.SISTEMA_GISP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SystemMap.SISTEMA_DBCFX:{
|
||||
generator = new XMLDbcfxGenerator();
|
||||
String[] xml = generator.generateXml(argument);
|
||||
IBHZClient ibhzClient = new IBHZClient();
|
||||
for (int i=0; i<xml.length; i++) {
|
||||
ibhzClient.sendCRMCRequest(xml[i], SystemMap.SISTEMA_DBCFX);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalArgumentException("sistema sconociuto!\n Sistema inserito : " +args[0]);
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static int getTipoSistema(String sis){
|
||||
|
||||
int sistema = -1;
|
||||
if(sis.equalsIgnoreCase("MSC"))
|
||||
sistema= SystemMap.SISTEMA_MSC;
|
||||
else
|
||||
if(sis.equalsIgnoreCase("MSP"))
|
||||
sistema= SystemMap.SISTEMA_CRMC_FE;
|
||||
else
|
||||
if(sis.equalsIgnoreCase("BIT"))
|
||||
sistema= SystemMap.SISTEMA_BIT;
|
||||
else
|
||||
if(sis.equalsIgnoreCase("GISP"))
|
||||
sistema= SystemMap.SISTEMA_GISP;
|
||||
else
|
||||
if(sis.equalsIgnoreCase("DBCFX"))
|
||||
sistema= SystemMap.SISTEMA_DBCFX;
|
||||
|
||||
return sistema;
|
||||
}
|
||||
|
||||
}
|
||||
389
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBSender.java
Normal file
389
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBSender.java
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package client;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import mnp.objects.TipoFlusso;
|
||||
import siminfobus.GwOloClient;
|
||||
import siminfobus.IBAttivazioneBIT_FDGenerator;
|
||||
import siminfobus.IBAttivazioneBIT_TACSGenerator;
|
||||
import siminfobus.IBAttivazioneMSCGenerator;
|
||||
import siminfobus.IBAttivazioneMSPGenerator;
|
||||
import siminfobus.IBAttivazioneMspEXTGenerator;
|
||||
import siminfobus.IBTracciato;
|
||||
import base.ProtectionManager;
|
||||
|
||||
|
||||
/**
|
||||
* Genera chiamate
|
||||
* @param argv String[]
|
||||
* @throws Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public class ClientIBSender {
|
||||
|
||||
private static String getTipoFlusso(String flusso) {
|
||||
|
||||
if ("MSP".equalsIgnoreCase(flusso))
|
||||
return "" + TipoFlusso.MSP_ATTIVAZIONE_IN;
|
||||
|
||||
if ("MSC".equalsIgnoreCase(flusso))
|
||||
return "" + TipoFlusso.MSC_ATTIVAZIONE_IN;
|
||||
|
||||
if ("BIT".equalsIgnoreCase(flusso))
|
||||
return "" + TipoFlusso.BIT_ATTIVAZIONE_IN;
|
||||
|
||||
if ("MSPCOOP".equalsIgnoreCase(flusso))
|
||||
return "" + TipoFlusso.MSPCOOP_ATTIVAZIONE_IN;
|
||||
|
||||
if ("SIMBA".equalsIgnoreCase(flusso))
|
||||
return "" + TipoFlusso.MSP_EXT_ATTIVAZIONE_IN;
|
||||
|
||||
return flusso;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
ProtectionManager.check();
|
||||
|
||||
try {
|
||||
GwOloClient gwolo = new GwOloClient();
|
||||
String metodo = "NONE";
|
||||
Properties p = new Properties();
|
||||
String tipoOperazione = null;
|
||||
String subsys=null;
|
||||
|
||||
int tipo_flusso = Integer.parseInt(getTipoFlusso(args[0])); //Tipo_flusso /* public static final int SID_ATTIVAZIONE_IN = 20;
|
||||
|
||||
int num_richieste = Integer.parseInt(args[1]);
|
||||
|
||||
String tipo_richiesta = args[2]; //tipo richiesta, STANDARD, ADHOC(solo BIT), SCIVOLOTACS
|
||||
String pre_postpagato = args[3]; //Pre post pagato, PRP,POP
|
||||
String accodata = args[4]; //ACCODATA, NO_ACCODATA
|
||||
String tipo_numbering = args[5]; //Per SID/MSP vale FN,DN,RT
|
||||
String tipoInfobus = args[6]; //R3,R4
|
||||
System.out.println("tipoinfobus: " + tipoInfobus);
|
||||
String codiceDealer = args[7]; //130,...
|
||||
String iccid = args[9];
|
||||
String flagTC="N";
|
||||
String idContratto=null;
|
||||
String flagFurto=null;
|
||||
String flagPrevalidazione=null;
|
||||
String prjHoc=null;
|
||||
String codGruppo=null;
|
||||
String msisdnParliSubito=null;
|
||||
boolean invioDatiAnagrafici = true;
|
||||
if (codiceDealer.equalsIgnoreCase("NULL")){
|
||||
codiceDealer = "";
|
||||
}
|
||||
|
||||
//codice operatore donating
|
||||
String operatore = args[8];
|
||||
if (operatore.equalsIgnoreCase("NULL")) {
|
||||
operatore = null;
|
||||
}
|
||||
if (args.length >= 11) {
|
||||
tipoOperazione= args[10];
|
||||
if(tipoOperazione.equalsIgnoreCase("NULL"))
|
||||
tipoOperazione=null;
|
||||
}
|
||||
if((tipo_flusso==TipoFlusso.BIT_ATTIVAZIONE_IN)) {
|
||||
flagTC= args[10];
|
||||
}
|
||||
if ((tipo_flusso== TipoFlusso.MSP_ATTIVAZIONE_IN) ||
|
||||
(tipo_flusso== TipoFlusso.MSPCOOP_ATTIVAZIONE_IN) || (tipo_flusso== TipoFlusso.MSC_ATTIVAZIONE_IN)){
|
||||
System.out.println(args[11]+"********************************************************");
|
||||
if (tipo_flusso== TipoFlusso.MSP_ATTIVAZIONE_IN){
|
||||
flagTC= args[11];
|
||||
flagFurto= args[12].equalsIgnoreCase("NULL")?"":args[12];
|
||||
flagPrevalidazione= args[13].equalsIgnoreCase("NULL")?"":args[13];
|
||||
prjHoc= args[14].equalsIgnoreCase("NULL")?"":args[14];
|
||||
codGruppo= args[15].equalsIgnoreCase("NULL")?"":args[15];
|
||||
msisdnParliSubito= args[16].equalsIgnoreCase("NULL")?"":args[16];
|
||||
if(args.length>=18){
|
||||
invioDatiAnagrafici=args[17].equalsIgnoreCase("N")?false:true;
|
||||
}
|
||||
}
|
||||
else if (tipo_flusso== TipoFlusso.MSC_ATTIVAZIONE_IN){
|
||||
flagTC= args[10];
|
||||
idContratto = args[11];
|
||||
flagFurto = args[12].equalsIgnoreCase("NULL")?"":args[12];
|
||||
flagPrevalidazione = args[13].equalsIgnoreCase("NULL")?"":args[13];
|
||||
prjHoc= args[14].equalsIgnoreCase("NULL")?"":args[14];
|
||||
codGruppo = args[15].equalsIgnoreCase("NULL")?"":args[15];
|
||||
msisdnParliSubito = args[16].equalsIgnoreCase("NULL")?"":args[16];
|
||||
if(args.length>=18) {
|
||||
invioDatiAnagrafici=args[17].equalsIgnoreCase("N")?false:true;
|
||||
}
|
||||
}else{
|
||||
flagTC= args[11];
|
||||
}
|
||||
}
|
||||
if (tipo_flusso== TipoFlusso.MSP_EXT_ATTIVAZIONE_IN){
|
||||
tipoOperazione = args[10];
|
||||
subsys = args[11];
|
||||
flagTC= args[12];
|
||||
flagFurto= args[13].equalsIgnoreCase("NULL")?"":args[13];
|
||||
flagPrevalidazione= args[14].equalsIgnoreCase("NULL")?"":args[14];
|
||||
prjHoc= args[15].equalsIgnoreCase("NULL")?"":args[15];
|
||||
codGruppo= args[16].equalsIgnoreCase("NULL")?"":args[16];
|
||||
msisdnParliSubito= args[17].equalsIgnoreCase("NULL")?"":args[17];
|
||||
if(args.length>=18) {
|
||||
invioDatiAnagrafici=args[17].equalsIgnoreCase("N")?false:true;
|
||||
}
|
||||
}
|
||||
switch (tipo_flusso) {
|
||||
case TipoFlusso.MSP_ATTIVAZIONE_IN:
|
||||
|
||||
p.setProperty("codice_pre_postpagato", pre_postpagato);
|
||||
if (operatore != null)
|
||||
p.setProperty("codice_operatore_donating", operatore);
|
||||
p.setProperty("codiceDealer", codiceDealer);
|
||||
|
||||
//p.setProperty("accodata", accodata);
|
||||
IBAttivazioneMSPGenerator msp_factory = new IBAttivazioneMSPGenerator("MSP", "CRMC_FE");
|
||||
msp_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
msp_factory.setCodice_dealer(codiceDealer);
|
||||
msp_factory.setFlagFurto(flagFurto);
|
||||
msp_factory.setFlagPrevalidazione(flagPrevalidazione);
|
||||
msp_factory.setProgettoAdHoc(prjHoc);
|
||||
msp_factory.setCodiceGruppo(codGruppo);
|
||||
msp_factory.setMsisdnParliSubito(msisdnParliSubito);
|
||||
if (tipoOperazione!=null)
|
||||
msp_factory.setTipoOperazione(tipoOperazione);
|
||||
|
||||
msp_factory.setFlagTC(flagTC);
|
||||
IBTracciato[] tMSP = msp_factory.generate(num_richieste, p, "SCIVOLOTACS".equalsIgnoreCase(tipo_richiesta), iccid);
|
||||
|
||||
if ("PRP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPPre";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNPre";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTPre";
|
||||
}
|
||||
else if ("POP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPAbb";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNAbb";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTAbb";
|
||||
}
|
||||
|
||||
for (int i = 0; i < tMSP.length; i++)
|
||||
gwolo.synch_call(metodo, tMSP[i].getTracciato(invioDatiAnagrafici), tipoInfobus);
|
||||
|
||||
msp_factory.savePhoneSeed();
|
||||
break;
|
||||
case TipoFlusso.MSPCOOP_ATTIVAZIONE_IN:
|
||||
p.setProperty("codice_pre_postpagato", pre_postpagato);
|
||||
if (operatore != null)
|
||||
p.setProperty("codice_operatore_donating", operatore);
|
||||
|
||||
p.setProperty("codiceDealer", codiceDealer);
|
||||
|
||||
//p.setProperty("accodata", accodata);
|
||||
IBAttivazioneMSPGenerator mspcoop_factory = new IBAttivazioneMSPGenerator("MSPCOOP","CRMCCOOP");
|
||||
mspcoop_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
mspcoop_factory.setCodice_dealer(codiceDealer);
|
||||
mspcoop_factory.setFlagTC(flagTC);
|
||||
if (tipoOperazione!=null)
|
||||
mspcoop_factory.setTipoOperazione(tipoOperazione);
|
||||
IBTracciato[] tMSPCOOP = mspcoop_factory.generate(num_richieste, p, "SCIVOLOTACS".equalsIgnoreCase(tipo_richiesta), iccid);
|
||||
if ("PRP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPPre";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNPre";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTPre";
|
||||
|
||||
for (int i = 0; i < tMSPCOOP.length; i++)
|
||||
gwolo.synch_call(metodo, tMSPCOOP[i].getTracciato(invioDatiAnagrafici), tipoInfobus);
|
||||
|
||||
mspcoop_factory.savePhoneSeed();
|
||||
|
||||
}
|
||||
else {
|
||||
System.out.println("Le richieste MSPCOOP possono essere solo CO PRP");
|
||||
}
|
||||
|
||||
break;
|
||||
case TipoFlusso.MSC_ATTIVAZIONE_IN:
|
||||
|
||||
p.setProperty("codice_pre_postpagato", pre_postpagato);
|
||||
if (operatore != null)
|
||||
p.setProperty("codice_operatore_donating", operatore);
|
||||
|
||||
//p.setProperty("accodata", accodata);
|
||||
IBAttivazioneMSCGenerator msc_factory = new IBAttivazioneMSCGenerator();
|
||||
msc_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
msc_factory.setCodice_dealer(codiceDealer);
|
||||
msc_factory.setFlagTC(flagTC);
|
||||
if ("N".equalsIgnoreCase(idContratto)){
|
||||
idContratto="";
|
||||
}
|
||||
if ("Y".equalsIgnoreCase(idContratto)){
|
||||
idContratto="abcdefghilmnopqrst";
|
||||
}
|
||||
if ("NULL".equalsIgnoreCase(idContratto)){
|
||||
idContratto="";
|
||||
}
|
||||
msc_factory.setIdContratto(idContratto);
|
||||
|
||||
if ("NULL".equalsIgnoreCase(flagFurto)){
|
||||
flagFurto="";
|
||||
}
|
||||
msc_factory.setFlagFurto(flagFurto);
|
||||
msc_factory.setFlagPrevalidazione((flagPrevalidazione));
|
||||
if ("NULL".equalsIgnoreCase(prjHoc)){
|
||||
prjHoc="";
|
||||
}
|
||||
msc_factory.setProgettoAdHoc(prjHoc);
|
||||
if("NULL".equalsIgnoreCase(codGruppo)){
|
||||
codGruppo = "";
|
||||
}
|
||||
msc_factory.setCodGruppo(codGruppo);
|
||||
if ("NULL".equalsIgnoreCase(msisdnParliSubito)){
|
||||
msisdnParliSubito = "";
|
||||
}
|
||||
msc_factory.setMsisdnParliSubito(msisdnParliSubito);
|
||||
|
||||
|
||||
IBTracciato[] tMSC = msc_factory.generate(num_richieste, p, "SCIVOLOTACS".equalsIgnoreCase(tipo_richiesta), iccid);
|
||||
|
||||
|
||||
if ("PRP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPPre";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNPre";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTPre";
|
||||
}
|
||||
else if ("POP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPAbb";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNAbb";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTAbb";
|
||||
}
|
||||
|
||||
for (int i = 0; i < tMSC.length; i++)
|
||||
gwolo.synch_call(metodo, tMSC[i].getTracciato(invioDatiAnagrafici), tipoInfobus);
|
||||
|
||||
msc_factory.savePhoneSeed();
|
||||
break;
|
||||
|
||||
case TipoFlusso.BIT_ATTIVAZIONE_IN:
|
||||
|
||||
System.out.println("BIT...");
|
||||
IBTracciato[] tBIT = new IBTracciato[0];
|
||||
|
||||
p.setProperty("cod_pre_post", pre_postpagato);
|
||||
if (operatore != null){
|
||||
p.setProperty("donating_cod_op", operatore);
|
||||
}
|
||||
p.setProperty("codiceDealer", codiceDealer);
|
||||
|
||||
//p.setProperty("accodata", accodata);
|
||||
if ("STANDARD".equalsIgnoreCase(tipo_richiesta)) {
|
||||
IBAttivazioneBIT_FDGenerator bit_factory = new IBAttivazioneBIT_FDGenerator();
|
||||
bit_factory.setFlagTC(args[10]);
|
||||
bit_factory.setFlagFurto(args[11]);
|
||||
//bit_factory.setFlagPrevalidazione(args[12]);
|
||||
bit_factory.setMsisdnParliSubito(args[12]);
|
||||
//bit_factory.setDescanaleVendita(CanaleVenditaBit.getNextDescrizioneCanaleVendita());
|
||||
bit_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
tBIT = bit_factory.generate(num_richieste, p, false, iccid);
|
||||
bit_factory.savePhoneSeed();
|
||||
//SETTO COD_PROFILO_TARIFFARIO_PCN = "U" e DESC_PROFILO_TARIFFARIO_PCN = "RICARICABILE BUSINESS" per simulare PCN
|
||||
if (args[13].equalsIgnoreCase("Y")){
|
||||
bit_factory.setCod_profilo_tariffario("U");
|
||||
bit_factory.setDesc_profilo_tariffario("RICARICABILE BUSINESS");
|
||||
}
|
||||
}
|
||||
else if ("ADHOC".equalsIgnoreCase(tipo_richiesta)) {
|
||||
IBAttivazioneBIT_FDGenerator bit_factory = new IBAttivazioneBIT_FDGenerator();
|
||||
bit_factory.setFlagTC(args[9]);
|
||||
bit_factory.setFlagFurto(args[10]);
|
||||
bit_factory.setMsisdnParliSubito(args[11]);
|
||||
bit_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
tBIT = bit_factory.generate(num_richieste, p, true, iccid);
|
||||
bit_factory.savePhoneSeed();
|
||||
}
|
||||
else if ("SCIVOLOTACS".equalsIgnoreCase(tipo_richiesta)) {
|
||||
IBAttivazioneBIT_TACSGenerator bit_factory = new IBAttivazioneBIT_TACSGenerator();
|
||||
bit_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
tBIT = bit_factory.generate(num_richieste, p);
|
||||
bit_factory.savePhoneSeed();
|
||||
}
|
||||
for (int i = 0; i < tBIT.length; i++){
|
||||
gwolo.async_call(tBIT[i].getTracciato());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TipoFlusso.MSP_EXT_ATTIVAZIONE_IN:
|
||||
|
||||
p.setProperty("codice_pre_postpagato", pre_postpagato);
|
||||
if (operatore != null){
|
||||
p.setProperty("codice_operatore_donating", operatore);
|
||||
}
|
||||
p.setProperty("codiceDealer", codiceDealer);
|
||||
|
||||
//p.setProperty("accodata", accodata);
|
||||
IBAttivazioneMspEXTGenerator mspExt_factory =
|
||||
new IBAttivazioneMspEXTGenerator("MSP", subsys);
|
||||
mspExt_factory.setAccodata("ACCODATA".equalsIgnoreCase(accodata));
|
||||
mspExt_factory.setCodice_dealer(codiceDealer);
|
||||
mspExt_factory.setTipoOperazioneMspExtension(tipoOperazione);
|
||||
mspExt_factory.setFlagTC(flagTC);
|
||||
mspExt_factory.setFlagFurto(flagFurto);
|
||||
mspExt_factory.setFlagPrevalidazione(flagPrevalidazione);
|
||||
mspExt_factory.setProgettoAdHoc(prjHoc);
|
||||
mspExt_factory.setCodiceGruppo(codGruppo);
|
||||
mspExt_factory.setMsisdnParliSubito(msisdnParliSubito);
|
||||
IBTracciato[] tMSP_EXT = mspExt_factory.generate(num_richieste, p, "SCIVOLOTACS".equalsIgnoreCase(tipo_richiesta), iccid);
|
||||
|
||||
if ("PRP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPPre";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNPre";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTPre";
|
||||
}
|
||||
else if ("POP".equalsIgnoreCase(pre_postpagato)) {
|
||||
if ("FN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaFMNPAbb";
|
||||
else if ("DN".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaDNAbb";
|
||||
else if ("RT".equalsIgnoreCase(tipo_numbering))
|
||||
metodo = "richiestaRTAbb";
|
||||
}
|
||||
|
||||
for (int i = 0; i < tMSP_EXT.length; i++)
|
||||
gwolo.synch_call(metodo, tMSP_EXT[i].getTracciato(), tipoInfobus);
|
||||
|
||||
mspExt_factory.savePhoneSeed();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println("IBSender failed ex:");
|
||||
ex.printStackTrace(System.out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
389
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBSim.java
Normal file
389
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/client/ClientIBSim.java
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* Created on Feb 23, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
|
||||
import mnp.objects.InfobusMap;
|
||||
import tim.infobus.connector.ejb.InfoBUSConnector;
|
||||
import tim.infobus.connector.ejb.InfoBUSConnectorHome;
|
||||
import conf.SimConfFile;
|
||||
import base.ProtectionManager;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ClientIBSim {
|
||||
|
||||
private static final String CESSAZIONE = "1";
|
||||
private static final String ATTIVAZIONE = "2";
|
||||
private static final String VALIDAZIONE = "3";
|
||||
|
||||
public ClientIBSim(String args[]) {
|
||||
try {
|
||||
if(args[0].equalsIgnoreCase("SVUOTA_CACHE")){
|
||||
svuotaCache();
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_MSS)) {
|
||||
if (args.length != 2)
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
setSimMSS(args);
|
||||
}else if (args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_GISP+InfobusMap.IDSYSTEM_GISP_DBC)) {
|
||||
if (args.length < 17 || args.length > 26)
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
setSimGISP(args);
|
||||
}else if (args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_DBC_MVNO+InfobusMap.IDSYSTEM_MVNO/*ID SYSTEM GISP CESS*/)) {
|
||||
if (args.length != 4)
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
if (args[1].equals(CESSAZIONE)){
|
||||
setSimGISPCess(args);
|
||||
}else if (args[1].equals(ATTIVAZIONE)){
|
||||
setSimGISPAtt(args);
|
||||
}else if (args[1].equals(VALIDAZIONE)){
|
||||
setSimVal(args);
|
||||
}else {
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
}
|
||||
}else if (args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_GISP_DBC_HZ)) {
|
||||
if (args.length != 9)
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
setSimGISPHZ(args);
|
||||
}else if((args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_DBC_GINO + InfobusMap.ID_SERVICE_GINO_TIMG)) ||
|
||||
args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_DBC_GINO + InfobusMap.ID_SERVICE_GINO_COOP_ESP)){
|
||||
if (args.length != 3)
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
boolean isTIMG = args[0].equalsIgnoreCase(InfobusMap.IDSYSTEM_DBC_GINO + InfobusMap.ID_SERVICE_GINO_TIMG);
|
||||
System.out.println("eseguo il set di infobus per il servizio GINO-" + (isTIMG ? "TIMG" : " COOP ESP"));
|
||||
setSimGINO(args, isTIMG);
|
||||
} else
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println("Problem: " + ex);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
ProtectionManager.check();
|
||||
|
||||
if (args.length == 0)
|
||||
throw new IllegalArgumentException("Numero parametri insufficienti!");
|
||||
try {
|
||||
new ClientIBSim(args);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setSimVal(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
String esitovalidazioneTiscali = args[2];
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
System.out.println("Setting RC on bean1 to " + esitovalidazioneTiscali);
|
||||
HashMap map = new HashMap();
|
||||
map.put("esitovalidazioneTiscali", esitovalidazioneTiscali);
|
||||
map.put("invioAutomatico", args[3]);
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_DBC_MVNO+InfobusMap.IDSYSTEM_MVNO+args[1]/*ID SYSTEM_TISCALI*/, map);
|
||||
}
|
||||
|
||||
private void setSimGISPAtt(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
String esitoAttivazioneGisp = args[2];
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
System.out.println("Setting RC on bean1 to " + esitoAttivazioneGisp);
|
||||
HashMap map = new HashMap();
|
||||
map.put("esitoAttivazioneGisp", esitoAttivazioneGisp);
|
||||
map.put("invioAutomatico", args[3]);
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_DBC_MVNO+InfobusMap.IDSYSTEM_MVNO+args[1]/*ID SYSTEM GISP ATT*/, map);
|
||||
}
|
||||
|
||||
private void setSimGISPCess(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
String esitoCessazioneGisp = args[2];
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
System.out.println("Setting RC on bean1 to " + esitoCessazioneGisp);
|
||||
HashMap map = new HashMap();
|
||||
map.put("esitoCessazioneGisp", esitoCessazioneGisp);
|
||||
map.put("invioAutomatico", args[3]);
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_DBC_MVNO+InfobusMap.IDSYSTEM_MVNO+args[1]/*ID SYSTEM GISP CESS*/, map);
|
||||
}
|
||||
|
||||
private void setSimMSS(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
String retCode = args[1];
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
System.out.println("Setting RC on bean1 to " + retCode);
|
||||
HashMap map = new HashMap();
|
||||
map.put("retCodeMSS", retCode);
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_MSS, map);
|
||||
}
|
||||
|
||||
private void setSimGISP(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
|
||||
String gispCode = args[1];
|
||||
String gispMsg = args[2];
|
||||
String gispStato = args[3];
|
||||
String gispCessazioneMNP = args[4];
|
||||
String gispOperatore = args[5];
|
||||
String stateHZ = args[6];
|
||||
String statoSlaveHZ = args[7];
|
||||
String iccid = args[8];
|
||||
String descrizioneProfilo = args[9];
|
||||
String usageValue = args[10];
|
||||
String tipologia = args[11];
|
||||
String nome = args[12];
|
||||
String marcaggioCliente = args[13];
|
||||
String cliente = args[14];
|
||||
String tipoRetrieve = args[15];
|
||||
String profilo = args[16];
|
||||
String furto = null;
|
||||
String frode = null;
|
||||
String prepagato = null;
|
||||
String reteStato = null;
|
||||
String reteTipologia = null;
|
||||
String reteDataUltimaOperazione = null;
|
||||
String sottoservizioName = null;
|
||||
String mainMsisdn = null;
|
||||
String msisdnCoinvolto = null;
|
||||
try {
|
||||
if(!args[17].equalsIgnoreCase("null"))
|
||||
furto = args[17];
|
||||
if(!args[18].equalsIgnoreCase("null"))
|
||||
frode = args[18];
|
||||
if(!args[19].equalsIgnoreCase("null"))
|
||||
prepagato = args[19];
|
||||
if(!args[20].equalsIgnoreCase("null"))
|
||||
reteStato = args[20];
|
||||
if(!args[21].equalsIgnoreCase("null"))
|
||||
reteTipologia = args[21];
|
||||
if(!args[22].equalsIgnoreCase("null"))
|
||||
reteDataUltimaOperazione = args[22];
|
||||
if(!args[23].equalsIgnoreCase("null"))
|
||||
sottoservizioName = args[23];
|
||||
if(!args[24].equalsIgnoreCase("null"))
|
||||
mainMsisdn = args[24];
|
||||
if(!args[25].equalsIgnoreCase("null"))
|
||||
msisdnCoinvolto = args[25];
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
Boolean isValidICCID = new Boolean(false);
|
||||
|
||||
if ("ATTIVO-FITTIZIO".equalsIgnoreCase(statoSlaveHZ))
|
||||
statoSlaveHZ = "ATTIVO_FITTIZIO";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(stateHZ))
|
||||
stateHZ = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(statoSlaveHZ))
|
||||
statoSlaveHZ = "";
|
||||
|
||||
if ("VALIDO".equals(iccid))
|
||||
isValidICCID = new Boolean(true);
|
||||
|
||||
if ("NULL".equalsIgnoreCase(descrizioneProfilo))
|
||||
descrizioneProfilo = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(nome))
|
||||
nome = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(marcaggioCliente))
|
||||
marcaggioCliente = "";
|
||||
|
||||
if ("Y".equalsIgnoreCase(cliente))
|
||||
cliente = "SRTMCC75C52A345Q";
|
||||
else if ("N".equalsIgnoreCase(cliente))
|
||||
cliente = "";
|
||||
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
|
||||
System.out.println("Setting RC on bean1 to " + gispCode);
|
||||
HashMap map = new HashMap();
|
||||
map.put("gispCode", gispCode);
|
||||
map.put("gispMsg", gispMsg);
|
||||
map.put("gispStato", gispStato);
|
||||
map.put("gispCessazioneMNP", gispCessazioneMNP);
|
||||
map.put("gispOperatore", gispOperatore);
|
||||
map.put("stateHZ",stateHZ);
|
||||
map.put("statoSlaveHZ",statoSlaveHZ);
|
||||
map.put("validICCID", isValidICCID);
|
||||
map.put("descrizioneProfilo", descrizioneProfilo);
|
||||
map.put("usageValue", usageValue);
|
||||
map.put("tipologia", tipologia);
|
||||
map.put("nome", nome);
|
||||
map.put("marcaggioCliente", marcaggioCliente);
|
||||
map.put("cliente", cliente);
|
||||
map.put("tipoRetrieve", tipoRetrieve);
|
||||
map.put("profilo", profilo);
|
||||
map.put("furto", furto);
|
||||
map.put("frode", frode);
|
||||
map.put("prepagato", prepagato);
|
||||
map.put("reteStato", reteStato);
|
||||
map.put("reteTipologia", reteTipologia);
|
||||
map.put("reteDataUltimaOperazione", reteDataUltimaOperazione);
|
||||
map.put("nomeSottoservizio", sottoservizioName);
|
||||
map.put("mainMsisdn", mainMsisdn);
|
||||
map.put("msisdnCoinvolto", msisdnCoinvolto);
|
||||
|
||||
|
||||
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_GISP+InfobusMap.IDSYSTEM_GISP_DBC, map);
|
||||
}
|
||||
|
||||
private InfoBUSConnector getIB() throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("InfobusOUT");
|
||||
|
||||
String url = properties.getProperty("url");
|
||||
String bindingName = properties.getProperty("jndiname");
|
||||
String user = properties.getProperty("user");
|
||||
String password = properties.getProperty("password");
|
||||
|
||||
InitialContext ic = null;
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
|
||||
p.put(Context.PROVIDER_URL, url);
|
||||
weblogic.jndi.WLInitialContextFactory m;
|
||||
if (user != null) {
|
||||
p.put(Context.SECURITY_PRINCIPAL, user);
|
||||
p.put(Context.SECURITY_CREDENTIALS, password);
|
||||
}
|
||||
|
||||
ic = new InitialContext(p);
|
||||
System.out.println("lookup: " + bindingName + " at " + url);
|
||||
Object home1 = ic.lookup(bindingName);
|
||||
InfoBUSConnectorHome ibHome1 = (InfoBUSConnectorHome) PortableRemoteObject.narrow(home1, InfoBUSConnectorHome.class);
|
||||
infobus1 = ibHome1.create();
|
||||
return infobus1;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println("Problem: " + ex);
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
finally {
|
||||
if (ic != null)
|
||||
ic.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setSimGISPHZ(String args[]) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
|
||||
String gispCode = args[1];
|
||||
String gispMsg = args[2];
|
||||
String flagTim = args[3];
|
||||
String statoFisso = args[4];
|
||||
String nrMsisdn = args[5];
|
||||
String tipoMsisdn = args[6];
|
||||
String tipoCliente = args[7];
|
||||
String tipoRetrieve = args[8];
|
||||
|
||||
if ("NULL".equalsIgnoreCase(flagTim))
|
||||
flagTim = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(statoFisso))
|
||||
statoFisso = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(nrMsisdn))
|
||||
nrMsisdn = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(tipoMsisdn))
|
||||
tipoMsisdn = "";
|
||||
|
||||
if ("NULL".equalsIgnoreCase(tipoCliente))
|
||||
tipoCliente = "";
|
||||
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
|
||||
System.out.println("TIPO RETRIEVE:" + tipoRetrieve);
|
||||
System.out.println("Setting RC on bean1 to " + gispCode);
|
||||
HashMap map = new HashMap();
|
||||
map.put("gispCode", gispCode);
|
||||
map.put("gispMsg", gispMsg);
|
||||
map.put("flagTim", flagTim);
|
||||
map.put("statoFisso", statoFisso);
|
||||
map.put("nrMsisdn", nrMsisdn);
|
||||
map.put("msisdn", getMsisdn());
|
||||
map.put("tipoMsisdn", tipoMsisdn);
|
||||
map.put("tipoCliente", tipoCliente);
|
||||
map.put("tipoRetrieve", tipoRetrieve);
|
||||
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_GISP+InfobusMap.IDSYSTEM_GISP_DBC, map);
|
||||
}
|
||||
|
||||
private void setSimGINO(String args[], boolean isTIMG) throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
|
||||
String state = args[1];
|
||||
String astState = args[2];
|
||||
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
|
||||
System.out.println("Setting RC on bean1 to state: " + state + " - astState: " + astState);
|
||||
HashMap map = new HashMap();
|
||||
map.put("state", state);
|
||||
map.put("astState", astState);
|
||||
|
||||
String idService = isTIMG ? InfobusMap.ID_SERVICE_GINO_TIMG : InfobusMap.ID_SERVICE_GINO_COOP_ESP;
|
||||
infobus1.setSim(InfobusMap.IDSYSTEM_DBC_GINO + idService, map);
|
||||
}
|
||||
|
||||
private String getMsisdn(){
|
||||
|
||||
String[] cifre = {"1","2","3","4","5","6","7","8","9","0"};
|
||||
String[] prefix ={"333","334","320","347","348","349","335"};
|
||||
|
||||
String appNumero[] = new String[7];
|
||||
String appPrefisso[] = new String[1];
|
||||
String msisdn = "";
|
||||
String prefisso = "";
|
||||
|
||||
appPrefisso[0] = prefix[(int) (Math.random()*7)];
|
||||
prefisso = prefisso + appPrefisso[0];
|
||||
for (int i=0; i<7; i++){
|
||||
appNumero[i]= cifre[(int)(Math.random()*9)];
|
||||
msisdn= msisdn + appNumero[i];
|
||||
}
|
||||
|
||||
return prefisso+msisdn;
|
||||
}
|
||||
|
||||
private void svuotaCache() throws Exception {
|
||||
InfoBUSConnector infobus1 = null;
|
||||
infobus1 = getIB();
|
||||
System.out.println("InfoBUSin bean1 acquired. HC:" + infobus1.hashCode());
|
||||
infobus1.svuotaCacheGispConfiguration();
|
||||
System.out.println("cache svuotata");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package conf;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
public class CanaleVenditaBit {
|
||||
|
||||
|
||||
private static List canaliVendita= new ArrayList();
|
||||
|
||||
public CanaleVenditaBit() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static String getNextDescrizioneCanaleVendita(){
|
||||
|
||||
Random randomGen= new Random();
|
||||
int numCan= canaliVendita.size();
|
||||
int indice = randomGen.nextInt(numCan+1);
|
||||
if(indice==0)
|
||||
indice=1;
|
||||
if(indice==numCan)
|
||||
indice=numCan-1;
|
||||
String canale = (String)canaliVendita.get(indice);
|
||||
|
||||
|
||||
return canale;
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
BufferedReader br;
|
||||
String path = System.getProperty("canaliVenditaBIT_file", "");
|
||||
if (path == null || path.length() == 0) {
|
||||
System.out.println("ERRORE NELLE VARIABILI DI AMBIENTE DELLA JVM. MANCA IL PARAMETRO 'canaliVenditaBIT_file'");
|
||||
|
||||
} else {
|
||||
try {
|
||||
File f = new File(path);
|
||||
if (f.exists()) {
|
||||
br = new BufferedReader(new FileReader(f));
|
||||
String fileLine;
|
||||
while ( (fileLine = br.readLine()) != null) {
|
||||
canaliVendita.add(fileLine);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}catch (FileNotFoundException e) {
|
||||
System.err.println("Impossibile trovare il file d'inizializzazione per Canali Vendita BIT : " + System.getProperty("canaliVenditaBIT_file", ""));
|
||||
System.err.println("Tutti i sistemi conosciuti daranno codice e descrizione vuoti!");
|
||||
}catch (IOException ex) {
|
||||
System.err.println("Errore di lettura durante l'inizializzazione!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
114
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/FTPProperties.java
Normal file
114
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/FTPProperties.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Created on Feb 11, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package conf;
|
||||
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class FTPProperties {
|
||||
|
||||
/**
|
||||
* @return Returns the hostname.
|
||||
*/
|
||||
public static String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
/**
|
||||
* @param hostname The hostname to set.
|
||||
*/
|
||||
public static void setHostname(String hostname) {
|
||||
FTPProperties.hostname = hostname;
|
||||
}
|
||||
/**
|
||||
* @return Returns the password.
|
||||
*/
|
||||
public static String getPassword() {
|
||||
return password;
|
||||
}
|
||||
/**
|
||||
* @param password The password to set.
|
||||
*/
|
||||
public static void setPassword(String password) {
|
||||
FTPProperties.password = password;
|
||||
}
|
||||
/**
|
||||
* @return Returns the username.
|
||||
*/
|
||||
public static String getUsername() {
|
||||
return username;
|
||||
}
|
||||
/**
|
||||
* @param username The username to set.
|
||||
*/
|
||||
public static void setUsername(String username) {
|
||||
FTPProperties.username = username;
|
||||
}
|
||||
static FTPProperties _instance = null;
|
||||
static private String hostname;
|
||||
|
||||
static private String username;
|
||||
static private String password;
|
||||
|
||||
|
||||
//private Vector _listaDirectory = new Vector();
|
||||
|
||||
private FTPProperties() {
|
||||
try {
|
||||
loadFileProperties();
|
||||
//createDefaultDirectory();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static FTPProperties getInstance() {
|
||||
if (_instance == null)
|
||||
_instance = new FTPProperties();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica le proprietà
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadFileProperties() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("FTP");
|
||||
|
||||
setHostname(properties.getProperty("hostname"));
|
||||
setUsername(properties.getProperty("username"));
|
||||
setPassword(properties.getProperty("password"));
|
||||
//setTxmode(properties.getProperty("txmode"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Created on Feb 4, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package conf;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class GeneralProperties {
|
||||
|
||||
static GeneralProperties _instance = null;
|
||||
static private String _PATH_TEST;
|
||||
static private String _PATH_TEST_UPCO;
|
||||
|
||||
private Vector _listaDirectory = new Vector();
|
||||
|
||||
private GeneralProperties() {
|
||||
try {
|
||||
loadFileProperties();
|
||||
createDefaultDirectory();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static GeneralProperties getInstance() {
|
||||
if (_instance == null)
|
||||
_instance = new GeneralProperties();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica le proprietà
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadFileProperties() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("BIT");
|
||||
|
||||
set_PATH_TEST(properties.getProperty("test"));
|
||||
set_PATH_TEST_UPCO(get_PATH_TEST() + "/" + properties.getProperty("nameDirBIT"));
|
||||
//set_PATH_TEST_CU(get_PATH_TEST() + "/" + properties.getProperty("nameDirCU"));
|
||||
//set_PATH_TEST_BIT(get_PATH_TEST() + "/" + properties.getProperty("nameDirBIT"));
|
||||
loadListaDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica la lista delle directory
|
||||
*/
|
||||
private void loadListaDirectory() {
|
||||
_listaDirectory.addElement(get_PATH_TEST());
|
||||
_listaDirectory.addElement(get_PATH_TEST_UPCO());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea le directory in cui salvare i file creati
|
||||
*/
|
||||
private void createDefaultDirectory() {
|
||||
for (int i = 0; i < _listaDirectory.size(); i++) {
|
||||
String nameDir = (String) _listaDirectory.elementAt(i);
|
||||
if (! (new File(nameDir).exists())) {
|
||||
boolean success = new File(nameDir).mkdir();
|
||||
if (!success)
|
||||
System.out.println("Errore nella creazione della directory: " + nameDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String get_PATH_TEST() {
|
||||
return _PATH_TEST;
|
||||
}
|
||||
public void set_PATH_TEST(String __PATH_TEST) {
|
||||
_PATH_TEST = __PATH_TEST;
|
||||
}
|
||||
public String get_PATH_TEST_UPCO() {
|
||||
return _PATH_TEST_UPCO;
|
||||
}
|
||||
public void set_PATH_TEST_UPCO(String __PATH_TEST_UPCO) {
|
||||
_PATH_TEST_UPCO = __PATH_TEST_UPCO;
|
||||
}
|
||||
|
||||
}
|
||||
639
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/JIniFile.java
Normal file
639
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/JIniFile.java
Normal file
@@ -0,0 +1,639 @@
|
||||
package conf;
|
||||
|
||||
/**
|
||||
* <p>Title: </p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2003</p>
|
||||
* <p>Company: </p>
|
||||
* @author unascribed
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
/**
|
||||
* <b><p>Description:</b><br>
|
||||
* JIniFile stores and retrieves application-specific information and settings from INI files.
|
||||
* <br><br>
|
||||
* JIniFile enables handling the storage and retrieval of application-specific information
|
||||
* and settings in a standard INI file. The INI file text format is a standard introduced
|
||||
* in Windows 3.x for storing and retrieving application settings from session to session.
|
||||
* An INI file stores information in logical groupings, called "sections." For example,
|
||||
* the WIN.INI file contains a section called "[Desktop]". Within each section, actual data
|
||||
* values are stored in named keys. Keys take the form:
|
||||
* <br><br>
|
||||
* <keyname>=<value><br>
|
||||
* A FileName is passed to the JIniFile constructor and identifies the INI file that the object accesses.</p>
|
||||
* @author Andreas Norman
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public class JIniFile extends ArrayList {
|
||||
private File userFileName;
|
||||
|
||||
//private static Logger logger = Logger.getLogger("phco.init");
|
||||
|
||||
/**
|
||||
* Constructor JIniFile
|
||||
*
|
||||
* Creates a JIniFile object for an application. Create assigns the FileName parameter
|
||||
* to the FileName property, which is used to specify the name of the INI file to use.
|
||||
* <p>
|
||||
* <b>Note:</b> By default the INI files are stored in the Application directory. To work with an INI file in another
|
||||
* location, specify the full path name of the file in FileName.
|
||||
*/
|
||||
public JIniFile(String name) {
|
||||
System.out.println("ini-file LOADING " + name);
|
||||
clear();
|
||||
this.userFileName = new File(name);
|
||||
if (userFileName.exists()) {
|
||||
System.out.println("ini-file READING ");
|
||||
try {
|
||||
BufferedReader inbuf = new BufferedReader(new FileReader(this.userFileName));
|
||||
while (true) {
|
||||
String s = inbuf.readLine();
|
||||
if (s == null) {
|
||||
break;
|
||||
}
|
||||
add(s);
|
||||
}
|
||||
inbuf.close();
|
||||
System.out.println("ini-file READING OK");
|
||||
} catch ( IOException ex ) {
|
||||
System.out.println("ini-file FILE " + name + " reading exception: " + ex);
|
||||
}
|
||||
} else {
|
||||
System.out.println("ini-file FILE " + name + " DOES NOT EXIST");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadSections to retrieve the names of all sections in the INI file into an ArrayList object.
|
||||
*
|
||||
* @return an ArrayList holding the sections
|
||||
*
|
||||
*/
|
||||
public ArrayList ReadSections() {
|
||||
ArrayList list = new ArrayList();
|
||||
String s;
|
||||
for (int i=0; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.startsWith("[") && s.endsWith("]")) {
|
||||
list.add(s.substring(1,(s.length()-1)));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call UpdateFile to flush buffered reads from and writes to the INI file to disk.
|
||||
*
|
||||
* @return returns <code>true</code> if sucessful
|
||||
*
|
||||
*/
|
||||
public boolean UpdateFile() {
|
||||
try {
|
||||
BufferedWriter outbuf = new BufferedWriter(new FileWriter(this.userFileName.toString(), false));
|
||||
int i=0;
|
||||
while (i<size()) {
|
||||
String s = get(i).toString();
|
||||
if (s == null) {
|
||||
break;
|
||||
}
|
||||
outbuf.write(s);
|
||||
outbuf.newLine();
|
||||
i++;
|
||||
}
|
||||
outbuf.close();
|
||||
return true;
|
||||
} catch ( IOException ioe ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call ReadString to read a string value from an INI file. Section identifies the
|
||||
* section in the file that contains the desired key. key is the name of the key
|
||||
* from which to retrieve the value. defaultValue is the string value to return if the:<br>
|
||||
* - Section does not exist.<br>
|
||||
* - Key does not exist.<br>
|
||||
* - Data value for the key is not assigned.<br>
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param defaultValue default value if no value is found
|
||||
*
|
||||
* @return returns the value. If empty or nonexistent it will return the default value
|
||||
*
|
||||
*/
|
||||
public String ReadString(String Section, String key, String defaultValue) {
|
||||
String value=defaultValue;
|
||||
if (ValuePosition(Section, key) > 0) {
|
||||
int strLen = key.length()+1;
|
||||
value = get(ValuePosition(Section, key)).toString().substring(strLen, get(ValuePosition(Section, key)).toString().length());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public String ReadStringRemapped(String Section, String key, String defaultValue, JIniFile remapFile) {
|
||||
String value=defaultValue;
|
||||
if (ValuePosition(Section, key) > 0) {
|
||||
int strLen = key.length()+1;
|
||||
String realValue = get(ValuePosition(Section, key)).toString().substring(strLen, get(ValuePosition(Section, key)).toString().length());
|
||||
if ((realValue != null) && (realValue.length() > 0)) {
|
||||
value=remapFile.ReadString(key, realValue, defaultValue);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadSectionValues to read the keys, and the values from all keys, within a specified
|
||||
* section of an INI file into an ArrayList object. Section identifies the section in the file
|
||||
* from which to read key values.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return an ArrayList holding the values in the specified section.
|
||||
*
|
||||
*/
|
||||
public ArrayList ReadSectionValues(String Section) {
|
||||
ArrayList myList = new ArrayList();
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
String s;
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
s = get(i).toString().substring(get(i).toString().indexOf("=")+1, get(i).toString().length());
|
||||
if (s.startsWith("[") && s.endsWith("]")) {
|
||||
break;
|
||||
} else {
|
||||
myList.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call ReadSection to read the keys, and the values from all keys, within a specified
|
||||
* section of an INI file into an Properties object. Section identifies the section in the file
|
||||
* from which to read key-value pairs.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return a Properties holding the key-value pairs in the specified section.
|
||||
*
|
||||
*/
|
||||
|
||||
public Properties ReadSection(String Section) {
|
||||
Properties myList = new Properties();
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
String line,key="",val="";
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
line = get(i).toString();
|
||||
if (line.startsWith("[") && line.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
else if((!line.equals(""))&&(line.indexOf("=")!=-1)){
|
||||
val = line.substring(line.indexOf("=")+1, line.length());
|
||||
key = line.substring(0,line.indexOf("="));
|
||||
myList.setProperty(key,val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadSection to read the keys, and the values from all keys, within a specified
|
||||
* section of an INI file into an Properties object. Section identifies the section in the file
|
||||
* from which to read key-value pairs.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return a ArrayList holding the key-value pairs in sequence key1,value1,key2,value2 etc.
|
||||
*
|
||||
*/
|
||||
|
||||
public ArrayList ReadSectionAsArray(String Section) {
|
||||
ArrayList myList = new ArrayList();
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
String line,key="",val="";
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
line = get(i).toString();
|
||||
if (line.startsWith("[") && line.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
else if((!line.equals(""))&&(line.indexOf("=")!=-1)){
|
||||
val = line.substring(line.indexOf("=")+1, line.length());
|
||||
key = line.substring(0,line.indexOf("="));
|
||||
myList.add(key);
|
||||
myList.add(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
|
||||
public String ReturnSectionAsString(String Section){
|
||||
String line,res="";
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
line = get(i).toString();
|
||||
if (line.startsWith("[") && line.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
else res=res+line;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadInteger to read a string value from an INI file. Section identifies the
|
||||
* section in the file that contains the desired key. key is the name of the key
|
||||
* from which to retrieve the value. defaultValue is the integer value to return if the:<br>
|
||||
* - Section does not exist.<br>
|
||||
* - Key does not exist.<br>
|
||||
* - Data value for the key is not assigned.<br>
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param defaultValue default value if no value is found
|
||||
*
|
||||
* @return returns the value. If empty or nonexistent it will return the default value
|
||||
*
|
||||
*/
|
||||
public int ReadInteger(String Section, String key, int defaultValue) {
|
||||
int value=defaultValue;
|
||||
if (ValuePosition(Section, key) > 0) {
|
||||
int strLen = key.length()+1;
|
||||
value = Integer.parseInt(get(ValuePosition(Section, key)).toString().substring(strLen, get(ValuePosition(Section, key)).toString().length()));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadFloat to read a string value from an INI file. Section identifies the
|
||||
* section in the file that contains the desired key. key is the name of the key
|
||||
* from which to retrieve the value. defaultValue is the float value to return if the:<br>
|
||||
* - Section does not exist.<br>
|
||||
* - Key does not exist.<br>
|
||||
* - Data value for the key is not assigned.<br>
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param defaultValue default value if no value is found
|
||||
*
|
||||
* @return returns the value. If empty or nonexistent it will return the default value
|
||||
*
|
||||
*/
|
||||
public Float ReadFloat(String Section, String key, Float defaultValue) {
|
||||
Float value = new Float(0f);
|
||||
value = defaultValue;
|
||||
if (ValuePosition(Section, key) > 0) {
|
||||
int strLen = key.length()+1;
|
||||
value = Float.valueOf(get(ValuePosition(Section, key)).toString().substring(strLen, get(ValuePosition(Section, key)).toString().length()));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Readbool to read a string value from an INI file. Section identifies the
|
||||
* section in the file that contains the desired key. key is the name of the key
|
||||
* from which to retrieve the value. defaultValue is the boolean value to return if the:<br>
|
||||
* - Section does not exist.<br>
|
||||
* - Key does not exist.<br>
|
||||
* - Data value for the key is not assigned.<br>
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param defaultValue default value if no value is found
|
||||
*
|
||||
* @return returns the value. If empty or nonexistent it will return the default value
|
||||
*
|
||||
*/
|
||||
public boolean ReadBool(String Section, String key, boolean defaultValue) {
|
||||
boolean value=defaultValue;
|
||||
if (ValuePosition(Section, key) > 0) {
|
||||
int strLen = key.length()+1;
|
||||
value = Boolean.getBoolean(get(ValuePosition(Section, key)).toString().substring(strLen, get(ValuePosition(Section, key)).toString().length()));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* SectionExists is used internally to determine the position of a section within the INI file
|
||||
* specified in FileName.
|
||||
* <p>
|
||||
* Section is the INI file section SectionExists determines the position of.
|
||||
* <p>
|
||||
* SectionExists returns an Integer value that indicates the position of the section in question.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return will return the position of the section. Returns -1 not found.
|
||||
*
|
||||
*/
|
||||
private int SectionPosition(String Section) {
|
||||
String s;
|
||||
int pos = -1;
|
||||
for (int i=0; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.equals("["+Section+"]")) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use SectionExists to determine whether a section exists within the INI file specified in FileName.
|
||||
* <p>
|
||||
* Section is the INI file section SectionExists determines the existence of.
|
||||
* <p>
|
||||
* SectionExists returns a Boolean value that indicates whether the section in question exists.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return returns <code>true</code> if the section exists.
|
||||
*
|
||||
*/
|
||||
public boolean SectionExist(String Section) {
|
||||
String s;
|
||||
boolean val = false;
|
||||
for (int i=0; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.equals("["+Section+"]")) {
|
||||
val = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call EraseSection to remove a section, all its keys, and their data values from
|
||||
* an INI file. Section identifies the INI file section to remove.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
*/
|
||||
public void EraseSection(String Section) {
|
||||
String s;
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.startsWith("[") && s.endsWith("]")) {
|
||||
break;
|
||||
} else {
|
||||
remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
remove(this.SectionPosition(Section));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call ReadSection to retrieve the names of all keys within a specified section of an
|
||||
* INI file into an ArrayList object.
|
||||
*
|
||||
* @param Section the section name
|
||||
*
|
||||
* @return an ArrayList holding all key names.
|
||||
*
|
||||
*/
|
||||
public ArrayList ReadSectionKeys(String Section) {
|
||||
String s;
|
||||
ArrayList myList = new ArrayList();
|
||||
int start = this.SectionPosition(Section)+1;
|
||||
if (this.SectionPosition(Section) > -1) {
|
||||
for (int i=start; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.startsWith("[") && s.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
else if(s.compareTo("")==0){
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
s=s.substring(0, s.indexOf("="));
|
||||
myList.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return myList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use ValueExist to determine whether a key exists in the INI file specified in FileName.<br>
|
||||
* Section is the section in the INI file in which to search for the key.<br>
|
||||
* key is the name of the key to search for.<br>
|
||||
* ValueExist returns a Boolean value that indicates whether the key exists in the specified section.<br>
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
*
|
||||
* @return returns <code>true</code> if value exists
|
||||
*
|
||||
*/
|
||||
public boolean ValueExist(String Section, String key) {
|
||||
int start = SectionPosition(Section);
|
||||
String s;
|
||||
boolean val = false;
|
||||
int strLen = key.length()+1;;
|
||||
for (int i=start+1; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.startsWith(key+"=")) {
|
||||
val = true;
|
||||
break;
|
||||
} else if (s.startsWith("[") && s.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* ValuePosition is used internally to determine the position of a in the INI file specified in FileName.
|
||||
* <P>
|
||||
* Section is the section in the INI file in which to search for the key.
|
||||
* <P>
|
||||
* key is the name of the key to search for.
|
||||
* <P>
|
||||
* ValuePosition returns an Integer value that indicates the position of the key in the INI file.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
*
|
||||
* @return returns the position of the Value. If not found it will return -1
|
||||
*
|
||||
*/
|
||||
private int ValuePosition(String Section, String key) {
|
||||
int start = SectionPosition(Section);
|
||||
String s;
|
||||
int pos =-1;
|
||||
int strLen = key.length()+1;;
|
||||
for (int i=start+1; i < size(); i++) {
|
||||
s = get(i).toString();
|
||||
if (s.startsWith(key+"=")) {
|
||||
pos = i;
|
||||
break;
|
||||
} else if (s.startsWith("[") && s.endsWith("]")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
/**
|
||||
* Call DeleteKey to erase an INI file entry. Section is string containing the name
|
||||
* of an INI file section, and key is a string containing the name of the key from
|
||||
* for which to set a nil value.
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to delete a key in a nonexistent section or attempting to delete a
|
||||
* nonexistent key are not errors. In these cases, DeleteKey does nothing.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
*
|
||||
*/
|
||||
public void DeleteKey(String Section, String key) {
|
||||
if (this.ValuePosition(Section, key) > 0) {
|
||||
remove(this.ValuePosition(Section, key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call WriteString to write a string value to an INI file. Section identifies the section in the
|
||||
* file that contain the key to which to write. key is the name of the key for which to set a value.
|
||||
* value is the string value to write.
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to write a data value to a nonexistent section or attempting to write data to a nonexistent
|
||||
* key are not errors. In these cases, WriteString creates the section and key and sets its initial value
|
||||
* to value.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param value the value
|
||||
*
|
||||
*/
|
||||
public void WriteString(String Section, String key, String value) {
|
||||
String s = key+"="+value;
|
||||
this.addToList(Section, key, s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call WriteBool to write a boolean value to an INI file. Section identifies the section in the
|
||||
* file that contain the key to which to write. key is the name of the key for which to set a value.
|
||||
* value is the boolean value to write.
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to write a data value to a nonexistent section or attempting to write data to a nonexistent
|
||||
* key are not errors. In these cases, WriteBool creates the section and key and sets its initial value
|
||||
* to value.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param value the value
|
||||
*
|
||||
*/
|
||||
public void WriteBool(String Section, String key, Boolean value) {
|
||||
String s = key+"="+value.toString();
|
||||
|
||||
this.addToList(Section, key, s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call WriteFloat to write a float value to an INI file. Section identifies the section in the
|
||||
* file that contain the key to which to write. key is the name of the key for which to set a value.
|
||||
* value is the float value to write.
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to write a data value to a nonexistent section or attempting to write data to a nonexistent
|
||||
* key are not errors. In these cases, WriteFloat creates the section and key and sets its initial value
|
||||
* to value.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param value the value
|
||||
*
|
||||
*/
|
||||
public void WriteFloat(String Section, String key, float value) {
|
||||
String s = key+"="+Float.toString(value);
|
||||
this.addToList(Section, key, s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call WriteInteger to write an integer value to an INI file. Section identifies the section in the
|
||||
* file that contain the key to which to write. key is the name of the key for which to set a value.
|
||||
* value is the integer value to write.
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to write a data value to a nonexistent section or attempting to write data to a nonexistent
|
||||
* key are not errors. In these cases, WriteInteger creates the section and key and sets its initial value
|
||||
* to value.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param value the value
|
||||
*
|
||||
*/
|
||||
public void WriteInteger(String Section, String key, int value) {
|
||||
String s = key+"="+Integer.toString(value);
|
||||
this.addToList(Section, key, s);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* addToList is used internally to add values to the INI file specified in FileName.
|
||||
* <p>
|
||||
* Section is the section in the INI file in which to search for the key.
|
||||
* <p>
|
||||
* key is the name of the key to search for.
|
||||
* <p>
|
||||
* value is the name of the value to write
|
||||
* <p>
|
||||
* <b>Note:</b> Attempting to write a data value to a nonexistent section or attempting to write data to a nonexistent
|
||||
* key are not errors. In these cases, addToList creates the section and key and sets its initial value
|
||||
* to value.
|
||||
*
|
||||
* @param Section the section name
|
||||
* @param key the key name
|
||||
* @param value the value
|
||||
*
|
||||
*/
|
||||
private void addToList(String Section, String key, String value) {
|
||||
if (this.SectionExist((Section))) {
|
||||
if (this.ValueExist(Section, key)) {
|
||||
int pos = this.ValuePosition(Section, key);
|
||||
remove(pos);
|
||||
add(pos, value);
|
||||
} else {
|
||||
add(/*(this.SectionPosition(Section)+1) l'ho tolto io!!!!*/value);
|
||||
}
|
||||
} else {
|
||||
add("["+Section+"]");
|
||||
add(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void addSpace(){
|
||||
add("");
|
||||
}
|
||||
|
||||
}
|
||||
76
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/MSSProperties.java
Normal file
76
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/MSSProperties.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package conf;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MSSProperties {
|
||||
static private String _PATH_TEST = null;
|
||||
static private String _PATH_TEST_MSS = null;
|
||||
static MSSProperties _instance = null;
|
||||
|
||||
private MSSProperties() {
|
||||
try {
|
||||
loadFileProperties();
|
||||
createDefaultDirectory();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static MSSProperties getInstance() {
|
||||
if (_instance == null)
|
||||
_instance = new MSSProperties();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica le proprietà
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadFileProperties() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("MSS");
|
||||
|
||||
set_PATH_TEST(properties.getProperty("test"));
|
||||
set_PATH_TEST_MSS(get_PATH_TEST() + "/" + properties.getProperty("nameDirMSS"));
|
||||
|
||||
}
|
||||
/**
|
||||
* Crea la directory su cui salvare il file
|
||||
*/
|
||||
private void createDefaultDirectory() {
|
||||
String nameDir = (String) get_PATH_TEST_MSS();
|
||||
if (! (new File(nameDir).exists())) {
|
||||
boolean success = new File(nameDir).mkdir();
|
||||
if (!success)
|
||||
System.out.println("Errore nella creazione della directory: " + nameDir);
|
||||
}
|
||||
}
|
||||
|
||||
public String get_PATH_TEST() {
|
||||
return _PATH_TEST;
|
||||
}
|
||||
|
||||
public void set_PATH_TEST(String _PATH_TEST) {
|
||||
this._PATH_TEST = _PATH_TEST;
|
||||
}
|
||||
|
||||
public void set_PATH_TEST_MSS(String _PATH_TEST_MSS) {
|
||||
this._PATH_TEST_MSS = _PATH_TEST_MSS;
|
||||
}
|
||||
|
||||
public String get_PATH_TEST_MSS() {
|
||||
return _PATH_TEST_MSS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package conf;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class PitagoraProperties {
|
||||
|
||||
static PitagoraProperties _instance = null;
|
||||
static private String _PATH_TEST;
|
||||
static private String _PATH_TEST_NOTIFICA;
|
||||
|
||||
public String get_PATH_TEST_NOTIFICA() {
|
||||
return _PATH_TEST_NOTIFICA;
|
||||
}
|
||||
|
||||
public void set_PATH_TEST(String _PATH_TEST) {
|
||||
this._PATH_TEST = _PATH_TEST;
|
||||
}
|
||||
|
||||
public void set_PATH_TEST_NOTIFICA(String _PATH_TEST_NOTIFICA) {
|
||||
this._PATH_TEST_NOTIFICA = _PATH_TEST_NOTIFICA;
|
||||
}
|
||||
|
||||
public String get_PATH_TEST() {
|
||||
return _PATH_TEST;
|
||||
}
|
||||
|
||||
private PitagoraProperties() {
|
||||
try {
|
||||
loadFileProperties();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static PitagoraProperties getInstance() {
|
||||
if (_instance == null)
|
||||
_instance = new PitagoraProperties();
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica le proprietà
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadFileProperties() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("NOTIFICAZIONE PITAGORA");
|
||||
|
||||
set_PATH_TEST(properties.getProperty("test"));
|
||||
set_PATH_TEST_NOTIFICA(get_PATH_TEST() + "/" + properties.getProperty("notifica") + "/");
|
||||
}
|
||||
}
|
||||
252
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/ProfiliTariffari.java
Normal file
252
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/ProfiliTariffari.java
Normal file
@@ -0,0 +1,252 @@
|
||||
package conf;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* @author Melec
|
||||
*
|
||||
*/
|
||||
public class ProfiliTariffari {
|
||||
|
||||
private static Hashtable[] profili = {new Hashtable(), new Hashtable(), new Hashtable()};
|
||||
private static Random random = new Random(System.currentTimeMillis());
|
||||
private static Set profiliSet = new HashSet(), profiliComplessiSet = new HashSet();
|
||||
private static String[] profiloTariffario = {""};
|
||||
|
||||
private static String[] splittedLine(String line) {
|
||||
String[] fields = line.split("\t");
|
||||
Vector vTemp = new Vector();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
//decommentare se si vuole evitare codice(o descrizione) null associato a descrizione(o codice) non null
|
||||
//if (fields[i].length() != 0) {
|
||||
vTemp.add(fields[i]);
|
||||
//}
|
||||
}
|
||||
return (String[]) vTemp.toArray(new String[]{});
|
||||
}
|
||||
|
||||
private static String[] Validate(String[] terna) {
|
||||
// controlla innanzitutto che la lunghezza sia >= 3;
|
||||
if (terna == null)
|
||||
return new String[]{"","",""};
|
||||
switch (terna.length) {
|
||||
case 0: return new String[]{"","",""};
|
||||
case 1: return new String[]{terna[0], "", ""};
|
||||
// coppie di cui uno tra codice e descrizione può essere null
|
||||
case 2: return new String[]{terna[0], terna[1], ""};
|
||||
default :return new String[]{terna[0], terna[1], terna[2]};
|
||||
// coppie di cui entrambi i membri della coppia sono null
|
||||
//case 2: return new String[]{terna[0], "", ""};
|
||||
//default :
|
||||
// if (terna[1].length() == 0 || terna[2].length == 0)
|
||||
// return new String[]{terna[0], "", ""};
|
||||
// return new String[]{terna[0], terna[1], terna[2]};
|
||||
}
|
||||
}
|
||||
|
||||
// INIZIALIZZAZIONE
|
||||
static {
|
||||
profiliSet.add("MSC");
|
||||
profiliSet.add("MSP");
|
||||
// profiliSet.add("SID");
|
||||
profiliSet.add("BIT");
|
||||
profiliSet.add("MSPCOOP");
|
||||
|
||||
profiliComplessiSet.add("BIT");
|
||||
|
||||
BufferedReader br;
|
||||
String path = System.getProperty("profiliTariffari_file", "");
|
||||
if (path == null || path.length() == 0) {
|
||||
System.out.println("ERRORE NELLE VARIABILI DI AMBIENTE DELLA JVM. MANCA IL PARAMETRO 'profiliTariffari_file'");
|
||||
System.out.println("Tutti i sistemi conosciuti forniranno codice e descrizione vuoti!");
|
||||
} else {
|
||||
try {
|
||||
File f = new File(path);
|
||||
if (f.exists()) {
|
||||
br = new BufferedReader(new FileReader(f));
|
||||
String fileLine;
|
||||
while ((fileLine = br.readLine()) != null) {
|
||||
fileLine = fileLine.trim();
|
||||
if (fileLine.length() != 0 && !fileLine.startsWith("#")) {
|
||||
String[] fileFields = splittedLine(fileLine);
|
||||
fileFields = Validate(fileFields);
|
||||
|
||||
if (profiliSet.contains(fileFields[0])) {
|
||||
setCoupleValues(fileFields, 0);
|
||||
} else if (profiliComplessiSet.contains(fileFields[0].substring(0, fileFields[0].length() - 2))) {
|
||||
if (fileFields[0].endsWith("AC")) {
|
||||
setCoupleValues(fileFields, 2);
|
||||
} else if (fileFields[0].endsWith("OF")) {
|
||||
setCoupleValues(fileFields, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.err.println("Impossibile trovare il file d'inizializzazione per ProfiliTariffari : " + System.getProperty("profiliTariffari_file", ""));
|
||||
System.err.println("Tutti i sistemi conosciuti daranno codice e descrizione vuoti!");
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
System.err.println("Impossibile trovare il file d'inizializzazione per ProfiliTariffari : " + System.getProperty("profiliTariffari_file", ""));
|
||||
System.err.println("Tutti i sistemi conosciuti daranno codice e descrizione vuoti!");
|
||||
} catch (IOException e) {
|
||||
System.err.println("Errore di lettura durante l'inizializzazione!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//restituisce l'iesimo elemento dell'array profiloTariffario se esiste; altrimeni stringa vuota
|
||||
private static String get(int index) {
|
||||
if (profiloTariffario.length > index)
|
||||
return profiloTariffario[index];
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return il codice del profilo tariffario
|
||||
*/
|
||||
public static String getCodiceProfilo() {
|
||||
return get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return la descrizione associata al profilo tariffario
|
||||
*/
|
||||
public static String getDescrizioneProfilo() {
|
||||
return get(1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return il codice dell'offerta
|
||||
*/
|
||||
public static String getCodiceOfferta() {
|
||||
return get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return la descrizione dell'offerta
|
||||
*/
|
||||
public static String getDescrizioneOfferta() {
|
||||
return get(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return il codice dell'accordo
|
||||
*/
|
||||
public static String getCodiceAccordo() {
|
||||
return get(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return la descrizione dell'accordo
|
||||
*/
|
||||
public static String getDescrizioneAccordo() {
|
||||
return get(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* inserisce nell'hashtable corrispondente la coppia codice-descrizione
|
||||
* Le chiavi dell'hashtable sono i sistemi (BIT, MSC, etc.)
|
||||
* Le coppie sono memorizzate all'interno di un Vector come array di 2 String.
|
||||
*/
|
||||
private static void setCoupleValues(String[] values, int index) {
|
||||
String key = values[0];
|
||||
if (index > 0)
|
||||
key = key.substring(0, key.length() - 2);
|
||||
Vector vettore = (Vector) profili[index].get(key);
|
||||
if (vettore == null) {
|
||||
vettore = new Vector();
|
||||
}
|
||||
vettore.add(new String[] {values[1], values[2]});
|
||||
profili[index].put(key, vettore);
|
||||
}
|
||||
|
||||
/**
|
||||
* inserisce nell'hashtable corrispondente la coppia codice-descrizione
|
||||
* Le chiavi dell'hashtable sono i sistemi (BIT, MSC, etc.)
|
||||
* Le coppie sono memorizzate all'interno di un Vector come array di 2 String.
|
||||
*/
|
||||
private static String[] getCodiceDescr(Vector coppiaCodiceDescr) {
|
||||
if (coppiaCodiceDescr == null || coppiaCodiceDescr.size() == 0)
|
||||
return new String[]{"",""};
|
||||
else
|
||||
return (String[]) coppiaCodiceDescr.elementAt(random.nextInt(coppiaCodiceDescr.size()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type: il tipo di profilo da generare (SID, MSP, MSC, BIT)
|
||||
* @return un array di stringhe contenenti i dati di un un profilo del tipo specificato.
|
||||
*/
|
||||
public static String[] nextProfiloTariffario(String type) {
|
||||
String[] profilo;
|
||||
if (profiliComplessiSet.contains(type)) {
|
||||
profilo = new String[6];
|
||||
String[] tmp = getCodiceDescr((Vector) profili[0].get(type));
|
||||
boolean profiloNull = ("".equals(tmp[0]) && "".equals(tmp[1]));
|
||||
for (int i = 1; i < 4; i++) {
|
||||
profilo[2 * (i - 1)] = tmp[0];
|
||||
profilo[2 * i - 1] = tmp[1];
|
||||
if (!profiloNull && i <3)
|
||||
tmp = getCodiceDescr((Vector) profili[i].get(type));
|
||||
}
|
||||
} else if (profiliSet.contains(type)) {
|
||||
System.out.println("TYPE: " + type);
|
||||
profilo = getCodiceDescr((Vector) profili[0].get(type));
|
||||
} else {
|
||||
profiloTariffario = new String[] {"","","","","",""};
|
||||
throw new RuntimeException("Sistema Mittente sconosciuto : " + type);
|
||||
}
|
||||
return (String[]) (profiloTariffario = profilo).clone();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
Enumeration ens = profili[x].keys();
|
||||
while (ens.hasMoreElements()) {
|
||||
String s = (String) ens.nextElement();
|
||||
Vector ss = (Vector) profili[x].get(s);
|
||||
System.out.println(s);
|
||||
for (int i = 0; i < ss.size(); i++) {
|
||||
String[] sss = (String[])ss.elementAt(i);
|
||||
System.out.print("\t\t");
|
||||
for (int j = 0; j < sss.length; j++) {
|
||||
System.out.print("|" + sss[j] + "|\t");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 50; i++) {
|
||||
double r = Math.random();
|
||||
String sist = (r < 0.24) ? "MSP" : ((r < 0.48) ? "MSC" : ((r < 0.72) ? "BIT" : ((r < 0.9) ? "SID" : "XXX")));
|
||||
try {
|
||||
String[] s = nextProfiloTariffario(sist);
|
||||
System.out.print(sist);
|
||||
/*for (int j = 0; j < s.length; j++) {
|
||||
System.out.print("\t" + s[j]);
|
||||
}*/
|
||||
System.out.println("CODICE PROFILO :" + getCodiceProfilo()+"; DESCRIZIONE " + getDescrizioneProfilo());
|
||||
System.out.println("CODICE ACCORDO :" + getCodiceAccordo()+"; DESCRIZIONE " + getDescrizioneAccordo());
|
||||
System.out.println("CODICE OFFERTA :" + getCodiceOfferta()+"; DESCRIZIONE " + getDescrizioneOfferta());
|
||||
System.out.println();
|
||||
System.out.println(sist + "\t" + getCodiceProfilo() + "\t" + getDescrizioneProfilo() + "\t" + getCodiceOfferta() + "\t" + getDescrizioneOfferta() + "\t" + getCodiceAccordo() + "\t" + getDescrizioneAccordo());
|
||||
|
||||
} catch (Exception rte) {
|
||||
System.err.println(rte.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/SimConfFile.java
Normal file
30
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/SimConfFile.java
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package conf;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class SimConfFile {
|
||||
/**
|
||||
* Ritorna un'istanza della classe
|
||||
* @return PropertiesDefault
|
||||
*/
|
||||
public static JIniFile _instance =null;
|
||||
|
||||
|
||||
public static JIniFile getInstance() {
|
||||
if (_instance == null) {
|
||||
String filepath = System.getProperty("sim_conf_file","");
|
||||
_instance = new JIniFile(filepath);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
282
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/XMLProperties.java
Normal file
282
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/conf/XMLProperties.java
Normal file
@@ -0,0 +1,282 @@
|
||||
package conf;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import org.omg.Security.SecEstablishTrustPolicy;
|
||||
|
||||
public class XMLProperties {
|
||||
|
||||
static private String _URL = null;
|
||||
static private String _PATH_TEST = null;
|
||||
static private String _PATH_TEST_ACK = null;
|
||||
static private String _PATH_TEST_ATTIVAZIONE = null;
|
||||
static private String _PATH_TEST_ATTIVAZIONE_HOC = null;
|
||||
static private String _PATH_TEST_VALIDAZIONE = null;
|
||||
static private String _PATH_TEST_PORTING = null;
|
||||
static private String _PATH_TEST_PRESAINCARICO = null;
|
||||
static private String _PATH_TEST_ESPLETAMENTO = null;
|
||||
static private String _PATH_TEST_CESSAZIONE = null;
|
||||
static private String _PATH_TEST_TC = null;
|
||||
static private String _PATH_TEST_SBLOCCO_IMPORTO_TC = null;
|
||||
static private String _PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC = null;
|
||||
|
||||
static boolean INTERNAL_HTTPS_FLAG=false;
|
||||
static boolean INTERNAL_SSL_FLAG=false;
|
||||
static String SSL_KEYSTORE= null;
|
||||
static String SSL_PRIVATEKEY_ALIAS= null;
|
||||
static String SSL_PRIVATEKEY_ALIAS_PWD= null;
|
||||
|
||||
static XMLProperties _instance = null;
|
||||
private Vector _listaDirectory = new Vector();
|
||||
|
||||
/**
|
||||
* Carica il file di properties e crea le directory in cui scrivere i file
|
||||
*/
|
||||
private XMLProperties() {
|
||||
try {
|
||||
loadFileProperties();
|
||||
createDefaultDirectory();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritorna un'istanza della classe
|
||||
* @return PropertiesDefault
|
||||
*/
|
||||
public static XMLProperties getInstance() {
|
||||
if (_instance == null)
|
||||
_instance = new XMLProperties();
|
||||
|
||||
return _instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica il file di properties
|
||||
* @throws Exception
|
||||
*/
|
||||
private void loadFileProperties() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("XML");
|
||||
|
||||
set_URL(properties.getProperty("url"));
|
||||
set_PATH_TEST(properties.getProperty("test"));
|
||||
set_PATH_TEST_ACK(get_PATH_TEST() + "/" + properties.getProperty("nameDirAck"));
|
||||
set_PATH_TEST_ATTIVAZIONE(get_PATH_TEST() + "/" + properties.getProperty("nameDirAttivazione"));
|
||||
set_PATH_TEST_ATTIVAZIONE_HOC(get_PATH_TEST() + "/" + properties.getProperty("nameDirAttivazioneHOC"));
|
||||
set_PATH_TEST_PRESAINCARICO(get_PATH_TEST() + "/" + properties.getProperty("nameDirPresaincarico"));
|
||||
set_PATH_TEST_VALIDAZIONE(get_PATH_TEST() + "/" + properties.getProperty("nameDirValidazione"));
|
||||
set_PATH_TEST_ESPLETAMENTO(get_PATH_TEST() + "/" + properties.getProperty("nameDirEspletamento"));
|
||||
set_PATH_TEST_PORTING(get_PATH_TEST() + "/" + properties.getProperty("nameDirPorting"));
|
||||
set_PATH_TEST_CESSAZIONE(get_PATH_TEST() + "/" + properties.getProperty("nameDirCessazione"));
|
||||
set_PATH_TEST_TC(get_PATH_TEST() + "/" + properties.getProperty("nameDirTrasferimentoCredito"));
|
||||
set_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC(get_PATH_TEST() + "/" + properties.getProperty("nameDirSbloccoImporto"));
|
||||
set_PATH_TEST_SBLOCCO_IMPORTO_TC(get_PATH_TEST() + "/" + properties.getProperty("nameDirSbloccoCreditoAnomalo"));
|
||||
|
||||
setINTERNAL_HTTPS_FLAG( new Boolean(properties.getProperty("INTERNAL_HTTPS_FLAG")).booleanValue());
|
||||
setINTERNAL_SSL_FLAG( new Boolean(properties.getProperty("INTERNAL_SSL_FLAG")).booleanValue());
|
||||
setSSL_KEYSTORE( properties.getProperty("SSL_KEYSTORE"));
|
||||
setSSL_PRIVATEKEY_ALIAS( properties.getProperty("SSL_PRIVATEKEY_ALIAS"));
|
||||
setSSL_PRIVATEKEY_ALIAS_PWD( properties.getProperty("SSL_PRIVATEKEY_ALIAS_PWD"));
|
||||
|
||||
loadListaDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Carica la lista delle directory
|
||||
*/
|
||||
private void loadListaDirectory() {
|
||||
_listaDirectory.addElement(get_PATH_TEST());
|
||||
_listaDirectory.addElement(get_PATH_TEST_ACK());
|
||||
_listaDirectory.addElement(get_PATH_TEST_ATTIVAZIONE());
|
||||
_listaDirectory.addElement(get_PATH_TEST_ATTIVAZIONE_HOC());
|
||||
_listaDirectory.addElement(get_PATH_TEST_VALIDAZIONE());
|
||||
_listaDirectory.addElement(get_PATH_TEST_PORTING());
|
||||
_listaDirectory.addElement(get_PATH_TEST_PRESAINCARICO());
|
||||
_listaDirectory.addElement(get_PATH_TEST_ESPLETAMENTO());
|
||||
_listaDirectory.addElement(get_PATH_TEST_CESSAZIONE());
|
||||
_listaDirectory.addElement(get_PATH_TEST_TC());
|
||||
_listaDirectory.addElement(get_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC());
|
||||
_listaDirectory.addElement(get_PATH_TEST_SBLOCCO_IMPORTO_TC());
|
||||
}
|
||||
|
||||
/**()
|
||||
* Crea le directory in cui salvare i file creati
|
||||
*/
|
||||
private void createDefaultDirectory() {
|
||||
for (int i = 0; i < _listaDirectory.size(); i++) {
|
||||
String nameDir = (String) _listaDirectory.elementAt(i);
|
||||
if (! (new File(nameDir).exists())) {
|
||||
boolean success = new File(nameDir).mkdir();
|
||||
if (!success)
|
||||
System.out.println("Errore nella creazione della directory: " + nameDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void set_PATH_TEST_ACK(String _PATH_TEST_ACK) {
|
||||
this._PATH_TEST_ACK = _PATH_TEST_ACK;
|
||||
}
|
||||
public String get_PATH_TEST_ATTIVAZIONE() {
|
||||
return _PATH_TEST_ATTIVAZIONE;
|
||||
}
|
||||
public void set_PATH_TEST_ATTIVAZIONE(String _PATH_TEST_ATTIVAZIONE) {
|
||||
this._PATH_TEST_ATTIVAZIONE = _PATH_TEST_ATTIVAZIONE;
|
||||
}
|
||||
public String get_PATH_TEST_ATTIVAZIONE_HOC() {
|
||||
return _PATH_TEST_ATTIVAZIONE_HOC;
|
||||
}
|
||||
public void set_PATH_TEST_ATTIVAZIONE_HOC(String _PATH_TEST_ATTIVAZIONE_HOC) {
|
||||
this._PATH_TEST_ATTIVAZIONE_HOC = _PATH_TEST_ATTIVAZIONE_HOC;
|
||||
}
|
||||
public String get_PATH_TEST_CESSAZIONE() {
|
||||
return _PATH_TEST_CESSAZIONE;
|
||||
}
|
||||
public void set_PATH_TEST_CESSAZIONE(String _PATH_TEST_CESSAZIONE) {
|
||||
this._PATH_TEST_CESSAZIONE = _PATH_TEST_CESSAZIONE;
|
||||
}
|
||||
public String get_PATH_TEST_ESPLETAMENTO() {
|
||||
return _PATH_TEST_ESPLETAMENTO;
|
||||
}
|
||||
public void set_PATH_TEST_ESPLETAMENTO(String _PATH_TEST_ESPLETAMENTO) {
|
||||
this._PATH_TEST_ESPLETAMENTO = _PATH_TEST_ESPLETAMENTO;
|
||||
}
|
||||
public String get_PATH_TEST_PORTING() {
|
||||
return _PATH_TEST_PORTING;
|
||||
}
|
||||
public void set_PATH_TEST_PORTING(String _PATH_TEST_PORTING) {
|
||||
this._PATH_TEST_PORTING = _PATH_TEST_PORTING;
|
||||
}
|
||||
public String get_PATH_TEST_PRESAINCARICO() {
|
||||
return _PATH_TEST_PRESAINCARICO;
|
||||
}
|
||||
public void set_PATH_TEST_PRESAINCARICO(String _PATH_TEST_PRESAINCARICO) {
|
||||
this._PATH_TEST_PRESAINCARICO = _PATH_TEST_PRESAINCARICO;
|
||||
}
|
||||
public String get_PATH_TEST_VALIDAZIONE() {
|
||||
return _PATH_TEST_VALIDAZIONE;
|
||||
}
|
||||
public void set_PATH_TEST_VALIDAZIONE(String _PATH_TEST_VALIDAZIONE) {
|
||||
this._PATH_TEST_VALIDAZIONE = _PATH_TEST_VALIDAZIONE;
|
||||
}
|
||||
public String get_URL() {
|
||||
return _URL;
|
||||
}
|
||||
public void set_URL(String _URL) {
|
||||
this._URL = _URL;
|
||||
}
|
||||
public String get_PATH_TEST() {
|
||||
return _PATH_TEST;
|
||||
}
|
||||
public void set_PATH_TEST(String _PATH_TEST) {
|
||||
this._PATH_TEST = _PATH_TEST;
|
||||
}
|
||||
public String get_PATH_TEST_ACK() {
|
||||
return _PATH_TEST_ACK;
|
||||
}
|
||||
/**
|
||||
* @return Returns the iNTERNAL_HTTPS_FLAG.
|
||||
*/
|
||||
public static boolean isINTERNAL_HTTPS_FLAG() {
|
||||
return INTERNAL_HTTPS_FLAG;
|
||||
}
|
||||
/**
|
||||
* @param internal_https_flag The iNTERNAL_HTTPS_FLAG to set.
|
||||
*/
|
||||
public static void setINTERNAL_HTTPS_FLAG(boolean internal_https_flag) {
|
||||
INTERNAL_HTTPS_FLAG = internal_https_flag;
|
||||
}
|
||||
/**
|
||||
* @return Returns the iNTERNAL_SSL_FLAG.
|
||||
*/
|
||||
public static boolean isINTERNAL_SSL_FLAG() {
|
||||
return INTERNAL_SSL_FLAG;
|
||||
}
|
||||
/**
|
||||
* @param internal_ssl_flag The iNTERNAL_SSL_FLAG to set.
|
||||
*/
|
||||
public static void setINTERNAL_SSL_FLAG(boolean internal_ssl_flag) {
|
||||
INTERNAL_SSL_FLAG = internal_ssl_flag;
|
||||
}
|
||||
/**
|
||||
* @return Returns the sSL_KEYSTORE.
|
||||
*/
|
||||
public static String getSSL_KEYSTORE() {
|
||||
return SSL_KEYSTORE;
|
||||
}
|
||||
/**
|
||||
* @param ssl_keystore The sSL_KEYSTORE to set.
|
||||
*/
|
||||
public static void setSSL_KEYSTORE(String ssl_keystore) {
|
||||
SSL_KEYSTORE = ssl_keystore;
|
||||
}
|
||||
/**
|
||||
* @return Returns the sSL_PRIVATEKEY_ALIAS.
|
||||
*/
|
||||
public static String getSSL_PRIVATEKEY_ALIAS() {
|
||||
return SSL_PRIVATEKEY_ALIAS;
|
||||
}
|
||||
/**
|
||||
* @param ssl_privatekey_alias The sSL_PRIVATEKEY_ALIAS to set.
|
||||
*/
|
||||
public static void setSSL_PRIVATEKEY_ALIAS(String ssl_privatekey_alias) {
|
||||
SSL_PRIVATEKEY_ALIAS = ssl_privatekey_alias;
|
||||
}
|
||||
/**
|
||||
* @return Returns the sSL_PRIVATEKEY_ALIAS_PWD.
|
||||
*/
|
||||
public static String getSSL_PRIVATEKEY_ALIAS_PWD() {
|
||||
return SSL_PRIVATEKEY_ALIAS_PWD;
|
||||
}
|
||||
/**
|
||||
* @param ssl_privatekey_alias_pwd The sSL_PRIVATEKEY_ALIAS_PWD to set.
|
||||
*/
|
||||
public static void setSSL_PRIVATEKEY_ALIAS_PWD(String ssl_privatekey_alias_pwd) {
|
||||
SSL_PRIVATEKEY_ALIAS_PWD = ssl_privatekey_alias_pwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the _PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC
|
||||
*/
|
||||
public String get_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC() {
|
||||
return _PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _path_test_sblocco_credito_anomalo_tc the _PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC to set
|
||||
*/
|
||||
public void set_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC(String _path_test_sblocco_credito_anomalo_tc) {
|
||||
_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC = _path_test_sblocco_credito_anomalo_tc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the _PATH_TEST_SBLOCCO_IMPORTO_TC
|
||||
*/
|
||||
public String get_PATH_TEST_SBLOCCO_IMPORTO_TC() {
|
||||
return _PATH_TEST_SBLOCCO_IMPORTO_TC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _path_test_sblocco_importo_tc the _PATH_TEST_SBLOCCO_IMPORTO_TC to set
|
||||
*/
|
||||
public void set_PATH_TEST_SBLOCCO_IMPORTO_TC(String _path_test_sblocco_importo_tc) {
|
||||
_PATH_TEST_SBLOCCO_IMPORTO_TC = _path_test_sblocco_importo_tc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the _PATH_TEST_TC
|
||||
*/
|
||||
public String get_PATH_TEST_TC() {
|
||||
return _PATH_TEST_TC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _path_test_tc the _PATH_TEST_TC to set
|
||||
*/
|
||||
public void set_PATH_TEST_TC(String _path_test_tc) {
|
||||
_PATH_TEST_TC = _path_test_tc;
|
||||
}
|
||||
}
|
||||
2758
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/db/ManagerDAO.java
Normal file
2758
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/db/ManagerDAO.java
Normal file
File diff suppressed because it is too large
Load Diff
50
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/infobus/IBHZClient.java
Normal file
50
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/infobus/IBHZClient.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package infobus;
|
||||
|
||||
import java.util.Properties;
|
||||
import conf.SimConfFile;
|
||||
import mnp.proxy.hzService.HZServiceHome;
|
||||
import javax.rmi.PortableRemoteObject;
|
||||
import utility.JndiUtility;
|
||||
import mnp.proxy.hzService.HZService;
|
||||
import tim.infobus.data.IBData;
|
||||
import obj.SystemMap;
|
||||
import tim.infobus.data.TID;
|
||||
|
||||
public class IBHZClient {
|
||||
|
||||
private static final String JNDI_NAME_HZSERVICE = "jndiname_hzService";
|
||||
|
||||
protected static Properties propIn = SimConfFile.getInstance().ReadSection(
|
||||
"InfobusIN");
|
||||
|
||||
public IBHZClient() {
|
||||
}
|
||||
|
||||
public void sendCRMCRequest(String tracciato, int system) throws Exception {
|
||||
System.out.println("Invio Tracciato: ");
|
||||
System.out.println(tracciato);
|
||||
HZServiceHome hzServiceHome = (HZServiceHome) PortableRemoteObject.
|
||||
narrow(JndiUtility.getHome(propIn.getProperty(JNDI_NAME_HZSERVICE)),
|
||||
HZServiceHome.class);
|
||||
HZService service = hzServiceHome.create();
|
||||
service.richiestaNPF2M(createIBData(system, tracciato));
|
||||
}
|
||||
|
||||
|
||||
private IBData createIBData(int system, String tracciato) throws
|
||||
Exception {
|
||||
|
||||
IBData ibData = new IBData();
|
||||
TID tid = new TID();
|
||||
|
||||
byte[] bDati = tracciato.getBytes();
|
||||
ibData.setData(bDati);
|
||||
ibData.setTID(tid);
|
||||
ibData.setService("richiestaNPF2M");
|
||||
ibData.setSystem(SystemMap.getSystemFromSimValue(system));
|
||||
|
||||
return ibData;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package mnp.database.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import mnp.objects.dao.RichiestaHZ;
|
||||
|
||||
public class HZGestioneRichiestaDAO
|
||||
extends SimBaseDAO {
|
||||
|
||||
public HZGestioneRichiestaDAO() {
|
||||
}
|
||||
|
||||
private static final String HZ_GESTIONE_RICHIESTA_TABLE =
|
||||
"HZ_GESTIONE_RICHIESTA";
|
||||
|
||||
private static final String HZ_RGN_DISTRETTO_AGW = "HZ_RGN_DISTRETTO_AGW";
|
||||
|
||||
private final String getGestioneRichiestaByStato = new StringBuffer().append(
|
||||
"SELECT * FROM ")
|
||||
.append(HZ_GESTIONE_RICHIESTA_TABLE).append(" WHERE STATO = ?").toString();
|
||||
|
||||
private final String getRandomDistretto = new StringBuffer().append(
|
||||
"SELECT distretto FROM ")
|
||||
.append("( SELECT distretto FROM ").append(HZ_RGN_DISTRETTO_AGW)
|
||||
.append(" ORDER BY dbms_random.value )").toString();
|
||||
|
||||
/**
|
||||
* Ritorna tutti i distretti ordinati in modo casuale
|
||||
*
|
||||
* @throws SQLException
|
||||
* @throws Exception
|
||||
* @return List di String
|
||||
*/
|
||||
public List getPrefix() throws SQLException,
|
||||
Exception {
|
||||
|
||||
List prefisso = new ArrayList();
|
||||
Connection conn = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
conn = getConnection();
|
||||
pstmt = conn.prepareStatement(getRandomDistretto);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
prefisso.add("0" + rs.getString("DISTRETTO"));
|
||||
}
|
||||
return prefisso;
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
throw sqle;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw ex;
|
||||
}
|
||||
finally {
|
||||
closeAll(null, pstmt, conn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritorna tutte le richieste che si trovano in un determinato stato
|
||||
*
|
||||
* @param stato int
|
||||
* @throws SQLException
|
||||
* @throws Exception
|
||||
* @return List di RichiestaHZ
|
||||
*/
|
||||
public List getGestioneRichiestaByStato(int stato, String richieste) throws
|
||||
SQLException,
|
||||
Exception {
|
||||
|
||||
List gestioneRichiestaList = null;
|
||||
Connection conn = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
conn = getConnection();
|
||||
if (richieste == null) {
|
||||
pstmt = conn.prepareStatement(getGestioneRichiestaByStato);
|
||||
}
|
||||
else {
|
||||
pstmt = conn.prepareStatement(getGestioneRichiestaByStato +
|
||||
" AND ROWNUM <= " +
|
||||
Integer.parseInt(richieste));
|
||||
}
|
||||
|
||||
pstmt.setInt(1, stato);
|
||||
|
||||
rs = pstmt.executeQuery();
|
||||
gestioneRichiestaList = createRichiestaHZ(rs);
|
||||
return gestioneRichiestaList;
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
throw sqle;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw ex;
|
||||
}
|
||||
finally {
|
||||
closeAll(null, pstmt, conn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea una lista di oggetti RichiestaHZ
|
||||
*
|
||||
* @param rs ResultSet
|
||||
* @throws SQLException
|
||||
* @throws Exception
|
||||
* @return List di RichiestaHZ
|
||||
*/
|
||||
private List createRichiestaHZ(ResultSet rs) throws SQLException, Exception {
|
||||
List richiestaHZList = new ArrayList();
|
||||
RichiestaHZ richiestaHZ = null;
|
||||
while (rs.next()) {
|
||||
richiestaHZ = new RichiestaHZ();
|
||||
richiestaHZ.setCausaleRifiuto(rs.getString("CAUSALE_RIFIUTO"));
|
||||
richiestaHZ.setCessazioneRientro(rs.getInt("CESSAZIONE_RIENTRO"));
|
||||
richiestaHZ.setCodiceComune(rs.getString("CODICE_COMUNE"));
|
||||
richiestaHZ.setCodiceFiscalePartitaIva(rs.getString("CF_PARTITA_IVA"));
|
||||
richiestaHZ.setCognomeCliente(rs.getString("COGNOME_CLIENTE"));
|
||||
richiestaHZ.setDac(rs.getDate("DAC"));
|
||||
richiestaHZ.setDacCalc(rs.getDate("DAC_CALC"));
|
||||
richiestaHZ.setDaInviare(rs.getInt("DA_INVIARE"));
|
||||
richiestaHZ.setDataRicezioneRichiesta(rs.getDate("DATA_RICEZIONE_RICHIESTA"));
|
||||
richiestaHZ.setDenominazioneSociale(rs.getString("DENOMINAZIONE_SOCIALE"));
|
||||
richiestaHZ.setDirectoryNumber(rs.getString("DIRECTORY_NUMBER"));
|
||||
richiestaHZ.setIdRichiesta(new Long(rs.getLong("ID_RICHIESTA")));
|
||||
richiestaHZ.setLocalita(rs.getString("LOCALITA"));
|
||||
richiestaHZ.setMsisdn(rs.getString("MSISDN"));
|
||||
richiestaHZ.setNomeCliente(rs.getString("NOME_CLIENTE"));
|
||||
richiestaHZ.setNote(rs.getString("NOTE"));
|
||||
richiestaHZ.setNumeroCivico(rs.getString("NUMERO_CIVICO"));
|
||||
richiestaHZ.setRgn(rs.getString("RGN"));
|
||||
richiestaHZ.setSistemaMittente(rs.getString("SISTEMA_MITTENTE"));
|
||||
richiestaHZ.setStato(rs.getInt("STATO"));
|
||||
richiestaHZ.setSubsys(rs.getString("SUBSYS"));
|
||||
richiestaHZ.setTipoProcesso(rs.getString("TIPO_PROCESSO"));
|
||||
richiestaHZ.setVia(rs.getString("VIA"));
|
||||
richiestaHZ.setIdReqInfobus(rs.getString("ID_REQ_INFOBUS"));
|
||||
richiestaHZList.add(richiestaHZ);
|
||||
}
|
||||
return richiestaHZList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Created on Feb 23, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package mnp.database.dao;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.naming.InitialContext;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import conf.SimConfFile;
|
||||
|
||||
import mnp.utility.Params;
|
||||
import mnp.utility.Resources;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public abstract class SimBaseDAO {
|
||||
|
||||
protected DataSource ds;
|
||||
protected InitialContext ctx;
|
||||
protected String DATASOURCE = Resources.getDATA_SOURCE();
|
||||
private Connection conn;
|
||||
private Params params;
|
||||
|
||||
/**
|
||||
* Inizializza il data source
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void initDB() throws Exception{
|
||||
try
|
||||
{
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
|
||||
|
||||
System.out.println("java.naming.factory.initial: " + properties.getProperty("java.naming.factory.initial"));
|
||||
System.out.println("java.naming.provider.url: " + properties.getProperty("java.naming.provider.url"));
|
||||
System.out.println("java.naming.security.principal: " + properties.getProperty("java.naming.security.principal"));
|
||||
System.out.println("java.naming.security.credentials: " + properties.getProperty("java.naming.security.credentials"));
|
||||
System.out.println("datasource.name: " + properties.getProperty("datasource.name"));
|
||||
System.out.println("Getting initial context.. ");
|
||||
|
||||
ctx = new InitialContext(properties);
|
||||
System.out.println("Getting initial context.. OK");
|
||||
|
||||
String dsName = properties.getProperty("datasource.name");
|
||||
System.out.println("Getting datasource name: " + dsName + " ..");
|
||||
|
||||
ds = (DataSource) ctx.lookup(properties.getProperty("datasource.name"));
|
||||
System.out.println("Getting datasource name: " + dsName + " .. OK");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
ctx.close();
|
||||
}
|
||||
catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Metodo per ottenere le connessioni dal DB
|
||||
* Se non <20> disponibile una connessione ritorna null
|
||||
*/
|
||||
public Connection getConnection() throws Exception{
|
||||
Connection conn = null;
|
||||
try
|
||||
{
|
||||
if (ds==null) initDB();
|
||||
conn = ds.getConnection();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if( conn != null ) conn.setAutoCommit(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
// se non riesce ad ottenere una connessione per tre volte torna null
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Metodo per la chiusura del ResultSet,dello Statement e della Connection
|
||||
* tale metodo non lancia eccezioni
|
||||
* @param rs
|
||||
* @param stmt
|
||||
* @param c
|
||||
*/
|
||||
public void closeAll(ResultSet rs, Statement stmt, Connection c) {
|
||||
try
|
||||
{
|
||||
if(rs!=null) rs.close();
|
||||
}
|
||||
catch (Throwable ex) {}
|
||||
try
|
||||
{
|
||||
if(stmt!=null) stmt.close();
|
||||
}
|
||||
catch (Throwable ex) {}
|
||||
try
|
||||
{
|
||||
if(c!=null)
|
||||
c.close();
|
||||
}
|
||||
catch (Throwable ex) {}
|
||||
}
|
||||
|
||||
// ******************************************************
|
||||
// *****UTILITA' PER PAGINAZIONE ************************
|
||||
// ******************************************************
|
||||
protected int getRow_page_limit(int page, int row_per_page) throws Exception {
|
||||
if(page<=0) page=1;
|
||||
int skipRecords = row_per_page*(page-1);
|
||||
int row_page_limit = skipRecords + row_per_page;
|
||||
return row_page_limit;
|
||||
}
|
||||
|
||||
protected int getMaxPage(int totRow, int rows_per_page) {
|
||||
int pages = -1;
|
||||
try {
|
||||
pages = totRow/rows_per_page;
|
||||
int resto = totRow%rows_per_page;
|
||||
if(resto!=0) pages++;
|
||||
if(pages==0) pages = 1;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
}
|
||||
finally {
|
||||
return pages;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
//SimBaseDAO baseDAO1 = new SimBaseDAO();
|
||||
}
|
||||
}
|
||||
25
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/FieldDbMap.java
Normal file
25
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/FieldDbMap.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package obj;
|
||||
|
||||
/**
|
||||
* @author Carmelo
|
||||
*
|
||||
*/
|
||||
public class FieldDbMap {
|
||||
|
||||
public static final String MSISDN = "MSISDN";
|
||||
public static final String CODICE_GRUPPO = "CODICE_GRUPPO";
|
||||
public static final String ID_RICHIESTA = "ID_RICHIESTA";
|
||||
public static final String CODICE_OPERATORE_DON_EFF = "CODICE_OPERATORE_DON_EFF";
|
||||
public static final String CODICE_OPERATORE_REC_EFF = "CODICE_OPERATORE_REC_EFF";
|
||||
public static final String CODICE_OPERATORE_RECIPIENT = "CODICE_OPERATORE_RECIPIENT";
|
||||
public static final String CODICE_OPERATORE_DONATING = "CODICE_OPERATORE_DONATING";
|
||||
public static final String DATA_CUT_OVER_CALC = "DATA_CUT_OVER_CALC";
|
||||
public static final String ORA_CUT_OVER = "ORA_CUT_OVER";
|
||||
public static final String FLAG_TC = "FLAG_TC";
|
||||
public static final String ADDIZIONALE_1 = "ADDIZIONALE_1";
|
||||
public static final String ADDIZIONALE_2 = "ADDIZIONALE_2";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package obj;
|
||||
|
||||
public class NotificaCrmcStatoPort {
|
||||
|
||||
private String System;
|
||||
private String Service;
|
||||
private String Tid;
|
||||
private String ReturnCode;
|
||||
private String ErrorDescription;
|
||||
private String OperationCode;
|
||||
private String MessageId;
|
||||
private String MessageType;
|
||||
private String IntObjectName;
|
||||
private String IntObjectFormat;
|
||||
private String OperationType;
|
||||
|
||||
public String getSystem() {
|
||||
return System;
|
||||
}
|
||||
public void setSystem(String system) {
|
||||
System = system;
|
||||
}
|
||||
public String getService() {
|
||||
return Service;
|
||||
}
|
||||
public void setService(String service) {
|
||||
Service = service;
|
||||
}
|
||||
public String getTid() {
|
||||
return Tid;
|
||||
}
|
||||
public void setTid(String tid) {
|
||||
Tid = tid;
|
||||
}
|
||||
public String getReturnCode() {
|
||||
return ReturnCode;
|
||||
}
|
||||
public void setReturnCode(String returnCode) {
|
||||
ReturnCode = returnCode;
|
||||
}
|
||||
public String getErrorDescription() {
|
||||
return ErrorDescription;
|
||||
}
|
||||
public void setErrorDescription(String errorDescription) {
|
||||
ErrorDescription = errorDescription;
|
||||
}
|
||||
public String getOperationCode() {
|
||||
return OperationCode;
|
||||
}
|
||||
public void setOperationCode(String operationCode) {
|
||||
OperationCode = operationCode;
|
||||
}
|
||||
public String getMessageId() {
|
||||
return MessageId;
|
||||
}
|
||||
public void setMessageId(String messageId) {
|
||||
MessageId = messageId;
|
||||
}
|
||||
public String getMessageType() {
|
||||
return MessageType;
|
||||
}
|
||||
public void setMessageType(String messageType) {
|
||||
MessageType = messageType;
|
||||
}
|
||||
public String getIntObjectName() {
|
||||
return IntObjectName;
|
||||
}
|
||||
public void setIntObjectName(String intObjectName) {
|
||||
IntObjectName = intObjectName;
|
||||
}
|
||||
public String getIntObjectFormat() {
|
||||
return IntObjectFormat;
|
||||
}
|
||||
public void setIntObjectFormat(String intObjectFormat) {
|
||||
IntObjectFormat = intObjectFormat;
|
||||
}
|
||||
public String getOperationType() {
|
||||
return OperationType;
|
||||
}
|
||||
public void setOperationType(String operationType) {
|
||||
OperationType = operationType;
|
||||
}
|
||||
}
|
||||
77
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/StatoMap.java
Normal file
77
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/StatoMap.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package obj;
|
||||
|
||||
public class StatoMap {
|
||||
|
||||
public static final int IN_CARICO = 2;
|
||||
public static final int ACCETTATA = 3;
|
||||
public static final int ESPLETATA = 5;
|
||||
|
||||
private StatoMap() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritorna lo stato
|
||||
*
|
||||
* @param stato String
|
||||
* @return int
|
||||
*/
|
||||
public static int getStato(String stato){
|
||||
if ("2".equals(stato))
|
||||
return StatoMap.IN_CARICO;
|
||||
if ("3".equals(stato))
|
||||
return StatoMap.ACCETTATA;
|
||||
if ("5".equals(stato))
|
||||
return StatoMap.ESPLETATA;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se lo stato inserito sia valido
|
||||
*
|
||||
* @param stato String[]
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean validateStato(String[] stato){
|
||||
|
||||
for (int i = 0; i < stato.length; i=i+2){
|
||||
if (stato[i] != null && i != 6)
|
||||
if (getStato(stato[i]) == -1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se lo stato inserito sia valido
|
||||
*
|
||||
* @param esito String[]
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean validateEsito(String[] esito){
|
||||
for (int i = 1; i < 7; i=i+2){
|
||||
if (esito[i] != null)
|
||||
if (!"ok".equalsIgnoreCase(esito[i]) && !"ko".equalsIgnoreCase(esito[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se la corrispondenza stato/esita sia valida
|
||||
*
|
||||
* @param args String[]
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean validateStatoEsito(String[] args){
|
||||
for (int i = 0; i < args.length; i=i+2){
|
||||
if (i == 6)
|
||||
return true;
|
||||
if (args[i] == null && args[i+1] != null)
|
||||
return false;
|
||||
if (args[i] != null && args[i+1] == null)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
46
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/SystemMap.java
Normal file
46
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/SystemMap.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package obj;
|
||||
|
||||
public class SystemMap {
|
||||
|
||||
public static final int SISTEMA_MSC = 1;
|
||||
public static final int SISTEMA_CRMC_FE = 2;
|
||||
public static final int SISTEMA_BIT = 3;
|
||||
public static final int SISTEMA_GISP = 4;
|
||||
public static final int SISTEMA_DBCFX = 5;
|
||||
|
||||
public static final String DESC_MSC = "MSC";
|
||||
public static final String DESC_MSP = "MSP";
|
||||
public static final String DESC_BIT = "BIT";
|
||||
public static final String DESC_GISP = "GISP";
|
||||
public static final String DESC_DBCFX = "DBCFX";
|
||||
private SystemMap() {
|
||||
}
|
||||
|
||||
public static String getSystemFromSimValue(int sys) throws Exception {
|
||||
|
||||
String result = null;
|
||||
switch (sys) {
|
||||
|
||||
case SISTEMA_MSC:
|
||||
result = DESC_MSC;
|
||||
break;
|
||||
case SISTEMA_CRMC_FE:
|
||||
result = DESC_MSP;
|
||||
break;
|
||||
case SISTEMA_BIT:
|
||||
result = DESC_BIT;
|
||||
break;
|
||||
case SISTEMA_GISP:
|
||||
result = DESC_GISP;
|
||||
break;
|
||||
case SISTEMA_DBCFX:
|
||||
result = DESC_DBCFX;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Sistema sconociuto");
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
49
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/TipoFlusso.java
Normal file
49
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/obj/TipoFlusso.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package obj;
|
||||
|
||||
public class TipoFlusso {
|
||||
|
||||
/**
|
||||
* Flusso Asincrono di Attivazione (Recipient MVNO, Recipient Virtuale)
|
||||
*/
|
||||
public static final String ATTIVAZIONE = "ATTIVAZIONE";
|
||||
/**
|
||||
* Flusso Asincrono di Validazione (Donor Mvno, Donor Virtuale)
|
||||
*/
|
||||
public static final String VALIDAZIONE = "VALIDAZIONE";
|
||||
/**
|
||||
* Risposta di Attivazione su Rete (Recipient MVNO, Recipient Virtuale)
|
||||
*/
|
||||
public static final String RISP_ATTIVAZIONE = "RISP_ATTIVAZIONE";
|
||||
/**
|
||||
* Risposta di Cessazione su Rete (Donor Mvno)
|
||||
*/
|
||||
public static final String RISP_CESSAZIONE = "RISP_CESSAZIONE";
|
||||
/**
|
||||
* Notifica di Cessazione su Rete (Donor Virtuale, Recipient Virtuale)
|
||||
*/
|
||||
public static final String NOT_CESSAZIONE = "NOT_CESSAZIONE";
|
||||
/**
|
||||
* Notifica di Attivazione su Rete (Donor Virtuale)
|
||||
*/
|
||||
public static final String NOT_ATTIVAZIONE = "NOT_ATTIVAZIONE";
|
||||
/**
|
||||
* Notifica di trasferimento credito da MVNO
|
||||
*/
|
||||
public static final String NOTIFICA_MVNO_TC = "MVNO_TC";
|
||||
/**
|
||||
* Notifica di trasferimento credito da MSP
|
||||
*/
|
||||
public static final String NOTIFICA_MSP_TC = "MSP_TC";
|
||||
/**
|
||||
* Notifica di di trasferimento credito da MSP COOP
|
||||
*/
|
||||
public static final String NOTIFICA_MSPCOOP_TC = "MSPCOOP_TC";
|
||||
/**
|
||||
* Update DCO donor pjhoc MVNO
|
||||
*/
|
||||
public static final String UPDATEDCO_MVNO = "UPDATEDCO_MVNO";
|
||||
|
||||
private TipoFlusso(){}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package proxy.jms;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jms.*;
|
||||
import javax.naming.InitialContext;
|
||||
import tim.infobus.data.TID;
|
||||
import javax.naming.Context;
|
||||
|
||||
import obj.TipoFlusso;
|
||||
|
||||
import conf.SimConfFile;
|
||||
|
||||
public class MessageHandler {
|
||||
|
||||
private static MessageHandler onlyInstance = new MessageHandler();
|
||||
|
||||
private static final String JMS_FACTORY = "jms/ConnectionFactory";
|
||||
|
||||
private static final String GISP_SYSTEM = "GISP";
|
||||
private static final String GISP_ATT_SERVICE = "esitoRichiesta";
|
||||
private static final String GISP_CESS_SERVICE = "esitoRichiesta";
|
||||
private static final String GISP_NOTIFICA_IN_SERVICE = "notificaEventoGISP";
|
||||
private static final String GISP_QUEUE_NAME = "jms/GispAcqServiceQueue";
|
||||
private static final String TISCALI_QUEUE_NAME = "jms/MVNOAcqServiceQueue";
|
||||
private static final String TRCS_QUEUE_NAME = "jms/TRCSAcqServiceQueue";
|
||||
private static final String TISCALI_SYSTEM = "MVNO";
|
||||
private static final String TISCALI_VAL_SERVICE = "notifyValidationDonor";
|
||||
private static final String TISCALI_ACQ_SERVICE = "requestPortingInRecipient";
|
||||
private static final String MVNO_UPDATEDCO = "updateDcoDonor";
|
||||
private static final String CREDIT_TRANSFER_DONOR_MVNO = "notifyCreditTransferDonor";
|
||||
private static final String MSP_IN_QUEUE_NAME = "jms/MSPAcqServiceQueue";
|
||||
private static final String MSP_SYSTEM = "MSP";
|
||||
private static final String CREDIT_TRANSFER_MSP = "notifyCreditTransferDonorTIM";
|
||||
private static final String MSP_COOP_IN_QUEUE_NAME = "jms/MSPCOOPAcqServiceQueue";
|
||||
private static final String MSP_COOP_SYSTEM = "MSPCOOP";
|
||||
private static final String CREDIT_TRANSFER_MSP_COOP = "notifyCreditTransferDonorESP";
|
||||
|
||||
public static final String QUEUE_NAME = "QUEUE_NAME";
|
||||
public static final String ID_SYSTEM = "ID_SYSTEM";
|
||||
public static final String ID_SERVICE = "ID_SERVICE";
|
||||
|
||||
private MessageHandler() {}
|
||||
|
||||
public static MessageHandler getInstance() {
|
||||
return onlyInstance;
|
||||
}
|
||||
/**
|
||||
* invia un messagge a DBC
|
||||
*
|
||||
* @param xmlResponse String
|
||||
*/
|
||||
public void sendMessage(String xml, String queueName, String system, String service)
|
||||
throws JMSException, Exception {
|
||||
|
||||
QueueConnection qcon = null;
|
||||
QueueSession qsession = null;
|
||||
QueueSender qsender = null;
|
||||
QueueConnectionFactory qconFactory = null;
|
||||
Queue q = null;
|
||||
BytesMessage message = null;
|
||||
Context initialcontext = null;
|
||||
TID tid = null;
|
||||
|
||||
try {
|
||||
|
||||
tid = new TID();
|
||||
|
||||
|
||||
initialcontext = getInitialContext();
|
||||
|
||||
// ottengo la jms factory
|
||||
qconFactory = (QueueConnectionFactory) initialcontext.lookup(JMS_FACTORY);
|
||||
|
||||
// Creo connessione fisica a JMS
|
||||
qcon = qconFactory.createQueueConnection();
|
||||
|
||||
//creo la sessione
|
||||
qsession = qcon.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
|
||||
// Ottengo il riferimento alla coda
|
||||
q = (Queue) initialcontext.lookup(queueName);
|
||||
|
||||
//creo il sender
|
||||
qsender = qsession.createSender(q);
|
||||
|
||||
message = qsession.createBytesMessage();
|
||||
System.out.println("Creato il messaggio");
|
||||
message.writeBytes(xml.getBytes());
|
||||
message.setJMSCorrelationID(tid.toString());
|
||||
message.setStringProperty("TID", tid.toString());
|
||||
message.setStringProperty("SERVICE", service);
|
||||
message.setStringProperty("SYSTEM", system);
|
||||
qsender.send(message);
|
||||
System.out.println("Inviato il messaggio");
|
||||
|
||||
closeAll(qcon, qsession, qsender, initialcontext);
|
||||
|
||||
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
System.out.println("Problemi nell'invio del messaggio");
|
||||
throw ex;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println("Problemi nell'invio del messaggio");
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInitialContext
|
||||
*
|
||||
* @return InitialContext
|
||||
*/
|
||||
private Context getInitialContext() throws Exception {
|
||||
String user = "";
|
||||
String password = "";
|
||||
|
||||
try {
|
||||
Properties env = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
Properties properties = new Properties();
|
||||
properties.put(Context.INITIAL_CONTEXT_FACTORY,
|
||||
env.getProperty("java.naming.factory.initial"));
|
||||
properties.put(Context.PROVIDER_URL, env.getProperty("java.naming.provider.url"));
|
||||
user = env.getProperty("java.naming.security.principal");
|
||||
password = env.getProperty("java.naming.security.credentials");
|
||||
|
||||
if ( (user != null) && (!user.equals(""))) {
|
||||
properties.put(Context.SECURITY_PRINCIPAL, user);
|
||||
properties.put(Context.SECURITY_CREDENTIALS,
|
||||
password == null ? "" : password);
|
||||
}
|
||||
return new InitialContext(properties);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// System.out.println("I parametri di configurazione del Context sono : \n");
|
||||
// System.out.println("context.factory : [" +
|
||||
// Resources.getWLServerContextFactory() + "]");
|
||||
// System.out.println("url : [" + Resources.getWLServerDbcUrl() + "]");
|
||||
// System.out.println("user [" + user + "]");
|
||||
//System.out.println("password [" +password+"]");
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* chiude initialcontext, sender,sessione,connection
|
||||
*
|
||||
* @param qcon QueueConnection
|
||||
* @param qsession QueueSession
|
||||
* @param qsender QueueSender
|
||||
*/
|
||||
private static void closeAll(QueueConnection qcon, QueueSession qsession,
|
||||
QueueSender qsender, Context initialcontext) {
|
||||
|
||||
try {
|
||||
initialcontext.close();
|
||||
qsender.close();
|
||||
qsession.close();
|
||||
qcon.close();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.out.println("Problemi nella chiusura dei servizi JMS");
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritorna la mappa dei parametri di comunicazione a partire dal tipo
|
||||
* flusso. Le chiavi sono: QUEUE_NAME, ID_SYSTEM, ID_SERVICE
|
||||
* @param flowType
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Map getParams(String flowType) throws Exception {
|
||||
|
||||
Map params;
|
||||
|
||||
if (flowType.equals(TipoFlusso.ATTIVAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, TISCALI_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, TISCALI_SYSTEM);
|
||||
params.put(ID_SERVICE, TISCALI_ACQ_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.VALIDAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, TISCALI_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, TISCALI_SYSTEM);
|
||||
params.put(ID_SERVICE, TISCALI_VAL_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.RISP_ATTIVAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, GISP_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, GISP_SYSTEM);
|
||||
params.put(ID_SERVICE, GISP_ATT_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.RISP_CESSAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, GISP_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, GISP_SYSTEM);
|
||||
params.put(ID_SERVICE, GISP_CESS_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.NOT_ATTIVAZIONE)
|
||||
|| flowType.equals(TipoFlusso.NOT_CESSAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, GISP_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, GISP_SYSTEM);
|
||||
params.put(ID_SERVICE, GISP_NOTIFICA_IN_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.NOT_CESSAZIONE)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, GISP_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, GISP_SYSTEM);
|
||||
params.put(ID_SERVICE, GISP_NOTIFICA_IN_SERVICE);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.NOTIFICA_MVNO_TC)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, TISCALI_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, TISCALI_SYSTEM);
|
||||
params.put(ID_SERVICE, CREDIT_TRANSFER_DONOR_MVNO);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.NOTIFICA_MSP_TC)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, MSP_IN_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, MSP_SYSTEM);
|
||||
params.put(ID_SERVICE, CREDIT_TRANSFER_MSP);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.NOTIFICA_MSPCOOP_TC)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, MSP_COOP_IN_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, MSP_COOP_SYSTEM);
|
||||
params.put(ID_SERVICE, CREDIT_TRANSFER_MSP_COOP);
|
||||
return params;
|
||||
}
|
||||
else if (flowType.equals(TipoFlusso.UPDATEDCO_MVNO)) {
|
||||
params = new HashMap();
|
||||
params.put(QUEUE_NAME, TISCALI_QUEUE_NAME);
|
||||
params.put(ID_SYSTEM, TISCALI_SYSTEM);
|
||||
params.put(ID_SERVICE, MVNO_UPDATEDCO);
|
||||
return params;
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("Tipo flusso errato!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package proxy.ws.dbssresponse;
|
||||
|
||||
import javax.jws.HandlerChain;
|
||||
import javax.jws.WebService;
|
||||
|
||||
import it.telecomitalia.soa.mobilenumberportabilitymgmtresponse.x20150511.PortInResultRequest;
|
||||
import it.telecomitalia.soa.mobilenumberportabilitymgmtresponse.x20150511.PortOutCreditResultRequest;
|
||||
import it.telecomitalia.soa.soap.soapheader.HeaderType;
|
||||
import mnp.proxy.ws.dbssresponse.MobileNumberPortabilityMgmtResponsePortType;
|
||||
import weblogic.jws.WLHttpTransport;
|
||||
|
||||
/**
|
||||
* MobileNumberPortabilityMgmtResponsePortTypeImpl class implements web service endpoint interface MobileNumberPortabilityMgmtResponsePortType
|
||||
*/
|
||||
|
||||
@WebService(
|
||||
serviceName = "serviceResponse",
|
||||
targetNamespace = "http://telecomitalia.it/SOA/MobileNumberPortabilityMgmtResponse-v1/service-b",
|
||||
endpointInterface = "mnp.proxy.ws.dbssresponse.MobileNumberPortabilityMgmtResponsePortType")
|
||||
@WLHttpTransport(contextPath = "simwscdbssresp", serviceUri = "MobileNumberPortabilityMgmtResponse", portName = "MobileNumberPortabilityMgmtResponseHttpEndpoint")
|
||||
@HandlerChain(file = "handler.config.xml", name = "portInResultChain")
|
||||
public class MobileNumberPortabilityMgmtResponsePortTypeImpl implements MobileNumberPortabilityMgmtResponsePortType {
|
||||
|
||||
public MobileNumberPortabilityMgmtResponsePortTypeImpl() {
|
||||
System.out.println("Created SIM WS for DBSS: [MobileNumberPortabilityMgmtResponsePortTypeImpl]");
|
||||
}
|
||||
|
||||
public void portInResult(PortInResultRequest body, it.telecomitalia.soa.soap.soapheader.HeaderType header) {
|
||||
// N - INIZIO PROCESSO
|
||||
System.out.println("*********************************");
|
||||
System.out.println("Ricezione richiesta PortInResult.");
|
||||
System.out.println("header ["+header+"]");
|
||||
System.out.println("portInResult ["+body+"]");
|
||||
System.out.println("*********************************");
|
||||
}
|
||||
|
||||
public void portOutCreditResult(PortOutCreditResultRequest portOutCreditResultRequest, HeaderType headerType) {
|
||||
// N - INIZIO PROCESSO
|
||||
System.out.println("*********************************");
|
||||
System.out.println("Ricezione richiesta portOutCreditResult.");
|
||||
System.out.println("header ["+headerType+"]");
|
||||
System.out.println("portInResult ["+portOutCreditResultRequest+"]");
|
||||
System.out.println("*********************************");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package proxy.ws.dbssresponse;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
import dbss_goa.mobileprepaidmnptransfercreditordermgmt.UpdatePortinCreditTransferRequest;
|
||||
import dbss_goa.mobileprepaidmnptransfercreditordermgmt.UpdatePortinCreditTransferResponse;
|
||||
import dbss_goa.mobileprepaidmnptransfercreditordermgmt.UpdatePortoutCreditTransferRequest;
|
||||
import dbss_goa.mobileprepaidmnptransfercreditordermgmt.UpdatePortoutCreditTransferResponse;
|
||||
import mnp.proxy.ws.dbssresponse.MobilePrepaidMNPTransferCreditOrderMgmtPortType;
|
||||
import weblogic.jws.WLHttpTransport;
|
||||
|
||||
/**
|
||||
* MobilePrepaidMNPTransferCreditOrderMgmtPortTypeImpl class implements web service endpoint interface MobilePrepaidMNPTransferCreditOrderMgmtPortType
|
||||
*/
|
||||
|
||||
@WebService(
|
||||
serviceName = "CreditOrderMgmt",
|
||||
targetNamespace = "http://xmlns.example.com/1449226534659",
|
||||
endpointInterface = "mnp.proxy.ws.dbssresponse.MobilePrepaidMNPTransferCreditOrderMgmtPortType")
|
||||
@WLHttpTransport(contextPath = "/", serviceUri = "CreditOrderMgmt", portName = "mobilePrepaidMNPTransferCreditOrderMgmtPortTypeEndpoint1")
|
||||
public class MobilePrepaidMNPTransferCreditOrderMgmtPortTypeImpl implements MobilePrepaidMNPTransferCreditOrderMgmtPortType {
|
||||
|
||||
public MobilePrepaidMNPTransferCreditOrderMgmtPortTypeImpl() {
|
||||
System.out.println("Created SIM WS for DBSS-GOA: [MobilePrepaidMNPTransferCreditOrderMgmt]");
|
||||
}
|
||||
|
||||
public UpdatePortinCreditTransferResponse portinTrasferCredit(it.telecomitalia.soa.soap.soapheader.holders.HeaderTypeHolder Header, UpdatePortinCreditTransferRequest body) {
|
||||
System.out.println("********** [SIM.CreditOrderMgmt] START **********");
|
||||
System.out.println("[SIM] CreditOrderMgmt.portinTrasferCredit. Ricezione richiesta portinTrasferCredit.");
|
||||
System.out.println("[SIM] CreditOrderMgmt.portinTrasferCredit. header [" + Header + "]");
|
||||
System.out.println("********** [SIM.CreditOrderMgmt] END **********");
|
||||
return null;
|
||||
}
|
||||
|
||||
public UpdatePortoutCreditTransferResponse portoutTrasferCredit(it.telecomitalia.soa.soap.soapheader.holders.HeaderTypeHolder Header, UpdatePortoutCreditTransferRequest body)
|
||||
{
|
||||
// Non utilizzato da DBC
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package proxy.ws.dbssresponse;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.rpc.handler.GenericHandler;
|
||||
import javax.xml.rpc.handler.HandlerInfo;
|
||||
import javax.xml.rpc.handler.MessageContext;
|
||||
import javax.xml.rpc.handler.soap.SOAPMessageContext;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
* utilizzato come Handler dal WS MobileNumberPortabilityMgmtResponsePortTypeImpl per loggare
|
||||
* in formato testo i messaggi SOAP in ingresso.
|
||||
*/
|
||||
public class PortInResultSOAPHandler extends GenericHandler {
|
||||
private QName[] headers;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.xml.rpc.handler.GenericHandler#init(javax.xml.rpc.handler.HandlerInfo)
|
||||
*/
|
||||
@Override
|
||||
public void init(HandlerInfo config) {
|
||||
super.init(config);
|
||||
headers = config.getHeaders();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public QName[] getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.xml.rpc.handler.GenericHandler#handleRequest(javax.xml.rpc.handler.MessageContext)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleRequest(MessageContext msgctx) {
|
||||
SOAPMessageContext soapMsgCtx = (SOAPMessageContext) msgctx;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
try {
|
||||
System.out.println("-------------------------------ricevuta chiamata Simulatore DBSS Response-------------------------------");
|
||||
System.out.println("PortInResultSOAPHandler - " + new java.util.Date());
|
||||
System.out.println("--------------------------------------------------------------------------------------------------------");
|
||||
soapMsgCtx.getMessage().writeTo(baos);
|
||||
System.out.println(baos.toString());
|
||||
System.out.println("---------------------------------fine chiamata Simulatore DBSS Response---------------------------------");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return super.handleRequest(msgctx);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.xml.rpc.handler.GenericHandler#handleFault(javax.xml.rpc.handler.MessageContext)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleFault(MessageContext msgctx) {
|
||||
SOAPMessageContext soapMsgCtx = (SOAPMessageContext) msgctx;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
try {
|
||||
System.out.println("-----------------------ricevuta chiamata Simulatore DBSS Response - fallita------------------------------");
|
||||
System.out.println("PortInResultSOAPHandler (fault) - " + new java.util.Date());
|
||||
System.out.println("---------------------------------------------------------------------------------------------------------");
|
||||
soapMsgCtx.getMessage().writeTo(baos);
|
||||
System.out.println(baos.toString());
|
||||
System.out.println("---------------------------------fine chiamata Simulatore DBSS Response----------------------------------");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return super.handleFault(msgctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package proxy.ws.dbssresponse;
|
||||
|
||||
import javax.jws.HandlerChain;
|
||||
import javax.jws.WebService;
|
||||
|
||||
import it.telecomitalia.soa.portingoutmgmt.NotifyPortoutRequest;
|
||||
import it.telecomitalia.soa.portingoutmgmt.PortoutOrderRequest;
|
||||
import it.telecomitalia.soa.portingoutmgmt.ValidatePortoutRequest;
|
||||
import mnp.proxy.ws.dbssresponse.PortingOutPortType;
|
||||
import weblogic.jws.WLHttpTransport;
|
||||
|
||||
/**
|
||||
* PortingOutPortTypeImpl class implements web service endpoint interface PortingOutPortType
|
||||
*/
|
||||
|
||||
@WebService(serviceName = "PortoutService", targetNamespace = "http://xmlns.example.com/1449226534659",
|
||||
endpointInterface = "mnp.proxy.ws.dbssresponse.PortingOutPortType")
|
||||
@HandlerChain(file = "handler.config.xml", name = "portInResultChain")
|
||||
@WLHttpTransport(contextPath = "simwscdbssportingout", serviceUri = "PortoutService", portName = "PortingOutPortTypeEndpoint1")
|
||||
public class PortingOutPortTypeImpl implements PortingOutPortType {
|
||||
|
||||
public PortingOutPortTypeImpl() {
|
||||
}
|
||||
|
||||
public void notifyPortout(NotifyPortoutRequest body, it.telecomitalia.soa.soap.soapheader.HeaderType Header) {
|
||||
System.out.println("********** [SIM.PortingOutMgmt] START **********");
|
||||
System.out.println("[SIM] PortingOutMgmt.notifyPortout. Ricezione richiesta notifyPortout.");
|
||||
System.out.println("[SIM] PortingOutMgmt.notifyPortout. header [" + Header + "]");
|
||||
System.out.println("********** [SIM.PortingOutMgmt] END **********");
|
||||
}
|
||||
|
||||
public void portoutOrder(PortoutOrderRequest body, it.telecomitalia.soa.soap.soapheader.HeaderType Header) {
|
||||
System.out.println("********** [SIM.PortingOutMgmt] START **********");
|
||||
System.out.println("[SIM] PortingOutMgmt.portoutOrder. Ricezione richiesta portoutOrder.");
|
||||
System.out.println("[SIM] PortingOutMgmt.portoutOrder. header [" + Header + "]");
|
||||
System.out.println("********** [SIM.PortingOutMgmt] END **********");
|
||||
}
|
||||
|
||||
public void validatePortout(ValidatePortoutRequest body, it.telecomitalia.soa.soap.soapheader.HeaderType Header) {
|
||||
System.out.println("********** [SIM.PortingOutMgmt] START **********");
|
||||
System.out.println("[SIM] PortingOutMgmt.validatePortout. Ricezione richiesta validatePortout.");
|
||||
System.out.println("[SIM] PortingOutMgmt.validatePortout. header [" + Header + "]");
|
||||
System.out.println("********** [SIM.PortingOutMgmt] END **********");
|
||||
}
|
||||
}
|
||||
@@ -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>portInResultChain</jwshc:handler-chain-name>
|
||||
<jwshc:handler>
|
||||
<handler-name>PortInResultSOAPHandler</handler-name>
|
||||
<handler-class>proxy.ws.dbssresponse.PortInResultSOAPHandler</handler-class>
|
||||
</jwshc:handler>
|
||||
</jwshc:handler-chain>
|
||||
</jwshc:handler-config>
|
||||
@@ -0,0 +1,152 @@
|
||||
package simFlatFile;
|
||||
|
||||
import conf.*;
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.ftp.FTPSessionFactory;
|
||||
import mnp.utility.ftp.FTPSessionIF;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Vector;
|
||||
|
||||
import tools.ToolsState;
|
||||
import db.*;
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class FileFlatSender {
|
||||
|
||||
static MSSProperties mssproperties = null;
|
||||
static FTPProperties ftpproperties = null;
|
||||
static PitagoraProperties pitagoraproperties = null;
|
||||
private ManagerDAO managerDAO = null;
|
||||
|
||||
static {
|
||||
mssproperties = MSSProperties.getInstance();
|
||||
ftpproperties = FTPProperties.getInstance();
|
||||
pitagoraproperties = PitagoraProperties.getInstance();
|
||||
}
|
||||
|
||||
public FileFlatSender() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
private File[] checkFiles(File[] fileList, String testId) {
|
||||
|
||||
String savedFileNames[] = ToolsState.getFiles(testId);
|
||||
|
||||
if (fileList!=null && savedFileNames!=null && savedFileNames.length > 0) {
|
||||
Vector fileVector =new Vector();
|
||||
Vector savedFileNameVector =new Vector();
|
||||
|
||||
for (int i=0; i<fileList.length; i++) {
|
||||
fileVector.add(fileList[i]);
|
||||
}
|
||||
for (int i=0; i<savedFileNames.length; i++) {
|
||||
savedFileNameVector.add(savedFileNames[i]);
|
||||
}
|
||||
for (int i=0; i<fileVector.size(); i++) {
|
||||
String name = ((File)fileVector.elementAt(i)).getName();
|
||||
if (!savedFileNameVector.contains(name))
|
||||
fileVector.remove(i);
|
||||
}
|
||||
File[] f = new File[0];
|
||||
f = (File[]) fileVector.toArray(f);
|
||||
|
||||
fileList = f;
|
||||
}
|
||||
|
||||
return fileList;
|
||||
|
||||
}
|
||||
|
||||
public void sendFlatFile(String testId, int tipo_flusso, String id_flusso) throws Exception{
|
||||
String path = null;
|
||||
|
||||
switch (tipo_flusso) {
|
||||
case TipoFlusso.MSS_CESSAZIONE_IN:
|
||||
path = mssproperties.get_PATH_TEST_MSS();
|
||||
break;
|
||||
default:
|
||||
path = mssproperties.get_PATH_TEST();
|
||||
break;
|
||||
}
|
||||
sendFile(testId, path, id_flusso);
|
||||
}
|
||||
|
||||
|
||||
private void ftpFile(String source, String dest) throws Exception {
|
||||
|
||||
// String path_to = managerDAO.getPathFile(sistema);
|
||||
|
||||
/* String host = "svi-venere";
|
||||
String user = "siebel";
|
||||
String pwd = "siebel";
|
||||
String txmode = "TYPE A"; //"TYPE I"
|
||||
|
||||
String localDir = "c:/";
|
||||
String localFileName = "ftp.txt";
|
||||
String remoteDir = "/fs1/app/SunOneWebSrvr6sp7";
|
||||
String remoteFileName = "ftp.txt";*/
|
||||
|
||||
String host = FTPProperties.getHostname();
|
||||
String user = FTPProperties.getUsername();
|
||||
String pwd = FTPProperties.getPassword();
|
||||
|
||||
FTPSessionIF session = FTPSessionFactory.getFTPSession(host,user,pwd,false /*SECURE FTP*/);
|
||||
session.connect();
|
||||
session.put(source, dest, "TYPE A");
|
||||
session.disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Spedisce il file specificato
|
||||
* @param path String path in cui si trova il file da spedire
|
||||
* @param tipo_file int tipo del file
|
||||
* @throws Exception
|
||||
*/
|
||||
private void sendFile(String testId, String path_from, String id_flusso) throws Exception {
|
||||
File _file = new File(path_from);
|
||||
File[] fileList = _file.listFiles();
|
||||
|
||||
//Controlla se siamo in un simpa-test
|
||||
fileList = checkFiles(fileList, testId);
|
||||
|
||||
String path_to = managerDAO.getPathFile(id_flusso);
|
||||
|
||||
if (FTPProperties.getHostname().equalsIgnoreCase("localhost")) {
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
moveFile(fileList[i].getAbsolutePath(), path_to + fileList[i].getName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
ftpFile(fileList[i].getAbsolutePath(), path_to + fileList[i].getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveFile(String sourceName, String destName) throws Exception {
|
||||
File _fileIn = new File(sourceName);
|
||||
File _fileOut = new File(destName);
|
||||
|
||||
FileInputStream fis = new FileInputStream(_fileIn);
|
||||
FileOutputStream fos = new FileOutputStream(_fileOut);
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int y = 0;
|
||||
while ( (y = fis.read(buf)) != -1) {
|
||||
fos.write(buf, 0, y);
|
||||
}
|
||||
//chiudo i canali
|
||||
fis.close();
|
||||
fos.close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,458 @@
|
||||
package simFlatFile;
|
||||
|
||||
import it.valueteam.infotracciati.FlowMaker;
|
||||
import it.valueteam.infotracciati.exception.BadFieldFormatException;
|
||||
import it.valueteam.infotracciati.exception.BadFlowException;
|
||||
import it.valueteam.infotracciati.exception.BadPositionException;
|
||||
import it.valueteam.infotracciati.exception.FillPositionException;
|
||||
import it.valueteam.infotracciati.exception.GenericException;
|
||||
import it.valueteam.infotracciati.exception.NotValidXMLException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mnp.database.dao.HZGestioneRichiestaDAO;
|
||||
import mnp.objects.TipoFlusso;
|
||||
import mnp.objects.dao.RichiestaHZ;
|
||||
import mnp.utility.DateUtils;
|
||||
import obj.StatoMap;
|
||||
|
||||
import org.exolab.castor.xml.MarshalException;
|
||||
import org.exolab.castor.xml.ValidationException;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
import tools.ToolsState;
|
||||
import base.SimGenerator;
|
||||
import conf.PitagoraProperties;
|
||||
import conf.SimConfFile;
|
||||
|
||||
public class HZPitagoraFileGenerator extends SimGenerator{
|
||||
|
||||
private static final String FILE_PATH = PitagoraProperties.getInstance().get_PATH_TEST_NOTIFICA();
|
||||
private static final String FILE_NAME = "TLCYYYYMMDDTIMN.csv";
|
||||
private static final String XML_PATH_FILE = SimConfFile.getInstance().ReadSection("NOTIFICAZIONE PITAGORA").getProperty("infoTracciatiXML");
|
||||
private static final String FLOW_TYPE = "NOTIFICA";
|
||||
|
||||
private static String CODICE_OP_FORNITORE = "codiceOperatoreFornitore";
|
||||
private static String CODICE_ORDINE_FORNITORE = "codiceOrdineFornitore";
|
||||
private static String CODICE_ORDINE_RICHIEDENTE = "codiceOrdineRichiedente";
|
||||
private static String DATA_NOTIFICA = "dataNotifica";
|
||||
private static String TIPO_NOTIFICA = "tipoNotifica";
|
||||
private static String ID_RISORSA = "idRisorsa";
|
||||
private static String TIPO_PRESTAZIONE = "tipoPrestazione";
|
||||
private static String STATO_ORDINE = "statoOrdine";
|
||||
private static String DATA_RICEZIONE_ORDINE = "dataRicezioneOrdine";
|
||||
private static String DATA_VAL_FORMALE_CONTRATTUALE = "dataValFormaleContrattuale";
|
||||
private static String DATA_VAL_TECNICO_GESTIONALE = "dataValTecnicoGestionale";
|
||||
private static String DATA_ESP_ORDINE = "dataEspOrdine";
|
||||
private static String ORA_ESP_ORDINE = "oraEspOrdine";
|
||||
private static String MOTIVO_RIFIUTO = "motivoRifiuto";
|
||||
private static String CAUSALE_RIFIUTO = "causaleRifiuto";
|
||||
private static String NOTE = "note";
|
||||
private static String CODICE_MOTIVO_RIFIUTO = "codiceMotivoRifiuto";
|
||||
//obj. di cache per i TEST automatici
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public HZPitagoraFileGenerator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il file CSV
|
||||
*
|
||||
* @param args String[]
|
||||
* @throws Exception
|
||||
*/
|
||||
public void generateFile(String[] args) throws Exception {
|
||||
|
||||
List inCaricoList = null;
|
||||
List accettataList = null;
|
||||
List espletataList = null;
|
||||
String[] inCaricoRecords = null;
|
||||
String[] accettataRecords = null;
|
||||
String[] espletataRecords = null;
|
||||
String[] records = null;
|
||||
|
||||
svuotaDirectory(FILE_PATH);
|
||||
HZGestioneRichiestaDAO richiestaDAO = new HZGestioneRichiestaDAO();
|
||||
try {
|
||||
if (args[0] != null && "N".equalsIgnoreCase(args[7])){
|
||||
System.out.println("QUERY STATO = " + args[0] );
|
||||
inCaricoList = richiestaDAO.getGestioneRichiestaByStato(StatoMap.getStato(args[0]), args[6]);
|
||||
System.out.println("RISULTATI: " + inCaricoList.size());
|
||||
inCaricoRecords = createFlow(inCaricoList, StatoMap.getStato(args[0]), args[1]);
|
||||
}else{
|
||||
inCaricoRecords = new String[0];
|
||||
}
|
||||
if (args[2] != null && "N".equalsIgnoreCase(args[7])){
|
||||
System.out.println("QUERY STATO = " + args[2]);
|
||||
accettataList = richiestaDAO.getGestioneRichiestaByStato(StatoMap.getStato(args[2]), args[6]);
|
||||
System.out.println("RISULTATI: " + accettataList.size());
|
||||
accettataRecords = createFlow(accettataList, StatoMap.getStato(args[2]), args[3]);
|
||||
}else{
|
||||
accettataRecords = new String[0];
|
||||
}
|
||||
if (args[4] != null && "N".equalsIgnoreCase(args[7])){
|
||||
System.out.println("QUERY STATO = " + args[4]);
|
||||
espletataList = richiestaDAO.getGestioneRichiestaByStato(StatoMap.getStato(args[4]), args[6]);
|
||||
System.out.println("RISULTATI: " + espletataList.size());
|
||||
espletataRecords = createFlow(espletataList, StatoMap.getStato(args[4]), args[5]);
|
||||
}else{
|
||||
espletataRecords = new String[0];
|
||||
}
|
||||
// crezione del file contenente la presaincarico e l'accetazione e l'espletamento di tutte le
|
||||
// richieste in stato 2
|
||||
if (args[0] !=null && "S".equalsIgnoreCase(args[7])){
|
||||
System.out.println("GENERAZIONE FILE CON RICHIESTE MULTIPLE DA PITAGORA");
|
||||
System.out.println("QUERY STATO = " + args[4]);
|
||||
inCaricoList = richiestaDAO.getGestioneRichiestaByStato(StatoMap.getStato(args[0]), args[6]);
|
||||
System.out.println("RISULTATI: " + inCaricoList.size());
|
||||
inCaricoRecords = createFlow(inCaricoList, StatoMap.getStato(args[0]), args[1]);
|
||||
accettataList = inCaricoList;
|
||||
System.out.println("RISULTATI: " + accettataList.size());
|
||||
accettataRecords = createFlow(accettataList, 3, "OK");
|
||||
espletataList = inCaricoList;
|
||||
espletataRecords = createFlow(espletataList, 5, "OK");
|
||||
|
||||
|
||||
}
|
||||
|
||||
records = new String[inCaricoRecords.length + accettataRecords.length + espletataRecords.length];
|
||||
System.arraycopy(inCaricoRecords, 0, records, 0, inCaricoRecords.length);
|
||||
System.arraycopy(accettataRecords, 0, records, inCaricoRecords.length, accettataRecords.length);
|
||||
System.arraycopy(espletataRecords, 0, records, inCaricoRecords.length + accettataRecords.length, espletataRecords.length);
|
||||
|
||||
System.out.println("CREO FILE");
|
||||
if (records.length != 0)
|
||||
send(FILE_NAME,FILE_PATH, records);
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* createFlow
|
||||
*
|
||||
* @param recordsList List
|
||||
* @return String[]
|
||||
*/
|
||||
private String[] createFlow(List recordsList, int stato, String esito) throws Exception {
|
||||
|
||||
RichiestaHZ richiesta= null;
|
||||
String[] records = new String[recordsList.size()];
|
||||
System.out.println("NEW FLOWMAKER: PATH FILE - " + this.XML_PATH_FILE);
|
||||
FlowMaker flowMaker = null;
|
||||
try {
|
||||
flowMaker = new FlowMaker(this.XML_PATH_FILE, this.FLOW_TYPE);
|
||||
for (int i = 0; i < recordsList.size(); i++) {
|
||||
richiesta = (RichiestaHZ) recordsList.get(i);
|
||||
|
||||
String record = null;
|
||||
|
||||
try {
|
||||
System.out.print("GENERATE FORMATTED RECORD " + i);
|
||||
record = flowMaker.generateFormattedRecord(formatValues(richiesta, stato, esito), true);
|
||||
record = record.substring(0, record.length()-1);
|
||||
}
|
||||
catch (BadPositionException ex1) {
|
||||
ex1.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (FillPositionException ex1) {
|
||||
ex1.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (BadFieldFormatException ex1) {
|
||||
ex1.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
records[i] = record;
|
||||
|
||||
}
|
||||
return records;
|
||||
}
|
||||
catch (NotValidXMLException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (BadFlowException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (ValidationException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (MarshalException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
catch (GenericException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Map formatValues(RichiestaHZ richiesta, int stato, String esito) throws Exception {
|
||||
HashMap formattedValues = null;
|
||||
switch (stato){
|
||||
case StatoMap.IN_CARICO:{
|
||||
System.out.println(" - INCARICO");
|
||||
formattedValues = (HashMap) inCaricoFormatValues(richiesta, esito);
|
||||
break;
|
||||
}
|
||||
case StatoMap.ACCETTATA:{
|
||||
System.out.println(" - ACCETTATA");
|
||||
formattedValues = (HashMap) accettataFormatValues(richiesta, esito);
|
||||
break;
|
||||
}
|
||||
case StatoMap.ESPLETATA:{
|
||||
System.out.println(" - ESPLETATA");
|
||||
formattedValues = (HashMap) espletataFormatValues(richiesta, esito);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return formattedValues;
|
||||
}
|
||||
|
||||
private Map formatValues(RichiestaHZ richiesta, Map formattedValues) {
|
||||
|
||||
formattedValues.put(this.CODICE_ORDINE_FORNITORE, "TIM/00NPO/20071016/00000020/G");
|
||||
formattedValues.put(this.DATA_NOTIFICA, new Date());
|
||||
formattedValues.put(this.TIPO_PRESTAZIONE, "0");
|
||||
formattedValues.put(this.DATA_RICEZIONE_ORDINE, richiesta.getDacCalc());
|
||||
formattedValues.put(this.CODICE_MOTIVO_RIFIUTO, "");
|
||||
formattedValues.put(this.NOTE, "");
|
||||
|
||||
return formattedValues;
|
||||
}
|
||||
|
||||
private Map inCaricoFormatValues(RichiestaHZ richiesta, String esito){
|
||||
HashMap formattedValues = new HashMap();
|
||||
formattedValues.put(this.CODICE_ORDINE_RICHIEDENTE, richiesta.getIdRichiesta());
|
||||
formattedValues.put(this.ID_RISORSA, "");
|
||||
formattedValues.put(this.TIPO_NOTIFICA, new Long(0));
|
||||
if ("ok".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(0));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "");
|
||||
} else if ("ko".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(1));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "1");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "DESCRIZIONE MOTIVO RIFIUTO");
|
||||
}
|
||||
formattedValues.put(this.DATA_VAL_FORMALE_CONTRATTUALE, null);
|
||||
formattedValues.put(this.DATA_VAL_TECNICO_GESTIONALE, null);
|
||||
formattedValues.put(this.DATA_ESP_ORDINE, null);
|
||||
formattedValues.put(this.ORA_ESP_ORDINE, null);
|
||||
|
||||
formattedValues = (HashMap) formatValues(richiesta, formattedValues);
|
||||
return formattedValues;
|
||||
}
|
||||
|
||||
private Map accettataFormatValues(RichiestaHZ richiesta, String esito) throws Exception {
|
||||
HashMap formattedValues = new HashMap();
|
||||
formattedValues.put(this.CODICE_ORDINE_RICHIEDENTE, richiesta.getIdRichiesta());
|
||||
formattedValues.put(this.TIPO_NOTIFICA, new Long(1));
|
||||
if ("ok".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(2));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "");
|
||||
}
|
||||
else if ("ko".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(1));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "1");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "DESCRIZIONE MOTIVO RIFIUTO");
|
||||
}
|
||||
formattedValues.put(this.ID_RISORSA, "");
|
||||
formattedValues.put(this.DATA_VAL_FORMALE_CONTRATTUALE, new Date());
|
||||
formattedValues.put(this.DATA_VAL_TECNICO_GESTIONALE, new Date());
|
||||
formattedValues.put(this.DATA_ESP_ORDINE, null);
|
||||
formattedValues.put(this.ORA_ESP_ORDINE, DateUtils.toDate(DateUtils.getHour(new Date()), "HH:mm"));
|
||||
formattedValues = (HashMap) formatValues(richiesta, formattedValues);
|
||||
return formattedValues;
|
||||
}
|
||||
|
||||
private Map espletataFormatValues(RichiestaHZ richiesta, String esito) throws Exception {
|
||||
HashMap formattedValues = new HashMap();
|
||||
formattedValues.put(this.CODICE_ORDINE_RICHIEDENTE,
|
||||
richiesta.getIdRichiesta());
|
||||
formattedValues.put(this.TIPO_NOTIFICA, new Long(2));
|
||||
if ("ok".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(3));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "");
|
||||
}
|
||||
else if ("ko".equalsIgnoreCase(esito)){
|
||||
formattedValues.put(this.STATO_ORDINE, new Long(4));
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, "1");
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, "DESCRIZIONE MOTIVO RIFIUTO");
|
||||
}
|
||||
formattedValues.put(this.ID_RISORSA, "");
|
||||
formattedValues.put(this.DATA_VAL_FORMALE_CONTRATTUALE,new Date());
|
||||
formattedValues.put(this.DATA_VAL_TECNICO_GESTIONALE,new Date());
|
||||
formattedValues.put(this.DATA_ESP_ORDINE,new Date());
|
||||
formattedValues.put(this.ORA_ESP_ORDINE, DateUtils.toDate(DateUtils.getHour(new Date()), "HH:mm"));
|
||||
formattedValues = (HashMap) formatValues(richiesta, formattedValues);
|
||||
return formattedValues;
|
||||
}
|
||||
|
||||
private boolean send(String nomeFileDaInviare, String path, String[] righeFile) throws
|
||||
Exception {
|
||||
try {
|
||||
|
||||
String date = DateUtils.toString(new Date(), "yyyyMMdd");
|
||||
nomeFileDaInviare = nomeFileDaInviare.replaceFirst("YYYYMMDD", date);
|
||||
File fileDaInviare = new File(path + nomeFileDaInviare);
|
||||
PrintWriter pw = new PrintWriter(new FileOutputStream(fileDaInviare));
|
||||
for (int i = 0; i < righeFile.length - 1; i++) {
|
||||
pw.println(righeFile[i]);
|
||||
}
|
||||
pw.write(righeFile[righeFile.length - 1]);
|
||||
pw.close();
|
||||
|
||||
String nomeFileDiSincro = nomeFileDaInviare.substring(0, nomeFileDaInviare.length() - ".csv".length());
|
||||
nomeFileDiSincro = nomeFileDiSincro + ".ctr";
|
||||
File fileDiSincro = new File(path + nomeFileDiSincro);
|
||||
PrintWriter pwSincro = new PrintWriter(new FileOutputStream(fileDiSincro));
|
||||
pwSincro.write("");
|
||||
pwSincro.close();
|
||||
//ToolsState.addFile("", nomeFileDaInviare, TipoFlusso.PITAGORA);
|
||||
ToolsState.print();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(
|
||||
"ATTENZIONE!!Problemi nella creazione del file di uscita " +
|
||||
nomeFileDaInviare);
|
||||
throw e;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Svuota la directory in cui deve salvare i file generati
|
||||
* @param path String
|
||||
*/
|
||||
public void svuotaDirectory(String path) {
|
||||
File file = new File(path);
|
||||
File[] list = file.listFiles();
|
||||
|
||||
if ((list != null ) && list.length != 0) {
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
File f1 = list[i];
|
||||
boolean success = f1.delete();
|
||||
if (!success)
|
||||
System.out.println("Errore nella cancellazione del file " + f1.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il file CSV contenente richieste di cessazione per passaggio ad altro olo
|
||||
*
|
||||
* @param args String[]
|
||||
* @throws Exception
|
||||
*/
|
||||
public void generateFileCessPerPassaggioAltroOlo(String[] args) throws Exception {
|
||||
|
||||
int numeroRichieste = Integer.valueOf(args[0]).intValue();
|
||||
String tipoNotifica = args[1];
|
||||
String statoOrdine = args[2];
|
||||
String record = "";
|
||||
String[] records = new String[numeroRichieste];
|
||||
FlowMaker flowMaker = new FlowMaker(this.XML_PATH_FILE, this.FLOW_TYPE);
|
||||
|
||||
svuotaDirectory(FILE_PATH);
|
||||
List lstRecord = new ArrayList();
|
||||
try {
|
||||
for (int i=0; i<numeroRichieste; i++){
|
||||
record = flowMaker.generateFormattedRecord(cessAltroOloFormatValues(tipoNotifica,statoOrdine), true);
|
||||
record = record.substring(0, record.length()-1);
|
||||
records[i] = record;
|
||||
System.out.println("RECORD " + i + " VALORE: " + records[i]);
|
||||
// test automatici
|
||||
lstRecord.add(record);
|
||||
}
|
||||
testProcessCache.addItem(TestProcessCache.HZ_PITAGORA_IN,lstRecord);
|
||||
System.out.println("CREO FILE");
|
||||
if (records.length != 0)
|
||||
send(FILE_NAME,FILE_PATH, records);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map cessAltroOloFormatValues(String tipoNotifica, String statoOrdine) throws Exception{
|
||||
|
||||
DateUtils date = new DateUtils();
|
||||
HashMap formattedValues = new HashMap();
|
||||
|
||||
formattedValues.put(this.CODICE_OP_FORNITORE, "TLC");
|
||||
formattedValues.put(this.DATA_NOTIFICA, date.toDate(date.toItalianString(date.getCurrentStringDate().substring(1,11))));
|
||||
formattedValues.put(this.TIPO_NOTIFICA, tipoNotifica);
|
||||
formattedValues.put(this.ID_RISORSA, getIdRisorsa());
|
||||
formattedValues.put(this.TIPO_PRESTAZIONE, new Long(0));
|
||||
formattedValues.put(this.STATO_ORDINE, statoOrdine);
|
||||
formattedValues.put(this.DATA_ESP_ORDINE, date.toDate(date.toItalianString(date.getCurrentStringDate().substring(1,11))));
|
||||
formattedValues.put(this.DATA_RICEZIONE_ORDINE, date.toDate(date.toItalianString(date.getCurrentStringDate().substring(1,11))));
|
||||
|
||||
|
||||
formattedValues.put(this.CODICE_ORDINE_FORNITORE, "");
|
||||
formattedValues.put(this.CODICE_ORDINE_RICHIEDENTE, null);
|
||||
formattedValues.put(this.DATA_VAL_FORMALE_CONTRATTUALE, null);
|
||||
formattedValues.put(this.DATA_VAL_TECNICO_GESTIONALE, null);
|
||||
formattedValues.put(this.ORA_ESP_ORDINE, null);
|
||||
formattedValues.put(this.CAUSALE_RIFIUTO, null);
|
||||
formattedValues.put(this.CODICE_MOTIVO_RIFIUTO, null);
|
||||
formattedValues.put(this.MOTIVO_RIFIUTO, null);
|
||||
formattedValues.put(this.NOTE, null);
|
||||
|
||||
return formattedValues;
|
||||
|
||||
}
|
||||
|
||||
private String getIdRisorsa(){
|
||||
|
||||
String[] cifre = {"1","2","3","4","5","6","7","8","9","0"};
|
||||
String[] prefix ={"06","02","0763","0131","0764","0776","0773"};
|
||||
|
||||
String appNumero[] = new String[6];
|
||||
String appPrefisso[] = new String[1];
|
||||
String msisdn = "";
|
||||
String prefisso = "";
|
||||
|
||||
appPrefisso[0] = prefix[(int) (Math.random()*7)];
|
||||
prefisso = prefisso + appPrefisso[0];
|
||||
for (int i=0; i<6; i++){
|
||||
appNumero[i]= cifre[(int)(Math.random()*9)];
|
||||
msisdn= msisdn + appNumero[i];
|
||||
}
|
||||
|
||||
return prefisso+msisdn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package simFlatFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
import tools.ToolsState;
|
||||
|
||||
import base.*;
|
||||
import conf.*;
|
||||
import db.*;
|
||||
import mnp.database.dao.*;
|
||||
import mnp.objects.dao.*;
|
||||
import mnp.objects.dao.mss.*;
|
||||
import mnp.utility.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: Genera il file proveniente da MSS</p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MSSFileGenerator extends FileGenerator implements SistemiInterniIF {
|
||||
|
||||
static MSSProperties properties = MSSProperties.getInstance();
|
||||
String nomeFile = "";
|
||||
|
||||
public MSSFileGenerator(String testId) {
|
||||
super(testId);
|
||||
this.managerDAO = new ManagerDAO();
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_MSS());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera il file sulla base di paramentri passati
|
||||
* @param params Vector
|
||||
* @throws Exception
|
||||
*/
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
try {
|
||||
Date now = new Date();
|
||||
//Il Sistema MSS ha id_flusso = 15
|
||||
String prefix = managerDAO.getPrefixSistemiInterni(SistemiInterniIF.ID_FLUSSO_MSS);
|
||||
//SistemiInterniPatternInfo[] sisInfo = sisDao.getSistemiPatternInfo(prefix);
|
||||
SistemiInterniPatternInfo[] sisInfo = managerDAO.getSistemiPatternInfo(prefix);
|
||||
String dataPattern = null;
|
||||
for (int i = 0; i < sisInfo.length; i++) {
|
||||
if(sisInfo[i].getTipo().equalsIgnoreCase("data")) dataPattern = sisInfo[i].getPattern();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(dataPattern);
|
||||
|
||||
nomeFile = prefix + sdf.format(now);
|
||||
|
||||
|
||||
EsitoMSS[] esiti = null;
|
||||
|
||||
String processo = (String)params.elementAt(0);
|
||||
String cod = (String)params.elementAt(1);
|
||||
|
||||
System.out.println("params = " + params);
|
||||
System.out.println("processo = " + processo);
|
||||
System.out.println("cod = " + cod);
|
||||
|
||||
if (processo.equalsIgnoreCase("DONOR"))
|
||||
esiti = managerDAO.generateMSSDonor(cod);
|
||||
|
||||
if (processo.equalsIgnoreCase("RECIPIENT"))
|
||||
esiti = managerDAO.generateMSSRecipient(cod);
|
||||
|
||||
if (processo.equalsIgnoreCase("PORTING"))
|
||||
esiti = managerDAO.generateMSSPorting(cod);
|
||||
|
||||
if (processo.equalsIgnoreCase("CESSAZIONE"))
|
||||
esiti = managerDAO.generateMSSCessazione(cod);
|
||||
|
||||
if (processo.equalsIgnoreCase("CESSAZIONE_PORTING"))
|
||||
esiti = generateMSSCessazionePorting(params);
|
||||
|
||||
if (processo.equalsIgnoreCase("ANNULLAMENTO_CESS_PORT"))
|
||||
esiti = managerDAO.generateMSSAnnullamentoCess(cod);
|
||||
|
||||
System.out.println("esiti = " + esiti);
|
||||
|
||||
if(esiti!=null)
|
||||
writeFile(esiti);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera gli esiti di MSS per il processo di CESSAZIONE PORTING
|
||||
* @param params Vector
|
||||
* @return EsitoMSS[]
|
||||
*/
|
||||
private EsitoMSS[] generateMSSCessazionePorting(Vector params) {
|
||||
testProcessCache.clear();
|
||||
String _prefix = null;
|
||||
String tipo = (String) params.elementAt(2);
|
||||
int numRichieste = Integer.parseInt((String)params.elementAt(3));
|
||||
|
||||
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
|
||||
if (tipo.equalsIgnoreCase("TIM"))
|
||||
_prefix = "39335";
|
||||
else //NO_TIM
|
||||
_prefix = "39328";
|
||||
|
||||
EsitoMSS[] result = new EsitoMSS[numRichieste];
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
|
||||
EsitoMSS esitoMSS = new EsitoMSS();
|
||||
esitoMSS.setCod("D");
|
||||
|
||||
String _num = _prefix + addZero( (i + 1) + "", 7);
|
||||
esitoMSS.setMsisdn(_num);
|
||||
java.util.Date _dr = new java.util.Date();
|
||||
esitoMSS.setData_ora_richiesta(df.format(_dr));
|
||||
esitoMSS.setData_ora_cessazione(df.format(_dr));
|
||||
result[i] = esitoMSS;
|
||||
testProcessCache.addItem(TestProcessCache.MSS,esitoMSS);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrive il file con gli esiti
|
||||
* @param esitiMSS EsitoMSS[]
|
||||
* @throws Exception
|
||||
*/
|
||||
private void writeFile(EsitoMSS[] esitiMSS) throws Exception{
|
||||
|
||||
try {
|
||||
System.out.println("Nome file da generare -> " + this.properties.get_PATH_TEST_MSS() + "/" + nomeFile);
|
||||
PrintWriter pw = new PrintWriter(new FileOutputStream(this.properties.get_PATH_TEST_MSS() + "/" + nomeFile));
|
||||
|
||||
|
||||
for (int i = 0; i < esitiMSS.length; i++) {
|
||||
EsitoMSS esito = esitiMSS[i];
|
||||
pw.println(creaTracciato(esito));
|
||||
}
|
||||
pw.flush();
|
||||
pw.close();
|
||||
ToolsState.svuotaHash();
|
||||
|
||||
}
|
||||
catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruisce il tracciato relativo all'esito passato
|
||||
* @param esitoMSS EsitoMSS
|
||||
* @return String
|
||||
*/
|
||||
private String creaTracciato(EsitoMSS esitoMSS) {
|
||||
String tracciato = "";
|
||||
String _msisdn = esitoMSS.getMsisdn().substring(2);
|
||||
|
||||
tracciato += Func.fill(esitoMSS.getCod(), esitoMSS.getCod().length() + 1) + Func.fill(_msisdn, _msisdn.length() + 1);
|
||||
|
||||
if (!esitoMSS.getCod().equalsIgnoreCase("D")) {
|
||||
if (esitoMSS.getRgn() != null) {
|
||||
tracciato += Func.fill(esitoMSS.getRgn(), esitoMSS.getRgn().length() + 1);
|
||||
}
|
||||
else {
|
||||
tracciato += Func.fill(esitoMSS.getImsi(), esitoMSS.getImsi().length() + 1);
|
||||
}
|
||||
}
|
||||
tracciato += Func.fill(esitoMSS.getData_ora_richiesta(), esitoMSS.getData_ora_richiesta().length() + 1) +
|
||||
Func.fill(esitoMSS.getData_ora_cessazione(), esitoMSS.getData_ora_cessazione().length());
|
||||
|
||||
return tracciato;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package simFlatFile;
|
||||
|
||||
public interface SistemiInterniIF {
|
||||
public static final int ID_FLUSSO_MSS = 15;
|
||||
|
||||
//M.G. Kit Aprile 07 - Costanti per identificare l'operatore interno
|
||||
public static final String INT_OP_TIM = "TIMG";
|
||||
public static final String INT_OP_COOP = "COOP";
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package simFlatFile;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface TipoEsitoMSS {
|
||||
public static final int I_RGN = 1;
|
||||
public static final int C_RGN = 2;
|
||||
public static final int D = 3;
|
||||
public static final int I_IMSI = 4;
|
||||
public static final int C_IMSI = 5;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Created on Feb 4, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class FILETracciatoBIT_UPDCO extends IBTracciato {
|
||||
|
||||
|
||||
protected char[] identificativo_richiesta_bit;
|
||||
protected char[] codice_gruppo;
|
||||
protected char[] msisdn;
|
||||
protected char[] data_cutover;
|
||||
|
||||
protected SimpleDateFormat sdf;
|
||||
|
||||
public FILETracciatoBIT_UPDCO(
|
||||
String _id_richiesta,
|
||||
String _codice_gruppo,
|
||||
String _msisdn,
|
||||
Date _data_cutover){
|
||||
|
||||
int i=0;
|
||||
|
||||
sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
identificativo_richiesta_bit = new char[64]; // identif richiesta
|
||||
codice_gruppo = new char[12]; //identif utenza
|
||||
msisdn = new char[13]; //numero linea
|
||||
data_cutover = new char[10];
|
||||
|
||||
identificativo_richiesta_bit = ((_id_richiesta + blanks).substring(0, identificativo_richiesta_bit.length)).toCharArray();
|
||||
codice_gruppo = ((_codice_gruppo + blanks).substring(0, codice_gruppo.length)).toCharArray();
|
||||
msisdn = ((_msisdn + blanks).substring(0, msisdn.length)).toCharArray();
|
||||
data_cutover = ((sdf.format(_data_cutover) + blanks).substring(0, data_cutover.length)).toCharArray();
|
||||
}
|
||||
|
||||
public String getTracciato() {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append(identificativo_richiesta_bit);
|
||||
sb.append(codice_gruppo);
|
||||
sb.append(msisdn);
|
||||
sb.append(data_cutover);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
|
||||
return getTracciato();
|
||||
}
|
||||
}
|
||||
348
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/siminfobus/GwOloClient.java
Normal file
348
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/siminfobus/GwOloClient.java
Normal file
@@ -0,0 +1,348 @@
|
||||
/*
|
||||
* Created on Jan 24, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
//import java.io.FileNotFoundException;
|
||||
//import java.io.IOException;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.*;
|
||||
import javax.naming.*;
|
||||
import javax.rmi.*;
|
||||
|
||||
import base.*;
|
||||
import conf.*;
|
||||
import mnp.proxy.FromWTC.*;
|
||||
import tim.infobus.data.*;
|
||||
|
||||
/**
|
||||
* Title: MNP-Sim Project
|
||||
* Description: Mobile Number Portability
|
||||
* Copyright: Copyright (c) 2005
|
||||
* Company: Teleap
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GwOloClient
|
||||
extends SimLogger {
|
||||
// Construct the EJB test client
|
||||
|
||||
static protected Properties prop = SimConfFile.getInstance().ReadSection("InfobusIN");
|
||||
|
||||
boolean logging = true;
|
||||
String url = "t3://nb-amici:7200";
|
||||
String jndiname_synch_gwoloR3 = "ServizioGwOloR3";
|
||||
String jndiname_synch_gwoloR4 = "ServizioGwOloR4";
|
||||
String jndiname_asynch_gwolo = "ServizioGwOloAsynch";
|
||||
String user = "guest";
|
||||
String password = "guest";
|
||||
|
||||
private boolean synch_gwoloR3_connected = false;
|
||||
private boolean synch_gwoloR4_connected = false;
|
||||
private boolean asynch_gwolo_connected = false;
|
||||
|
||||
private ServizioGwOloWrapperHome synch_gwoloR3_home = null;
|
||||
private ServizioGwOloWrapperHome synch_gwoloR4_home = null;
|
||||
private ServizioGWOloAsynchHome asynch_gwolo_home = null;
|
||||
|
||||
public void init() {
|
||||
|
||||
System.out.println("Init.. ");
|
||||
|
||||
//logging = Boolean.getBoolean(prop.getProperty("logging", "" + logging));
|
||||
url = prop.getProperty("url", url);
|
||||
|
||||
jndiname_synch_gwoloR3 = prop.getProperty("jndiname_synch_gwoloR3", jndiname_synch_gwoloR3);
|
||||
jndiname_synch_gwoloR4 = prop.getProperty("jndiname_synch_gwoloR4", jndiname_synch_gwoloR4);
|
||||
jndiname_asynch_gwolo = prop.getProperty("jndiname_asynch_gwolo", jndiname_asynch_gwolo);
|
||||
|
||||
user = prop.getProperty("user", user);
|
||||
password = prop.getProperty("password", password);
|
||||
|
||||
System.out.println("logging: " + logging);
|
||||
System.out.println("url: " + url);
|
||||
System.out.println("jndiname_synch_gwoloR3: " + jndiname_synch_gwoloR3);
|
||||
System.out.println("jndiname_synch_gwoloR4: " + jndiname_synch_gwoloR4);
|
||||
System.out.println("jndiname_asynch_gwolo: " + jndiname_asynch_gwolo);
|
||||
System.out.println("user: " + user);
|
||||
System.out.println("password: " + password);
|
||||
}
|
||||
|
||||
public GwOloClient() throws Exception {
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
public ServizioGwOloWrapperHome getSynchHome(String tipoInfobus) {
|
||||
|
||||
ServizioGwOloWrapperHome home = null;
|
||||
//logging = prop.getProperty("logging") != null ?
|
||||
// prop.getProperty("logging").equals("true"): true;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Initializing bean access. " + new Date());
|
||||
System.out.println("Initializing bean access. " + new Date());
|
||||
}
|
||||
|
||||
try {
|
||||
//get naming context
|
||||
//System.out.println("AAAAAAAAAAAAAAA");
|
||||
//Context ctx = getInitialContext();
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
Context ctx = new InitialContext(properties);
|
||||
|
||||
//look up jndi name
|
||||
//String jndiname = prop.getProperty("jndiname") == null ?
|
||||
// "ServizioGwOlo" : prop.getProperty("jndiname");
|
||||
|
||||
Object ref = null;
|
||||
if (tipoInfobus.equals("R3")) {
|
||||
if (logging)
|
||||
System.out.println("look up of " + jndiname_synch_gwoloR3);
|
||||
ref = ctx.lookup(jndiname_synch_gwoloR3);
|
||||
}
|
||||
else {
|
||||
if (logging)
|
||||
System.out.println("look up of " + jndiname_synch_gwoloR4);
|
||||
ref = ctx.lookup(jndiname_synch_gwoloR4);
|
||||
}
|
||||
|
||||
//cast to Home interface
|
||||
home = (ServizioGwOloWrapperHome) PortableRemoteObject.narrow(ref,
|
||||
ServizioGwOloWrapperHome.class);
|
||||
if (logging) {
|
||||
long endTime = System.currentTimeMillis();
|
||||
if (logging)
|
||||
System.out.println("Succeeded initializing bean access. elapsed "
|
||||
+ (endTime - startTime) / 1000);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (logging) {
|
||||
System.out.println("Failed initializing bean access. " + ex);
|
||||
}
|
||||
}
|
||||
return home;
|
||||
}
|
||||
|
||||
public ServizioGWOloAsynchHome getAsynchHome() {
|
||||
|
||||
ServizioGWOloAsynchHome home = null;
|
||||
//logging = prop.getProperty("logging") != null ?
|
||||
// prop.getProperty("logging").equals("true"): true;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Initializing bean access. " + new Date());
|
||||
}
|
||||
|
||||
try {
|
||||
//get naming context
|
||||
//Context ctx = getInitialContext();
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
Context ctx = new InitialContext(properties);
|
||||
|
||||
//look up jndi name
|
||||
//String jndiname = prop.getProperty("jndiname") == null ?
|
||||
// "ServizioGwOlo" : prop.getProperty("jndiname");
|
||||
if (logging)
|
||||
log("look up of " + jndiname_asynch_gwolo);
|
||||
Object ref = ctx.lookup(jndiname_asynch_gwolo);
|
||||
|
||||
//cast to Home interface
|
||||
home = (ServizioGWOloAsynchHome) PortableRemoteObject.narrow(ref, ServizioGWOloAsynchHome.class);
|
||||
if (logging) {
|
||||
long endTime = System.currentTimeMillis();
|
||||
if (logging)
|
||||
log("Succeeded initializing bean access. elapsed "
|
||||
+ (endTime - startTime) / 1000);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (logging) {
|
||||
log("Failed initializing bean access. " + ex);
|
||||
}
|
||||
}
|
||||
return home;
|
||||
}
|
||||
|
||||
private Context getInitialContext() throws Exception {
|
||||
|
||||
InitialContext ic = null;
|
||||
try {
|
||||
Properties p = new Properties();
|
||||
p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
|
||||
p.put(Context.PROVIDER_URL, url);
|
||||
if (user != null) {
|
||||
p.put(Context.SECURITY_PRINCIPAL, user);
|
||||
p.put(Context.SECURITY_CREDENTIALS, password);
|
||||
}
|
||||
ic = new InitialContext(p);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log("Unable to connect to WebLogic server at " + url
|
||||
+ " Please make sure that the server is running.");
|
||||
}
|
||||
finally {
|
||||
if (ic == null)
|
||||
ic = new InitialContext();
|
||||
}
|
||||
return ic;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Methods that use Home interface methods to generate a Remote interface
|
||||
// reference
|
||||
//----------------------------------------------------------------------------
|
||||
public ServizioGwOloWrapper getSynchBean(ServizioGwOloWrapperHome home) throws Exception {
|
||||
|
||||
ServizioGwOloWrapper bean = null;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Calling create()");
|
||||
}
|
||||
try {
|
||||
bean = home.create();
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Create SUCCEEDED elapsed: " + (endTime - startTime) / 1000
|
||||
+ " sec. ret. val: " + bean);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (logging) {
|
||||
log("Create FAILED " + ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
public ServizioGWOloAsynch getAsynchBean(ServizioGWOloAsynchHome home) throws Exception {
|
||||
|
||||
ServizioGWOloAsynch bean = null;
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Calling create()");
|
||||
}
|
||||
try {
|
||||
bean = home.create();
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
if (logging) {
|
||||
log("Create SUCCEEDED elapsed: " + (endTime - startTime) / 1000
|
||||
+ " sec. ret. val: " + bean);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
if (logging) {
|
||||
log("Create FAILED " + ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
public void synch_call(String metodo, String tracciato, String tipoInfobus) {
|
||||
ServizioGwOloWrapper synch_gwolo=null;
|
||||
try {
|
||||
|
||||
IBData ibData = new IBData();
|
||||
|
||||
TID tid = new TID();
|
||||
byte[] bDati = tracciato.getBytes();
|
||||
ibData.setTID(tid);
|
||||
ibData.setData(bDati);
|
||||
|
||||
//GwOloClient client = new GwOloClient();
|
||||
|
||||
if (tipoInfobus.equalsIgnoreCase("R3")) {
|
||||
if (!synch_gwoloR3_connected) {
|
||||
log("Connecting GwOloSynchR3..");
|
||||
synch_gwoloR3_home = getSynchHome(tipoInfobus);
|
||||
}
|
||||
synch_gwolo = getSynchBean(synch_gwoloR3_home);
|
||||
synch_gwoloR3_connected = true;
|
||||
}
|
||||
else { //R4
|
||||
if (!synch_gwoloR4_connected) {
|
||||
log("Connecting GwOloSynchR4..");
|
||||
synch_gwoloR4_home = getSynchHome(tipoInfobus);
|
||||
}
|
||||
synch_gwolo = getSynchBean(synch_gwoloR4_home);
|
||||
synch_gwoloR4_connected = true;
|
||||
}
|
||||
|
||||
if ("richiestaDNAbb".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaDNAbb(ibData);
|
||||
|
||||
else if ("richiestaDNPre".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaDNPre(ibData);
|
||||
|
||||
else if ("richiestaRTAbb".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaRTAbb(ibData);
|
||||
|
||||
else if ("richiestaRTPre".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaRTPre(ibData);
|
||||
|
||||
else if ("richiestaFMNPAbb".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaFMNPAbb(ibData);
|
||||
|
||||
else if ("richiestaFMNPPre".equalsIgnoreCase(metodo))
|
||||
synch_gwolo.richiestaFMNPPre(ibData);
|
||||
|
||||
if (tipoInfobus.equalsIgnoreCase("R3"))
|
||||
log("GwOloClient sync_gwoloR3 method " + metodo + " SUCCEEDED tracciato <" + tracciato + ">");
|
||||
else
|
||||
log("GwOloClient sync_gwoloR4 method " + metodo + " SUCCEEDED tracciato <" + tracciato + ">");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
if (tipoInfobus.equalsIgnoreCase("R3"))
|
||||
log("GwOloClient sync_gwoloR3 method " + metodo + " FAILED " + ex);
|
||||
else
|
||||
log("GwOloClient sync_gwoloR4 method " + metodo + " FAILED " + ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void async_call(String tracciato) {
|
||||
ServizioGWOloAsynch asynch_gwolo = null;
|
||||
try {
|
||||
|
||||
IBData ibData = new IBData();
|
||||
|
||||
byte[] bDati = tracciato.getBytes();
|
||||
ibData.setData(bDati);
|
||||
|
||||
//GwOloClient client = new GwOloClient();
|
||||
if (!asynch_gwolo_connected) {
|
||||
log("Connecting GwOloASynch..");
|
||||
asynch_gwolo_home = getAsynchHome();
|
||||
asynch_gwolo_connected = true;
|
||||
}
|
||||
asynch_gwolo = getAsynchBean(asynch_gwolo_home);
|
||||
asynch_gwolo.acquisisciDaBit(ibData);
|
||||
|
||||
log("GwOloClient async_gwolo acquisisciDaBit SUCCEEDED tracciato <" + tracciato + ">");
|
||||
} catch (RemoteException remEx) {
|
||||
remEx.printStackTrace();
|
||||
System.out.println(remEx.getMessage());
|
||||
log("ERRORE REMOTO");
|
||||
} catch (Exception ex) {
|
||||
log("GwOloAsyncClient acquisisciDaBit FAILED " + ex);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Created on Jan 27, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import conf.ProfiliTariffari;
|
||||
|
||||
import base.SimGenerator;
|
||||
import conf.CanaleVenditaBit;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
|
||||
|
||||
public class IBAttivazioneBIT_FDGenerator extends SimGenerator {
|
||||
|
||||
// obj. di cache per i TEST automatici
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
private String cod_offerta, desc_offerta;
|
||||
private String cod_accordo, desc_accordo;
|
||||
private String descanaleVendita;
|
||||
|
||||
|
||||
public IBAttivazioneBIT_FDGenerator() {
|
||||
cutover_date_format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
ProfiliTariffari.nextProfiloTariffario("BIT");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
setCod_accordo(ProfiliTariffari.getCodiceAccordo());
|
||||
setDesc_accordo(ProfiliTariffari.getDescrizioneAccordo());
|
||||
setCod_offerta(ProfiliTariffari.getCodiceOfferta());
|
||||
setDesc_offerta(ProfiliTariffari.getDescrizioneOfferta());
|
||||
|
||||
}
|
||||
|
||||
//public String cut_over_format_string ="yyyy-MM-dd";
|
||||
public String data_richiesta_format_string ="yyyy-MM-dd";
|
||||
public String data_invio_richiesta_format_string ="yyyy-MM-dd";
|
||||
//public SimpleDateFormat cut_over_format =new SimpleDateFormat(cut_over_format_string);
|
||||
public SimpleDateFormat data_richiesta_format =new SimpleDateFormat(data_richiesta_format_string);
|
||||
public SimpleDateFormat data_invio_richiesta_format =new SimpleDateFormat(data_invio_richiesta_format_string);
|
||||
|
||||
public Properties initDefProperties(int min_properties, int max_properties, boolean adhoc, String iccid) {
|
||||
Properties p = new Properties();
|
||||
ProfiliTariffari.nextProfiloTariffario("BIT");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
setCod_accordo(ProfiliTariffari.getCodiceAccordo());
|
||||
setDesc_accordo(ProfiliTariffari.getDescrizioneAccordo());
|
||||
setCod_offerta(ProfiliTariffari.getCodiceOfferta());
|
||||
setDesc_offerta(ProfiliTariffari.getDescrizioneOfferta());
|
||||
|
||||
log("initDefProperties min:" +min_properties +"max: " + max_properties);
|
||||
|
||||
p.setProperty("tipo_spedizione","01");
|
||||
p.setProperty("cod_service_order", getCodiceServiceOrder());
|
||||
p.setProperty("asset_uses", getAssetUses());
|
||||
p.setProperty("donating_cod_op", getCodiceOperatoreOLO(min_properties, max_properties));
|
||||
p.setProperty("cod_pre_post", getPrePost(min_properties, max_properties));
|
||||
|
||||
String prefisso =randomPrefisso();
|
||||
String telefono =getTelefono();
|
||||
|
||||
p.setProperty("prefisso_tim",prefisso);
|
||||
p.setProperty("numero_tim",telefono);
|
||||
p.setProperty("prefisso_olo","39"+prefisso);
|
||||
p.setProperty("numero_olo",telefono);
|
||||
|
||||
p.setProperty("icc_id_olo",!"NULL".equalsIgnoreCase(iccid)? iccid : getIccdSerialNumber());
|
||||
p.setProperty("cod_fis_cli_olo",getCodiceFiscalePartitaIVA());
|
||||
p.setProperty("tipo_doc_identita",getTipoDocumento());
|
||||
p.setProperty("num_doc_identita",getNumeroDocumento());
|
||||
p.setProperty("data_richiesta",data_richiesta_format.format(new Date()));
|
||||
p.setProperty("cod_contratto",getCodiceGruppo());
|
||||
p.setProperty("ot_cod",getOT());
|
||||
p.setProperty("nome_cliente_pf",randomNomeCliente());
|
||||
p.setProperty("cognome_cliente_pf",randomCognomeCliente());
|
||||
p.setProperty("denominazione_pg",randomNomeCliente() + " S.P.A.");
|
||||
p.setProperty("data_cutover",getDataCutover());
|
||||
p.setProperty("imsi_tim",getImsi());
|
||||
p.setProperty("data_invio_richiesta",data_invio_richiesta_format.format(new Date()));
|
||||
p.setProperty("cod_richiesta",getCodiceRichiestaBit());
|
||||
if (adhoc)
|
||||
p.setProperty("progetti_ad_hoc","9");
|
||||
else
|
||||
p.setProperty("progetti_ad_hoc"," ");
|
||||
p.setProperty("cod_profilo_tariffario", getCod_profilo_tariffario());
|
||||
p.setProperty("desc_profilo_tariffario", getDesc_profilo_tariffario());
|
||||
p.setProperty("cod_accordo", getCod_accordo());
|
||||
p.setProperty("desc_accordo", getDesc_accordo());
|
||||
p.setProperty("cod_offerta", getCod_offerta());
|
||||
p.setProperty("desc_offerta", getDesc_offerta());
|
||||
p.setProperty("descanale_vendita_bit",CanaleVenditaBit.getNextDescrizioneCanaleVendita());
|
||||
// Danilo Del Fio kit aprile 2009
|
||||
p.setProperty("flag_trasferimento_credito", getFlagTC());
|
||||
p.setProperty("flag_furto", getFlagFurto());
|
||||
//p.setProperty("flag_prevalidazione", getFlagPrevalidazione());
|
||||
p.setProperty("msisdn_parli_subito", getMsisdnParliSubito());
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Crea N tracciati BIT full-dual numbering
|
||||
* @param N numero dei tracciati da generare
|
||||
* @param prop Properties con i valori dei campi del tracciato (chiave in minucolo con uderscore al posto dello spazio)
|
||||
* @param iccid TODO
|
||||
* @param scivolotacs a true se la richiesta SID è per uno scivolo tacs
|
||||
* @return IBTracciatoSID[]
|
||||
*/
|
||||
public IBTracciato[] generate(int N, Properties prop, boolean adhoc, String iccid) {
|
||||
int max=N;
|
||||
int min_properties=index;
|
||||
int max_properties=index + N;
|
||||
IBTracciato[] tracciati = new IBTracciatoBIT_FD[max];
|
||||
|
||||
|
||||
testProcessCache.clear();
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_properties, max_properties, adhoc, iccid);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
tracciati[i] = new IBTracciatoBIT_FD();
|
||||
tracciati[i].loadFromProperties(p);
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
//test automatici
|
||||
|
||||
testProcessCache.addItem(TestProcessCache.BIT_IN,p);
|
||||
}
|
||||
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
log("Testing IBAttivazioneBIT_FDGenerator.. ");
|
||||
IBAttivazioneBIT_FDGenerator generator = new IBAttivazioneBIT_FDGenerator();
|
||||
IBTracciato tBIT[] = generator.generate(10, null, true, "NULL");
|
||||
for (int i=0; i<10; i++)
|
||||
log("tracciato " + i +": "+tBIT[i].getTracciato());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getCod_accordo() {
|
||||
return cod_accordo;
|
||||
}
|
||||
|
||||
|
||||
public void setCod_accordo(String cod_accordo) {
|
||||
this.cod_accordo = cod_accordo;
|
||||
}
|
||||
|
||||
|
||||
public String getCod_offerta() {
|
||||
return cod_offerta;
|
||||
}
|
||||
|
||||
|
||||
public void setCod_offerta(String cod_offerta) {
|
||||
this.cod_offerta = cod_offerta;
|
||||
}
|
||||
|
||||
|
||||
public String getDesc_accordo() {
|
||||
return desc_accordo;
|
||||
}
|
||||
|
||||
|
||||
public void setDesc_accordo(String desc_accordo) {
|
||||
this.desc_accordo = desc_accordo;
|
||||
}
|
||||
|
||||
|
||||
public String getDesc_offerta() {
|
||||
return desc_offerta;
|
||||
}
|
||||
|
||||
|
||||
public void setDesc_offerta(String desc_offerta) {
|
||||
this.desc_offerta = desc_offerta;
|
||||
}
|
||||
public String getDescanaleVendita() {
|
||||
return descanaleVendita;
|
||||
}
|
||||
public void setDescanaleVendita(String descanaleVendita) {
|
||||
this.descanaleVendita = descanaleVendita;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Created on Jan 27, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBAttivazioneBIT_TACSGenerator extends
|
||||
IBAttivazioneBIT_FDGenerator {
|
||||
|
||||
|
||||
public Properties initDefProperties(int min_properties, int max_properties) {
|
||||
|
||||
|
||||
log("initDefProperties min: " + min_properties +" max: "+ max_properties);
|
||||
|
||||
Properties p = super.initDefProperties(min_properties, max_properties, false, null);
|
||||
p.setProperty("tipo_spedizione","03");
|
||||
p.setProperty("donating_cod_op", "TIMT");
|
||||
p.setProperty("prefisso_olo", "39330");
|
||||
p.setProperty("prefisso_tim","330");
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crea N tracciati BIT TACS
|
||||
* @param N numero dei tracciati da generare
|
||||
* @param prop Properties con i valori dei campi del tracciato (chiave in minucolo con uderscore al posto dello spazio)
|
||||
* @return IBTracciatoSID[]
|
||||
*/
|
||||
public IBTracciato[] generate(int N, Properties prop) {
|
||||
int max=N;
|
||||
int min_properties=index;
|
||||
int max_properties=index + N;
|
||||
IBTracciato[] tracciati = new IBTracciatoBIT_TACS[max];
|
||||
|
||||
|
||||
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_properties, max_properties);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
tracciati[i] = new IBTracciatoBIT_TACS();
|
||||
tracciati[i].loadFromProperties(p);
|
||||
incrementaIndiceRichieste();
|
||||
}
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
log("Testing IBAttivazioneBIT_TACSGenerator.. ");
|
||||
IBAttivazioneBIT_TACSGenerator generator = new IBAttivazioneBIT_TACSGenerator();
|
||||
IBTracciato tBIT[] = generator.generate(10, null);
|
||||
for (int i=0; i<10; i++)
|
||||
log("tracciato BIT_TACS " + i +": "+tBIT[i].getTracciato());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import conf.ProfiliTariffari;
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBAttivazioneMSCGenerator extends IBAttivazioneSIDGenerator {
|
||||
public IBAttivazioneMSCGenerator() {
|
||||
ProfiliTariffari.nextProfiloTariffario("MSC");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
}
|
||||
|
||||
public Properties initDefProperties(int min, int max, boolean scivolotacs, String iccid) {
|
||||
|
||||
|
||||
log("initDefProperties max: " + max+ " scivolotacs: " + scivolotacs);
|
||||
|
||||
Properties p = super.initDefProperties(min, max, scivolotacs, iccid);
|
||||
ProfiliTariffari.nextProfiloTariffario("MSP");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
p.setProperty("subsys","MSC");
|
||||
ProfiliTariffari.nextProfiloTariffario("MSC");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
p.setProperty("cod_profilo_tariffario", getCod_profilo_tariffario());
|
||||
p.setProperty("desc_profilo_tariffario", getDesc_profilo_tariffario());
|
||||
p.setProperty("flag_trasferimento_credito", getFlagTC());
|
||||
p.setProperty("id_contratto", getIdContratto());
|
||||
p.setProperty("flag_furto", getFlagFurto());
|
||||
p.setProperty("flag_prevalidazione", getFlagPrevalidazione());
|
||||
p.setProperty("flag_progetto_ad_hoc", getProgettoAdHoc());
|
||||
p.setProperty("codice_gruppo", getCodGruppo());
|
||||
p.setProperty("msisdn_parli_subito", getMsisdnParliSubito());
|
||||
return p;
|
||||
}
|
||||
|
||||
public IBTracciato[] generate(int N, Properties prop, boolean scivolotacs, String iccid) {
|
||||
int max=N;
|
||||
int min_p = index;
|
||||
int max_p = N + index;
|
||||
IBTracciato[] tracciati = new IBTracciatoMSC[max];
|
||||
|
||||
|
||||
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_p, max_p, scivolotacs, iccid);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
tracciati[i] = new IBTracciatoMSC();
|
||||
tracciati[i].loadFromProperties(p);
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.MSC_IN,p);
|
||||
}
|
||||
return tracciati;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import conf.ProfiliTariffari;
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBAttivazioneMSPGenerator extends IBAttivazioneSIDGenerator {
|
||||
|
||||
//Nome del sistema (MSP, MSPCOOP) --> mi permette di individuare la section del file profiliTariffari.properties
|
||||
private String name;
|
||||
//Valore del compo subsystem nel tracciato infobus
|
||||
private String sub_sys;
|
||||
|
||||
private String flagFurto;
|
||||
private String flagPrevalidazione;
|
||||
private String progettoAdHoc;
|
||||
private String codiceGruppo;
|
||||
private String msisdnParliSubito;
|
||||
|
||||
|
||||
public IBAttivazioneMSPGenerator(String name, String sub_sys) {
|
||||
this.name = name;
|
||||
this.sub_sys = sub_sys;
|
||||
ProfiliTariffari.nextProfiloTariffario(this.name);
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
}
|
||||
|
||||
public Properties initDefProperties(int min, int max, boolean scivolotacs, String iccid) {
|
||||
|
||||
System.out.println("SUB SYSTEM "+this.sub_sys);
|
||||
System.out.println("NAME "+this.name);
|
||||
|
||||
log("initDefProperties max: " + max+ " scivolotacs: " + scivolotacs);
|
||||
|
||||
Properties p = super.initDefProperties(min, max, scivolotacs, iccid);
|
||||
p.setProperty("subsys",this.sub_sys);
|
||||
|
||||
ProfiliTariffari.nextProfiloTariffario(this.name);
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
p.setProperty("cod_profilo_tariffario", getCod_profilo_tariffario());
|
||||
p.setProperty("desc_profilo_tariffario", getDesc_profilo_tariffario());
|
||||
|
||||
if (getTipoOperazione()!=null)
|
||||
p.setProperty("tipo_operazione", getTipoOperazione());
|
||||
|
||||
p.setProperty("flag_trasferimento_credito", getFlagTC());
|
||||
if(getFlagFurto()!=null){
|
||||
p.setProperty("flag_furto",getFlagFurto());
|
||||
}
|
||||
if (getFlagPrevalidazione()!=null) {
|
||||
p.setProperty("flag_prevalidazione",getFlagPrevalidazione());
|
||||
}
|
||||
if (getProgettoAdHoc()!=null) {
|
||||
p.setProperty("progetto_adhoc",getProgettoAdHoc());
|
||||
}
|
||||
if (getCodiceGruppo()!=null) {
|
||||
p.setProperty("codice_gruppo",getCodiceGruppo());
|
||||
}
|
||||
if (getMsisdnParliSubito()!=null) {
|
||||
p.setProperty("msisdn_parli_subito",getMsisdnParliSubito());
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
public IBTracciato[] generate(int N, Properties prop, boolean scivolotacs, String iccid) {
|
||||
int max=N;
|
||||
int min_p = index;
|
||||
int max_p = N + index;
|
||||
|
||||
IBTracciato[] tracciati = null;
|
||||
if(this.name.equals("MSPCOOP")){
|
||||
tracciati=new IBTracciatoMSPCOOP[max];
|
||||
}else{
|
||||
tracciati=new IBTracciatoMSP[max];
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_p, max_p, scivolotacs, iccid);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
if(this.name.equals("MSPCOOP")){
|
||||
tracciati[i] = new IBTracciatoMSPCOOP();
|
||||
}else{
|
||||
tracciati[i] = new IBTracciatoMSP();
|
||||
}
|
||||
|
||||
tracciati[i].loadFromProperties(p);
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.MSP_IN,p);
|
||||
}
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
|
||||
public String getCodiceGruppo() {
|
||||
return codiceGruppo;
|
||||
}
|
||||
|
||||
public void setCodiceGruppo(String codiceGruppo) {
|
||||
this.codiceGruppo = codiceGruppo;
|
||||
}
|
||||
|
||||
public String getFlagFurto() {
|
||||
return flagFurto;
|
||||
}
|
||||
|
||||
public void setFlagFurto(String flagFurto) {
|
||||
this.flagFurto = flagFurto;
|
||||
}
|
||||
|
||||
public String getFlagPrevalidazione() {
|
||||
return flagPrevalidazione;
|
||||
}
|
||||
|
||||
public void setFlagPrevalidazione(String flagPrevalidazione) {
|
||||
this.flagPrevalidazione = flagPrevalidazione;
|
||||
}
|
||||
|
||||
public String getMsisdnParliSubito() {
|
||||
return msisdnParliSubito;
|
||||
}
|
||||
|
||||
public void setMsisdnParliSubito(String msisdnParliSubito) {
|
||||
this.msisdnParliSubito = msisdnParliSubito;
|
||||
}
|
||||
|
||||
public String getProgettoAdHoc() {
|
||||
return progettoAdHoc;
|
||||
}
|
||||
|
||||
public void setProgettoAdHoc(String progettoAdHoc) {
|
||||
this.progettoAdHoc = progettoAdHoc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import conf.ProfiliTariffari;
|
||||
|
||||
public class IBAttivazioneMspEXTGenerator extends IBAttivazioneMSPGenerator {
|
||||
|
||||
|
||||
|
||||
//Nome del sistema (MSP per Extension) --> mi permette di individuare la section del file profiliTariffari.properties
|
||||
private String name;
|
||||
//Valore del compo subsystem nel tracciato infobus
|
||||
private String sub_sys;
|
||||
|
||||
private static final String FILLER_EXTENSION=" ";
|
||||
|
||||
public IBAttivazioneMspEXTGenerator(String name, String sub_sys) {
|
||||
super( name, sub_sys);
|
||||
}
|
||||
|
||||
public Properties initDefProperties(int min, int max, boolean scivolotacs, String iccid) {
|
||||
|
||||
System.out.println("SUB SYSTEM "+this.sub_sys + " MSP EXTENSION");
|
||||
System.out.println("NAME "+this.name);
|
||||
|
||||
log("initDefProperties max: " + max+ " scivolotacs: " + scivolotacs);
|
||||
|
||||
Properties p = super.initDefProperties(min, max, scivolotacs, iccid);
|
||||
p.setProperty("codice_ordine",getCodiceOrdineMspExtension());
|
||||
return p;
|
||||
}
|
||||
|
||||
public IBTracciato[] generate(int N, Properties prop, boolean scivolotacs, String iccid) {
|
||||
int max=N;
|
||||
int min_p = index;
|
||||
int max_p = N + index;
|
||||
|
||||
IBTracciatoMspEXT[] tracciati = new IBTracciatoMspEXT[max];
|
||||
|
||||
|
||||
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_p, max_p, scivolotacs, iccid);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
tracciati[i] = new IBTracciatoMspEXT();
|
||||
tracciati[i].loadFromProperites(p);
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.MSP_EXT_IN,p);
|
||||
}
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
package siminfobus;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import conf.ProfiliTariffari;
|
||||
|
||||
import base.SimGenerator;
|
||||
|
||||
/**
|
||||
* Title: MNP-Sim Project
|
||||
* Description: Mobile Number Portability
|
||||
* Copyright: Copyright (c) 2005
|
||||
* Company: Teleap
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
public class IBAttivazioneSIDGenerator extends SimGenerator {
|
||||
|
||||
/*private ServizioGwOloHome home = null;
|
||||
private ServizioGwOlo servizioGwOlo = null;
|
||||
private String url = null;
|
||||
private String user = null;
|
||||
private String password = null;
|
||||
private String[] dati = new String[100];
|
||||
private String tipoServizio = null;
|
||||
private Properties propLoader = null;*/
|
||||
|
||||
//obj. di cache per i TEST automatici
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
|
||||
//public String recipient_type = "STANDARD"; //"STANDARD","SCIVOLOTACS"
|
||||
public IBAttivazioneSIDGenerator() {
|
||||
testProcessCache.clear();
|
||||
cutover_date_format = new SimpleDateFormat("yyyyMMdd");
|
||||
ProfiliTariffari.nextProfiloTariffario("MSP");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
}
|
||||
|
||||
|
||||
public String richiesta_operazione_format_string ="yyyyMMddHHmmssSS";
|
||||
public SimpleDateFormat richiesta_operazione_format =new SimpleDateFormat(richiesta_operazione_format_string);
|
||||
|
||||
public Properties initDefProperties(int min, int max, boolean scivolotacs, String iccid) {
|
||||
Properties p = new Properties();
|
||||
String prefisso =randomPrefisso();
|
||||
String telefono =getTelefono();
|
||||
|
||||
ProfiliTariffari.nextProfiloTariffario("MSP");
|
||||
setCod_profilo_tariffario(ProfiliTariffari.getCodiceProfilo());
|
||||
setDesc_profilo_tariffario(ProfiliTariffari.getDescrizioneProfilo());
|
||||
|
||||
log("initDefProperties min: " + min + " max: " + max + " scivolotacs: " + scivolotacs);
|
||||
|
||||
p.setProperty("subsys","SUBSYS_SID");
|
||||
|
||||
if (!scivolotacs) {
|
||||
p.setProperty("codice_operatore_donating", getCodiceOperatoreOLO(min,max));
|
||||
p.setProperty("prefisso_tim", prefisso);
|
||||
p.setProperty("prefisso_aom", prefisso);
|
||||
p.setProperty("tecnologia" , "3");
|
||||
p.setProperty("tipo_operazione", getTipoOperazione(min, max));
|
||||
}
|
||||
else {
|
||||
p.setProperty("codice_operatore_donating", "TIMT");
|
||||
p.setProperty("prefisso_tim", "330");
|
||||
p.setProperty("prefisso_aom", "330");
|
||||
p.setProperty("tecnologia" , "2");
|
||||
p.setProperty("tipo_operazione", "MTG");
|
||||
}
|
||||
|
||||
|
||||
p.setProperty("numero_di_telefono_tim",telefono);
|
||||
p.setProperty("numero_di_telefono_aom",telefono);
|
||||
|
||||
if ("VUOTO".equalsIgnoreCase(iccid)) {
|
||||
p.setProperty("iccid_aom", "");
|
||||
} else
|
||||
p.setProperty("iccid_aom", !"NULL".equalsIgnoreCase(iccid)? iccid : getIccdSerialNumber());
|
||||
p.setProperty("codice_fiscale", getCodiceFiscalePartitaIVA());
|
||||
p.setProperty("partita_iva", getCodiceFiscalePartitaIVA());;
|
||||
p.setProperty("codice_pre_postpagato", getPrePost(min, max));
|
||||
p.setProperty("data_cut_over", getDataCutover());
|
||||
p.setProperty("cognome", randomCognomeCliente());
|
||||
p.setProperty("nome",randomNomeCliente());
|
||||
p.setProperty("denomominazione_societa", randomNomeCliente() + " S.R.L.");
|
||||
p.setProperty("tipo_documento" , getTipoDocumento());
|
||||
p.setProperty("numero_documento" , getNumeroDocumento());
|
||||
p.setProperty("data_richiesta_operazione", richiesta_operazione_format.format(new Date()));
|
||||
|
||||
|
||||
p.setProperty("imsi", getImsi());
|
||||
p.setProperty("codice_dealer", getCodice_dealer());
|
||||
p.setProperty("cod_profilo_tariffario", getCod_profilo_tariffario());
|
||||
p.setProperty("desc_profilo_tariffario", getDesc_profilo_tariffario());
|
||||
|
||||
p.setProperty("filler", IBTracciatoSID.blanks);
|
||||
|
||||
//log("properties: " + p.toString());
|
||||
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Crea N tracciati SID
|
||||
* @param N numero dei tracciati da generare
|
||||
* @param prop Properties con i valori dei campi del tracciato (chiave in minucolo con uderscore al posto dello spazio)
|
||||
* @param scivolotacs a true se la richiesta SID è per uno scivolo tacs
|
||||
* @param iccid TODO
|
||||
* @return IBTracciatoSID[]
|
||||
*/
|
||||
public IBTracciato[] generate(int N, Properties prop, boolean scivolotacs, String iccid) {
|
||||
int max=N;
|
||||
int min_p=index;
|
||||
int max_p=index + N;
|
||||
IBTracciato[] tracciati = new IBTracciatoSID[max];
|
||||
|
||||
for (int i=0; i<max; i++) {
|
||||
Properties p = initDefProperties(min_p, max_p, scivolotacs, iccid);
|
||||
if (prop != null)
|
||||
p.putAll(prop);
|
||||
tracciati[i] = new IBTracciatoSID();
|
||||
tracciati[i].loadFromProperties(p);
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
//test automatici
|
||||
//testProcessCache.addItem(TestProcessCache.SID_IN,p);
|
||||
}
|
||||
return tracciati;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
log("Testing IBAttivazioneGenerator.. ");
|
||||
IBAttivazioneSIDGenerator generator = new IBAttivazioneSIDGenerator();
|
||||
IBTracciato tSID[] = generator.generate(10, null, true, "NULL");
|
||||
for (int i=0; i<10; i++)
|
||||
log("tracciato " + i +": "+tSID[i].getTracciato());
|
||||
/*
|
||||
ServizioGwOloClient client = new ServizioGwOloClient(args[0]);
|
||||
// Use the client object to call one of the Home interface wrappers
|
||||
// above, to create a Remote interface reference to the bean.
|
||||
// If the return value is of the Remote interface type, you can use it
|
||||
// to access the remote interface methods. You can also just use the
|
||||
// client object to call the Remote interface wrappers.
|
||||
//System.out.println("");
|
||||
IBInfo buffer = new IBInfo();
|
||||
//IBInfo bufferMss = new IBInfo();
|
||||
TID Tid = new TID();
|
||||
//TID Tid1 = new TID();
|
||||
buffer.setIdReq(Tid);
|
||||
//bufferMss.setIdReq(new TID());
|
||||
System.out.println(Tid.toString());
|
||||
|
||||
client.create();
|
||||
int i = 0;
|
||||
String record = null;
|
||||
byte[] bDati = null;
|
||||
while ( i<100 && client.dati[i] != null && !client.dati[i].trim().equals(""))
|
||||
{
|
||||
record = client.dati[i];
|
||||
System.out.println("Il record è :"+"["+record+"]");
|
||||
bDati = record.getBytes();
|
||||
|
||||
buffer.setData(bDati);
|
||||
buffer.setLenData(bDati.length);
|
||||
|
||||
if (client.tipoServizio.equalsIgnoreCase("richiestaDNAbb")) client.servizioGwOlo.richiestaDNAbb(buffer);
|
||||
else if (client.tipoServizio.equalsIgnoreCase("richiestaDNPre")) client.servizioGwOlo.richiestaDNPre(buffer) ;
|
||||
else if (client.tipoServizio.equalsIgnoreCase("richiestaRTAbb")) client.servizioGwOlo.richiestaRTAbb(buffer);
|
||||
else if (client.tipoServizio.equalsIgnoreCase("richiestaRTPre")) client.servizioGwOlo.richiestaRTPre(buffer);
|
||||
else if (client.tipoServizio.equalsIgnoreCase("richiestaFMNPAbb")) client.servizioGwOlo.richiestaFMNPAbb(buffer);
|
||||
else if (client.tipoServizio.equalsIgnoreCase("richiestaFMNPPre")) client.servizioGwOlo.richiestaFMNPPre(buffer);
|
||||
|
||||
System.out.println("Leggo il record num " + i +" Il valore è : ["+client.dati[i]+"]");
|
||||
i++;
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Created on Jan 26, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Properties;
|
||||
|
||||
import base.SimLogger;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to Window -
|
||||
* Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public abstract class IBTracciato extends SimLogger {
|
||||
// 100 spazi
|
||||
// RAGGIUNTI 150 SPAZI A CAUSA DI DESC_OFFERTA!
|
||||
public final static String blanks = " ";
|
||||
|
||||
public void loadFromProperties(Properties prop) {
|
||||
int len = 0;
|
||||
|
||||
// log("loadFromPetroperties prop len: " + prop.size() + "..");
|
||||
Class current = getClass();
|
||||
|
||||
while (!"java.lang.Object".equalsIgnoreCase(current.getName())) {
|
||||
|
||||
// System.out.println("******** current " + current.getName());
|
||||
Field fields[] = current.getDeclaredFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
String name = fields[i].getName();
|
||||
// log("property name: " + name + "..");
|
||||
String value = prop.getProperty(name);
|
||||
if (value != null) {
|
||||
// log("found value: " + value + "..");
|
||||
// log("-> name: " + name + ": <" + value + ">");
|
||||
try {
|
||||
char[] m_field = (char[]) fields[i].get(this);
|
||||
value = (value + blanks).substring(0, m_field.length);
|
||||
char[] m_value = value.toCharArray();
|
||||
fields[i].set(this, m_value);
|
||||
log("prop name: " + name + " len: " + new
|
||||
String(m_value).length() +" set: <" + new
|
||||
String(m_value) + ">");
|
||||
log("-> name: " + name + ": <" + value + "> [" + new String(m_value).length() + "]");
|
||||
len += m_value.length;
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Exception loading " + fields[i].getName() + ": " + ex);
|
||||
}
|
||||
} else {
|
||||
// log("property name: " + name + ".. NOT FOUND");
|
||||
}
|
||||
|
||||
}
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
log(getClass().getName() + " total length: " + len);
|
||||
// System.out.println("total length: "+len);
|
||||
|
||||
}
|
||||
|
||||
abstract public String getTracciato();
|
||||
abstract public String getTracciato(boolean invioDatiAnagrafici);
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Created on Jan 27, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoBIT_FD extends IBTracciato {
|
||||
|
||||
protected char[] tipo_spedizione;
|
||||
protected char[] cod_service_order;
|
||||
protected char[] asset_uses;
|
||||
protected char[] donating_cod_op;
|
||||
protected char[] cod_pre_post;
|
||||
protected char[] prefisso_tim;
|
||||
protected char[] numero_tim;
|
||||
protected char[] prefisso_olo;
|
||||
protected char[] numero_olo;
|
||||
protected char[] icc_id_olo;
|
||||
protected char[] cod_fis_cli_olo;
|
||||
protected char[] tipo_doc_identita;
|
||||
protected char[] num_doc_identita;
|
||||
protected char[] data_richiesta;
|
||||
protected char[] cod_contratto;
|
||||
protected char[] ot_cod;
|
||||
protected char[] nome_cliente_pf;
|
||||
protected char[] cognome_cliente_pf;
|
||||
protected char[] denominazione_pg;
|
||||
protected char[] data_cutover;
|
||||
protected char[] imsi_tim;
|
||||
protected char[] data_invio_richiesta;
|
||||
protected char[] cod_richiesta;
|
||||
protected char[] progetti_ad_hoc;
|
||||
protected char[] cod_profilo_tariffario;
|
||||
protected char[] desc_profilo_tariffario;
|
||||
protected char[] cod_offerta;
|
||||
protected char[] desc_offerta;
|
||||
protected char[] desc_accordo;
|
||||
protected char[] cod_accordo;
|
||||
protected char[] descanale_vendita_bit;
|
||||
protected char[] flag_trasferimento_credito;
|
||||
protected char[] msisdn_parli_subito;
|
||||
|
||||
protected char[] flag_furto;
|
||||
|
||||
|
||||
public IBTracciatoBIT_FD() {
|
||||
|
||||
tipo_spedizione = new char[2]; //tipo_spedizione "01"
|
||||
cod_service_order = new char[15];
|
||||
asset_uses = new char[22]; //identif utenza
|
||||
donating_cod_op = new char[4]; //cod operat donating
|
||||
cod_pre_post = new char[3]; //PRP, POP
|
||||
prefisso_tim = new char[3];
|
||||
numero_tim = new char[10];
|
||||
prefisso_olo = new char[5];
|
||||
numero_olo = new char[10];
|
||||
icc_id_olo = new char[30]; //iccid della sim olo
|
||||
cod_fis_cli_olo = new char[16]; //cod fiscale o P.IVA
|
||||
tipo_doc_identita = new char[3];
|
||||
num_doc_identita = new char[30];
|
||||
data_richiesta = new char[10]; //data in cui è avvenuta la rich. del cliente
|
||||
cod_contratto = new char[12]; //codice gruppo/cliente
|
||||
ot_cod = new char[2]; //organizzaziobe territoriale
|
||||
nome_cliente_pf = new char[20];
|
||||
cognome_cliente_pf = new char[50];
|
||||
denominazione_pg = new char[70];
|
||||
data_cutover = new char[10];
|
||||
imsi_tim = new char[15]; //imsi assegnato da TIM
|
||||
data_invio_richiesta = new char[10]; //data di invio della rich a DBC
|
||||
cod_richiesta = new char[18]; //cod richiesta generato da BIT
|
||||
progetti_ad_hoc = new char[1]; //'9', ' '
|
||||
cod_profilo_tariffario = new char[10];// codice profilo tariffario assegrato da TIM
|
||||
cod_accordo = new char[10];// codice accordo assegnato da TIM
|
||||
cod_offerta = new char[5];// codice offerta assegnato da TIM
|
||||
desc_profilo_tariffario = new char[50]; // descrizione profilo tariffario assegnato da TIM
|
||||
desc_accordo = new char[150];// descrizione accordo assegnato da TIM
|
||||
desc_offerta = new char[50];// descrizione offerta assegnato da TIM
|
||||
descanale_vendita_bit = new char[50]; // descrizione del canale di vendita per BIT
|
||||
flag_trasferimento_credito= new char[1]; // flag che indica se è attivo o meno il trasferimento del credito (dominio: Y/N)
|
||||
flag_furto= new char[1]; // flag che indica se è attivo o meno il trasferimento del credito (dominio: Y/N)
|
||||
//flag_prevalidazione= new char[1]; // flag che indica se è attivo o meno il trasferimento del credito (dominio: Y/N)
|
||||
msisdn_parli_subito= new char[13]; // flag che indica se è attivo o meno il trasferimento del credito (dominio: Y/N)
|
||||
}
|
||||
|
||||
|
||||
public String getTracciato() {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append(tipo_spedizione);
|
||||
sb.append(cod_service_order);
|
||||
sb.append(asset_uses);
|
||||
sb.append(donating_cod_op);
|
||||
sb.append(cod_pre_post);
|
||||
sb.append(prefisso_tim);
|
||||
sb.append(numero_tim);
|
||||
sb.append(prefisso_olo);
|
||||
sb.append(numero_olo);
|
||||
sb.append(icc_id_olo);
|
||||
sb.append(cod_fis_cli_olo);
|
||||
sb.append(tipo_doc_identita);
|
||||
sb.append(num_doc_identita);
|
||||
sb.append(data_richiesta);
|
||||
sb.append(cod_contratto);
|
||||
sb.append(ot_cod);
|
||||
sb.append(nome_cliente_pf);
|
||||
sb.append(cognome_cliente_pf);
|
||||
sb.append(denominazione_pg);
|
||||
sb.append(data_cutover);
|
||||
sb.append(imsi_tim);
|
||||
sb.append(data_invio_richiesta);
|
||||
sb.append(cod_richiesta);
|
||||
sb.append(progetti_ad_hoc);
|
||||
sb.append(cod_offerta);
|
||||
sb.append(desc_offerta);
|
||||
sb.append(cod_accordo);
|
||||
sb.append(desc_accordo);
|
||||
sb.append(cod_profilo_tariffario);
|
||||
sb.append(desc_profilo_tariffario);
|
||||
sb.append(descanale_vendita_bit);
|
||||
sb.append(flag_trasferimento_credito);
|
||||
sb.append(flag_furto);
|
||||
// sb.append(flag_prevalidazione);
|
||||
sb.append(msisdn_parli_subito);
|
||||
|
||||
//log("tracciato: <" + sb.toString() + ">");
|
||||
System.out.println("tracciato: <" + sb.toString() + ">");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
|
||||
return getTracciato();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Created on Jan 27, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoBIT_TACS extends IBTracciatoBIT_FD {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Giovanni/Danilo Del Fio kit aprile 2009
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoMSC extends IBTracciatoSID {
|
||||
|
||||
public IBTracciatoMSC(/*Properties prop*/) {
|
||||
super();
|
||||
id_contratto = new char[18];
|
||||
flag_trasferimento_credito= new char[1];
|
||||
codice_gruppo= new char[12];
|
||||
msisdn_parli_subito = new char[13];
|
||||
flag_furto= new char[1];
|
||||
flag_prevalidazione= new char[1];
|
||||
flag_progetto_ad_hoc= new char[1];
|
||||
filler = new char[13];
|
||||
}
|
||||
|
||||
protected char[] id_contratto;
|
||||
protected char[] flag_trasferimento_credito;
|
||||
protected char[] codice_gruppo;
|
||||
protected char[] msisdn_parli_subito;
|
||||
protected char[] flag_furto;
|
||||
protected char[] flag_prevalidazione;
|
||||
protected char[] flag_progetto_ad_hoc;
|
||||
|
||||
|
||||
public void loadFromProperites(Properties p) {
|
||||
super.loadFromProperties(p);
|
||||
p.setProperty("subsys","MSC");
|
||||
}
|
||||
public String getTracciato() {
|
||||
return getTracciato(true);
|
||||
}
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
System.out.println("IBTracciatoMSC.getTracciato(): invioDatiAnagrafici="+(invioDatiAnagrafici==true?"TRUE":"FALSE"));
|
||||
sb.append(subsys);
|
||||
sb.append(codice_operatore_donating);
|
||||
sb.append(prefisso_tim);
|
||||
sb.append(numero_di_telefono_tim);
|
||||
sb.append(prefisso_aom);
|
||||
sb.append(numero_di_telefono_aom);
|
||||
sb.append(iccid_aom);
|
||||
sb.append(codice_fiscale);
|
||||
sb.append(partita_iva);
|
||||
sb.append(codice_pre_postpagato);
|
||||
sb.append(data_cut_over);
|
||||
if(invioDatiAnagrafici){
|
||||
sb.append(cognome);
|
||||
sb.append(nome);
|
||||
sb.append(denomominazione_societa);
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(tipo_documento);
|
||||
sb.append(numero_documento);
|
||||
sb.append(data_richiesta_operazione);
|
||||
sb.append(tipo_operazione);
|
||||
sb.append(tecnologia);
|
||||
sb.append(imsi);
|
||||
sb.append(codice_dealer);
|
||||
sb.append(cod_profilo_tariffario);
|
||||
sb.append(desc_profilo_tariffario);
|
||||
sb.append(flag_trasferimento_credito);
|
||||
sb.append(id_contratto);
|
||||
sb.append(flag_furto);
|
||||
sb.append(flag_prevalidazione);
|
||||
sb.append(flag_progetto_ad_hoc);
|
||||
sb.append(codice_gruppo);
|
||||
sb.append(msisdn_parli_subito);
|
||||
|
||||
sb.append(filler);
|
||||
|
||||
log("tracciato: <" + sb.toString() + "> - length:"+sb.toString().length());
|
||||
|
||||
return sb.toString();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoMSP extends IBTracciatoSID {
|
||||
|
||||
public IBTracciatoMSP(/*Properties prop*/) {
|
||||
super();
|
||||
codice_ordine = new char[15];
|
||||
flag_trasferimento_credito= new char[1];
|
||||
filler = new char[16];
|
||||
flag_furto= new char[1];
|
||||
flag_prevalidazione= new char[1];
|
||||
progetto_adhoc= new char[1];
|
||||
codice_gruppo=new char[12];
|
||||
msisdn_parli_subito=new char[13];
|
||||
}
|
||||
|
||||
protected char[] codice_ordine;
|
||||
protected char[] flag_trasferimento_credito;
|
||||
protected char[] flag_furto;
|
||||
protected char[] flag_prevalidazione;
|
||||
protected char[] progetto_adhoc;
|
||||
protected char[] codice_gruppo;
|
||||
protected char[] msisdn_parli_subito;
|
||||
|
||||
public void loadFromProperites(Properties p) {
|
||||
super.loadFromProperties(p);
|
||||
}
|
||||
public String getTracciato() {
|
||||
return getTracciato(true);
|
||||
}
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
System.out.println("IBTracciatoMSP.getTracciato(): invioDatiAnagrafici="+(invioDatiAnagrafici==true?"TRUE":"FALSE"));
|
||||
sb.append(subsys);
|
||||
sb.append(codice_operatore_donating);
|
||||
sb.append(prefisso_tim);
|
||||
sb.append(numero_di_telefono_tim);
|
||||
sb.append(prefisso_aom);
|
||||
sb.append(numero_di_telefono_aom);
|
||||
sb.append(iccid_aom);
|
||||
sb.append(codice_fiscale);
|
||||
sb.append(partita_iva);
|
||||
sb.append(codice_pre_postpagato);
|
||||
sb.append(data_cut_over);
|
||||
if(invioDatiAnagrafici){
|
||||
sb.append(cognome);
|
||||
sb.append(nome);
|
||||
sb.append(denomominazione_societa);
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(tipo_documento);
|
||||
sb.append(numero_documento);
|
||||
sb.append(data_richiesta_operazione);
|
||||
sb.append(tipo_operazione);
|
||||
sb.append(tecnologia);
|
||||
sb.append(imsi);
|
||||
sb.append(codice_dealer);
|
||||
sb.append(cod_profilo_tariffario);
|
||||
sb.append(desc_profilo_tariffario);
|
||||
sb.append(codice_ordine);
|
||||
sb.append(flag_trasferimento_credito);
|
||||
sb.append(flag_furto);
|
||||
sb.append(flag_prevalidazione);
|
||||
sb.append(progetto_adhoc);
|
||||
sb.append(codice_gruppo);
|
||||
sb.append(msisdn_parli_subito);
|
||||
sb.append(filler);
|
||||
|
||||
log("tracciato: <" + sb.toString() + "> - length:"+sb.toString().length());
|
||||
|
||||
return sb.toString();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Created on Jan 25, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoMSPCOOP extends IBTracciatoSID {
|
||||
|
||||
public IBTracciatoMSPCOOP(/*Properties prop*/) {
|
||||
super();
|
||||
flag_trasferimento_credito= new char[1];
|
||||
filler = new char[59];
|
||||
}
|
||||
|
||||
protected char[] flag_trasferimento_credito;
|
||||
|
||||
|
||||
public void loadFromProperites(Properties p) {
|
||||
super.loadFromProperties(p);
|
||||
}
|
||||
public String getTracciato() {
|
||||
return getTracciato(true);
|
||||
}
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
System.out.println("IBTracciatoMSPCOOP.getTracciato(): invioDatiAnagrafici="+(invioDatiAnagrafici==true?"TRUE":"FALSE"));
|
||||
sb.append(subsys);
|
||||
sb.append(codice_operatore_donating);
|
||||
sb.append(prefisso_tim);
|
||||
sb.append(numero_di_telefono_tim);
|
||||
sb.append(prefisso_aom);
|
||||
sb.append(numero_di_telefono_aom);
|
||||
sb.append(iccid_aom);
|
||||
sb.append(codice_fiscale);
|
||||
sb.append(partita_iva);
|
||||
sb.append(codice_pre_postpagato);
|
||||
sb.append(data_cut_over);
|
||||
if(invioDatiAnagrafici){
|
||||
sb.append(cognome);
|
||||
sb.append(nome);
|
||||
sb.append(denomominazione_societa);
|
||||
} else {
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(tipo_documento);
|
||||
sb.append(numero_documento);
|
||||
sb.append(data_richiesta_operazione);
|
||||
sb.append(tipo_operazione);
|
||||
sb.append(tecnologia);
|
||||
sb.append(imsi);
|
||||
sb.append(codice_dealer);
|
||||
sb.append(cod_profilo_tariffario);
|
||||
sb.append(desc_profilo_tariffario);
|
||||
sb.append(flag_trasferimento_credito);
|
||||
sb.append(filler);
|
||||
|
||||
log("tracciato: <" + sb.toString() + "> - length:"+sb.toString().length());
|
||||
|
||||
return sb.toString();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package siminfobus;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class IBTracciatoMspEXT extends IBTracciatoMSP {
|
||||
|
||||
|
||||
public IBTracciatoMspEXT(/*Properties prop*/) {
|
||||
super();
|
||||
}
|
||||
|
||||
public void loadFromProperites(Properties p) {
|
||||
super.loadFromProperties(p);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Created on Jan 24, 2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package siminfobus;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Title: MNP-Sim Project
|
||||
* Description: Mobile Number Portability
|
||||
* Copyright: Copyright (c) 2005
|
||||
* Company: Teleap
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
public class IBTracciatoSID extends IBTracciato{
|
||||
|
||||
|
||||
|
||||
protected char[] subsys;
|
||||
protected char[] codice_operatore_donating;
|
||||
protected char[] prefisso_aom;
|
||||
protected char[] prefisso_tim;
|
||||
protected char[] codice_fiscale;
|
||||
protected char[] numero_di_telefono_aom;
|
||||
protected char[] numero_di_telefono_tim;
|
||||
protected char[] iccid_aom;
|
||||
protected char[] partita_iva;
|
||||
protected char[] codice_pre_postpagato;
|
||||
protected char[] data_cut_over;
|
||||
protected char[] cognome;
|
||||
protected char[] nome;
|
||||
protected char[] denomominazione_societa;
|
||||
protected char[] tipo_documento;
|
||||
protected char[] numero_documento;
|
||||
protected char[] data_richiesta_operazione;
|
||||
protected char[] tipo_operazione;
|
||||
protected char[] tecnologia;
|
||||
protected char[] imsi;
|
||||
protected char[] codice_dealer;
|
||||
protected char[] cod_profilo_tariffario;
|
||||
protected char[] desc_profilo_tariffario;
|
||||
protected char[] filler;
|
||||
|
||||
protected String tipo_richiesta;
|
||||
|
||||
|
||||
public IBTracciatoSID(/*Properties prop*/) {
|
||||
subsys = new char[10]; //SUBSYS_SID
|
||||
codice_operatore_donating = new char[4];
|
||||
prefisso_tim = new char[3];
|
||||
numero_di_telefono_tim = new char[10];
|
||||
prefisso_aom = new char[3];
|
||||
numero_di_telefono_aom = new char[10];
|
||||
|
||||
iccid_aom = new char[27]; //Serial number della SIM CARD
|
||||
codice_fiscale = new char[16];
|
||||
partita_iva = new char[11];
|
||||
codice_pre_postpagato = new char[3]; //PRP, POP
|
||||
data_cut_over = new char[8];
|
||||
cognome = new char[50];
|
||||
nome = new char[20];
|
||||
denomominazione_societa = new char[70];
|
||||
tipo_documento = new char[3]; //PA,PS,CI
|
||||
numero_documento = new char[10];
|
||||
data_richiesta_operazione = new char[16]; //formato yyyyMMddHHmmssSS
|
||||
tipo_operazione = new char[3]; //ADN (dual numbering) FNP (full numbering)
|
||||
tecnologia = new char[1]; //3
|
||||
imsi = new char[16]; //imsi della carta TIM
|
||||
codice_dealer = new char[10]; //codice dealer
|
||||
cod_profilo_tariffario = new char[10];
|
||||
desc_profilo_tariffario = new char[50];
|
||||
filler = new char[60]; //spazi
|
||||
|
||||
|
||||
|
||||
|
||||
//loadFromProperties(prop);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void loadFromProperties(Properties prop) {
|
||||
int len =0;
|
||||
|
||||
//log("loadFromPetroperties prop len: " + prop.size() + "..");
|
||||
Class current = getClass();
|
||||
|
||||
while (!"java.lang.Object".equalsIgnoreCase(current.getName())) {
|
||||
|
||||
//System.out.println("******** current " + current.getName());
|
||||
Field fields[] = current.getDeclaredFields();
|
||||
for (int i=0; i<fields.length;i++) {
|
||||
String name = fields[i].getName();
|
||||
//log("property name: " + name + "..");
|
||||
String value = prop.getProperty(name);
|
||||
if (value != null){
|
||||
//log("found value: " + value + "..");
|
||||
try {
|
||||
char[] m_field = (char[]) fields[i].get(this);
|
||||
value = (value + blanks).substring(0, m_field.length);
|
||||
char[] m_value = value.toCharArray();
|
||||
fields[i].set(this, m_value);
|
||||
log("prop name: " + name + " len: " + new String(m_value).length() +" set: <" + new String(m_value) + ">");
|
||||
len += m_value.length;
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Exception loading " +fields[i].getName() +": "+ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//log("property name: " + name + ".. NOT FOUND");
|
||||
}
|
||||
|
||||
}
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
log(getClass().getName() + "total length: "+len);
|
||||
//System.out.println("total length: "+len);
|
||||
|
||||
}
|
||||
|
||||
public String getTracciato() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append(subsys);
|
||||
sb.append(codice_operatore_donating);
|
||||
sb.append(prefisso_tim);
|
||||
sb.append(numero_di_telefono_tim);
|
||||
sb.append(prefisso_aom);
|
||||
sb.append(numero_di_telefono_aom);
|
||||
sb.append(iccid_aom);
|
||||
sb.append(codice_fiscale);
|
||||
sb.append(partita_iva);
|
||||
sb.append(codice_pre_postpagato);
|
||||
sb.append(data_cut_over);
|
||||
sb.append(cognome);
|
||||
sb.append(nome);
|
||||
sb.append(denomominazione_societa);
|
||||
sb.append(tipo_documento);
|
||||
sb.append(numero_documento);
|
||||
sb.append(data_richiesta_operazione);
|
||||
sb.append(tipo_operazione);
|
||||
sb.append(tecnologia);
|
||||
sb.append(imsi);
|
||||
sb.append(codice_dealer);
|
||||
sb.append(cod_profilo_tariffario);
|
||||
sb.append(desc_profilo_tariffario);
|
||||
sb.append(filler);
|
||||
|
||||
log("tracciato: <" + sb.toString() + ">");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getTracciato(boolean invioDatiAnagrafici) {
|
||||
System.out.println("IBTracciatoSID.getTracciato(): invioDatiAnagrafici="+(invioDatiAnagrafici==true?"TRUE":"FALSE"));
|
||||
return getTracciato();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package testUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class TestProcessCache {
|
||||
private static TestProcessCache onlyInstance;
|
||||
private HashMap cache = new HashMap();
|
||||
|
||||
|
||||
public static final int XML=1;
|
||||
//public static final int SID_IN=2;//?? SISTEMA ELIMINATO
|
||||
public static final int MSP_IN=3;//??
|
||||
public static final int MSC_IN=4;//??
|
||||
public static final int BIT_IN=5;//??
|
||||
public static final int MSISDN=6;
|
||||
public static final int IDRICHIESTA=7;
|
||||
public static final int HZ=8;
|
||||
public static final int MSP_EXT_IN=9;
|
||||
public static final int TISCALI_IN=10;
|
||||
public static final int MSS=11;
|
||||
public static final int IDREQINFOBUS=12;
|
||||
public static final int HZ_PITAGORA_IN=13;
|
||||
|
||||
private TestProcessCache() {
|
||||
}
|
||||
|
||||
public static synchronized TestProcessCache getInstance() {
|
||||
if (onlyInstance==null) {
|
||||
onlyInstance = new TestProcessCache();
|
||||
}
|
||||
return onlyInstance;
|
||||
}
|
||||
|
||||
public synchronized void addItem(int id,Object o) {
|
||||
Integer iID = new Integer(id);
|
||||
if (cache.containsKey(iID)) {
|
||||
ArrayList a = (ArrayList)cache.get(iID);
|
||||
a.add(o);
|
||||
}
|
||||
else {
|
||||
ArrayList a = new ArrayList();
|
||||
a.add(o);
|
||||
cache.put(iID,a);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized ArrayList getItem(int id) {
|
||||
Integer iID = new Integer(id);
|
||||
ArrayList a = (ArrayList)cache.get(iID);
|
||||
return a;
|
||||
}
|
||||
|
||||
public synchronized void clear() {
|
||||
cache.clear();
|
||||
}
|
||||
}
|
||||
67
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/Decrypter.java
Normal file
67
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/Decrypter.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package tools;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
public class Decrypter {
|
||||
Cipher ecipher;
|
||||
Cipher dcipher;
|
||||
|
||||
// 8-byte Salt
|
||||
byte[] salt = {
|
||||
(byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
|
||||
(byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
|
||||
};
|
||||
|
||||
// Iteration count
|
||||
int iterationCount = 19;
|
||||
|
||||
public Decrypter() {
|
||||
try {
|
||||
// Create the key
|
||||
String passPhrase = "generate a key!";
|
||||
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
|
||||
SecretKey key = SecretKeyFactory.getInstance(
|
||||
"PBEWithMD5AndDES").generateSecret(keySpec);
|
||||
ecipher = Cipher.getInstance(key.getAlgorithm());
|
||||
dcipher = Cipher.getInstance(key.getAlgorithm());
|
||||
|
||||
// Prepare the parameter to the ciphers
|
||||
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
|
||||
|
||||
// Create the ciphers
|
||||
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
|
||||
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
|
||||
} catch (java.security.InvalidAlgorithmParameterException e) {
|
||||
} catch (java.security.spec.InvalidKeySpecException e) {
|
||||
} catch (javax.crypto.NoSuchPaddingException e) {
|
||||
} catch (java.security.NoSuchAlgorithmException e) {
|
||||
} catch (java.security.InvalidKeyException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public String decrypt(String str) {
|
||||
try {
|
||||
// Decode base64 to get bytes
|
||||
byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
|
||||
|
||||
// Decrypt
|
||||
byte[] utf8 = dcipher.doFinal(dec);
|
||||
|
||||
// Decode using utf-8
|
||||
return new String(utf8, "UTF8");
|
||||
} catch (javax.crypto.BadPaddingException e) {
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
} catch (java.io.IOException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
58
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/FileInfoSaver.java
Normal file
58
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/FileInfoSaver.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package tools;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import mnp.objects.FileInfo;
|
||||
|
||||
public class FileInfoSaver {
|
||||
public void salvaFile(String filename, String filexml,String tipofile) throws Exception
|
||||
{
|
||||
ObjectOutputStream out = null;
|
||||
String dest = null;
|
||||
|
||||
filexml = URLDecoder.decode(filexml,"UTF-8");
|
||||
FileInfo fileinfo = new FileInfo();
|
||||
fileinfo.setFilename(filename);
|
||||
fileinfo.setFilexml(filexml);
|
||||
fileinfo.setData_ricezione(new java.util.Date());
|
||||
fileinfo.setTipofile(tipofile);
|
||||
|
||||
File file = null;
|
||||
try{
|
||||
file = new File(filename+".xml");
|
||||
out = new ObjectOutputStream(new FileOutputStream(file));
|
||||
out.writeObject(fileinfo);
|
||||
out.flush();
|
||||
}catch(Exception e){
|
||||
throw e;
|
||||
}finally{
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
FileInfoSaver fis = new FileInfoSaver();
|
||||
|
||||
String s = "<LISTA_MNP_RECORD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"MNP.xsd\"><FILENAME>" +
|
||||
"<MITTENTE>OPIV</MITTENTE>" +
|
||||
"<DATA>2012-10-26</DATA>" +
|
||||
"<ORA>09:07:00</ORA>" +
|
||||
"<DESTINATARIO>TIMG</DESTINATARIO>" +
|
||||
"<ID_FILE>00001</ID_FILE>" +
|
||||
"</FILENAME>" +
|
||||
"<ATTIVAZIONE><TIPO_MESSAGGIO>1</TIPO_MESSAGGIO><CODICE_OPERATORE_RECIPIENT>H3GI</CODICE_OPERATORE_RECIPIENT><CODICE_OPERATORE_DONATING>TIMG</CODICE_OPERATORE_DONATING><CODICE_RICHIESTA_RECIPIENT>000000000000131153</CODICE_RICHIESTA_RECIPIENT><MSISDN>39346923007</MSISDN><ICCID_SERIAL_NUMBER>0000000000000131153</ICCID_SERIAL_NUMBER><CODICE_FISCALE_PARTITA_IVA>SRTMCC75C52A345Q</CODICE_FISCALE_PARTITA_IVA><CODICE_PRE_POST_PAGATO>PRP</CODICE_PRE_POST_PAGATO><CODICE_ANALOGICO_DIGITALE>D</CODICE_ANALOGICO_DIGITALE><DATA_CUT_OVER>2012-04-10</DATA_CUT_OVER><NOME_CLIENTE>IVAN</NOME_CLIENTE><COGNOME_CLIENTE>RENDE</COGNOME_CLIENTE><TIPO_DOCUMENTO>PA</TIPO_DOCUMENTO><NUMERO_DOCUMENTO>AQ5633392Z</NUMERO_DOCUMENTO><IMSI>000000000131153</IMSI><FLAG_TRASFERIMENTO_CREDITO>Y</FLAG_TRASFERIMENTO_CREDITO><CODICE_OPERATORE_VIRTUALE_DONATING>T000</CODICE_OPERATORE_VIRTUALE_DONATING><ROUTING_NUMBER>397</ROUTING_NUMBER><PREVALIDAZIONE>N</PREVALIDAZIONE><FURTO>N</FURTO></ATTIVAZIONE>" +
|
||||
"</LISTA_MNP_RECORD>";
|
||||
|
||||
fis.salvaFile("OPIV20121026090700TIMG00001", s, "1");
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
System.out.println("Attenzione: inizializzazione Task ReinvioManager fallita, reason: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
20
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/MNPRequest.java
Normal file
20
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/MNPRequest.java
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Created on Feb 11, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class MNPRequest {
|
||||
|
||||
}
|
||||
71
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/TestCase.java
Normal file
71
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/TestCase.java
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Created on Feb 9, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import client.ClientAOMGenerator;
|
||||
import client.ClientAOMSender;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class TestCase {
|
||||
|
||||
public TestCase() {
|
||||
|
||||
}
|
||||
|
||||
public void test1() {
|
||||
/* params.add(argv[1]); // numero di file XML da generare file: <=100
|
||||
params.add(argv[2]); // numero di richieste per file: <=30
|
||||
params.add(argv[3]); // Codice operatore Recipient: OPIV, WIND, H3GI, MISTO
|
||||
params.add(argv[4]); // Contratto: PRP, POP, MISTO
|
||||
params.add(argv[5]); // Codice operatore Donating: TIMG, TIMT, MISTO
|
||||
params.add(argv[6]); // Codice Analogico Digitale: A, D, MISTO
|
||||
params.add(argv[7]); // Indica se il file deve contenere richieste duplicate: DUP, NODUP
|
||||
*/
|
||||
String testId ="FK0101_STEP1";
|
||||
|
||||
//Azione
|
||||
//Generazione file di attivazione
|
||||
String args1[] = {testId, "1", "1", "3", "WIND", "PRP", "TIMG", "D", "NODUP"};
|
||||
ClientAOMGenerator.main(args1);
|
||||
|
||||
|
||||
//Send file di attivazione
|
||||
String args2[] = {"1"};
|
||||
ClientAOMSender.main(args2);
|
||||
|
||||
//Verifica -checkpoint
|
||||
//Eventualmernte implementare uno sleep???
|
||||
try {
|
||||
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Verifica se c'e' in XML_IN il file inviato - serve il nome del file
|
||||
|
||||
|
||||
//Verifica se c'e' in XML_OUT l'ack relativo al file inviato
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
138
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsDatabase.java
Normal file
138
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsDatabase.java
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Created on Feb 8, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.Statement;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.naming.InitialContext;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import conf.SimConfFile;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to Window -
|
||||
* Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ToolsDatabase extends ToolsLogger {
|
||||
|
||||
private static DataSource ds = null;
|
||||
|
||||
private static synchronized void initDS() throws Exception {
|
||||
|
||||
Properties properties = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
InitialContext ctx = new InitialContext(properties);
|
||||
ds = (DataSource) ctx.lookup(properties.getProperty("datasource.name"));
|
||||
}
|
||||
|
||||
private static synchronized boolean dsNull() throws Exception {
|
||||
|
||||
return (ds == null);
|
||||
}
|
||||
|
||||
protected static synchronized Connection getConnection() throws Exception {
|
||||
|
||||
if (dsNull())
|
||||
initDS();
|
||||
|
||||
return ds.getConnection();
|
||||
}
|
||||
|
||||
private ToolsDatabase() {
|
||||
|
||||
}
|
||||
|
||||
private static void close(Object obj) {
|
||||
try {
|
||||
if (obj instanceof Connection) {
|
||||
Connection conn = (Connection) obj;
|
||||
conn.close();
|
||||
} else if (obj instanceof Statement) {
|
||||
Statement stmt = (Statement) obj;
|
||||
stmt.close();
|
||||
} else if (obj instanceof ResultSet) {
|
||||
ResultSet rs = (ResultSet) obj;
|
||||
rs.close();
|
||||
} else {
|
||||
warning("Cant close " + obj);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
error("Exception closing " + obj + ": " + ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] query(String sql) {
|
||||
String[] values = new String[0];
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
conn = getConnection();
|
||||
stmt = conn.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
|
||||
ResultSetMetaData md = rs.getMetaData();
|
||||
int count = md.getColumnCount();
|
||||
|
||||
if (count > 0) {
|
||||
Vector v = new Vector();
|
||||
|
||||
for (int i = 1; i <= count; i++) {
|
||||
v.addElement(md.getColumnName(i));
|
||||
}
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
//System.out.println("Entry" + i);
|
||||
Object obj = rs.getObject(i + 1);
|
||||
if (obj != null)
|
||||
v.addElement(obj.toString());
|
||||
else
|
||||
v.addElement("NULL");
|
||||
}
|
||||
}
|
||||
|
||||
values = (String[]) v.toArray(values);
|
||||
debug("array: " + v);
|
||||
|
||||
ToolsResultSet qr = new ToolsResultSet(values, count);
|
||||
qr.print();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
error("Error executing [" + sql+"] excepion: " +ex);
|
||||
|
||||
} finally {
|
||||
close(rs);
|
||||
close(stmt);
|
||||
close(conn);
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public static void main(String args []) {
|
||||
String s[] = ToolsDatabase.query("select * from mnp_gestione_richiesta");
|
||||
System.out.println("s: " + s);
|
||||
}
|
||||
|
||||
}
|
||||
46
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsFile.java
Normal file
46
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsFile.java
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Created on Feb 9, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ToolsFile {
|
||||
|
||||
String nomeFile;
|
||||
int tipoFile;
|
||||
/**
|
||||
* @return Returns the nomeFile.
|
||||
*/
|
||||
public String getNomeFile() {
|
||||
return nomeFile;
|
||||
}
|
||||
/**
|
||||
* @param nomeFile The nomeFile to set.
|
||||
*/
|
||||
public void setNomeFile(String nomeFile) {
|
||||
this.nomeFile = nomeFile;
|
||||
}
|
||||
/**
|
||||
* @return Returns the tipoFile.
|
||||
*/
|
||||
public int getTipoFile() {
|
||||
return tipoFile;
|
||||
}
|
||||
/**
|
||||
* @param tipoFile The tipoFile to set.
|
||||
*/
|
||||
public void setTipoFile(int tipoFile) {
|
||||
this.tipoFile = tipoFile;
|
||||
}
|
||||
}
|
||||
28
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsLogger.java
Normal file
28
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsLogger.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Created on Feb 8, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ToolsLogger {
|
||||
protected static void debug(String text) {
|
||||
System.out.println("DEBUG " + text);
|
||||
}
|
||||
protected static void warning(String text) {
|
||||
System.out.println("WARNI " + text);
|
||||
}
|
||||
protected static void error(String text) {
|
||||
System.out.println("ERROR " + text);
|
||||
}
|
||||
}
|
||||
108
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsResultSet.java
Normal file
108
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsResultSet.java
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Created on Feb 8, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ToolsResultSet {
|
||||
|
||||
public static final String NOT_FOUND = "NOT_FOUND";
|
||||
public static final String NULL = "NULL";
|
||||
|
||||
private int m_current_row = 0;
|
||||
private int m_col_count = 0;
|
||||
private int m_row_count = 0;
|
||||
|
||||
private String m_values[] = null;
|
||||
|
||||
public ToolsResultSet() {
|
||||
|
||||
m_current_row = 0;
|
||||
m_col_count = 0;
|
||||
m_row_count = 0;
|
||||
m_values = new String[0];
|
||||
}
|
||||
|
||||
public ToolsResultSet(String[] values, int count) {
|
||||
|
||||
this();
|
||||
|
||||
if (values.length % count == 0)
|
||||
if (values.length / count > 0) {
|
||||
//inizializziamo il vettore interno
|
||||
|
||||
m_col_count = count;
|
||||
m_row_count = values.length / count; //Al più 1, solo i nomi colonna
|
||||
m_values = values;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
|
||||
return m_current_row < m_row_count;
|
||||
}
|
||||
|
||||
public void next() {
|
||||
|
||||
m_current_row++;
|
||||
}
|
||||
|
||||
public void first() {
|
||||
|
||||
m_current_row=0;
|
||||
}
|
||||
|
||||
public String get(String name) {
|
||||
|
||||
String value = NOT_FOUND;
|
||||
if (m_current_row < m_row_count) {
|
||||
int index = m_col_count + (m_current_row * m_col_count);
|
||||
String m_value = m_values[index];
|
||||
if (m_value != null)
|
||||
value = m_value;
|
||||
else
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public String get(int row, int col) {
|
||||
|
||||
String value = NOT_FOUND;
|
||||
if (row >= 0 && row < m_row_count)
|
||||
if (col >= 0 && col < m_col_count) {
|
||||
int index = (row * m_col_count) + col;
|
||||
String m_value = m_values[index];
|
||||
if (m_value != null)
|
||||
value = m_value;
|
||||
else
|
||||
value = NULL;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public void print() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int r=0; r<m_row_count; r++) {
|
||||
for (int c=0; c<m_col_count; c++) {
|
||||
sb.append(get(r,c)).append("\t\t\t");
|
||||
}
|
||||
sb.append('\n');
|
||||
}
|
||||
System.out.println("Print:\n" + sb.toString());
|
||||
}
|
||||
|
||||
}
|
||||
176
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsState.java
Normal file
176
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/tools/ToolsState.java
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Created on Feb 9, 2005
|
||||
*
|
||||
* MNP [project sim]
|
||||
* Copyright (c) 2005
|
||||
*
|
||||
* @author Giovanni Amici
|
||||
* @version 1.0
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Giovanni
|
||||
*
|
||||
* To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class ToolsState extends ToolsLogger {
|
||||
|
||||
protected static Hashtable files;
|
||||
protected static Hashtable richieste;
|
||||
|
||||
static {
|
||||
files = new Hashtable();
|
||||
richieste = new Hashtable();
|
||||
}
|
||||
|
||||
public static void svuotaHash (){
|
||||
|
||||
files = new Hashtable();
|
||||
richieste = new Hashtable();
|
||||
}
|
||||
|
||||
public static String[] getFiles(String testId) {
|
||||
String array[] = new String[0];
|
||||
|
||||
ToolsFile[] f = (ToolsFile[]) files.get(testId);
|
||||
if (f != null) {
|
||||
array = new String[f.length];
|
||||
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
array[i] = f[i].getNomeFile();
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
public static String[] getFiles(String testId, int tipoFile) {
|
||||
String array[] = new String[0];
|
||||
|
||||
ToolsFile[] f = (ToolsFile[]) files.get(testId);
|
||||
|
||||
if (f != null) {
|
||||
Vector v = new Vector();
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
if (f[i].getTipoFile() == tipoFile)
|
||||
v.add(f[i].getNomeFile());
|
||||
}
|
||||
array = (String[]) v.toArray(array);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
public static void setFiles(String TEST_ID, String[] NOME_FILES, int TIPO_FILE) {
|
||||
|
||||
ToolsFile[] f = new ToolsFile[NOME_FILES.length];
|
||||
|
||||
for (int i=0; i<NOME_FILES.length; i++) {
|
||||
f[i] = new ToolsFile();
|
||||
f[i].setNomeFile(NOME_FILES[i]);
|
||||
f[i].setTipoFile(TIPO_FILE);
|
||||
}
|
||||
|
||||
files.put(TEST_ID, f);
|
||||
}
|
||||
|
||||
public static void addFile(String testId, String nomeFile, int tipoFile) {
|
||||
|
||||
ToolsFile[] f1 =(ToolsFile[]) files.get(testId);
|
||||
|
||||
if (f1 == null) {
|
||||
f1 = new ToolsFile[1];
|
||||
ToolsFile tf = new ToolsFile();
|
||||
tf.setNomeFile(nomeFile);
|
||||
tf.setTipoFile(tipoFile);
|
||||
f1[0] = tf;
|
||||
files.put(testId, f1);
|
||||
}
|
||||
else {
|
||||
ToolsFile[] f2 = new ToolsFile[f1.length + 1];
|
||||
|
||||
//Copi l'array e aggiungo in coda
|
||||
System.arraycopy(f1, 0, f2, 0, f1.length);
|
||||
ToolsFile newFile = new ToolsFile();
|
||||
newFile.setNomeFile(nomeFile);
|
||||
newFile.setTipoFile(tipoFile);
|
||||
f2[f1.length] = newFile;
|
||||
|
||||
files.put(testId, f2);
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getRichiesta(String TEST_ID) {
|
||||
|
||||
String[] r =(String[]) richieste.get(getTestName(TEST_ID));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/*public static String[] getRichiestaById(String TEST_ID) {
|
||||
|
||||
String[] r =(String[]) richieste.get(TEST_ID);
|
||||
|
||||
return r;
|
||||
}*/
|
||||
|
||||
public static void setRichiesta(String TEST_ID, String[] ID_RICHIESTE) {
|
||||
|
||||
richieste.put(getTestName(TEST_ID), ID_RICHIESTE);
|
||||
}
|
||||
|
||||
private static String getTestName(String TEST_ID) {
|
||||
return TEST_ID.substring(0, TEST_ID.indexOf('_'));
|
||||
}
|
||||
|
||||
/* private static String getStepName(String TEST_ID) {
|
||||
return TEST_ID.substring(TEST_ID.indexOf('_') + 1);
|
||||
}*/
|
||||
|
||||
public static void print() {
|
||||
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("Printing ToolsState\n");
|
||||
sb.append("Files:\n");
|
||||
Enumeration e = files.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String key = (String) e.nextElement();
|
||||
sb.append("\t").append(key).append(": [");
|
||||
ToolsFile[] tf = (ToolsFile[]) files.get(key);
|
||||
for (int i=0; i<tf.length; i++) {
|
||||
if (i>0)
|
||||
sb.append(", ");
|
||||
sb.append(tf[i].getNomeFile());
|
||||
|
||||
}
|
||||
sb.append("]\n");
|
||||
}
|
||||
|
||||
sb.append("Richiesta:\n");
|
||||
e = richieste.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
String key = (String) e.nextElement();
|
||||
sb.append("\t").append(key).append(": [");
|
||||
String[] r = (String[]) richieste.get(key);
|
||||
for (int i=0; i<r.length; i++) {
|
||||
if (i>0)
|
||||
sb.append(", ");
|
||||
sb.append(r[i]);
|
||||
|
||||
}
|
||||
sb.append("]\n");
|
||||
}
|
||||
debug(sb.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
39
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/utility/JndiUtility.java
Normal file
39
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/utility/JndiUtility.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package utility;
|
||||
|
||||
import java.util.Properties;
|
||||
import conf.SimConfFile;
|
||||
import javax.naming.Context;
|
||||
import java.util.Hashtable;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
public class JndiUtility {
|
||||
|
||||
protected static Properties propJndi = SimConfFile.getInstance().ReadSection("JNDI");
|
||||
|
||||
private JndiUtility() {
|
||||
}
|
||||
|
||||
public static Object getHome(String jndiName) throws Exception {
|
||||
Context ctx = getServerContext();
|
||||
Object ref = ctx.lookup(jndiName);
|
||||
return ref;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static Context getServerContext() throws Exception {
|
||||
|
||||
Hashtable ht = new Hashtable();
|
||||
Context ctx = null;
|
||||
|
||||
ht.put(Context.INITIAL_CONTEXT_FACTORY, propJndi.getProperty("java.naming.factory.initial"));
|
||||
ht.put(Context.SECURITY_PRINCIPAL, propJndi.getProperty("java.naming.security.principal"));
|
||||
ht.put(Context.SECURITY_CREDENTIALS, propJndi.getProperty("java.naming.security.credentials"));
|
||||
ht.put(Context.PROVIDER_URL,propJndi.getProperty("java.naming.provider.url"));
|
||||
ctx = new InitialContext(ht);
|
||||
|
||||
return ctx;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
33
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/utility/XmlUtility.java
Normal file
33
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/utility/XmlUtility.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package utility;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import org.exolab.castor.xml.Marshaller;
|
||||
|
||||
public class XmlUtility {
|
||||
|
||||
private XmlUtility() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converte un Castor binded XML object ad una stringa XML
|
||||
* @param castorObj Object
|
||||
* @param validate boolean
|
||||
* @throws Exception
|
||||
* @return String
|
||||
*/
|
||||
public static String getXmlStringFromCastorXmlObject(Object castorObj, boolean validate) throws Exception {
|
||||
String xml=null;
|
||||
if (castorObj == null)
|
||||
throw new IllegalArgumentException("Object to marshaller is null");
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
// Marshal
|
||||
Marshaller marshaller = new Marshaller();
|
||||
marshaller.setValidation(validate);
|
||||
marshaller.marshal(castorObj, writer);
|
||||
writer.flush();
|
||||
xml = writer.toString();
|
||||
writer.close();
|
||||
return xml;
|
||||
}
|
||||
}
|
||||
73
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/web/object/AOMDelay.java
Normal file
73
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/web/object/AOMDelay.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package web.object;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AOMDelay {
|
||||
public static final String KEY="aomDelay";
|
||||
private int validazioneDelay;
|
||||
private int portingDelay;
|
||||
private int presaincaricoDelay;
|
||||
private int espletamentoDelay;
|
||||
private int cessazioneDelay;
|
||||
private int ackDelay;
|
||||
private int prjhocDelay;
|
||||
private int attivazioneDelay;
|
||||
public AOMDelay() {
|
||||
}
|
||||
public int getAttivazioneDelay() {
|
||||
return attivazioneDelay;
|
||||
}
|
||||
public void setAttivazioneDelay(int attivazioneDelay) {
|
||||
this.attivazioneDelay = attivazioneDelay;
|
||||
}
|
||||
public int getValidazioneDelay() {
|
||||
return validazioneDelay;
|
||||
}
|
||||
public void setValidazioneDelay(int validazioneDelay) {
|
||||
this.validazioneDelay = validazioneDelay;
|
||||
}
|
||||
public int getPortingDelay() {
|
||||
return portingDelay;
|
||||
}
|
||||
public void setPortingDelay(int portingDelay) {
|
||||
this.portingDelay = portingDelay;
|
||||
}
|
||||
public int getPresaincaricoDelay() {
|
||||
return presaincaricoDelay;
|
||||
}
|
||||
public void setPresaincaricoDelay(int presaincaricoDelay) {
|
||||
this.presaincaricoDelay = presaincaricoDelay;
|
||||
}
|
||||
public int getEspletamentoDelay() {
|
||||
return espletamentoDelay;
|
||||
}
|
||||
public void setEspletamentoDelay(int espletamentoDelay) {
|
||||
this.espletamentoDelay = espletamentoDelay;
|
||||
}
|
||||
public int getCessazioneDelay() {
|
||||
return cessazioneDelay;
|
||||
}
|
||||
public void setCessazioneDelay(int cessazioneDelay) {
|
||||
this.cessazioneDelay = cessazioneDelay;
|
||||
}
|
||||
public int getAckDelay() {
|
||||
return ackDelay;
|
||||
}
|
||||
public void setAckDelay(int ackDelay) {
|
||||
this.ackDelay = ackDelay;
|
||||
}
|
||||
public int getPrjhocDelay() {
|
||||
return prjhocDelay;
|
||||
}
|
||||
public void setPrjhocDelay(int prjhocDelay) {
|
||||
this.prjhocDelay = prjhocDelay;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package web.servlet;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import web.object.AOMDelay;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ChangeConfiguration extends HttpServlet {
|
||||
private static final String CONTENT_TYPE = "text/html";
|
||||
|
||||
//Initialize global variables
|
||||
public void init() throws ServletException {
|
||||
}
|
||||
|
||||
//Process the HTTP Post request
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
// select login.jsp as the template
|
||||
RequestDispatcher disp;
|
||||
disp = getServletContext().getRequestDispatcher("/index.jsp");
|
||||
|
||||
// forward the request to the template
|
||||
disp.forward(request, response);
|
||||
}
|
||||
|
||||
//Clean up resources
|
||||
public void destroy() {
|
||||
}
|
||||
}
|
||||
154
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/web/servlet/TestReceive.java
Normal file
154
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/web/servlet/TestReceive.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package web.servlet;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import web.object.*;
|
||||
|
||||
/**
|
||||
* Title: MNP Project
|
||||
* Description: Mobile Number Portability
|
||||
* Copyright: Copyright (c) 2002
|
||||
* Company: ObjectWay spa
|
||||
* @author Gian Luca Paloni
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class TestReceive
|
||||
extends HttpServlet {
|
||||
private int maxrichieste;
|
||||
private static final String XMLAckHeader =
|
||||
"XMLAckHeader=<?xml version=\"1.0\" encoding=\"UTF-8\"?><ACKNOWLEDGE xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"MNP.xsd\">";
|
||||
private static final String XMLRequestHeader =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><LISTA_MNP_RECORD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"MNP.xsd\">";
|
||||
|
||||
public void init(ServletConfig cfg) throws ServletException {
|
||||
AOMDelay aomDelay = new AOMDelay();
|
||||
|
||||
super.init(cfg);
|
||||
String n = cfg.getInitParameter("maxrichieste");
|
||||
String attivazioneDelay = cfg.getInitParameter("attivazioneDelay");
|
||||
String validazioneDelay = cfg.getInitParameter("validazioneDelay");
|
||||
String portingDelay = cfg.getInitParameter("portingDelay");
|
||||
String presaincaricoDelay = cfg.getInitParameter("presaincaricoDelay");
|
||||
String espletamentoDelay = cfg.getInitParameter("espletamentoDelay");
|
||||
String cessazioneDelay = cfg.getInitParameter("cessazioneDelay");
|
||||
String ackDelay = cfg.getInitParameter("ackDelay");
|
||||
String prjhocDelay = cfg.getInitParameter("prjhocDelay");
|
||||
|
||||
try {
|
||||
maxrichieste = Integer.parseInt(n);
|
||||
aomDelay.setAttivazioneDelay(Integer.parseInt(attivazioneDelay));
|
||||
aomDelay.setValidazioneDelay(Integer.parseInt(validazioneDelay));
|
||||
aomDelay.setPortingDelay(Integer.parseInt(portingDelay));
|
||||
aomDelay.setPresaincaricoDelay(Integer.parseInt(presaincaricoDelay));
|
||||
aomDelay.setEspletamentoDelay(Integer.parseInt(espletamentoDelay));
|
||||
aomDelay.setCessazioneDelay(Integer.parseInt(cessazioneDelay));
|
||||
aomDelay.setAckDelay(Integer.parseInt(ackDelay));
|
||||
aomDelay.setPrjhocDelay(Integer.parseInt(prjhocDelay));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
maxrichieste = 30;
|
||||
}
|
||||
cfg.getServletContext().setAttribute(AOMDelay.KEY, aomDelay);
|
||||
System.out.println("Salve, sono testReceive e sono appena nata!!");
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
|
||||
String filename = null;
|
||||
String filexml = null;
|
||||
String tipofile = null;
|
||||
|
||||
filename = request.getParameter("filename");
|
||||
filexml = request.getParameter("filexml");
|
||||
tipofile = request.getParameter("tipofile");
|
||||
|
||||
if (! ( (filename != null && !filename.equals("")) &&
|
||||
(filexml != null && !filexml.equals("")) &&
|
||||
(tipofile != null && !tipofile.equals("")))) {
|
||||
|
||||
System.out.println("Skipping request");
|
||||
return;
|
||||
}
|
||||
System.out.println("\n********\nRICEVO=" + filexml + "\n" + filename + "\n" + tipofile + "\n*********");
|
||||
|
||||
try {
|
||||
if ( (filexml.indexOf("ACKNOWLEDGE")) > 0) {
|
||||
filexml = filexml.substring(
|
||||
(filexml.indexOf(">", (filexml.indexOf("<ACKNOWLEDGE>"))) + 1),
|
||||
(filexml.length())
|
||||
);
|
||||
|
||||
filexml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ACKNOWLEDGE xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"MNP.xsd\">" + filexml;
|
||||
//filexml=Resources.XMLAckHeader+filexml;
|
||||
//RequestManager.acquisizioneAck(filexml, filename,tipofile);
|
||||
System.out.println("Messaggio: " + filename + ", di tipo: " + tipofile);
|
||||
}
|
||||
else {
|
||||
filexml = filexml.substring(
|
||||
(filexml.indexOf(">", (filexml.indexOf("<LISTA_MNP_RECORD>"))) + 1),
|
||||
(filexml.length())
|
||||
);
|
||||
filexml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><LISTA_MNP_RECORD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"MNP.xsd\">" + filexml;
|
||||
//filexml=Resources.XMLRequestHeader+filexml;
|
||||
// Prendo in carico solo i files di tipo ATTIVAZIONE (tipoFile = 1)
|
||||
System.out.println("Messaggio: " + filename + ", di tipo: " + tipofile);
|
||||
}
|
||||
|
||||
// wait in base al tipo file
|
||||
AOMDelay aomDelay = (AOMDelay) request.getSession().getServletContext().getAttribute(AOMDelay.KEY);
|
||||
if (aomDelay == null)
|
||||
System.out.println("aomDelay non trovato");
|
||||
else {
|
||||
int sleepTime = 0;
|
||||
switch (Integer.parseInt(tipofile)) {
|
||||
case 1: //attivazione
|
||||
sleepTime = aomDelay.getAttivazioneDelay();
|
||||
break;
|
||||
case 2: //validazione
|
||||
sleepTime = aomDelay.getValidazioneDelay();
|
||||
break;
|
||||
case 3: //porting
|
||||
sleepTime = aomDelay.getPortingDelay();
|
||||
break;
|
||||
case 4: //annullamento
|
||||
throw new UnsupportedOperationException();
|
||||
case 5: //presaincarico
|
||||
sleepTime = aomDelay.getPresaincaricoDelay();
|
||||
break;
|
||||
case 6: //espletamento
|
||||
sleepTime = aomDelay.getEspletamentoDelay();
|
||||
break;
|
||||
case 7: //cessazione
|
||||
sleepTime = aomDelay.getCessazioneDelay();
|
||||
break;
|
||||
case 8: //ack
|
||||
sleepTime = aomDelay.getAckDelay();
|
||||
break;
|
||||
case 9: //prjhoc
|
||||
sleepTime = aomDelay.getPrjhocDelay();
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
if (sleepTime != 0) {
|
||||
long mm = sleepTime * 1000; // trasformo in millesecondi
|
||||
System.out.println("\n********\nATTENDO=" + filename + "\nsecondi:" + sleepTime + "\n*********");
|
||||
Thread.currentThread().sleep(mm);
|
||||
System.out.println("\n********\nFINE=" + filename + "\nsecondi:" + sleepTime + "\n*********");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
System.out.println("Salve, sono testReceive e sono miseramente morta!!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package xml;
|
||||
|
||||
import base.SimGenerator;
|
||||
import utility.XmlUtility;
|
||||
|
||||
public abstract class AbstractXmlGenerator extends SimGenerator implements XMLGeneratorIF{
|
||||
public AbstractXmlGenerator() {
|
||||
}
|
||||
|
||||
protected String getXmlFromCastorObject(Object bean , boolean validate) throws
|
||||
Exception {
|
||||
|
||||
return XmlUtility.getXmlStringFromCastorXmlObject(bean,validate);
|
||||
}
|
||||
|
||||
/**
|
||||
* implementazione di default
|
||||
*/
|
||||
public void postGenerate() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package xml;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
import mnp.database.dao.FileXMLDAO;
|
||||
import mnp.objects.FileName;
|
||||
import mnp.xml.parser.FileXML;
|
||||
import mnp.xml.senders.XMLAckGenerator;
|
||||
import db.ManagerDAO;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLAcknowledgeGenerator extends XMLGenerator {
|
||||
ManagerDAO managerDAO = new ManagerDAO();
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
||||
public XMLAcknowledgeGenerator(String testId) {
|
||||
super(testId);
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_ACK());
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
String type = (String) params.elementAt(0);
|
||||
String errMsg = "ACK KO - File non valido";
|
||||
FileName _fileNameAck = null;
|
||||
FileXML _fileAckGen = null;
|
||||
String codiceFile = "";
|
||||
|
||||
String[] _ackList = managerDAO.generateListAck();
|
||||
|
||||
if (_ackList == null)return;
|
||||
|
||||
int len = _ackList.length;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
codiceFile = "00000" + Integer.toString(managerDAO.getProgressivoInvioXML());
|
||||
codiceFile = codiceFile.substring( (codiceFile.length() - 5), codiceFile.length());
|
||||
_fileNameAck = new FileName();
|
||||
|
||||
String _nomeFile = _ackList[i];
|
||||
String _mittente = _nomeFile.substring(0, 4);
|
||||
String _data = _nomeFile.substring(4, 8) + "-" + _nomeFile.substring(8, 10) + "-" + _nomeFile.substring(10, 12);
|
||||
String _ora = _nomeFile.substring(12, 14) + ":" + _nomeFile.substring(14, 16) + ":" + _nomeFile.substring(16, 18);
|
||||
String _destinatario = _nomeFile.substring(18, 22);
|
||||
String _idFile = _nomeFile.substring(22, 27);
|
||||
|
||||
_fileNameAck.setMittente(_mittente);
|
||||
_fileNameAck.setData(_data);
|
||||
_fileNameAck.setOra(_ora);
|
||||
_fileNameAck.setDestinatario(_destinatario);
|
||||
_fileNameAck.setId_file(_idFile);
|
||||
_fileNameAck.setNomeFile(_ackList[i]);
|
||||
|
||||
String content = "<FILENAME>\n<MITTENTE>" + _mittente + "</MITTENTE>\n<DATA>"
|
||||
+ _data + "</DATA>\n<ORA>"
|
||||
+ _ora + "</ORA>\n<DESTINATARIO>"
|
||||
+ _destinatario + "</DESTINATARIO>\n<ID_FILE>"
|
||||
+ _idFile + "</ID_FILE>\n</FILENAME>";
|
||||
|
||||
_fileNameAck.setContent(content);
|
||||
|
||||
if (type.toUpperCase().equals("OK"))
|
||||
_fileAckGen = new XMLAckGenerator(_fileNameAck, "OK", null).getXMLAck();
|
||||
else
|
||||
_fileAckGen = new XMLAckGenerator(_fileNameAck, "ERROR", errMsg).getXMLAck();
|
||||
|
||||
String _dataOra = sdf.format(new Date());
|
||||
String _nomeFileAck = _destinatario + _dataOra + _mittente + codiceFile + ".xml";
|
||||
|
||||
PrintWriter pw = null;
|
||||
pw = new PrintWriter(new FileOutputStream(this.properties.get_PATH_TEST_ACK() + "/" + _nomeFileAck));
|
||||
|
||||
pw.write(_fileAckGen.getXML());
|
||||
pw.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import db.ManagerDAO;
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.*;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLAttivazioneGenerator extends XMLGenerator {
|
||||
|
||||
private String _nomeFile = null;
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
public XMLAttivazioneGenerator(String testId) {
|
||||
super(testId);
|
||||
testProcessCache.clear();
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_ATTIVAZIONE());
|
||||
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
|
||||
testProcessCache.clear();
|
||||
int numFile = Integer.parseInt((String) params.elementAt(0));
|
||||
int numRic = Integer.parseInt((String) params.elementAt(1));
|
||||
String recipient = (String) params.elementAt(2);
|
||||
String codPrePost = (String) params.elementAt(3);
|
||||
String donating = (String) params.elementAt(4);
|
||||
String codAD = (String) params.elementAt(5);
|
||||
String dup = (String) params.elementAt(6);
|
||||
String donVirt = ((String) params.elementAt(7)).equalsIgnoreCase("NULL") ? null : (String) params.elementAt(7);
|
||||
String recVirt = ((String) params.elementAt(8)).equalsIgnoreCase("NULL") ? null : (String) params.elementAt(8);
|
||||
String flagTc = (String) params.elementAt(9);
|
||||
String flagPrevalidazione = (String) params.elementAt(10);
|
||||
String flagFurto = (String) params.elementAt(11);
|
||||
String addizionale1 = (String) params.elementAt(12);
|
||||
String tipoUtenza = params.size() > 13 ? (String) params.elementAt(13) : null;
|
||||
|
||||
int max = (numFile * numRic);
|
||||
int min_p = index;
|
||||
int max_p = index + max;
|
||||
|
||||
for (int i = 0; i < numFile; i++) { //conta max file
|
||||
|
||||
Date now = new Date();
|
||||
RichiestaXMLAOM[] _listaMNP = null;
|
||||
Vector listaRecord = new Vector();
|
||||
String data_ora = sdf.format(now);
|
||||
ImpostaDate impDate = new ImpostaDate();
|
||||
|
||||
// Processo a 5 giorni
|
||||
String _data_cut_over = impDate.aggiungiGiorni(sdf1.format(now), 5);
|
||||
|
||||
String _operatoreRecipient = getCodiceOperatoreRecipient(recipient);
|
||||
String _operatoreDonating = getCodiceOperatoreDonating(donating);
|
||||
|
||||
String _codiceFile = getCodiceFile();
|
||||
|
||||
_nomeFile = _operatoreRecipient + data_ora + _operatoreDonating +
|
||||
_codiceFile + ".xml";
|
||||
|
||||
for (int j = 1; j <= numRic; j++) { //conta richieste nel file
|
||||
|
||||
incrementaIndiceRichieste();
|
||||
|
||||
String _codicePrePost = getCodicePrePost(codPrePost, min_p, max_p);
|
||||
|
||||
String _codAnalogicoDigitale = getCodiceAnalogicoDigitale(codAD, max);
|
||||
RichiestaXMLAOM o = new RichiestaXMLAOM();
|
||||
|
||||
o.setTipo_messaggio("" + TipoFile.ATTIVAZIONE);
|
||||
o.setCodice_operatore_recipient(_operatoreRecipient);
|
||||
o.setCodice_operatore_donating(_operatoreDonating);
|
||||
o.setCodice_richiesta_recipient(getCodiceRichiestaRecipient());
|
||||
String msisdn = getMSISDN("TIM");
|
||||
o.setMsisdn(msisdn);
|
||||
o.setIccd_serialnumber(getIccdSerialNumber());
|
||||
String codiceFiscalePartitaIva = getCodiceFiscalePartitaIVA();
|
||||
o.setCodice_fiscale_partita_iva(codiceFiscalePartitaIva);
|
||||
o.setCodice_pre_post_pagato(_codicePrePost);
|
||||
o.setCodice_analogico_digitale(_codAnalogicoDigitale);
|
||||
o.setData_cut_over(_data_cut_over);
|
||||
o.setNome_cliente(randomNomeCliente());
|
||||
o.setCognome_cliente(randomCognomeCliente());
|
||||
o.setTipo_documento(getTipoDocumento());
|
||||
o.setNumero_documento(getNumeroDocumento());
|
||||
o.setImsi(getImsi());
|
||||
o.setCodiceOperatoreVirtualeDonating(donVirt);
|
||||
o.setCodiceOperatoreVirtualeRecipient(recVirt);
|
||||
o.setFlagTc(flagTc);
|
||||
o.setRoutingNumber(getRGN(_operatoreRecipient));
|
||||
o.setPrevalidazione(flagPrevalidazione);
|
||||
o.setFurto(flagFurto);
|
||||
if (addizionale1 != null && addizionale1.equalsIgnoreCase("Y")) {
|
||||
incrementaIndiceRichieste();
|
||||
o.setAddizionale_1(getMSISDN("TIM"));
|
||||
}
|
||||
|
||||
o.createContent();
|
||||
if (dup.equalsIgnoreCase("DUP") && (j == numRic - 1)) {
|
||||
listaRecord.addElement(o);
|
||||
j++;
|
||||
}
|
||||
listaRecord.addElement(o);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.XML, o);
|
||||
|
||||
if ("A".equals(tipoUtenza) || "B".equals(tipoUtenza) || "C".equals(tipoUtenza) || "D".equals(tipoUtenza)) {
|
||||
new ManagerDAO().insertTipoClientiDbss(msisdn, "6", "X", tipoUtenza, "C", "DBSS", null, codiceFiscalePartitaIva, "859970968", "ATTIVO");
|
||||
}
|
||||
|
||||
_listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" + data_ora.substring(4, 6) +
|
||||
"-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" + data_ora.substring(10, 12) +
|
||||
":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(_operatoreRecipient, _operatoreDonating, _data, _ora,
|
||||
"" + _codiceFile);
|
||||
|
||||
generateXML(TipoFile.ATTIVAZIONE, _nomeFile, _listaMNP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLBitGenerator.java
Normal file
89
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLBitGenerator.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package xml;
|
||||
|
||||
import mnp.xml.dao.bit.NotificaFromBIT;
|
||||
import mnp.database.dao.HZGestioneRichiestaDAO;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLBitGenerator
|
||||
extends AbstractXmlGenerator {
|
||||
|
||||
HZGestioneRichiestaDAO dao = null;
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
public XMLBitGenerator() {
|
||||
dao = new HZGestioneRichiestaDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* @param args String[] - 0 - SUBSYS, 1 - TIPO OPERAZIONE - 2 NUM RICHIESTE - 3 DAC - 4 DISTRETTO
|
||||
* 5 - NUMERO, 6 - MSISDN
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
int numRichieste = Integer.parseInt(args[2]);
|
||||
String[] records = new String[numRichieste];
|
||||
|
||||
if (args.length < 7) {
|
||||
throw new IllegalArgumentException("Numero di parametri insufficienti");
|
||||
}
|
||||
NotificaFromBIT notifica = new NotificaFromBIT();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("parametro xml " + i + ": " + args[i]);
|
||||
}
|
||||
Map numMap = new HashMap();
|
||||
List prefix = dao.getPrefix();
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
notifica.setSUBSYS(args[0]);
|
||||
notifica.setTIPO_OPERAZIONE(Integer.parseInt(args[1]));
|
||||
notifica.setDAC(args[3]);
|
||||
|
||||
notifica.setCF_PARTITA_IVA(getCodiceFiscalePartitaIVA());
|
||||
notifica.setCODICE_COMUNE(getCodiceComune());
|
||||
notifica.setCOGNOME_CLIENTE(randomCognomeCliente());
|
||||
notifica.setDENOMINAZIONE_SOCIALE(getDenominazioneSociale());
|
||||
notifica.setLOCALITA(randomLocalita());
|
||||
notifica.setID_RICHIESTA_BIT("123456789012");
|
||||
if ("SI".equalsIgnoreCase(args[6])){
|
||||
notifica.setMSISDN(getMSISDN("TIM", false));
|
||||
}else{
|
||||
notifica.setMSISDN(null);
|
||||
}
|
||||
notifica.setNOME_CLIENTE(randomNomeCliente());
|
||||
notifica.setNOTE(getNote());
|
||||
notifica.setNUMERO_CIVICO(randomNumeroCivico());
|
||||
//Se l'utente non ha valorizzato alcun prefisso, lo genero randomicamente
|
||||
if (args[4] == null) {
|
||||
notifica.setPREFISSO_DN( (String) randomElementByList(prefix));
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setPREFISSO_DN(args[4]);
|
||||
}
|
||||
//Se l'utente non ha valorizzato alcun numero, lo genero randomicamente
|
||||
if (args[5] == null) {
|
||||
String num = "";
|
||||
while (numMap.containsKey(num = randomTelefono(notifica.getPREFISSO_DN().length()))){
|
||||
//do nothing
|
||||
}
|
||||
numMap.put(num, num);
|
||||
notifica.setNUMERO_DN(num);
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setNUMERO_DN(args[5]);
|
||||
}
|
||||
notifica.setVIA(getVia());
|
||||
records[i] = getXmlFromCastorObject(notifica, false);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.HZ,notifica);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import mnp.objects.*;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLCessazioneGenerator
|
||||
extends XMLGenerator {
|
||||
private String _nomeFile = null;
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
public XMLCessazioneGenerator(String testId) {
|
||||
super(testId);
|
||||
testProcessCache.clear();
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_CESSAZIONE());
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
|
||||
int numFile = Integer.parseInt( (String) params.elementAt(0));
|
||||
int numRic = Integer.parseInt( (String) params.elementAt(1));
|
||||
String recipient = (String) params.elementAt(2);
|
||||
String tipo = (String) params.elementAt(3);
|
||||
String recVirt = (String) params.elementAt(4);
|
||||
String donating = "TIMG";
|
||||
|
||||
for (int i = 0; i < numFile; i++) {
|
||||
|
||||
Date now = new Date();
|
||||
RichiestaXMLAOM[] _listaMNP = null;
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
String data_ora = sdf.format(now);
|
||||
String _data_cut_over = sdf1.format(now);
|
||||
String _codiceFile = getCodiceFile();
|
||||
|
||||
_nomeFile = recipient + data_ora + donating + _codiceFile + ".xml";
|
||||
|
||||
for (int j = 1; j <= numRic; j++) { //conta richieste nel file
|
||||
incrementaIndiceRichieste();
|
||||
RichiestaXMLAOM o = new RichiestaXMLAOM();
|
||||
o.setTipo_messaggio("" + TipoFile.CESSAZIONE);
|
||||
o.setCodice_operatore_recipient(recipient);
|
||||
o.setCodice_richiesta_recipient(getCodiceRichiestaRecipient());
|
||||
o.setMsisdn(getMSISDN(tipo));
|
||||
o.setData_cut_over(_data_cut_over);
|
||||
o.setCodiceOperatoreVirtualeRecipient(recVirt.equals("NULL")?null:recVirt);
|
||||
o.createContent();
|
||||
listaRecord.addElement(o);
|
||||
// test automatici
|
||||
testProcessCache.addItem(TestProcessCache.XML,o);
|
||||
}
|
||||
|
||||
_listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" + data_ora.substring(4, 6) + "-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" + data_ora.substring(10, 12) + ":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(recipient, donating, _data, _ora, "" + _codiceFile);
|
||||
|
||||
generateXML(TipoFile.CESSAZIONE, _nomeFile, _listaMNP);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package xml;
|
||||
|
||||
import mnp.xml.dao.crmc.NotificaFromCRMC;
|
||||
import mnp.database.dao.HZGestioneRichiestaDAO;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLCrmcGenerator
|
||||
extends AbstractXmlGenerator {
|
||||
|
||||
HZGestioneRichiestaDAO dao = null;
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
public XMLCrmcGenerator() {
|
||||
dao = new HZGestioneRichiestaDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* @param args String[] - 0 - SUBSYS, 1 - TIPO OPERAZIONE - 2 NUM RICHIESTE - 3 DAC - 4 DISTRETTO
|
||||
* 5 - NUMERO, 6 - MSISDN
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
int numRichieste = Integer.parseInt(args[2]);
|
||||
String[] records = new String[numRichieste];
|
||||
|
||||
if (args.length < 7) {
|
||||
throw new IllegalArgumentException("Numero di parametri insufficienti");
|
||||
}
|
||||
NotificaFromCRMC notifica = new NotificaFromCRMC();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("parametro xml " + i + ": " + args[i]);
|
||||
}
|
||||
Map numMap = new HashMap();
|
||||
List prefix = dao.getPrefix();
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
notifica.setSUBSYS(args[0]);
|
||||
notifica.setTIPO_OPERAZIONE(Integer.parseInt(args[1]));
|
||||
notifica.setDAC(args[3]);
|
||||
|
||||
notifica.setCF_PARTITA_IVA(getCodiceFiscalePartitaIVA());
|
||||
notifica.setCODICE_COMUNE(getCodiceComune());
|
||||
notifica.setCOGNOME_CLIENTE(randomCognomeCliente());
|
||||
notifica.setDENOMINAZIONE_SOCIALE(getDenominazioneSociale());
|
||||
notifica.setLOCALITA(randomLocalita());
|
||||
if ("SI".equalsIgnoreCase(args[6])){
|
||||
notifica.setMSISDN(getMSISDN("TIM", false));
|
||||
}else{
|
||||
notifica.setMSISDN(null);
|
||||
}
|
||||
notifica.setNOME_CLIENTE(randomNomeCliente());
|
||||
notifica.setNOTE(getNote());
|
||||
notifica.setNUMERO_CIVICO(randomNumeroCivico());
|
||||
//Se l'utente non ha valorizzato alcun prefisso, lo genero randomicamente
|
||||
if (args[4] == null) {
|
||||
notifica.setPREFISSO_DN( (String) randomElementByList(prefix));
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setPREFISSO_DN(args[4]);
|
||||
}
|
||||
//Se l'utente non ha valorizzato alcun numero, lo genero randomicamente
|
||||
if (args[5] == null) {
|
||||
String num = "";
|
||||
while (numMap.containsKey(num = randomTelefono(notifica.getPREFISSO_DN().length()))){
|
||||
//do nothing
|
||||
}
|
||||
numMap.put(num, num);
|
||||
notifica.setNUMERO_DN(num);
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setNUMERO_DN(args[5]);
|
||||
}
|
||||
notifica.setVIA(getVia());
|
||||
records[i] = getXmlFromCastorObject(notifica, false);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.HZ,notifica);
|
||||
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package xml;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import mnp.database.dao.HZGestioneRichiestaDAO;
|
||||
import mnp.utility.DateUtils;
|
||||
import mnp.xml.dao.dbcfx.notifica.NotificaHZFromDBCFX;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLDbcfxGenerator
|
||||
extends AbstractXmlGenerator {
|
||||
|
||||
HZGestioneRichiestaDAO dao = null;
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
public XMLDbcfxGenerator() {
|
||||
dao = new HZGestioneRichiestaDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* @param args String[] - 0 - TIPO SISTEMA, 1 - TIPO OPERAZIONE - 2 DET -
|
||||
* 3 NUMERO RICHIESTE
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
int numRichieste = Integer.parseInt(args[2]);
|
||||
String[] records = new String[numRichieste];
|
||||
String data="";
|
||||
System.out.println("args.length " + args.length);
|
||||
|
||||
if (args.length != 3) {
|
||||
throw new IllegalArgumentException("Numero di parametri insufficienti");
|
||||
}
|
||||
NotificaHZFromDBCFX notifica = new NotificaHZFromDBCFX();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("parametro xml " + i + ": " + args[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
if ("S".equalsIgnoreCase(args[1])){
|
||||
// MI COSTRUISCO UNA STRINGA CONTENENTE UNA DATA NEL FORMATO:
|
||||
//det = DateUtils.toDateFormat(DateUtils.getCurrentStringDate(), "DD-MM-yyyy HH:MM:SS");
|
||||
data = DateUtils.toString(new Date(), "dd-MM-yyyy HH:MM:SS");
|
||||
data= data.substring(0,19);
|
||||
notifica.setDET(data);
|
||||
|
||||
}else {
|
||||
notifica.setDET(args[1]);
|
||||
}
|
||||
|
||||
notifica.setTIPO_OPERAZIONE(Integer.parseInt(args[0]));
|
||||
notifica.setDIRECTORY_NUMBER(getIdRisorsa());
|
||||
|
||||
records[i] = getXmlFromCastorObject(notifica, false);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.HZ,notifica);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
private String getIdRisorsa(){
|
||||
|
||||
String[] cifre = {"1","2","3","4","5","6","7","8","9","0"};
|
||||
String[] prefix ={"06","02","0763","0131","0764","0776","0773"};
|
||||
|
||||
String appNumero[] = new String[8];
|
||||
String appPrefisso[] = new String[1];
|
||||
String msisdn = "";
|
||||
String prefisso = "";
|
||||
|
||||
appPrefisso[0] = prefix[(int) (Math.random()*7)];
|
||||
prefisso = prefisso + appPrefisso[0];
|
||||
for (int i=0; i<8; i++){
|
||||
appNumero[i]= cifre[(int)(Math.random()*9)];
|
||||
msisdn= msisdn + appNumero[i];
|
||||
}
|
||||
|
||||
return prefisso+msisdn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import obj.FieldDbMap;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.DateUtils;
|
||||
import mnp.utility.Func;
|
||||
import mnp.xml.databinding.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLEspletamentoGenerator extends XMLGenerator {
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
int codiceFile = 66666;
|
||||
|
||||
public XMLEspletamentoGenerator(String testId) {
|
||||
super(testId);
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_ESPLETAMENTO());
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
generateFilesNew(params);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void generateFilesNew(Vector params) throws Exception {
|
||||
String[] app_oloList = managerDAO.getListOLO();
|
||||
String[] oloList = new String[app_oloList.length + 1];
|
||||
for (int i = 0; i < app_oloList.length; i++)
|
||||
oloList[i] = app_oloList[i];
|
||||
int _statoRichNotifica = Integer.parseInt( (String) params.elementAt(0));
|
||||
String tipoProcesso = (String)params.elementAt(1);
|
||||
if(!"R".equalsIgnoreCase(tipoProcesso) && !"RV".equalsIgnoreCase(tipoProcesso) && !"DV".equalsIgnoreCase(tipoProcesso))
|
||||
throw new Exception("PARAMETRO ERRATO: TIPO PROCESSO!");
|
||||
oloList[app_oloList.length] = "TIMT";
|
||||
|
||||
String[] _timRecipent = null;
|
||||
int numOLO_1 = oloList.length;
|
||||
int numOLO_2 = oloList.length;
|
||||
|
||||
if("R".equalsIgnoreCase(tipoProcesso)){
|
||||
String [] local = {"TIMG", "TIMT"};
|
||||
_timRecipent = local;
|
||||
} else {
|
||||
String [] local = {"TIMG"};
|
||||
_timRecipent = local;
|
||||
numOLO_2 = 1;
|
||||
}
|
||||
|
||||
for (int p = 0; p < _timRecipent.length; p++) {
|
||||
|
||||
for (int i = 0; i < numOLO_2; i++) {
|
||||
|
||||
List _espletamentoList = managerDAO.getMapRichiesteEspletamento(_timRecipent[p], oloList[i], tipoProcesso);
|
||||
|
||||
if (! (_espletamentoList == null) && _espletamentoList.size()>0) {
|
||||
|
||||
int len_1 = _espletamentoList.size();
|
||||
|
||||
int _numFile = getNumFileGenerate(len_1);
|
||||
for (int k = 0; k < numOLO_1; k++) {
|
||||
int index = 0;
|
||||
for (int t = 0; t < _numFile; t++) {
|
||||
Thread.sleep(1000);
|
||||
Date now = new Date();
|
||||
String data_ora = sdf.format(now);
|
||||
|
||||
codiceFile += t;
|
||||
|
||||
if (!oloList[k].equals("TIMT")) {
|
||||
String _nomeFile = oloList[k] + data_ora + _timRecipent[p] + codiceFile + ".xml";
|
||||
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
for (int j = 0; (j < 30 && index < len_1); j++, index++) {
|
||||
|
||||
Map _elem = (Map)_espletamentoList.get(index);
|
||||
RichiestaXMLAOM _val = new RichiestaXMLAOM();
|
||||
_val.setTipo_messaggio(TipoFile.ESPLETAMENTO + "");
|
||||
_val.setCodice_operatore_recipient((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)_elem.get(FieldDbMap.CODICE_OPERATORE_RECIPIENT))).toString());
|
||||
_val.setCodice_operatore_donating((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)_elem.get(FieldDbMap.CODICE_OPERATORE_DONATING))).toString());
|
||||
_val.setCodice_richiesta_recipient((String)_elem.get(FieldDbMap.ID_RICHIESTA));
|
||||
_val.setMsisdn((String)_elem.get(FieldDbMap.MSISDN));
|
||||
_val.setStato_richiesta_notifica(_statoRichNotifica + "");
|
||||
_val.setFlagTc((String)_elem.get(FieldDbMap.FLAG_TC));
|
||||
_val.setCodiceOperatoreVirtualeDonating((String)_elem.get(FieldDbMap.CODICE_OPERATORE_DON_EFF));
|
||||
_val.setCodiceOperatoreVirtualeRecipient((String)_elem.get(FieldDbMap.CODICE_OPERATORE_REC_EFF));
|
||||
String _date_cut_over = sdf1.format(DateUtils.toDate((String)_elem.get(FieldDbMap.DATA_CUT_OVER_CALC),"yyyy-MM-dd"));
|
||||
String oraCutOver = (String)_elem.get(FieldDbMap.ORA_CUT_OVER);
|
||||
if(oraCutOver!=null){
|
||||
int ora = Integer.parseInt(oraCutOver.substring(0, 2));
|
||||
int minuti = Integer.parseInt(oraCutOver.substring( 3, 5));
|
||||
int secondi = Integer.parseInt(oraCutOver.substring(6, 8));
|
||||
long time = (ora * 3600000) + (minuti * 60000) + (secondi * 1000);
|
||||
_val.setOra_cut_over(new org.exolab.castor.types.Time(time).toString());
|
||||
}
|
||||
_val.setData_cut_over(_date_cut_over);
|
||||
_val.setCodice_operatore(oloList[k]);
|
||||
_val.setRoutingNumber(getRGN(_val.getCodice_operatore_recipient()));
|
||||
_val.createContent();
|
||||
listaRecord.addElement(_val);
|
||||
}
|
||||
RichiestaXMLAOM[] _listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" + data_ora.substring(4, 6) + "-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" + data_ora.substring(10, 12) + ":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(oloList[k], _timRecipent[p], _data, _ora, "" + codiceFile);
|
||||
|
||||
generateXML(TipoFile.ESPLETAMENTO, _nomeFile, _listaMNP);
|
||||
}
|
||||
} // fine ciclo generazione file
|
||||
} // fine ciclo olo per file
|
||||
}
|
||||
else {
|
||||
System.out.println("Nessun file di espletamento per " + oloList[i] + "---" + _timRecipent[p]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
311
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLGenerator.java
Normal file
311
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLGenerator.java
Normal file
@@ -0,0 +1,311 @@
|
||||
package xml;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
|
||||
import tools.ToolsState;
|
||||
|
||||
import conf.*;
|
||||
|
||||
import base.*;
|
||||
|
||||
import db.*;
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.*;
|
||||
import mnp.xml.parser.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class XMLGenerator extends FileGenerator {
|
||||
|
||||
static XMLProperties properties = XMLProperties.getInstance();
|
||||
private String body = "";
|
||||
private String header = "";
|
||||
private String xml = "";
|
||||
private int codiceFile = 0;
|
||||
|
||||
|
||||
public XMLGenerator(String testId) {
|
||||
super(testId);
|
||||
this.managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Costruisce l'header del file
|
||||
* @param mittente String
|
||||
* @param destinatario String
|
||||
* @param data String
|
||||
* @param ora String
|
||||
* @param codFile String
|
||||
*/
|
||||
protected void generateHeader(String mittente, String destinatario,
|
||||
String data, String ora, String codFile) {
|
||||
header = "";
|
||||
|
||||
header +=
|
||||
"<FILENAME>\n" +
|
||||
"<MITTENTE>" + mittente + "</MITTENTE>\n" +
|
||||
"<DATA>" + data + "</DATA>\n" +
|
||||
"<ORA>" + ora + "</ORA>\n" +
|
||||
"<DESTINATARIO>" + destinatario + "</DESTINATARIO>\n" +
|
||||
"<ID_FILE>" + codFile + "</ID_FILE>\n" +
|
||||
"</FILENAME>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Costruisce il corpo del file
|
||||
* @param lista ListaMNPRecord[]
|
||||
*/
|
||||
protected void generateBody(RichiestaXMLAOM[] lista) {
|
||||
body = "";
|
||||
RichiestaXMLAOM _record = null;
|
||||
for (int i = 0; i < lista.length; i++) {
|
||||
_record = lista[i];
|
||||
body += _record.getXMLContent() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce la stringa corrispondente al file XML
|
||||
* @param lista ListaMNPRecord[]
|
||||
* @return String
|
||||
*/
|
||||
protected String getXML(RichiestaXMLAOM[] lista) {
|
||||
xml = "";
|
||||
generateBody(lista);
|
||||
String intestazione = Resources.getXMLRequestHeader();
|
||||
|
||||
return xml += intestazione +
|
||||
header +
|
||||
body +
|
||||
"</LISTA_MNP_RECORD>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Da inizio al processo di generazione del file XML
|
||||
* @param tipoFile int Tipo del file da generare
|
||||
* @param nomeFile String Nome del file da generare
|
||||
* @param listaMNP ListaMNPRecord[] Elenco delle richieste da inserire nel file
|
||||
* @throws Exception
|
||||
*/
|
||||
protected void generateXML(int tipoFile, String nomeFile,RichiestaXMLAOM[] listaMNP) throws Exception {
|
||||
|
||||
String path = null;
|
||||
|
||||
switch (tipoFile) {
|
||||
case TipoFile.ATTIVAZIONE:
|
||||
path = properties.get_PATH_TEST_ATTIVAZIONE();
|
||||
break;
|
||||
case TipoFile.ATTIVAZIONE_HOC:
|
||||
path = properties.get_PATH_TEST_ATTIVAZIONE_HOC();
|
||||
break;
|
||||
case TipoFile.VALIDAZIONE:
|
||||
path = properties.get_PATH_TEST_VALIDAZIONE();
|
||||
break;
|
||||
case TipoFile.PORTING:
|
||||
path = properties.get_PATH_TEST_PORTING();
|
||||
break;
|
||||
case TipoFile.PRESAINCARICO:
|
||||
path = properties.get_PATH_TEST_PRESAINCARICO();
|
||||
break;
|
||||
case TipoFile.ESPLETAMENTO:
|
||||
path = properties.get_PATH_TEST_ESPLETAMENTO();
|
||||
break;
|
||||
case TipoFile.CESSAZIONE:
|
||||
path = properties.get_PATH_TEST_CESSAZIONE();
|
||||
break;
|
||||
case TipoFile.ACK:
|
||||
path = properties.get_PATH_TEST_ACK();
|
||||
break;
|
||||
case TipoFile.TRASFERIMENTOCREDITO:
|
||||
path = properties.get_PATH_TEST_TC();
|
||||
break;
|
||||
case TipoFile.SBLOCCOIMPORTO:
|
||||
path = properties.get_PATH_TEST_SBLOCCO_IMPORTO_TC();
|
||||
break;
|
||||
case TipoFile.SBLOCCOCREDITOANOMALO:
|
||||
path = properties.get_PATH_TEST_SBLOCCO_CREDITO_ANOMALO_TC();
|
||||
break;
|
||||
default:
|
||||
path = properties.get_PATH_TEST();
|
||||
break;
|
||||
}
|
||||
|
||||
String file = getXML(listaMNP);
|
||||
// Validazione del file
|
||||
XMLParser parser = new XMLParser();
|
||||
FileXML fileXML = parser.getFileXML(file, nomeFile);
|
||||
|
||||
|
||||
// Se il file non è valido genero exception
|
||||
if (!fileXML.getValidityMsg().equals("OK"))
|
||||
throw new Exception(fileXML.getValidityMsg());
|
||||
|
||||
try {
|
||||
// Scrive il file sulla relativa directory
|
||||
PrintWriter pw = null;
|
||||
pw = new PrintWriter(new FileOutputStream(path + "/" + nomeFile));
|
||||
System.out.println("Generato file ----> " + path + "/" + nomeFile);
|
||||
pw.write(file);
|
||||
pw.close();
|
||||
ToolsState.addFile(testId, nomeFile, tipoFile);
|
||||
ToolsState.print();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ricava il numero di file da generale in base al numero di richieste
|
||||
* @param n int
|
||||
* @return int
|
||||
*/
|
||||
protected int getNumFileGenerate(int n) {
|
||||
int _numFile = 0;
|
||||
if (n != 0) {
|
||||
if (n <= 30)
|
||||
_numFile = 1;
|
||||
else {
|
||||
if ( (n % 30) != 0)
|
||||
_numFile = (n / 30) + 1;
|
||||
else
|
||||
_numFile = (n / 30);
|
||||
}
|
||||
}
|
||||
return _numFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ricava l'identificativo del file
|
||||
* @return String
|
||||
*/
|
||||
protected String getCodiceFile() {
|
||||
codiceFile++;
|
||||
return addZero(Integer.toString(codiceFile), 5);
|
||||
}
|
||||
|
||||
protected String getAnalogicoDigitale(int max) {
|
||||
if (index <= (max / 2))
|
||||
return "D";
|
||||
else
|
||||
return "A";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce TIMG o TIMT in modo random
|
||||
* @return String
|
||||
*/
|
||||
protected String randomCodiceOperatoreDonating() {
|
||||
String[] list = {"TIMG", "TIMT"};
|
||||
int i = rand.nextInt(2);
|
||||
return list[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce WIND, H3GI o OPIV in modo random
|
||||
* @return String
|
||||
*/
|
||||
/*protected String randomCodiceOperatoreRecipient() {
|
||||
String[] list = {"WIND", "OPIV", "H3GI", "LMIT"};
|
||||
int i = rand.nextInt(4);
|
||||
return list[i];
|
||||
}*/
|
||||
|
||||
protected String randomCodiceOperatoreRecipient() {
|
||||
String[] list = {"WIND", "OPIV", "H3GI"};
|
||||
int i = rand.nextInt(3);
|
||||
return list[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il codice operatore donating
|
||||
* @param sel String
|
||||
* @return String
|
||||
*/
|
||||
protected String getCodiceOperatoreDonating(String sel) {
|
||||
String val = "";
|
||||
if (sel.toUpperCase().equals("MISTO"))
|
||||
val = randomCodiceOperatoreDonating();
|
||||
else
|
||||
if (sel.toUpperCase().equals("TIMG"))
|
||||
val = "TIMG";
|
||||
else
|
||||
val = "TIMT";
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il codice operatore recipient
|
||||
* @param sel String
|
||||
* @return String
|
||||
*/
|
||||
protected String getCodiceOperatoreRecipient(String sel) {
|
||||
String val = "";
|
||||
if (sel.toUpperCase().equals("MISTO"))
|
||||
val = randomCodiceOperatoreRecipient();
|
||||
else
|
||||
if (sel.toUpperCase().equals("WIND"))
|
||||
val = "WIND";
|
||||
else if (sel.toUpperCase().equals("OPIV"))
|
||||
val = "OPIV";
|
||||
/*else if (sel.toUpperCase().equals("LMIT"))
|
||||
val = "LMIT";*/
|
||||
else
|
||||
val = "H3GI";
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il codice operatore recipient
|
||||
* @param sel String
|
||||
* @return String
|
||||
*/
|
||||
protected String getRGN(String operatore) {
|
||||
String val = "";
|
||||
if (operatore.equals("H3GI"))
|
||||
val = "397";
|
||||
else
|
||||
if (operatore.equals("OPIV"))
|
||||
val = "341";
|
||||
else
|
||||
if (operatore.equals("WIND"))
|
||||
val = "322";
|
||||
else
|
||||
if (operatore.equals("LMIT"))
|
||||
val = "382";
|
||||
else
|
||||
val= "";
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce il codice analogico digitale
|
||||
* @param sel String
|
||||
* @param max int
|
||||
* @return String
|
||||
*/
|
||||
protected String getCodiceAnalogicoDigitale(String tipo, int max) {
|
||||
String val = null;
|
||||
if (tipo.toUpperCase().equals("MISTO"))
|
||||
val = getAnalogicoDigitale(max);
|
||||
else
|
||||
if (tipo.toUpperCase().equals("D"))
|
||||
val = "D";
|
||||
else
|
||||
val = "A";
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
23
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLGeneratorIF.java
Normal file
23
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLGeneratorIF.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package xml;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public interface XMLGeneratorIF {
|
||||
|
||||
/**
|
||||
* metodo da invocare per generare un tracciato xml
|
||||
* @param args
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception;
|
||||
|
||||
/**
|
||||
* Metodo da invocare dopo la generazione di un tracciato
|
||||
* @throws Exception
|
||||
*/
|
||||
public void postGenerate() throws Exception;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package xml;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mnp.database.dao.HZGestioneRichiestaDAO;
|
||||
import mnp.xml.dao.gisp.HZCessNaturale;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLGispGenerator
|
||||
extends AbstractXmlGenerator {
|
||||
|
||||
HZGestioneRichiestaDAO dao = null;
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
public XMLGispGenerator() {
|
||||
dao = new HZGestioneRichiestaDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* @param args String[] - 0 - SUBSYS, 1 - TIPO OPERAZIONE - 2 NUM RICHIESTE - 3 DAC - 4 DISTRETTO
|
||||
* 5 - NUMERO, 6 - MSISDN
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
int numRichieste = Integer.parseInt(args[2]);
|
||||
String[] records = new String[numRichieste];
|
||||
|
||||
if (args.length < 7) {
|
||||
throw new IllegalArgumentException("Numero di parametri insufficienti");
|
||||
}
|
||||
HZCessNaturale notifica = new HZCessNaturale();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
System.out.println("parametro xml " + i + ": " + args[i]);
|
||||
}
|
||||
Map numMap = new HashMap();
|
||||
List prefix = dao.getPrefix();
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
notifica.setSUBSYS(args[0]);
|
||||
notifica.setTIPO_OPERAZIONE(Integer.parseInt(args[1]));
|
||||
notifica.setDAC(args[3]);
|
||||
notifica.setCF_PARTITA_IVA(getCodiceFiscalePartitaIVA());
|
||||
notifica.setCODICE_COMUNE(getCodiceComune());
|
||||
notifica.setCOGNOME_CLIENTE(randomCognomeCliente());
|
||||
notifica.setDENOMINAZIONE_SOCIALE(getDenominazioneSociale());
|
||||
notifica.setLOCALITA(randomLocalita());
|
||||
if ("SI".equalsIgnoreCase(args[6])){
|
||||
notifica.setMSISDN(getMSISDN("TIM", false));
|
||||
}else if ("NULL".equalsIgnoreCase(args[6])){
|
||||
notifica.setMSISDN(null);
|
||||
}else{
|
||||
notifica.setMSISDN(args[6]);
|
||||
}
|
||||
notifica.setNOME_CLIENTE(randomNomeCliente());
|
||||
notifica.setNOTE(getNote());
|
||||
notifica.setNUMERO_CIVICO(randomNumeroCivico());
|
||||
//Se l'utente non ha valorizzato alcun prefisso, lo genero randomicamente
|
||||
if (args[4] == null) {
|
||||
notifica.setPREFISSO_DN( (String) randomElementByList(prefix));
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setPREFISSO_DN(args[4]);
|
||||
}
|
||||
//Se l'utente non ha valorizzato alcun numero, lo genero randomicamente
|
||||
if (args[5] == null) {
|
||||
String num = "";
|
||||
while (numMap.containsKey(num = randomTelefono(notifica.getPREFISSO_DN().length()))){
|
||||
//do nothing
|
||||
}
|
||||
numMap.put(num, num);
|
||||
notifica.setNUMERO_DN(num);
|
||||
}
|
||||
else {
|
||||
//altimenti setto il valore specificato dall'utente
|
||||
notifica.setNUMERO_DN(args[5]);
|
||||
}
|
||||
notifica.setVIA(getVia());
|
||||
records[i] = getXmlFromCastorObject(notifica, false);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.HZ,notifica);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import db.ManagerDAO;
|
||||
|
||||
import mnp.objects.StatoRichiestaDonorVirtuale;
|
||||
import mnp.objects.StatoRichiestaRecipientVirtuale;
|
||||
import mnp.objects.map.GispMap;
|
||||
import mnp.utility.DateUtils;
|
||||
import mnp.xml.dao.gisp.Event;
|
||||
import mnp.xml.dao.gisp.Msisdn;
|
||||
import mnp.xml.dao.gisp.Tipo_evento;
|
||||
|
||||
public class XMLGispNotificationGenerator extends AbstractXmlGenerator {
|
||||
|
||||
public XMLGispNotificationGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
|
||||
List msisdnList = new ArrayList();
|
||||
String tipoFlusso = args[0];
|
||||
String esito = args[1];
|
||||
|
||||
String idRichiesta = args[2];
|
||||
|
||||
if (tipoFlusso.equals("NOT_CESSAZIONE")) {
|
||||
if (esito.equals(GispMap.CESS_DON_VIRTUALE)) {
|
||||
if (!idRichiesta.equalsIgnoreCase("NULL")) {
|
||||
msisdnList = managerDAO.findMsisdnByIdRichiestaDV(idRichiesta);
|
||||
}
|
||||
else {
|
||||
msisdnList = managerDAO.findMsisdnByStatoDV(StatoRichiestaDonorVirtuale.ATTESAEVASIONE);
|
||||
}
|
||||
return generateNotifiche(msisdnList, esito);
|
||||
}
|
||||
else if (esito.equals(GispMap.CESS_REC_VIRTUALE)) {
|
||||
if (!idRichiesta.equalsIgnoreCase("NULL")) {
|
||||
msisdnList = managerDAO.findMsisdnByIdRichiestaRV(idRichiesta);
|
||||
}
|
||||
else {
|
||||
msisdnList = managerDAO.findMsisdnByStatoRV(StatoRichiestaRecipientVirtuale.IN_CESSAZIONE);
|
||||
}
|
||||
return generateNotifiche(msisdnList, esito);
|
||||
}
|
||||
else
|
||||
throw new Exception("Esito errato: " + esito);
|
||||
}
|
||||
else if (tipoFlusso.equals("NOT_ATTIVAZIONE")) {
|
||||
if (esito.equals(GispMap.ATT_DON_VIRTUALE)) {
|
||||
if (!idRichiesta.equalsIgnoreCase("NULL")) {
|
||||
msisdnList = managerDAO.findMsisdnByIdRichiestaDV(idRichiesta);
|
||||
}
|
||||
else {
|
||||
msisdnList = managerDAO.findMsisdnByStatoDV(StatoRichiestaDonorVirtuale.CESSATA);
|
||||
}
|
||||
return generateNotifiche(msisdnList, esito);
|
||||
}
|
||||
else
|
||||
throw new Exception("Esito errato: " + esito);
|
||||
}
|
||||
else
|
||||
throw new Exception("Tipo Flusso errato: " + tipoFlusso);
|
||||
}
|
||||
|
||||
|
||||
private String[] generateNotifiche(List richiestaList, String esito) throws Exception {
|
||||
String[] records = new String[richiestaList.size()];
|
||||
Event notifica = null;
|
||||
|
||||
String dataNotifica = DateUtils.toStringLocale(new Date(), GispMap.DATA_ESPL_FORMAT,Locale.ENGLISH);
|
||||
//String dataNotifica = "27-May-2008 13:01:01";
|
||||
|
||||
String msisdn;
|
||||
Msisdn msisdnTag = null;
|
||||
Tipo_evento evento = null;
|
||||
for (int i = 0; i < richiestaList.size(); i++) {
|
||||
msisdn = (String)richiestaList.get(i);
|
||||
notifica = new Event();
|
||||
msisdnTag = new Msisdn();
|
||||
msisdnTag.setValue(msisdn);
|
||||
evento = new Tipo_evento();
|
||||
evento.setValue(esito);
|
||||
msisdnTag.setTipo_evento(evento);
|
||||
notifica.setMsisdn(msisdnTag);
|
||||
notifica.setSysdate(dataNotifica);
|
||||
records[i] = getXmlFromCastorObject(notifica, false);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import obj.TipoFlusso;
|
||||
|
||||
import client.ClientIBAsincSender;
|
||||
import db.ManagerDAO;
|
||||
|
||||
import mnp.objects.ProcessMapper;
|
||||
import mnp.objects.StatoRichiesta;
|
||||
import mnp.objects.StatoRichiestaCess;
|
||||
import mnp.objects.StatoRichiestaPorting;
|
||||
import mnp.objects.StatoRichiestaRec;
|
||||
import mnp.objects.StatoRichiestaRecipientVirtuale;
|
||||
import mnp.xml.dao.gisp.GispToDBCRispostaRichiestaAttCess;
|
||||
|
||||
public class XMLGispResponseGenerator extends AbstractXmlGenerator {
|
||||
|
||||
public XMLGispResponseGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
List richiestaList = new ArrayList();
|
||||
String tipoFlusso = args[0];
|
||||
String esito = args[1];
|
||||
String processo = args[2];
|
||||
String emptyTid ="";
|
||||
/*if(args[3]!= null) emptyTid =args[3];
|
||||
else emptyTid ="n";*/
|
||||
if (tipoFlusso.equals(TipoFlusso.RISP_ATTIVAZIONE)) {
|
||||
if (ProcessMapper.proc_RECIPIENT.equals(processo)){
|
||||
int[] stati = {StatoRichiestaRec.ATTESAEVASIONE, StatoRichiestaRec.EVASA};
|
||||
richiestaList = managerDAO.generateListRispostaGisp(stati);
|
||||
}else if (ProcessMapper.proc_RECIPIENT_VIRT.equals(processo)){
|
||||
richiestaList = managerDAO.generateListRispostaGispVirtuale(StatoRichiestaRecipientVirtuale.IN_ATTIVAZIONE);
|
||||
}else{
|
||||
throw new Exception("Processo errato: " + processo);
|
||||
}
|
||||
return generateRispAttCess(richiestaList, esito);
|
||||
}
|
||||
else if (tipoFlusso.equals(TipoFlusso.RISP_CESSAZIONE)) {
|
||||
if (ProcessMapper.proc_DONOR.equals(processo)){
|
||||
int[] stati = {StatoRichiesta.INCESSAZIONE, StatoRichiesta.CESSATA, StatoRichiesta.ESPLETATA};
|
||||
richiestaList = managerDAO.generateListRispostaGispDonor(stati);
|
||||
}
|
||||
else if (ProcessMapper.proc_RECIPIENT_VIRT.equals(processo)) {
|
||||
richiestaList = managerDAO.generateListRispostaGispRV();
|
||||
} else if(ProcessMapper.proc_CESS.equals(processo)){
|
||||
int[] stati = {StatoRichiestaCess.ACQUISITA, StatoRichiestaCess.DACESSARE};
|
||||
richiestaList = managerDAO.generateListRispostaGispCessazione(stati);
|
||||
}else if(ProcessMapper.proc_PORTING_IN.equals(processo)){
|
||||
int[] stati = {StatoRichiestaPorting.ATTESAEVASIONE, StatoRichiestaPorting.NON_EVASA_INVIATA};
|
||||
richiestaList = managerDAO.generateListRispostaGispPorting(stati);
|
||||
}
|
||||
else {
|
||||
throw new Exception("Processo errato: " + processo);
|
||||
}
|
||||
if(emptyTid.equalsIgnoreCase("y")){
|
||||
for(int i=0;i<richiestaList.size();i++){
|
||||
((GispToDBCRispostaRichiestaAttCess)richiestaList.get(i)).setCODICE_RIPROPOSIZIONE("");
|
||||
}
|
||||
}
|
||||
return generateRispAttCess(richiestaList, esito);
|
||||
}
|
||||
else
|
||||
throw new Exception("Tipo Flusso errato: " + tipoFlusso);
|
||||
}
|
||||
|
||||
private String[] generateRispAttCess(List richiestaList, String esito) throws Exception {
|
||||
String[] records = new String[richiestaList.size()];
|
||||
for (int i = 0; i < richiestaList.size(); i++){
|
||||
GispToDBCRispostaRichiestaAttCess risposta = (GispToDBCRispostaRichiestaAttCess)richiestaList.get(i);
|
||||
risposta.setDESCRIZIONE_ESITO("esito: " +esito);
|
||||
risposta.setDETTAGLIO_ESITO("WR");
|
||||
risposta.setESITO_CAS(esito);
|
||||
records[i] = getXmlFromCastorObject(risposta, false);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import db.ManagerDAO;
|
||||
import testUtil.TestProcessCache;
|
||||
import mnp.utility.UUIDHelper;
|
||||
import mnp.xml.dao.mvno.MVNOToDbcNotifyCreditTransferDonor;
|
||||
|
||||
public class XMLMvnoNotificaTcGenerator extends AbstractXmlGenerator {
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public XMLMvnoNotificaTcGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* NOTIFICA TRASFERIMENTO CREDITO
|
||||
* args[0] selettore per il tipo di notifica da effettuare ('MVNO_TC')
|
||||
* args[1] processType (tipo di processo: DON, DON_VIRT, REC_VIRT)
|
||||
* args[2] tipo evento (trasferimento = 01, sblocco credito anomalo = 02, sblocco importo = 03)
|
||||
* args[3] id richiesta (id della richiesta dbc associata)
|
||||
* args[4] credito residuo (xxxxx.xx)
|
||||
* args[5] verifica credito anomalo (flag Y|N)
|
||||
*
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
|
||||
if(args.length != 5 && args.length != 6)
|
||||
throw new Exception("Numero parametri errato!");
|
||||
String records[] = null;
|
||||
String idRichiesta = args[1];
|
||||
String processType = args[2];
|
||||
String tipoEvento = args[3];
|
||||
String creditoResiduo = args[4];
|
||||
String verificaCreditoAnomalo = null;
|
||||
if(tipoEvento.equals("01"))
|
||||
verificaCreditoAnomalo = args[5];
|
||||
|
||||
checkFields(processType, tipoEvento, creditoResiduo, verificaCreditoAnomalo);
|
||||
|
||||
List request = new ArrayList();
|
||||
|
||||
MVNOToDbcNotifyCreditTransferDonor richiestaTC = new MVNOToDbcNotifyCreditTransferDonor();
|
||||
if("NULL".equals(idRichiesta)){
|
||||
if(tipoEvento.equals("01")){
|
||||
request = managerDAO.getIdRichiestaBusinessID(processType);
|
||||
} else if(tipoEvento.equals("02")){
|
||||
request = managerDAO.getIdRichiestaBusinessIDByState(processType, tipoEvento);
|
||||
} else if(tipoEvento.equals("03")){
|
||||
request = managerDAO.getIdRichiestaBusinessIDByState(processType, tipoEvento);
|
||||
}
|
||||
//ciclo sulle coppie di id_richiesta/ business id acquisite
|
||||
if(request != null && request.size() > 0){
|
||||
records = new String[request.size()];
|
||||
for(int i = 0; i < request.size(); i++){
|
||||
String[] current = (String[])request.get(i);
|
||||
richiestaTC.setID_RICHIESTA_DBC(current[0]);
|
||||
if(current[1] == null)
|
||||
richiestaTC.setBUSINESS_ID(UUIDHelper.generateBusinessID());
|
||||
else
|
||||
richiestaTC.setBUSINESS_ID(current[1]);
|
||||
if(tipoEvento.equals("01"))
|
||||
richiestaTC.setFLAG_VERIFICA_CREDITO_ANOMALO(verificaCreditoAnomalo);
|
||||
richiestaTC.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTC.setTIPO_EVENTO(tipoEvento);
|
||||
records[i] = getXmlFromCastorObject(richiestaTC, false);
|
||||
}
|
||||
} else
|
||||
throw new Exception("NON SONO PRESENTI SUL DB DATI COMPATIBILI CON I PARAMETRI DI INPUT");
|
||||
} else {
|
||||
String businessId = managerDAO.verificaEsistenzaIdRichiestaMvno(processType, idRichiesta);
|
||||
// if(businessId != null){
|
||||
// if(tipoEvento.equals("01")){
|
||||
// //do nothing
|
||||
// } else
|
||||
if(tipoEvento.equals("02")){
|
||||
request = managerDAO.verificaEsistenzaRichiestaTcMvno(processType, idRichiesta, tipoEvento);
|
||||
if(request == null || request.size() == 0)
|
||||
throw new Exception("SUL DB NON E' PRESENTE NESSUNA RICHIESTA DI TC AVENTE ID RICHIESTA = " + idRichiesta);
|
||||
} else if(tipoEvento.equals("03")){
|
||||
request = managerDAO.verificaEsistenzaRichiestaTcMvno(processType, idRichiesta, tipoEvento);
|
||||
if(request == null || request.size() == 0)
|
||||
throw new Exception("SUL DB NON E' PRESENTE NESSUNA RICHIESTA DI TC AVENTE ID RICHIESTA = " + idRichiesta);
|
||||
}
|
||||
richiestaTC.setID_RICHIESTA_DBC(idRichiesta);
|
||||
if(businessId==null)
|
||||
richiestaTC.setBUSINESS_ID(UUIDHelper.generateBusinessID());
|
||||
else
|
||||
richiestaTC.setBUSINESS_ID(businessId);
|
||||
if(tipoEvento.equals("01"))
|
||||
richiestaTC.setFLAG_VERIFICA_CREDITO_ANOMALO(verificaCreditoAnomalo);
|
||||
richiestaTC.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTC.setTIPO_EVENTO(tipoEvento);
|
||||
records = new String[1];
|
||||
records[0] = getXmlFromCastorObject(richiestaTC, false);
|
||||
// records[0] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><MVNOToDbcNotifyCreditTransferDonor><TIPO_EVENTO>01</TIPO_EVENTO><ID_RICHIESTA_DBC>RV000000000000000001076</ID_RICHIESTA_DBC><BUSINESS_ID>f0865988-b8c3-3539-bb64-7809487e2d1c</BUSINESS_ID><IMPORTO_CREDITO_RESIDUO>6543,21</IMPORTO_CREDITO_RESIDUO><FLAG_VERIFICA_CREDITO_ANOMALO>N</FLAG_VERIFICA_CREDITO_ANOMALO></MVNOToDbcNotifyCreditTransferDonor>";
|
||||
// } else {
|
||||
// throw new Exception(idRichiestaErr);
|
||||
// }
|
||||
}
|
||||
testProcessCache.addItem(TestProcessCache.TISCALI_IN, richiestaTC);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
private void checkFields(String processType, String tipoEvento, String creditoResiduo, String verificaCreditoAnomalo) throws Exception {
|
||||
if( !( processType.equals("DON") || processType.equals("DON_VIRT") || processType.equals("REC_VIRT") ) )
|
||||
throw new Exception("PROCESS TYPE ERRATO!");
|
||||
if( !( tipoEvento.equals("01") || tipoEvento.equals("02") || tipoEvento.equals("03") ) )
|
||||
throw new Exception("TIPO EVENTO ERRATO!");
|
||||
|
||||
String pattern = "[0-9]{1,5}[.][0-9]{2,2}";
|
||||
if(!creditoResiduo.matches(pattern))
|
||||
throw new Exception("VALORE CREDITO RESIDUO NON VALIDO!");
|
||||
|
||||
if(tipoEvento.equals("01") && ! (verificaCreditoAnomalo.equals("Y") || verificaCreditoAnomalo.equals("N")) )
|
||||
throw new Exception("PER TIPO EVENTO = '01', IL FLAG DI VERIFICA CREDITO ANOMALO DEVE ESSERE 'Y' o 'N'!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package xml;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import db.ManagerDAO;
|
||||
|
||||
import mnp.utility.UUIDHelper;
|
||||
import mnp.xml.dao.mvno.MVNOToDbcPortingInRecipient;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLMvnoPortingInGenerator extends AbstractXmlGenerator {
|
||||
|
||||
private static final String MISTO = "MISTO";
|
||||
private static final String TISC = "TISC";
|
||||
private static final String NOVE = "NOVE";
|
||||
private static final String COOP = "COOP";
|
||||
private static final String BIPM = "BIPM";
|
||||
private static final String OPTI = "OPTI";
|
||||
private static final String FNP = "FNP";
|
||||
private static final String ACCODATA = "ACCODATA";
|
||||
private String richiesta_operazione_format_string = "yyyyMMddHHmmss";
|
||||
private String cut_over_format_string = "yyyyMMdd";
|
||||
private SimpleDateFormat richiesta_operazione_format = new SimpleDateFormat(richiesta_operazione_format_string);
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public XMLMvnoPortingInGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
|
||||
if (args.length != 18 && args.length != 19) {
|
||||
throw new IllegalArgumentException("Numero parametri errati!");
|
||||
}
|
||||
testProcessCache.clear();
|
||||
return generateXmlAttivazione(args);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* ATTIVAZIONE
|
||||
* args[0] tipo flusso: ATTIVAZIONE
|
||||
* args[1] Numero richieste
|
||||
* args[2] Pre post pagato: PRP,POP,MISTO
|
||||
* args[3] RECIPIENT: TISC, NOVE
|
||||
* args[4] DONATING: WIND,OPIV,H3GI,MISTO
|
||||
* args[5] accodata: ACCODATA, NO_ACCODATA
|
||||
* args[6] Prefisso
|
||||
* args[7] Numero
|
||||
* args[8] ICCID
|
||||
* args[9] Codice Fiscale
|
||||
* args[10] Flag trasferimento credito
|
||||
* args[11] Flag furto
|
||||
* args[12] Flag validazione
|
||||
* args[13] Project ad hoc
|
||||
* args[14] Codice gruppo
|
||||
* args[15] Routing number
|
||||
* args[16] Tipo documento
|
||||
* args[17] Numero documentos
|
||||
* args[18] Tipo utenza (opzionale)
|
||||
*
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXmlAttivazione(String[] args) throws Exception {
|
||||
int numRichieste = Integer.parseInt(args[1]);
|
||||
|
||||
int min_p=index;
|
||||
int max_p=index + numRichieste;
|
||||
|
||||
String[] records = new String[numRichieste];
|
||||
|
||||
MVNOToDbcPortingInRecipient attivazione = null;
|
||||
|
||||
String prePostPagato = args[2];
|
||||
String recipient = args[3];
|
||||
String donating = args[4];
|
||||
String accodata = args[5];
|
||||
String prefisso = args[6];
|
||||
String telefono = args[7];
|
||||
String iccid = args[8];
|
||||
String cod_fiscale = args[9];
|
||||
String flag_trasferimento_credito= args[10];
|
||||
String flag_furto = args[11];
|
||||
String flag_prevalidazione = args[12];
|
||||
String prjHoc = args[13];
|
||||
String codiceGruppo = args[14];
|
||||
String routingNumber = args[15];
|
||||
String tipoDocumento = args[16];
|
||||
String numeroDocumento = args[17];
|
||||
String tipoUtenza = args.length > 18 ? args[18] : null;
|
||||
|
||||
if (donating.equalsIgnoreCase(recipient))
|
||||
throw new Exception("Operatore Donating uguale all'operatore Recipient");
|
||||
|
||||
|
||||
if (!(recipient.equals(TISC) || recipient.equals(NOVE) || recipient.equals(COOP) || recipient.equals(BIPM) || recipient.equals(OPTI)))
|
||||
throw new Exception("Operatore recipient sconosciuto: " + recipient);
|
||||
|
||||
cutover_date_format = new SimpleDateFormat(cut_over_format_string);
|
||||
|
||||
|
||||
if (accodata.equals(ACCODATA)){
|
||||
setAccodata(true);
|
||||
}
|
||||
|
||||
if (tipoUtenza != null && !tipoUtenza.equals("A") && !tipoUtenza.equals("B") && !tipoUtenza.equals("C") && !tipoUtenza.equals("D")
|
||||
&& !tipoUtenza.equals("NULL")) {
|
||||
throw new Exception("Tipo utenza non corretto: " + tipoUtenza);
|
||||
}
|
||||
|
||||
for (int i = 0; i < numRichieste; i++) {
|
||||
attivazione = new MVNOToDbcPortingInRecipient();
|
||||
if (donating.equals(MISTO))
|
||||
donating = getCodiceOperatoreOLO(min_p, max_p);
|
||||
|
||||
attivazione.setCODICE_RECIPIENT(recipient);
|
||||
attivazione.setCODICE_DONATING(donating);
|
||||
attivazione.setPREFISSO_AOM(!"NULL".equalsIgnoreCase(prefisso)?prefisso:randomPrefisso());
|
||||
attivazione.setNUMERO_TELEFONO_AOM(!"NULL".equalsIgnoreCase(telefono)? telefono : getTelefono());
|
||||
if (!iccid.equalsIgnoreCase("VUOTO"))
|
||||
attivazione.setICCID_AOM(!"NULL".equalsIgnoreCase(iccid)? iccid : getIccdSerialNumber());
|
||||
if ("SI".equalsIgnoreCase(cod_fiscale)){
|
||||
attivazione.setCODICE_FISCALE(getCodiceFiscalePartitaIVA());
|
||||
attivazione.setPARTITA_IVA(getCodiceFiscalePartitaIVA().substring(0, 11));
|
||||
}else{
|
||||
// NON SETTO IL CODICE FISCALE E LA PARTITA IVA
|
||||
}
|
||||
|
||||
if (MISTO.equals(prePostPagato))
|
||||
attivazione.setTIPO_UTENZA(getPrePost(min_p, max_p));
|
||||
else if(!"NULL".equalsIgnoreCase(prePostPagato))
|
||||
attivazione.setTIPO_UTENZA(prePostPagato);
|
||||
|
||||
if("SI".equalsIgnoreCase(tipoDocumento))
|
||||
attivazione.setTIPO_DOCUMENTO(getTipoDocumento());
|
||||
if("SI".equalsIgnoreCase(numeroDocumento))
|
||||
attivazione.setNUMERO_DOCUMENTO(getNumeroDocumento());
|
||||
|
||||
attivazione.setDATA_CUT_OVER(getDataCutover());
|
||||
attivazione.setCOGNOME(randomCognomeCliente());
|
||||
attivazione.setNOME(randomNomeCliente());
|
||||
attivazione.setRAGIONE_SOCIALE(randomNomeCliente() + " S.R.L.");
|
||||
attivazione.setDATA_RICHIESTA_OPERAZIONE(richiesta_operazione_format.format(new Date()));
|
||||
attivazione.setTIPO_OPERAZIONE(FNP);
|
||||
attivazione.setPROFILO("TODO");
|
||||
attivazione.setIMSI(getImsi());
|
||||
attivazione.setBUSINESS_ID(UUIDHelper.generateBusinessID());
|
||||
|
||||
if(flag_trasferimento_credito.equalsIgnoreCase("NULL"))
|
||||
flag_trasferimento_credito=randomFlagYN();
|
||||
|
||||
attivazione.setFLAG_TRASFERIMENTO_CREDITO(flag_trasferimento_credito);
|
||||
|
||||
if(!"NULL".equalsIgnoreCase(flag_furto))
|
||||
attivazione.setFLAG_FURTO(flag_furto);
|
||||
|
||||
if(!"NULL".equalsIgnoreCase(flag_prevalidazione))
|
||||
attivazione.setFLAG_PREVALIDAZIONE(flag_prevalidazione);
|
||||
|
||||
attivazione.setPROGETTO_AD_HOC(prjHoc);
|
||||
|
||||
if (!"NULL".equalsIgnoreCase(codiceGruppo))
|
||||
attivazione.setCODICE_GRUPPO(codiceGruppo);
|
||||
|
||||
if (!"NULL".equalsIgnoreCase(routingNumber)){
|
||||
attivazione.setROUTING_NUMBER(routingNumber);
|
||||
}
|
||||
|
||||
if (tipoUtenza != null) {
|
||||
String msisdn = "39"+attivazione.getPREFISSO_AOM() + attivazione.getNUMERO_TELEFONO_AOM();
|
||||
new ManagerDAO().insertTipoClientiDbss(msisdn, "6", "X", tipoUtenza, "C", "DBSS", null, attivazione.getCODICE_FISCALE(), "859970968", "ATTIVO");
|
||||
}
|
||||
|
||||
records[i] = getXmlFromCastorObject(attivazione, false);
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.TISCALI_IN, attivazione);
|
||||
incrementaIndiceRichieste();
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see xml.AbstractXmlGenerator#postGenerate()
|
||||
*/
|
||||
public void postGenerate() throws Exception {
|
||||
//incremento il numero di telefono
|
||||
savePhoneSeed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package xml;
|
||||
|
||||
import db.ManagerDAO;
|
||||
import mnp.database.hb.dto.MnpGestioneRichiesta;
|
||||
import mnp.xml.dao.mvno.MVNOToDbcUpdateDcoDonor;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class XMLMvnoUpdateDCOGenerator extends AbstractXmlGenerator {
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
|
||||
public XMLMvnoUpdateDCOGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
* <p/>
|
||||
* UPDATE DCO MVNO DONOR Prjhoc
|
||||
* args[0] tipo flusso: UPDATEDCO
|
||||
* args[1] nuova DCO (dd-MM-yyyy)
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
testProcessCache.clear();
|
||||
String nuovaDCO = args[1];
|
||||
|
||||
|
||||
String[] ret = new String[0];
|
||||
List richieste = managerDAO.recuperaRichiesteMvnoDonPrjHocWithStatus();
|
||||
if (richieste != null && richieste.size()!=0) {
|
||||
ret = new String[richieste.size()];
|
||||
for (int i = 0; i < richieste.size(); i++) {
|
||||
MnpGestioneRichiesta mnpGestioneRichiesta = (MnpGestioneRichiesta) richieste.get(i);
|
||||
ret[i] = creaSingolaRichiestaXml(mnpGestioneRichiesta, nuovaDCO);
|
||||
|
||||
}
|
||||
}else{
|
||||
System.out.println("NESSUNA RICHIESTA PER CUI EFFETTUARE L'UPDATE DCO");
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private String creaSingolaRichiestaXml(MnpGestioneRichiesta mnpGestioneRichiesta, String nuovaDataCO) throws Exception {
|
||||
MVNOToDbcUpdateDcoDonor ret = new MVNOToDbcUpdateDcoDonor();
|
||||
ret.setBUSINESS_ID(mnpGestioneRichiesta.getBusinessId());
|
||||
ret.setCODICE_GRUPPO(mnpGestioneRichiesta.getCodiceGruppo());
|
||||
ret.setDATA_CUT_OVER(nuovaDataCO);
|
||||
ret.setID_RICHIESTA_DBC(mnpGestioneRichiesta.getIdRichiesta());
|
||||
testProcessCache.addItem(TestProcessCache.TISCALI_IN, ret);
|
||||
return getXmlFromCastorObject(ret, false);
|
||||
}
|
||||
|
||||
}
|
||||
111
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLMvnoValGenerator.java
Normal file
111
dbcmnpsrc/FE/mnpdev/sim/sistemi/src/xml/XMLMvnoValGenerator.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package xml;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import db.ManagerDAO;
|
||||
|
||||
import mnp.utility.UUIDHelper;
|
||||
import mnp.xml.dao.mvno.CODICE_CAUSALE_RIFIUTO;
|
||||
import mnp.xml.dao.mvno.MVNOToDbcValidazioneDonor;
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
public class XMLMvnoValGenerator extends AbstractXmlGenerator {
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
private static final String RIFIUTATA = "RIFIUTATA";
|
||||
|
||||
private String data_eff_validazione_format_string = "yyyyMMddHHmmss";
|
||||
private SimpleDateFormat data_eff_validazione_format = new SimpleDateFormat(data_eff_validazione_format_string);
|
||||
|
||||
public XMLMvnoValGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* VALIDAZIONE
|
||||
* args[0] tipo flusso: VALIDAZIONE
|
||||
* args[1] esito: ACCETTATA, RIFIUTATA
|
||||
* args[2] causale: 1,...,13,NULL
|
||||
* args[3] tipo processo: D (donor standard), V (donor virtuale)
|
||||
* args[4] idRichiesta: id, NULL
|
||||
*
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
testProcessCache.clear();
|
||||
String[] causali = null;
|
||||
String[] records = null;
|
||||
String esito = args[1];
|
||||
String causaleRifiuto = args[2];
|
||||
if (!"NULL".equalsIgnoreCase(causaleRifiuto)){
|
||||
causali = causaleRifiuto.split("_");
|
||||
}else{
|
||||
causali = new String [1];
|
||||
causali[0] = causaleRifiuto;
|
||||
}
|
||||
String tipoProcesso = args[3];
|
||||
String id = args[4];
|
||||
|
||||
MVNOToDbcValidazioneDonor validazione = new MVNOToDbcValidazioneDonor();
|
||||
|
||||
if ("NULL".equalsIgnoreCase(id)) {
|
||||
List idRichiestaList = managerDAO.generateListValidazioneTiscali(tipoProcesso);
|
||||
|
||||
records = new String[idRichiestaList.size()];
|
||||
|
||||
for (int i = 0; i < idRichiestaList.size(); i++) {
|
||||
String[] richiesta = (String[]) idRichiestaList.get(i);
|
||||
validazione = creaValidazione(richiesta[0],esito,causaleRifiuto, causali);
|
||||
validazione.setBUSINESS_ID(richiesta[1]);
|
||||
records[i] = getXmlFromCastorObject(validazione, false);
|
||||
//test automatici
|
||||
|
||||
testProcessCache.addItem(TestProcessCache.TISCALI_IN,validazione);
|
||||
}
|
||||
} else {
|
||||
records = new String[1];
|
||||
validazione = creaValidazione(id,esito,causaleRifiuto, causali);
|
||||
List businessList = managerDAO.findBusinessIDByIdRichiestaDV(id);
|
||||
if (businessList.size() == 0){
|
||||
validazione.setBUSINESS_ID(UUIDHelper.generateBusinessID());
|
||||
}else{
|
||||
validazione.setBUSINESS_ID((String)businessList.get(0));
|
||||
}
|
||||
|
||||
records[0] = getXmlFromCastorObject(validazione, false);
|
||||
testProcessCache.clear();
|
||||
testProcessCache.addItem(TestProcessCache.TISCALI_IN,validazione);
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
private MVNOToDbcValidazioneDonor creaValidazione(String idRichiesta,String esito, String causaleRifiuto, String[] causali) throws Exception {
|
||||
MVNOToDbcValidazioneDonor validazione = new MVNOToDbcValidazioneDonor();
|
||||
validazione.setID_RICHIESTA_DBC(idRichiesta);
|
||||
validazione.setESITO_VALIDAZIONE(esito);
|
||||
|
||||
CODICE_CAUSALE_RIFIUTO codice_causale_rifiuto = new CODICE_CAUSALE_RIFIUTO();
|
||||
|
||||
if (!"NULL".equalsIgnoreCase(causali[0])){
|
||||
for (int i=0; i<causali.length; i++ ){
|
||||
codice_causale_rifiuto.addCODICE(causali[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (esito.equals(RIFIUTATA)) {
|
||||
validazione.setCODICE_CAUSALE_RIFIUTO(codice_causale_rifiuto);
|
||||
} else {
|
||||
validazione.setCODICE_CAUSALE_RIFIUTO(null);
|
||||
}
|
||||
validazione.setDATA_EFFETTIVA_VALIDAZIONE(data_eff_validazione_format.format(new Date()));
|
||||
return validazione;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mnp.xml.dao.msp.NotifyCreditTransferDonorESP;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import db.ManagerDAO;
|
||||
|
||||
public class XMLNotificaMspCoopTcGenerator extends AbstractXmlGenerator {
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public XMLNotificaMspCoopTcGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* NOTIFICA TRASFERIMENTO CREDITO
|
||||
* args[0] selettore per il tipo di notifica da effettuare ('MSPCOOP_TC')
|
||||
* args[1] processType (tipo di processo: DON, DON_VIRT, REC_VIRT)
|
||||
* args[2] tipo evento (trasferimento = 01, sblocco credito anomalo = 02, sblocco importo = 03)
|
||||
* args[3] id richiesta (id della richiesta dbc associata)
|
||||
* args[4] credito residuo (xxxxx.xx)
|
||||
* args[5] verifica credito anomalo (flag Y|N)
|
||||
*
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
|
||||
if(args.length != 5)
|
||||
throw new Exception("Numero parametri errato!");
|
||||
|
||||
String records[] = null;
|
||||
String idRichiesta = args[1];
|
||||
String processType = args[2];
|
||||
String tipoEvento = args[3];
|
||||
String creditoResiduo = args[4];
|
||||
|
||||
checkFields(processType, tipoEvento, creditoResiduo);
|
||||
|
||||
List request = new ArrayList();
|
||||
|
||||
NotifyCreditTransferDonorESP richiestaTc = new NotifyCreditTransferDonorESP();
|
||||
if("NULL".equals(idRichiesta)){
|
||||
if(tipoEvento.equals("01")){
|
||||
request = managerDAO.getIdRichiestaMspCoop(processType);
|
||||
} else if(tipoEvento.equals("03")) {
|
||||
request = managerDAO.getIdRichiestaMspCoopByState(processType, tipoEvento);
|
||||
}
|
||||
//ciclo sulle coppie di id_richiesta/ business id acquisite
|
||||
if(request != null && request.size() > 0){
|
||||
records = new String[request.size()];
|
||||
for(int i = 0; i < request.size(); i++){
|
||||
richiestaTc.setID_RICHIESTA_DBC((String)request.get(i));
|
||||
richiestaTc.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTc.setTIPO_EVENTO(tipoEvento);
|
||||
records[i] = getXmlFromCastorObject(richiestaTc, false);
|
||||
}
|
||||
} else
|
||||
throw new Exception("NON SONO PRESENTI SUL DB DATI COMPATIBILI CON I PARAMETRI DI INPUT");
|
||||
} else {
|
||||
String businessId = managerDAO.verificaEsistenzaIdRichiestaMspCoop(processType, idRichiesta);
|
||||
// if(tipoEvento.equals("01")){
|
||||
// do nothing
|
||||
// } else
|
||||
if(tipoEvento.equals("03")) {
|
||||
request = managerDAO.verificaEsistenzaRichiestaTcMspCoop(processType, idRichiesta, tipoEvento);
|
||||
if(request == null || request.size() == 0)
|
||||
throw new Exception("SUL DB NON E' PRESENTE NESSUNA RICHIESTA DI TC AVENTE ID RICHIESTA = " + idRichiesta);
|
||||
}
|
||||
richiestaTc.setID_RICHIESTA_DBC(idRichiesta);
|
||||
richiestaTc.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTc.setTIPO_EVENTO(tipoEvento);
|
||||
records = new String[1];
|
||||
records[0] = getXmlFromCastorObject(richiestaTc, false);
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
private void checkFields(String processType, String tipoEvento, String creditoResiduo) throws Exception {
|
||||
if( !( processType.equals("DON") || processType.equals("DON_VIRT") || processType.equals("REC_VIRT") ) )
|
||||
throw new Exception("PROCESS TYPE ERRATO!");
|
||||
|
||||
if( !( tipoEvento.equals("01") || tipoEvento.equals("03") ) )
|
||||
throw new Exception("TIPO EVENTO ERRATO!");
|
||||
|
||||
String pattern = "[0-9]{1,5}[.][0-9]{2,2}";
|
||||
if(!creditoResiduo.matches(pattern))
|
||||
throw new Exception("VALORE CREDITO RESIDUO NON VALIDO!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import mnp.xml.dao.msp.NotifyCreditTransferDonorTIM;
|
||||
|
||||
import db.ManagerDAO;
|
||||
|
||||
public class XMLNotificaMspTcGenerator extends AbstractXmlGenerator {
|
||||
|
||||
protected TestProcessCache testProcessCache = TestProcessCache.getInstance();
|
||||
|
||||
public XMLNotificaMspTcGenerator() {
|
||||
managerDAO = new ManagerDAO();
|
||||
}
|
||||
|
||||
/**
|
||||
* generateXml
|
||||
*
|
||||
* NOTIFICA TRASFERIMENTO CREDITO
|
||||
* args[0] selettore per il tipo di notifica da effettuare ('MSP_TC')
|
||||
* args[1] processType (tipo di processo: DON, DON_VIRT, REC_VIRT)
|
||||
* args[2] tipo evento (trasferimento = 01, sblocco credito anomalo = 02, sblocco importo = 03)
|
||||
* args[3] id richiesta (id della richiesta dbc associata)
|
||||
* args[4] credito residuo (xxxxx.xx)
|
||||
* args[5] verifica credito anomalo (flag Y|N)
|
||||
*
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String[] generateXml(String[] args) throws Exception {
|
||||
|
||||
if(args.length != 5)
|
||||
throw new Exception("Numero parametri errato!");
|
||||
String records[] = null;
|
||||
String idRichiesta = args[1];
|
||||
String processType = args[2];
|
||||
String tipoEvento = args[3];
|
||||
String creditoResiduo = args[4];
|
||||
|
||||
checkFields(processType, tipoEvento, creditoResiduo);
|
||||
|
||||
List request = new ArrayList();
|
||||
|
||||
NotifyCreditTransferDonorTIM richiestaTc = new NotifyCreditTransferDonorTIM();
|
||||
if("NULL".equals(idRichiesta)){
|
||||
if(tipoEvento.equals("01")){
|
||||
request = managerDAO.getIdRichiestaMsp(processType);
|
||||
} else if(tipoEvento.equals("03")) {
|
||||
request = managerDAO.getIdRichiestaMspByState(processType, tipoEvento);
|
||||
}
|
||||
//ciclo sulle coppie di id_richiesta/ business id acquisite
|
||||
if(request != null && request.size() > 0){
|
||||
records = new String[request.size()];
|
||||
for(int i = 0; i < request.size(); i++){
|
||||
richiestaTc.setID_RICHIESTA_DBC((String)request.get(i));
|
||||
richiestaTc.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTc.setTIPO_EVENTO(tipoEvento);
|
||||
records[i] = getXmlFromCastorObject(richiestaTc, false);
|
||||
}
|
||||
} else
|
||||
throw new Exception("NON SONO PRESENTI SUL DB DATI COMPATIBILI CON I PARAMETRI DI INPUT");
|
||||
} else {
|
||||
String businessId = managerDAO.verificaEsistenzaIdRichiestaMsp(processType, idRichiesta);
|
||||
// if(tipoEvento.equals("01")){
|
||||
// do nothing
|
||||
// } else
|
||||
if(tipoEvento.equals("03")) {
|
||||
request = managerDAO.verificaEsistenzaRichiestaTcMsp(processType, idRichiesta, tipoEvento);
|
||||
if(request == null || request.size() == 0)
|
||||
throw new Exception("SUL DB NON E' PRESENTE NESSUNA RICHIESTA DI TC AVENTE ID RICHIESTA = " + idRichiesta);
|
||||
}
|
||||
richiestaTc.setID_RICHIESTA_DBC(idRichiesta);
|
||||
richiestaTc.setIMPORTO_CREDITO_RESIDUO(creditoResiduo);
|
||||
richiestaTc.setTIPO_EVENTO(tipoEvento);
|
||||
records = new String[1];
|
||||
records[0] = getXmlFromCastorObject(richiestaTc, false);
|
||||
}
|
||||
|
||||
testProcessCache.addItem(TestProcessCache.MSP_IN, richiestaTc);
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
private void checkFields(String processType, String tipoEvento, String creditoResiduo) throws Exception {
|
||||
if( !( processType.equals("DON") || processType.equals("REC_VIRT") ) )
|
||||
throw new Exception("PROCESS TYPE ERRATO!");
|
||||
|
||||
if( !( tipoEvento.equals("01") || tipoEvento.equals("03") ) )
|
||||
throw new Exception("TIPO EVENTO ERRATO!");
|
||||
|
||||
String pattern = "[0-9]{1,5}[.][0-9]{2,2}";
|
||||
if(!creditoResiduo.matches(pattern))
|
||||
throw new Exception("VALORE CREDITO RESIDUO NON VALIDO!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLPortingGenerator extends XMLGenerator{
|
||||
|
||||
private String _nomeFile = null;
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
public XMLPortingGenerator(String testId) {
|
||||
super(testId);
|
||||
testProcessCache.clear();
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_PORTING());
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
|
||||
int numFile = Integer.parseInt( (String) params.elementAt(0));
|
||||
int numRic = Integer.parseInt( (String) params.elementAt(1));
|
||||
String recipient = (String) params.elementAt(2);
|
||||
String donating = (String) params.elementAt(3);
|
||||
String dco = (String) params.elementAt(4);
|
||||
String donVirt = (String) params.elementAt(5);
|
||||
String recVirt = (String) params.elementAt(6);
|
||||
String flagTc = (String) params.elementAt(7);
|
||||
String _dco = null;
|
||||
|
||||
int max = (numFile * numRic);
|
||||
|
||||
for (int i = 0; i < numFile; i++) { //conta max file
|
||||
|
||||
Date now = new Date();
|
||||
RichiestaXMLAOM[] _listaMNP = null;
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
if (dco.toUpperCase().equals("DATA_CUT_OVER_OGGI"))
|
||||
_dco = sdf1.format(now);
|
||||
else
|
||||
_dco = DateUtils.aggiungiGiorniLavorativi(sdf1.format(now), -1);
|
||||
|
||||
String _operatoreTerzaParte = "TIMG";
|
||||
String _codiceFile = getCodiceFile();
|
||||
String data_ora = sdf.format(now);
|
||||
|
||||
|
||||
_nomeFile = recipient + data_ora + _operatoreTerzaParte + _codiceFile + ".xml";
|
||||
|
||||
for (int j = 1; j <= numRic; j++) { //conta richieste nel file
|
||||
incrementaIndiceRichieste();
|
||||
RichiestaXMLAOM o = new RichiestaXMLAOM();
|
||||
o.setTipo_messaggio("" + TipoFile.PORTING);
|
||||
o.setCodice_operatore_recipient(recipient);
|
||||
o.setCodice_operatore_donating(donating);
|
||||
o.setCodice_richiesta_recipient(getCodiceRichiestaRecipient());
|
||||
o.setMsisdn(getMSISDN("TIM"));
|
||||
o.setData_cut_over(_dco);
|
||||
o.setCodiceOperatoreVirtualeDonating(donVirt.equals("NULL")?null:donVirt);
|
||||
o.setCodiceOperatoreVirtualeRecipient(recVirt.equals("NULL")?null:recVirt);
|
||||
o.setFlagTc(flagTc);
|
||||
o.setRoutingNumber(getRGN(recipient));
|
||||
o.createContent();
|
||||
listaRecord.addElement(o);
|
||||
testProcessCache.addItem(TestProcessCache.XML,o);
|
||||
}
|
||||
|
||||
_listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" + data_ora.substring(4, 6) +
|
||||
"-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" + data_ora.substring(10, 12) +
|
||||
":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(recipient, _operatoreTerzaParte, _data, _ora,
|
||||
"" + _codiceFile);
|
||||
|
||||
generateXML(TipoFile.PORTING, _nomeFile, _listaMNP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import obj.FieldDbMap;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.Func;
|
||||
import mnp.xml.databinding.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Title: Simulatori sistema MNP
|
||||
* </p>
|
||||
* <p>
|
||||
* Description:
|
||||
* </p>
|
||||
* <p>
|
||||
* Copyright: Copyright (c) 2005
|
||||
* </p>
|
||||
* <p>
|
||||
* Company: TeleAp
|
||||
* </p>
|
||||
*
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLPresaincaricoGenerator extends XMLGenerator {
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
int codiceFile = 55555;
|
||||
|
||||
public XMLPresaincaricoGenerator(String testId) {
|
||||
super(testId);
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_PRESAINCARICO());
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
generateFilesNew(params);
|
||||
}
|
||||
|
||||
public void generateFilesNew(Vector params) throws Exception {
|
||||
// elenco terze parti
|
||||
String[] oloList = managerDAO.getListOLO();
|
||||
int numOLO = oloList.length;
|
||||
int _statoRichNotifica = Integer.parseInt((String) params.elementAt(0));
|
||||
|
||||
for (int i = 0; i < numOLO; i++) {
|
||||
|
||||
List list = managerDAO.getMapPresaInCarico(oloList[i],
|
||||
((String) params.elementAt(1))
|
||||
.equalsIgnoreCase("PROGETTI_HOC"));
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
int len_1 = list.size();
|
||||
int numFile = getNumFileGenerate(len_1);
|
||||
|
||||
int index = 0;
|
||||
for (int k = 0; k < numFile; k++) {
|
||||
Date now = new Date();
|
||||
String data_ora = sdf.format(now);
|
||||
codiceFile += k;
|
||||
String _nomeFile = oloList[i] + data_ora + "TIMG"
|
||||
+ codiceFile + ".xml";
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
for (int j = 0; (j < 30 && index < len_1); j++, index++) {
|
||||
Map richiesta = (Map) list.get(index);
|
||||
RichiestaXMLAOM _val = new RichiestaXMLAOM();
|
||||
_val.setTipo_messaggio(TipoFile.PRESAINCARICO + "");
|
||||
_val
|
||||
.setCodice_operatore_recipient((mnp.xml.dao.aom.types.OLO_TYPE
|
||||
.valueOf((String) richiesta
|
||||
.get(FieldDbMap.CODICE_OPERATORE_RECIPIENT)))
|
||||
.toString());
|
||||
_val
|
||||
.setCodice_operatore_donating((mnp.xml.dao.aom.types.OLO_TYPE
|
||||
.valueOf((String) richiesta
|
||||
.get(FieldDbMap.CODICE_OPERATORE_DONATING)))
|
||||
.toString());
|
||||
_val.setCodice_richiesta_recipient((String) richiesta
|
||||
.get(FieldDbMap.ID_RICHIESTA));
|
||||
_val.setCodice_gruppo((String) richiesta
|
||||
.get(FieldDbMap.CODICE_GRUPPO));
|
||||
_val.setMsisdn((String) richiesta
|
||||
.get(FieldDbMap.MSISDN));
|
||||
_val.setStato_richiesta_notifica(_statoRichNotifica
|
||||
+ "");
|
||||
_val
|
||||
.setCodiceOperatoreVirtualeDonating((String) richiesta
|
||||
.get(FieldDbMap.CODICE_OPERATORE_DON_EFF));
|
||||
_val
|
||||
.setCodiceOperatoreVirtualeRecipient((String) richiesta
|
||||
.get(FieldDbMap.CODICE_OPERATORE_REC_EFF));
|
||||
_val.createContent();
|
||||
listaRecord.addElement(_val);
|
||||
}
|
||||
RichiestaXMLAOM[] _listaMNP = new RichiestaXMLAOM[listaRecord
|
||||
.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord
|
||||
.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-"
|
||||
+ data_ora.substring(4, 6) + "-"
|
||||
+ data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":"
|
||||
+ data_ora.substring(10, 12) + ":"
|
||||
+ data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(oloList[i], "TIMG", _data, _ora, ""
|
||||
+ codiceFile);
|
||||
|
||||
generateXML(TipoFile.PRESAINCARICO, _nomeFile, _listaMNP);
|
||||
}
|
||||
} else {
|
||||
System.out.println("Nessu file di Presaincarico per "
|
||||
+ oloList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import testUtil.TestProcessCache;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLProgettoAdHocGenerator
|
||||
extends XMLGenerator {
|
||||
|
||||
private String _nomeFile = null;
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
public XMLProgettoAdHocGenerator(String testId) {
|
||||
super(testId);
|
||||
testProcessCache.clear();
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_ATTIVAZIONE_HOC());
|
||||
|
||||
}
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
|
||||
int numFile = Integer.parseInt( (String) params.elementAt(0));
|
||||
int numRic = Integer.parseInt( (String) params.elementAt(1));
|
||||
String recipient = (String) params.elementAt(2);
|
||||
String codPrePost = (String) params.elementAt(3);
|
||||
String donating = (String) params.elementAt(4);
|
||||
String codAD = (String) params.elementAt(5);
|
||||
setCodiceGruppi((String) params.elementAt(6));
|
||||
String donVirt = ((String) params.elementAt(7)).equalsIgnoreCase("NULL")?null:(String) params.elementAt(7);
|
||||
String recVirt = ((String) params.elementAt(8)).equalsIgnoreCase("NULL")?null:(String) params.elementAt(8);
|
||||
String flagTc = (String) params.elementAt(9);
|
||||
String flagPrevalidazione = ((String) params.elementAt(10)).equalsIgnoreCase("NULL")?null:(String) params.elementAt(10);
|
||||
String flagFurto = ((String) params.elementAt(11)).equalsIgnoreCase("NULL")?null:(String) params.elementAt(11);
|
||||
|
||||
int max = (numFile * numRic);
|
||||
|
||||
int min_p = index;
|
||||
int max_p = index + max;
|
||||
|
||||
for (int i = 0; i < numFile; i++) { //conta max file
|
||||
|
||||
Date now = new Date();
|
||||
RichiestaXMLAOM[] _listaMNP = null;
|
||||
Vector listaRecord = new Vector();
|
||||
String data_ora = sdf.format(now);
|
||||
ImpostaDate impDate = new ImpostaDate();
|
||||
|
||||
// Processo a 5 giorni
|
||||
String _data_cut_over = impDate.aggiungiGiorni(sdf1.format(now), 5);
|
||||
|
||||
String _operatoreRecipient = getCodiceOperatoreRecipient(recipient);
|
||||
String _operatoreDonating = getCodiceOperatoreDonating(donating);
|
||||
|
||||
String _codiceFile = getCodiceFile();
|
||||
|
||||
_nomeFile = _operatoreRecipient + data_ora + _operatoreDonating +
|
||||
_codiceFile + ".xml";
|
||||
|
||||
for (int j = 1; j <= numRic; j++) { //conta richieste nel file
|
||||
|
||||
incrementaIndiceRichieste();
|
||||
String _codicePrePost = getCodicePrePost(codPrePost, min_p, max_p);
|
||||
String _codAnalogicoDigitale = getCodiceAnalogicoDigitale(codAD, max);
|
||||
RichiestaXMLAOM o = new RichiestaXMLAOM();
|
||||
|
||||
o.setTipo_messaggio("" + TipoFile.ATTIVAZIONE_HOC);
|
||||
o.setCodice_operatore_recipient(_operatoreRecipient);
|
||||
o.setCodice_operatore_donating(_operatoreDonating);
|
||||
o.setCodice_richiesta_recipient(getCodiceRichiestaRecipient());
|
||||
o.setMsisdn(getMSISDN("TIM"));
|
||||
o.setCodice_gruppo(getCodiceGruppo());
|
||||
o.setIccd_serialnumber(getIccdSerialNumber());
|
||||
o.setCodice_fiscale_partita_iva(getCodiceFiscalePartitaIVA());
|
||||
o.setCodice_pre_post_pagato(_codicePrePost);
|
||||
o.setCodice_analogico_digitale(_codAnalogicoDigitale);
|
||||
o.setData_cut_over(_data_cut_over);
|
||||
o.setNome_cliente(randomNomeCliente());
|
||||
o.setCognome_cliente(randomCognomeCliente());
|
||||
o.setTipo_documento(getTipoDocumento());
|
||||
o.setNumero_documento(getNumeroDocumento());
|
||||
o.setImsi(getImsi());
|
||||
o.setCodiceOperatoreVirtualeDonating(donVirt);
|
||||
o.setCodiceOperatoreVirtualeRecipient(recVirt);
|
||||
o.setFlagTc(flagTc);
|
||||
o.setRoutingNumber(getRGN(_operatoreRecipient));
|
||||
o.setPrevalidazione(flagPrevalidazione);
|
||||
o.setFurto(flagFurto);
|
||||
|
||||
o.createContent();
|
||||
listaRecord.addElement(o);
|
||||
|
||||
//test automatici
|
||||
testProcessCache.addItem(TestProcessCache.XML,o);
|
||||
}
|
||||
_listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" + data_ora.substring(4, 6) +
|
||||
"-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" + data_ora.substring(10, 12) +
|
||||
":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(_operatoreRecipient, _operatoreDonating, _data, _ora,
|
||||
"" + _codiceFile);
|
||||
|
||||
generateXML(TipoFile.ATTIVAZIONE_HOC, _nomeFile, _listaMNP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import obj.FieldDbMap;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.DateUtils;
|
||||
import mnp.utility.Func;
|
||||
import mnp.xml.databinding.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLSbloccoCreditoAnomaloGenerator extends XMLGenerator {
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
int codiceFile = 77777;
|
||||
|
||||
public XMLSbloccoCreditoAnomaloGenerator(String testId) {
|
||||
super(testId);
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_TC());
|
||||
}
|
||||
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
// elenco terze parti
|
||||
String codOlo = (String) params.elementAt(0);
|
||||
String credito = ( (String) params.elementAt(1));
|
||||
|
||||
|
||||
List list = managerDAO.getMapSbloccoCreditoAnomalo(codOlo);
|
||||
|
||||
if (list != null && list.size()>0) {
|
||||
int len_1 = list.size();
|
||||
int numFile = getNumFileGenerate(len_1);
|
||||
|
||||
int index = 0;
|
||||
for (int k = 0; k < numFile; k++) {
|
||||
Date now = new Date();
|
||||
String data_ora = sdf.format(now);
|
||||
codiceFile += k;
|
||||
String _nomeFile = codOlo + data_ora + "TIMG" + codiceFile + ".xml";
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
for (int j = 0; (j < 30 && index < len_1); j++, index++) {
|
||||
Map richiesta = (Map)list.get(index);
|
||||
RichiestaXMLAOM _val = new RichiestaXMLAOM();
|
||||
_val.setTipo_messaggio(TipoFile.SBLOCCOCREDITOANOMALO + "");
|
||||
_val.setCodice_operatore_recipient((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_RECIPIENT))).toString());
|
||||
_val.setCodice_operatore_donating((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_DONATING))).toString());
|
||||
_val.setCodice_richiesta_recipient((String)richiesta.get(FieldDbMap.ID_RICHIESTA));
|
||||
_val.setMsisdn((String)richiesta.get(FieldDbMap.MSISDN));
|
||||
_val.setAddizionale_1((String)richiesta.get(FieldDbMap.ADDIZIONALE_1));
|
||||
_val.setAddizionale_2((String)richiesta.get(FieldDbMap.ADDIZIONALE_2));
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String _date_cut_over = df.format((Date)richiesta.get(FieldDbMap.DATA_CUT_OVER_CALC));
|
||||
_val.setData_cut_over(_date_cut_over);
|
||||
String oraCutOver = (String)richiesta.get(FieldDbMap.ORA_CUT_OVER);
|
||||
if(oraCutOver!=null){
|
||||
int ora = Integer.parseInt(oraCutOver.substring(0, 2));
|
||||
int minuti = Integer.parseInt(oraCutOver.substring( 3, 5));
|
||||
int secondi = Integer.parseInt(oraCutOver.substring(6, 8));
|
||||
long time = (ora * 3600000) + (minuti * 60000) + (secondi * 1000);
|
||||
_val.setOra_cut_over(new org.exolab.castor.types.Time(time).toString());
|
||||
}
|
||||
_val.setFlagTc((String)richiesta.get(FieldDbMap.FLAG_TC));
|
||||
_val.setDataNotificaCredito(DateUtils.toString(new Date(), "yyyy-MM-dd"));
|
||||
_val.setOraNotificaCredito(DateUtils.toString(new Date(), "HH:mm:ss"));
|
||||
_val.setImportoCreditoResiduo(credito);
|
||||
_val.setCodiceOperatoreVirtualeDonating((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_DON_EFF));
|
||||
_val.setCodiceOperatoreVirtualeRecipient((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_REC_EFF));
|
||||
_val.createContent();
|
||||
System.out.println(Func.getFieldDescription(_val));
|
||||
listaRecord.addElement(_val);
|
||||
}
|
||||
RichiestaXMLAOM[] _listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" +
|
||||
data_ora.substring(4, 6) + "-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" +
|
||||
data_ora.substring(10, 12) + ":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(codOlo, "TIMG", _data, _ora, "" + codiceFile);
|
||||
|
||||
generateXML(TipoFile.SBLOCCOCREDITOANOMALO, _nomeFile, _listaMNP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Nessu file di SBLOCCOCREDITOANOMALO credito per " + codOlo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package xml;
|
||||
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import obj.FieldDbMap;
|
||||
|
||||
import mnp.objects.*;
|
||||
import mnp.utility.DateUtils;
|
||||
import mnp.utility.Func;
|
||||
import mnp.xml.databinding.*;
|
||||
|
||||
/**
|
||||
* <p>Title: Simulatori sistema MNP</p>
|
||||
* <p>Description: </p>
|
||||
* <p>Copyright: Copyright (c) 2005</p>
|
||||
* <p>Company: TeleAp</p>
|
||||
* @author Ambra Parati
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class XMLSbloccoImportoGenerator extends XMLGenerator {
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
int codiceFile = 77777;
|
||||
|
||||
public XMLSbloccoImportoGenerator(String testId) {
|
||||
super(testId);
|
||||
this.svuotaDirectory(properties.get_PATH_TEST_TC());
|
||||
}
|
||||
|
||||
|
||||
public void generateFiles(Vector params) throws Exception {
|
||||
// elenco terze parti
|
||||
String codOlo = (String) params.elementAt(0);
|
||||
String credito = ( (String) params.elementAt(1));
|
||||
|
||||
|
||||
List list = managerDAO.getMapSbloccoImporto(codOlo);
|
||||
|
||||
if (list != null && list.size()>0) {
|
||||
int len_1 = list.size();
|
||||
int numFile = getNumFileGenerate(len_1);
|
||||
|
||||
int index = 0;
|
||||
for (int k = 0; k < numFile; k++) {
|
||||
Date now = new Date();
|
||||
String data_ora = sdf.format(now);
|
||||
codiceFile += k;
|
||||
String _nomeFile = codOlo + data_ora + "TIMG" + codiceFile + ".xml";
|
||||
Vector listaRecord = new Vector();
|
||||
|
||||
for (int j = 0; (j < 30 && index < len_1); j++, index++) {
|
||||
Map richiesta = (Map)list.get(index);
|
||||
RichiestaXMLAOM _val = new RichiestaXMLAOM();
|
||||
_val.setTipo_messaggio(TipoFile.SBLOCCOIMPORTO + "");
|
||||
_val.setCodice_operatore_recipient((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_RECIPIENT))).toString());
|
||||
_val.setCodice_operatore_donating((mnp.xml.dao.aom.types.OLO_TYPE.fromValue((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_DONATING))).toString());
|
||||
_val.setCodice_richiesta_recipient((String)richiesta.get(FieldDbMap.ID_RICHIESTA));
|
||||
_val.setMsisdn((String)richiesta.get(FieldDbMap.MSISDN));
|
||||
_val.setAddizionale_1((String)richiesta.get(FieldDbMap.ADDIZIONALE_1));
|
||||
_val.setAddizionale_2((String)richiesta.get(FieldDbMap.ADDIZIONALE_2));
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String _date_cut_over = df.format((Date)richiesta.get(FieldDbMap.DATA_CUT_OVER_CALC));
|
||||
_val.setData_cut_over(_date_cut_over);
|
||||
String oraCutOver = (String)richiesta.get(FieldDbMap.ORA_CUT_OVER);
|
||||
if(oraCutOver!=null){
|
||||
int ora = Integer.parseInt(oraCutOver.substring(0, 2));
|
||||
int minuti = Integer.parseInt(oraCutOver.substring( 3, 5));
|
||||
int secondi = Integer.parseInt(oraCutOver.substring(6, 8));
|
||||
long time = (ora * 3600000) + (minuti * 60000) + (secondi * 1000);
|
||||
_val.setOra_cut_over(new org.exolab.castor.types.Time(time).toString());
|
||||
}
|
||||
_val.setFlagTc((String)richiesta.get(FieldDbMap.FLAG_TC));
|
||||
_val.setDataNotificaCredito(DateUtils.toString(new Date(), "yyyy-MM-dd"));
|
||||
_val.setOraNotificaCredito(DateUtils.toString(new Date(), "HH:mm:ss"));
|
||||
_val.setImportoCreditoResiduo(credito);
|
||||
_val.setCodiceOperatoreVirtualeDonating((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_DON_EFF));
|
||||
_val.setCodiceOperatoreVirtualeRecipient((String)richiesta.get(FieldDbMap.CODICE_OPERATORE_REC_EFF));
|
||||
_val.createContent();
|
||||
System.out.println(Func.getFieldDescription(_val));
|
||||
listaRecord.addElement(_val);
|
||||
}
|
||||
RichiestaXMLAOM[] _listaMNP = new RichiestaXMLAOM[listaRecord.size()];
|
||||
_listaMNP = (RichiestaXMLAOM[]) listaRecord.toArray(_listaMNP);
|
||||
|
||||
String _data = data_ora.substring(0, 4) + "-" +
|
||||
data_ora.substring(4, 6) + "-" + data_ora.substring(6, 8);
|
||||
String _ora = data_ora.substring(8, 10) + ":" +
|
||||
data_ora.substring(10, 12) + ":" + data_ora.substring(12, 14);
|
||||
|
||||
generateHeader(codOlo, "TIMG", _data, _ora, "" + codiceFile);
|
||||
|
||||
generateXML(TipoFile.SBLOCCOIMPORTO, _nomeFile, _listaMNP);
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("Nessu file di SBLOCCOIMPORTO credito per " + codOlo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user