First Commit - Source Code from Reply

This commit is contained in:
vincenzofariello
2024-05-13 12:54:14 +02:00
parent 73e32a5020
commit a15aee1f08
11184 changed files with 1065913 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
package it.valueteam.standartdeliverablegenerator;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class VirtOperatorScriptGen {
public static void main(String[] args) throws IOException {
final String PARAGRAFO_1 = "5.3.3";
final String PARAGRAFO_2 = "10.1";
final String INSERT_SLA = "INSERT INTO MNP_IMPORTI_SLA_OPERATORE (ID_OPERATORE, SLA, IMPORTO) VALUES (";
Scanner sc = new Scanner(System.in);
System.out.print("Digitare il path di destinazione degli script: ");
String folder = sc.nextLine().trim();
System.out.println();
System.out.println();
System.out.print(getInputMessage("Codice descrittivo", PARAGRAFO_1));
String idOperatore = sc.nextLine().toUpperCase().trim();
System.out.print(getInputMessage("Descrizione", PARAGRAFO_1));
String descrizione = sc.nextLine().trim();
System.out.print(getInputMessage("Codice amministrativo", PARAGRAFO_1));
String idAmministrativo = sc.nextLine().toUpperCase().trim();
System.out.print(getInputMessage("Codice operatore di rete", PARAGRAFO_1));
String idOLO = sc.nextLine().toUpperCase().trim();
System.out.print(getInputMessage("Codice gestore", PARAGRAFO_2));
String idGestore = sc.nextLine().toUpperCase().trim();
String filename = folder + "/dbcDML_" + idOperatore + ".sql";
File fout = new File(filename);
FileOutputStream fos = new FileOutputStream(fout);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
bw.write("-- INSERIMENTO " + descrizione + " IN ANAGRAFICA SCHEMA MNP COME VIRTUALE");
bw.newLine();
bw.write("INSERT INTO MNP_ANAGRAFICA_OPERATORI (ID_OPERATORE, TIPO_OPERATORE, GESTORE_AOM, ID_AMMINISTRATIVO, INIZIALE_ID_AMM, DESCRIZIONE, ATTIVO) VALUES ");
bw.newLine();
bw.write("\t\t('" + idOperatore + "', 'VIRT', '" + idOLO + "', '" + idAmministrativo + "', '" + idAmministrativo.substring(0, 1) + "', '" + descrizione + "', 'N');");
bw.newLine();
bw.newLine();
bw.newLine();
bw.write("-- L'Operatore deve confermare la Capacita' di Evasione di " + descrizione);
bw.newLine();
bw.write("INSERT INTO MNP_EVASIONE_REC (CAPACITA_MINIMA, CAPACITA_TOTALE, CAPACITA_EVASA_B, CAPACITA_EVASA_C, COD_OLO, ");
bw.newLine();
bw.write("CAPACITA_EVASA, CAPACITA_TOTALE_NUOVA, PERC_BU, DATA_UTILIZZO, DATA_UPDATE, ID_OPERATORE) VALUES ");
bw.newLine();
bw.write("(0, 0, 0, 0, " + idGestore + ", 0, 0, 50, NULL, NULL, '" + idOperatore + "');");
bw.newLine();
bw.newLine();
bw.newLine();
bw.write("-- INSERIMENTO SLA VALORI PER " + descrizione);
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLAX', 10);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLAY', 10);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLAZ', 10);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLA0', 10);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLA1', 30);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLA2', 3);");
bw.newLine();
bw.write(INSERT_SLA + "'" + idOperatore + "', 'SLA3', 1);");
bw.newLine();
bw.close();
filename = folder + "/dbcgoDML_" + idOperatore + ".sql";
fout = new File(filename);
fos = new FileOutputStream(fout);
bw = new BufferedWriter(new OutputStreamWriter(fos));
bw.write("-- INSERIMENTO " + descrizione + " SU DBCGO_ANAGRAFICA_OPERATORI");
bw.newLine();
bw.write("INSERT INTO DBCGO.DBCGO_ANAGRAFICA_OPERATORI (ID_OPERATORE, TIPO_OPERATORE, GESTORE_AOM, INIZIALE_ID_AMM, DESCRIZIONE) VALUES ");
bw.newLine();
bw.write("\t\t('" + idOperatore + "', 'VIRT', '" + idOLO + "', '" + idAmministrativo.substring(0, 1) + "', '" + descrizione + "');");
bw.newLine();
bw.newLine();
bw.newLine();
bw.write("-- INSERIMENTO " + descrizione + " SU DBCGO_LOV");
bw.newLine();
bw.write("INSERT INTO DBCGO.DBCGO_LOV (LOV_ID, LOV_NAME, NAME, DESCR, ORDER_BY) VALUES (SEQ_LOV.nextval, 'AOM_DONOR', '" + idOperatore + "', '" + descrizione + "', null);");
bw.newLine();
bw.write("INSERT INTO DBCGO.DBCGO_LOV (LOV_ID, LOV_NAME, NAME, DESCR, ORDER_BY) VALUES (SEQ_LOV.nextval, 'AOM_RECIPIENT', '" + idOperatore + "', '" + descrizione + "', null);");
bw.newLine();
bw.write("INSERT INTO DBCGO.DBCGO_LOV (LOV_ID, LOV_NAME, NAME, DESCR, ORDER_BY) VALUES (SEQ_LOV.nextval, 'AOM_DONOR_SLA', '" + idOperatore + "', '" + descrizione + "', null);");
bw.newLine();
bw.write("INSERT INTO DBCGO.DBCGO_LOV (LOV_ID, LOV_NAME, NAME, DESCR, ORDER_BY) VALUES (SEQ_LOV.nextval, 'AOM_RECIPIENT_SLA', '" + idOperatore + "', '" + descrizione + "', null);");
bw.newLine();
bw.close();
System.out.print("\n\n\nGenerazione script eseguita con successo!!!");
}
private static String getInputMessage(String descCampo, String paragrafo) {
return "Digitare il campo \""+descCampo+"\" indicato nella tabella del paragrafo " + paragrafo + " del documento: ";
}
}