46 lines
1.7 KiB
Java
46 lines
1.7 KiB
Java
package it.acxent.cc;
|
|
|
|
import it.acxent.art.Articolo;
|
|
import it.acxent.art.ArticoloCR;
|
|
import it.acxent.common.CrontabInterface;
|
|
import it.acxent.db.ApplParm;
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapter;
|
|
import it.acxent.db.ResParm;
|
|
|
|
public class CCCronCreaTrovaprezziXml implements CrontabInterface {
|
|
public ResParm crontabJob(ApplParmFull ap) {
|
|
ResParm rp = new ResParm(true);
|
|
System.out.println("CCCronCreaTrovaprezziXml start...");
|
|
StringBuffer msg = new StringBuffer("\n################# Inizio crontab TROVAPREZZI XML OFFERTE CC (" +
|
|
DBAdapter.getNow().toString() + ")\n#################");
|
|
msg.append("\n\n");
|
|
msg.append(ap.getMsg());
|
|
msg.append("\n\n");
|
|
long t0 = System.currentTimeMillis();
|
|
ArticoloCR CR = new ArticoloCR(ap);
|
|
CR.setFlgTrovaprezzi(1L);
|
|
CR.setFileNameTrovaprezzi("trovaprezzi-f3.xml");
|
|
CR.setFlgEscludiWeb(0L);
|
|
Articolo art = new Articolo(ap);
|
|
if (art.isLocalhost());
|
|
rp = art.creaFileXmlTrovaprezzi(CR);
|
|
msg.append(rp.getMsg());
|
|
msg.append("\n################# Fine crontab TROVAPREZZI XML OFFERTE CC (" +
|
|
DBAdapter.getNow().toString() + ")\n#################");
|
|
long tn = System.currentTimeMillis();
|
|
long duration = (tn - t0) / 60000L;
|
|
msg.append("Durata aggiornamento: " + duration + " minuti.\n");
|
|
rp.setMsg(msg.toString());
|
|
System.out.println(msg.toString());
|
|
return rp;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
String hostname = "localhost";
|
|
String db = "cc";
|
|
ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300));
|
|
CCCronCreaTrovaprezziXml bean = new CCCronCreaTrovaprezziXml();
|
|
bean.crontabJob(apTarget);
|
|
}
|
|
}
|