Regalamiunsorriso/rus/WEB-INF/lib/abliaDbCom_src/SaveDocumento.java
2026-03-14 20:04:39 +01:00

50 lines
1.6 KiB
Java

import com.ablia.contab.Documento;
import com.ablia.contab.DocumentoCR;
import com.ablia.db.ApplParm;
import com.ablia.db.ApplParmFull;
import com.ablia.util.DbConsole;
import com.ablia.util.Vectumerator;
public class SaveDocumento extends DbConsole {
public static void main(String[] args) {
SaveDocumento bean = new SaveDocumento();
bean.doImport();
System.exit(0);
}
public void doImport() {
String db = "tf19";
int i = 0;
int se1 = 10;
int se2 = 100;
String hostname = "www.tuttofoto.com";
String temp = getCi().readLine("Hostname (" + hostname + "):");
if (!temp.isEmpty())
hostname = temp;
temp = getCi().readLine("Database name (" + db + "):");
if (!temp.isEmpty())
db = temp;
System.out.println("Db: " + db);
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
apTarget.setDebug(false);
StringBuffer msg = new StringBuffer();
try {
DocumentoCR CR = new DocumentoCR();
CR.setId_tipoDocumento(21L);
Vectumerator<Documento> vec = new Documento(apTarget).findByCR(CR, 0, 0);
System.out.println("TOT RECORD: " + vec.getTotNumberOfRecords());
while (vec.hasMoreElements()) {
Documento row = (Documento)vec.nextElement();
row.save();
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println(i);
}
System.out.println("\n\n ------------- Fine ----------------");
} catch (Exception e) {
e.printStackTrace();
}
}
}