www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,117 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Abbonamento extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1587713684972L;
private long id_abbonamento;
private long id_attivita;
private String dataInizio;
private String dataFine;
private double costoMensile;
private Attivita attivita;
public Abbonamento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Abbonamento() {}
public void setId_abbonamento(long newId_abbonamento) {
this.id_abbonamento = newId_abbonamento;
}
public void setId_attivita(long newId_attivita) {
this.id_attivita = newId_attivita;
setAttivita(null);
}
public void setDataInizio(String newDataInizio) {
this.dataInizio = newDataInizio;
}
public void setDataFine(String newDataFine) {
this.dataFine = newDataFine;
}
public void setCostoMensile(double newCostoMensile) {
this.costoMensile = newCostoMensile;
}
public long getId_abbonamento() {
return this.id_abbonamento;
}
public long getId_attivita() {
return this.id_attivita;
}
public String getDataInizio() {
return (this.dataInizio == null) ? "" : this.dataInizio.trim();
}
public String getDataFine() {
return (this.dataFine == null) ? "" : this.dataFine.trim();
}
public double getCostoMensile() {
return this.costoMensile;
}
public void setAttivita(Attivita newAttivita) {
this.attivita = newAttivita;
}
public Attivita getAttivita() {
this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class,
getId_attivita());
return this.attivita;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<Abbonamento> findByCR(AbbonamentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ABBONAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,76 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class AbbonamentoCR extends CRAdapter {
private long id_abbonamento;
private long id_attivita;
private String dataInizio;
private String dataFine;
private double costoMensile;
private Attivita attivita;
public AbbonamentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AbbonamentoCR() {}
public void setId_abbonamento(long newId_abbonamento) {
this.id_abbonamento = newId_abbonamento;
}
public void setId_attivita(long newId_attivita) {
this.id_attivita = newId_attivita;
setAttivita(null);
}
public void setDataInizio(String newDataInizio) {
this.dataInizio = newDataInizio;
}
public void setDataFine(String newDataFine) {
this.dataFine = newDataFine;
}
public void setCostoMensile(double newCostoMensile) {
this.costoMensile = newCostoMensile;
}
public long getId_abbonamento() {
return this.id_abbonamento;
}
public long getId_attivita() {
return this.id_attivita;
}
public String getDataInizio() {
return (this.dataInizio == null) ? "" : this.dataInizio.trim();
}
public String getDataFine() {
return (this.dataFine == null) ? "" : this.dataFine.trim();
}
public double getCostoMensile() {
return this.costoMensile;
}
public void setAttivita(Attivita newAttivita) {
this.attivita = newAttivita;
}
public Attivita getAttivita() {
this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class,
getId_attivita());
return this.attivita;
}
}

View file

@ -0,0 +1,281 @@
package it.acxent.cc;
import it.acxent.anag.ListinoArticolo;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.art.Marca;
import it.acxent.art.Vetrina;
import it.acxent.common.StatusMsg;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.Timer;
import it.acxent.util.Vectumerator;
import java.sql.Date;
import java.util.Calendar;
import java.util.HashMap;
public class ArticoloAutoOfferte {
private static boolean threadAutoOfferte = false;
private long nArticoliAO = 30L;
private long nGiorniAO = 3L;
private long id_vetrinaAO;
private double prezzoDaAO;
private long giacenzaMinimaAO = 10L;
private double percScontoOffertaAO;
private ApplParmFull apFull;
class ThreadAutoOfferte extends Thread {
private ApplParmFull apFull;
private boolean sendEmail;
private final String TAG_THREAD_MSG = "AUTO OFFERTE ";
public ThreadAutoOfferte(ApplParmFull apFull, boolean sendEmail) {
this.apFull = apFull;
this.sendEmail = sendEmail;
if (!ArticoloAutoOfferte.isThreadAttivo()) {
ArticoloAutoOfferte.threadAutoOfferte = true;
start();
}
}
public void run() {
boolean debug = false;
Timer timer = new Timer();
timer.start();
StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", "...inizio ...");
ResParm rp = new ResParm(true);
int i = 1;
int se1 = 10;
int se2 = 100;
ArticoloCR CR = new ArticoloCR();
Articolo bean = new Articolo(this.apFull);
Vetrina vetrina = new Vetrina(this.apFull);
vetrina.findByPrimaryKey(ArticoloAutoOfferte.this.getId_vetrinaAO());
if (vetrina.getId_vetrina() == 0L) {
rp.setMsg("ERRORE! vetrina non definito..");
rp.setStatus(false);
} else {
if (ArticoloAutoOfferte.this.getPercScontoOffertaAO() > 0.0D) {
String sqlUpdate = "update ARTICOLO as A set id_vetrina=null";
String today = DBAdapter.getToday().toString();
WcString updateCR = new WcString();
updateCR.addWc("id_vetrina=" + ArticoloAutoOfferte.this.getId_vetrinaAO());
updateCR.addWc("(A.dataScadenzaOfferta<'" + today + "' or A.dataScadenzaOffertaFornitore<'" + today + "' OR (A.dataScadenzaOfferta is null and A.dataScadenzaOffertaFornitore is null) )");
bean.update(sqlUpdate + sqlUpdate);
CR.setFlgOfferta(4L);
CR.setFlgEscludiWeb(0L);
if (!debug)
CR.setFlgReadyForWeb(1L);
CR.setFlgOrderBy(99L);
CR.setPrezzoDa(ArticoloAutoOfferte.this.getPrezzoDaAO());
if (ArticoloAutoOfferte.this.getGiacenzaMinimaAO() > 0L) {
CR.setQtaDa(ArticoloAutoOfferte.this.getGiacenzaMinimaAO());
CR.setQtaA(999999L);
CR.setFlgQta(1L);
}
Calendar cal = Calendar.getInstance();
cal.add(6, (int)ArticoloAutoOfferte.this.getNGiorniAO());
Date dataScadenzaOfferta = new Date(cal.getTimeInMillis());
Vectumerator<Articolo> vectumerator = bean.findByCR(CR, 1, (int)ArticoloAutoOfferte.this.getNArticoliAO());
System.out.println("Tot Record: " + vectumerator.getTotNumberOfRecords());
while (vectumerator.hasMoreElements()) {
Articolo row = (Articolo)vectumerator.nextElement();
String temp = "Aggiornamento " + i + " su " + vectumerator.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome();
StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", temp);
DBAdapter.printDebug(debug, "AUTO OFFERTE " + temp);
row.setPrezzoIvatoBarrato(row.getStreetPriceIva());
row.setId_vetrina(ArticoloAutoOfferte.this.getId_vetrinaAO());
if (debug)
System.out.println("AUTO OFFERTE ora salvo...");
row.save();
if (debug)
System.out.println("AUTO OFFERTE salvataggio ok");
if (DBAdapter.getDateDiff(DBAdapter.getToday(), dataScadenzaOfferta) < 0L) {
if (debug)
System.out.println("AUTO OFFERTE cancello offerta....");
ListinoArticolo la = row.getListinoArticoloBase();
la.setDataScadenzaOffertaLA(null);
la.setPercScontoOffertaLA(0.0D);
la.setPrezzoOffertaLA(0.0D);
la.save();
}
if (dataScadenzaOfferta != null && DBAdapter.getDateDiff(DBAdapter.getToday(), dataScadenzaOfferta) >= 0L &&
ArticoloAutoOfferte.this.getPercScontoOffertaAO() > 0.0D) {
if (debug)
System.out.println("AUTO OFFERTE inserisco offerta....");
ListinoArticolo la = row.getListinoArticoloBase();
la.setDataScadenzaOffertaLA(dataScadenzaOfferta);
la.setPercScontoOffertaLA(ArticoloAutoOfferte.this.getPercScontoOffertaAO());
la.save();
}
if (bean.isLocalhost())
System.out.println("Auto Offerta:.... localhost");
if (debug)
System.out.println("AUTO OFFERTE FINE CICLO.... RIPARTO... " + i + "\n");
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println("" + i + " / " + i);
}
}
String tagVetrina = vetrina.getDescrizione().toLowerCase();
bean.update("update ARTICOLO as A set tagArticolo = replace(A.tagArticolo,'" + tagVetrina + ",','') ");
Marca marca = new Marca(this.apFull);
Vectumerator<Marca> vecMarca = marca.findMarcheConTagOfferta();
HashMap<Long, String> hmMarcaTag = new HashMap<>();
while (vecMarca.hasMoreElements()) {
Marca row = (Marca)vecMarca.nextElement();
bean.update("update ARTICOLO as A set tagArticolo = replace(A.tagArticolo,'" + row.getTagOfferta() + ",','') ");
hmMarcaTag.put(Long.valueOf(row.getId_marca()), row.getTagOfferta());
}
CR = new ArticoloCR();
CR.setFlgOfferta(1L);
CR.setFlgEscludiWeb(0L);
if (!debug)
CR.setFlgReadyForWeb(1L);
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
if (debug)
System.out.println("AUTO OFFERTE CICLO TAG ...tot record " + vec.getTotNumberOfRecords() + "\n");
i = 0;
while (vec.hasMoreElements()) {
boolean isTagAggiornato = false;
Articolo row = (Articolo)vec.nextElement();
String temp = "Aggiornamento tag " + i + " su " + vec.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome();
StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", temp);
String l_tag = row.getTagArticolo();
if (l_tag.indexOf(tagVetrina) < 0) {
if (!l_tag.endsWith(","))
l_tag = l_tag + ",";
l_tag = l_tag + l_tag + ",";
row.setTagArticolo(l_tag);
isTagAggiornato = true;
}
if (hmMarcaTag.containsKey(Long.valueOf(row.getId_marca()))) {
l_tag = row.getTagArticolo();
String tagMarca = hmMarcaTag.get(Long.valueOf(row.getId_marca()));
if (l_tag.indexOf(tagMarca) < 0) {
if (!l_tag.endsWith(","))
l_tag = l_tag + ",";
l_tag = l_tag + l_tag + ",";
row.setTagArticolo(l_tag);
isTagAggiornato = true;
}
}
if (isTagAggiornato)
row.superSave();
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println("" + i + " / " + i);
}
if (debug)
System.out.println("AUTO OFFERTE FINE CICLO TAG " + i + "\n");
}
timer.stop();
rp.setMsg("AUTO OFFERTE concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg());
if (this.sendEmail);
StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", rp.getMsg());
try {
sleep(10000L);
} catch (Exception e) {}
StatusMsg.deleteMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ");
ArticoloAutoOfferte.threadAutoOfferte = false;
System.out.println(rp.getMsg());
}
public boolean isSendEmail() {
return this.sendEmail;
}
public void setSendEmail(boolean sendEmail) {
this.sendEmail = sendEmail;
}
}
public ArticoloAutoOfferte(ApplParmFull apFull) {
this.apFull = apFull;
}
public ArticoloAutoOfferte() {}
public static boolean isThreadAttivo() {
return threadAutoOfferte;
}
public long getNArticoliAO() {
return this.nArticoliAO;
}
public void setNArticoliAO(long nArticoliAO) {
this.nArticoliAO = nArticoliAO;
}
public long getNGiorniAO() {
return this.nGiorniAO;
}
public void setNGiorniAO(long nGiorniAO) {
this.nGiorniAO = nGiorniAO;
}
public long getId_vetrinaAO() {
return this.id_vetrinaAO;
}
public void setId_vetrinaAO(long id_vetrinaAO) {
this.id_vetrinaAO = id_vetrinaAO;
}
public double getPrezzoDaAO() {
return this.prezzoDaAO;
}
public void setPrezzoDaAO(double prezzoDaAO) {
this.prezzoDaAO = prezzoDaAO;
}
public long getGiacenzaMinimaAO() {
return this.giacenzaMinimaAO;
}
public void setGiacenzaMinimaAO(long giacenzaMinimaAO) {
this.giacenzaMinimaAO = giacenzaMinimaAO;
}
public double getPercScontoOffertaAO() {
return this.percScontoOffertaAO;
}
public void setPercScontoOffertaAO(double percScontoOffertaAO) {
this.percScontoOffertaAO = percScontoOffertaAO;
}
public ApplParmFull getApFull() {
return this.apFull;
}
public void setApFull(ApplParmFull apFull) {
this.apFull = apFull;
}
public final ResParm starAutoOfferte(ApplParmFull apFull, boolean sendEmail) {
if (!isThreadAttivo()) {
new ThreadAutoOfferte(apFull, sendEmail);
return new ResParm(true, "Thread AUTO OFFERTE avviato");
}
return new ResParm(false, "ATTENZIONE!! Thread AUTO OFFERTE in esecuzione!!!");
}
}

View file

@ -0,0 +1,651 @@
package it.acxent.cc;
import it.acxent.anag.ListinoArticolo;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.art.Tipo;
import it.acxent.common.StatusMsg;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.ScaleImage;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Timer;
import it.acxent.util.Vectumerator;
import java.io.File;
import java.sql.Date;
public class ArticoloBulkUpdate {
public final long FLG_TAG_SOSTITUISCI = 0L;
public final long FLG_TAG_AGGIUNGI = 1L;
public final long FLG_TAG_RIMUOVI = 2L;
private final String TAG_THREAD_MSG = "BULK UPDATE ";
private ApplParmFull apFull;
private long id_tipoBA;
private double ricaricoBA;
private long qtaMaxAcquistoWwwBA;
private long id_listinoEbayBA;
private long qtaEbayBA;
private long flgEbayBA;
private long id_listinoAmazonBA;
private long qtaAmazonBA;
private long flgAmazonBA;
private long flgGoogleBA = -1L;
private String icecatLang;
private long flgEscludiWebArtBA;
private String previewSizes = "66,350";
private long flgPreventivoWwwArtBA = -1L;
private long percCostoSpedizioneBA = -1L;
private long percScontoOffertaBA = -1L;
private Date dataScadenzaOffertaBA;
private long flgCaricaAmazon;
private String tagBA;
private long flgRicaricaImmagini;
private long id_vetrinaBA;
private long flgTagActBA;
private String previewSizes1 = "50,150,200";
private long id_statoUsatoBA;
private long flgTrovaprezziBA;
private long flgIdealoBA;
private Tipo tipoBA;
private double prezzoPubblicoDaBA;
private double ricaricoOltreBA;
private long flgCaricaEbay;
private static boolean threadBulkUpdate = false;
public static final String getGoogleBA(long l_flgGoogleBA) {
return Articolo.getGoogle(l_flgGoogleBA);
}
public final String getGoogleBA() {
return Articolo.getGoogle(getFlgGoogleBA());
}
class ThreadBulkUpdate extends Thread {
private ApplParmFull apFull;
private boolean sendEmail;
private ArticoloCR CR;
private WwwAutomator wwwAutomator;
public ThreadBulkUpdate(ApplParmFull apFull, ArticoloCR CR, boolean sendEmail) {
this.apFull = apFull;
this.sendEmail = sendEmail;
this.CR = CR;
this.wwwAutomator = null;
if (!ArticoloBulkUpdate.isThreadAttivo()) {
ArticoloBulkUpdate.threadBulkUpdate = true;
start();
}
}
public ThreadBulkUpdate(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) {
this.apFull = apFull;
this.sendEmail = false;
this.CR = CR;
this.wwwAutomator = wwwAutomator;
if (!ArticoloBulkUpdate.isThreadAttivo()) {
ArticoloBulkUpdate.threadBulkUpdate = true;
start();
}
}
public void run() {
boolean debug = true;
Timer timer = new Timer();
timer.start();
StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", "...inizio ...");
ResParm rp = new ResParm(true);
StringBuffer err = new StringBuffer();
StringBuilder sb = new StringBuilder();
int i = 0;
int se1 = 10;
int se2 = 100;
boolean sovrascriviImmagini = (ArticoloBulkUpdate.this.getFlgRicaricaImmagini() == 1L);
Articolo bean = new Articolo(this.apFull);
sb.append("<style>\ntable, th, td {\n border: 1px solid black;\n border-collapse: collapse;\n padding: 2px;\n}\n</style>");
sb.append("<table>");
sb.append("<tr>");
StringTokenizer st = new StringTokenizer(bean.getDescrizionePerMail(true), "|");
while (st.hasMoreTokens()) {
sb.append("<th>");
String token = st.nextToken();
sb.append(token);
sb.append("</th>");
}
sb.append("</tr>");
Vectumerator<Articolo> vec = bean.findByCR(this.CR, 0, 0);
DBAdapter.printDebug(debug, "Tot Record: " + vec.getTotNumberOfRecords());
while (vec.hasMoreElements()) {
Articolo row = (Articolo)vec.nextElement();
String temp = "Aggiornamento " + i + " su " + vec.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome();
StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", temp);
DBAdapter.printDebug(debug, "BULK UPDATE " + temp);
if (ArticoloBulkUpdate.this.getId_tipoBA() > 0L) {
row.setId_tipo(ArticoloBulkUpdate.this.getId_tipoBA());
row.superSave();
DBAdapter.printDebug(debug, "BULK UPDATE tipo save ok");
}
if (row.getMarca().getFlgIcecatAuto() == 1L &&
!ArticoloBulkUpdate.this.getIcecatLang().isEmpty()) {
boolean caricaImmagini = sovrascriviImmagini;
st = new StringTokenizer(ArticoloBulkUpdate.this.getIcecatLang(), ",");
while (st.hasMoreTokens()) {
String lang = st.nextToken();
StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", temp + " chiamata icecat " + temp + " .....");
DBAdapter.printDebug(debug, "BULK UPDATE chiamo icecat " + lang + "...");
row.caricaIcecat(lang, caricaImmagini, 1);
caricaImmagini = false;
DBAdapter.printDebug(debug, "BULK UPDATE chiamo icecat " + lang + " ok");
}
}
if (ArticoloBulkUpdate.this.getRicaricoBA() > 0.0D) {
if (ArticoloBulkUpdate.this.getPrezzoPubblicoDaBA() == 0.0D) {
row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA());
} else if (row.getPrezzoPubblico() < ArticoloBulkUpdate.this.getPrezzoPubblicoDaBA()) {
row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA());
} else if (ArticoloBulkUpdate.this.getRicaricoOltreBA() <= 0.0D) {
row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA());
} else {
row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoOltreBA());
}
row.setCostoNuovo(row.getCostoNetto());
DBAdapter.printDebug(debug, "BULK UPDATE ricarico ok");
}
row.setPrezzoIvatoBarrato(row.getStreetPriceIva());
if (ArticoloBulkUpdate.this.getFlgEbayBA() >= 0L)
row.setFlgEbay(ArticoloBulkUpdate.this.getFlgEbayBA());
if (ArticoloBulkUpdate.this.getId_listinoEbayBA() > 0L)
row.setId_listinoEbay(ArticoloBulkUpdate.this.getId_listinoEbayBA());
if (ArticoloBulkUpdate.this.getQtaEbayBA() >= 0L)
row.setQtaEbay(ArticoloBulkUpdate.this.getQtaEbayBA());
if (ArticoloBulkUpdate.this.getFlgAmazonBA() >= 0L)
row.setFlgAmazon(ArticoloBulkUpdate.this.getFlgAmazonBA());
if (ArticoloBulkUpdate.this.getId_listinoAmazonBA() > 0L)
row.setId_listinoAmazon(ArticoloBulkUpdate.this.getId_listinoAmazonBA());
if (ArticoloBulkUpdate.this.getQtaAmazonBA() >= 0L)
row.setQtaAmz(ArticoloBulkUpdate.this.getQtaAmazonBA());
if (ArticoloBulkUpdate.this.getQtaMaxAcquistoWwwBA() >= 0L)
row.setQtaMaxAcquistoWww(ArticoloBulkUpdate.this.getQtaMaxAcquistoWwwBA());
if (ArticoloBulkUpdate.this.getFlgGoogleBA() >= 0L)
row.setFlgGoogle(ArticoloBulkUpdate.this.getFlgGoogleBA());
if (ArticoloBulkUpdate.this.getFlgTrovaprezziBA() >= 0L)
row.setFlgTrovaprezzi(ArticoloBulkUpdate.this.getFlgTrovaprezziBA());
if (ArticoloBulkUpdate.this.getFlgIdealoBA() >= 0L)
row.setFlgIdealo(ArticoloBulkUpdate.this.getFlgIdealoBA());
if (ArticoloBulkUpdate.this.getFlgEscludiWebArtBA() >= -1L)
row.setFlgEscludiWebArt(ArticoloBulkUpdate.this.getFlgEscludiWebArtBA());
if (ArticoloBulkUpdate.this.getFlgPreventivoWwwArtBA() >= 0L)
row.setFlgPreventivoWwwArt(ArticoloBulkUpdate.this.getFlgPreventivoWwwArtBA());
if (ArticoloBulkUpdate.this.getPercCostoSpedizioneBA() >= 0L)
row.setPercCostoSpedizione(ArticoloBulkUpdate.this.getPercCostoSpedizioneBA());
if (ArticoloBulkUpdate.this.getId_vetrinaBA() == -1L) {
row.setId_vetrina(0L);
} else if (ArticoloBulkUpdate.this.getId_vetrinaBA() > 0L) {
row.setId_vetrina(ArticoloBulkUpdate.this.getId_vetrinaBA());
}
if (ArticoloBulkUpdate.this.getId_statoUsatoBA() == -1L) {
row.setId_statoUsato(0L);
} else if (ArticoloBulkUpdate.this.getId_statoUsatoBA() > 0L) {
row.setId_statoUsato(ArticoloBulkUpdate.this.getId_statoUsatoBA());
if (ArticoloBulkUpdate.this.getId_statoUsatoBA() == 1L) {
row.setFlgUsato(0L);
} else {
row.setFlgUsato(2L);
}
}
DBAdapter.printDebug(debug, "BULK UPDATE inizio tag..");
if (ArticoloBulkUpdate.this.getFlgTagActBA() == 2L) {
row.setTagArticolo("");
} else if (!ArticoloBulkUpdate.this.getTagBA().isEmpty()) {
if (ArticoloBulkUpdate.this.getFlgTagActBA() == 0L) {
l_tag = "";
} else {
l_tag = row.getTagArticolo();
}
if (!l_tag.endsWith(","))
l_tag = l_tag + ",";
String l_tag = l_tag + l_tag + ",";
row.setTagArticolo(l_tag);
}
DBAdapter.printDebug(debug, "BULK UPDATE tag finito... ora salvo...");
row.save();
DBAdapter.printDebug(debug, "BULK UPDATE salvataggio ok");
if (ArticoloBulkUpdate.this.getRicaricoBA() > 0.0D) {
DBAdapter.printDebug(debug, "BULK UPDATE aggiornamento prezzo con costo nuovo....");
row.aggiornaPrezzoNettoConCostoNuovo();
DBAdapter.printDebug(debug, "BULK UPDATE aggiornamento prezzo con costo nuovo OK");
}
if (DBAdapter.getDateDiff(DBAdapter.getToday(), ArticoloBulkUpdate.this.getDataScadenzaOffertaBA()) < 0L) {
DBAdapter.printDebug(debug, "BULK UPDATE cancello offerta....");
ListinoArticolo la = row.getListinoArticoloBase();
la.setDataScadenzaOffertaLA(null);
la.setPercScontoOffertaLA(0.0D);
la.setPrezzoOffertaLA(0.0D);
la.save();
}
if (ArticoloBulkUpdate.this.getDataScadenzaOffertaBA() != null && DBAdapter.getDateDiff(DBAdapter.getToday(), ArticoloBulkUpdate.this.getDataScadenzaOffertaBA()) >= 0L &&
ArticoloBulkUpdate.this.getPercScontoOffertaBA() > 0L) {
DBAdapter.printDebug(debug, "BULK UPDATE inserisco offerta....");
ListinoArticolo la = row.getListinoArticoloBase();
la.setDataScadenzaOffertaLA(ArticoloBulkUpdate.this.getDataScadenzaOffertaBA());
la.setPercScontoOffertaLA((double)ArticoloBulkUpdate.this.getPercScontoOffertaBA());
la.save();
}
if (!bean.isLocalhost()) {
if (ArticoloBulkUpdate.this.getFlgCaricaEbay() == 1L && row.getFlgEbay() == 1L) {
DBAdapter.printDebug(debug, "BULK UPDATE ebay publish full....");
row.ebayPublishFull();
}
if (ArticoloBulkUpdate.this.getFlgCaricaEbay() == 9L && row.getFlgEbay() == 1L && row.isEbayPubblicato()) {
DBAdapter.printDebug(debug, "BULK UPDATE ebay delete inventory item....");
rp = row.ebayDeleteInventoryItem();
}
if (ArticoloBulkUpdate.this.getFlgCaricaAmazon() == 1L && row.getFlgAmazon() == 1L) {
DBAdapter.printDebug(debug, "BULK UPDATE amazon publish full.... ");
bean.setFlgPriceTypeAmz(1L);
rp = bean.amzUpdateOfferAuto();
}
if (ArticoloBulkUpdate.this.getFlgCaricaAmazon() == 9L && row.getFlgAmazon() == 1L) {
DBAdapter.printDebug(debug, "BULK UPDATE amazon delete inventory item....");
rp = row.amzDeleteItem();
}
} else {
DBAdapter.printDebug(true, "Bulk Update: ebay non aggiornabile se localhost");
}
if (!ArticoloBulkUpdate.this.getPreviewSizes().isEmpty()) {
DBAdapter.printDebug(debug, "BULK UPDATE creo preview....");
row.creaPreviewH(ArticoloBulkUpdate.this.getPreviewSizes(), 8, "BULK UPDATE ", temp);
}
if (!ArticoloBulkUpdate.this.getPreviewSizes1().isEmpty()) {
DBAdapter.printDebug(debug, "BULK UPDATE creo preview 1....");
row.creaPreviewH(ArticoloBulkUpdate.this.getPreviewSizes1(), 1, "BULK UPDATE ", temp);
}
sb.append("<tr>");
st = new StringTokenizer(row.getDescrizionePerMail(false), "|");
while (st.hasMoreTokens()) {
sb.append("<td>");
String token = st.nextToken();
sb.append(token);
sb.append("</td>");
}
sb.append("</tr>");
DBAdapter.printDebug(debug, "BULK UPDATE FINE CICLO.... RIPARTO... " + i + "\n");
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println("" + i + " / " + i);
}
sb.append("</table>");
timer.stop();
rp.setMsg("BULK UPDATE concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg());
if (this.wwwAutomator != null) {
if (i == 0) {
this.wwwAutomator.setUltimaEsecuzione(DBAdapter.getTimestamp().toString() + "<br/>BULK UPDATE concluso. DURATA: " + DBAdapter.getTimestamp().toString() + "<br/>record processati: " +
timer.getDurataHourMin() + "<br/>" + i);
} else {
this.wwwAutomator.setUltimaEsecuzione(DBAdapter.getTimestamp().toString() + "<br/>BULK UPDATE concluso. DURATA: " + DBAdapter.getTimestamp().toString() + "<br/><b style='color:darkred'>record processati: " +
timer.getDurataHourMin() + "</b><br/>" + i);
}
this.wwwAutomator.save();
}
if (this.sendEmail);
StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", rp.getMsg());
try {
if (this.wwwAutomator != null) {
sleep(1000L);
} else {
sleep(10000L);
}
} catch (Exception e) {}
StatusMsg.deleteMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ");
ArticoloBulkUpdate.threadBulkUpdate = false;
DBAdapter.printDebug(debug, rp.getMsg());
}
}
public ArticoloBulkUpdate(ApplParmFull apFull) {
this.apFull = apFull;
}
public ArticoloBulkUpdate() {}
public ApplParmFull getApFull() {
return this.apFull;
}
public void setApFull(ApplParmFull apFull) {
this.apFull = apFull;
}
public long getId_tipoBA() {
return this.id_tipoBA;
}
public void setId_tipoBA(long id_tipoBA) {
this.id_tipoBA = id_tipoBA;
}
public double getRicaricoBA() {
return this.ricaricoBA;
}
public void setRicaricoBA(double ricaricoBA) {
this.ricaricoBA = ricaricoBA;
}
public long getId_listinoEbayBA() {
return this.id_listinoEbayBA;
}
public void setId_listinoEbayBA(long id_listinoEbayBA) {
this.id_listinoEbayBA = id_listinoEbayBA;
}
public long getQtaMaxAcquistoWwwBA() {
return this.qtaMaxAcquistoWwwBA;
}
public void setQtaMaxAcquistoWwwBA(long qtaMaxAcquistoWwwBA) {
this.qtaMaxAcquistoWwwBA = qtaMaxAcquistoWwwBA;
}
public long getQtaEbayBA() {
return this.qtaEbayBA;
}
public void setQtaEbayBA(long qtaEbayBA) {
this.qtaEbayBA = qtaEbayBA;
}
public long getFlgEbayBA() {
return this.flgEbayBA;
}
public void setFlgEbayBA(long flgEbayBA) {
this.flgEbayBA = flgEbayBA;
}
public long getFlgGoogleBA() {
return this.flgGoogleBA;
}
public void setFlgGoogleBA(long flgGoogleBA) {
this.flgGoogleBA = flgGoogleBA;
}
public String getIcecatLang() {
return (this.icecatLang == null) ? "" : this.icecatLang.trim();
}
public void setIcecatLang(String icecatLang) {
this.icecatLang = icecatLang;
}
public long getFlgEscludiWebArtBA() {
return this.flgEscludiWebArtBA;
}
public void setFlgEscludiWebArtBA(long flgEscludiWebArtBA) {
this.flgEscludiWebArtBA = flgEscludiWebArtBA;
}
public final ResParm starBulkUpdate(ApplParmFull apFull, ArticoloCR CR, boolean sendEmail) {
boolean test = false;
if (!isThreadAttivo()) {
new ThreadBulkUpdate(apFull, CR, sendEmail);
return new ResParm(true, "Thread BULK UPDATE avviato");
}
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
}
public final ResParm starBulkUpdate(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) {
boolean test = false;
if (!isThreadAttivo()) {
new ThreadBulkUpdate(apFull, CR, wwwAutomator);
return new ResParm(true, "Thread BULK UPDATE AUTOMATOR avviato");
}
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
}
public final ResParm starBulkUpdateAutomator(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) {
boolean test = false;
if (!isThreadAttivo()) {
new ThreadBulkUpdate(apFull, CR, false);
return new ResParm(true, "Thread BULK UPDATE avviato");
}
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
}
public static boolean isThreadAttivo() {
return threadBulkUpdate;
}
public long getFlgCaricaEbay() {
return this.flgCaricaEbay;
}
public void setFlgCaricaEbay(long flgCaricaEbay) {
this.flgCaricaEbay = flgCaricaEbay;
}
public String getPreviewSizes() {
return (this.previewSizes == null) ? "" : this.previewSizes.trim();
}
public void setPreviewSizes(String previewSizes) {
this.previewSizes = previewSizes;
}
public String getPreviewSizes1() {
return (this.previewSizes1 == null) ? "" : this.previewSizes1.trim();
}
public void setPreviewSizes1(String previewSizes1) {
this.previewSizes1 = previewSizes1;
}
protected void creaPreviewXX(Articolo row, String sizes, int fotoFinale, String statusMsg) {
if (!sizes.isEmpty()) {
String targetDir = row.getDocBase() + row.getDocBase();
StringTokenizer st = new StringTokenizer(sizes, ",");
while (st.hasMoreTokens()) {
int size = Integer.parseInt(st.nextToken());
for (int j = 1; j <= fotoFinale; j++) {
String currentImageName = targetDir + targetDir;
if (new File(currentImageName).exists()) {
StatusMsg.updateMsgByTag(getApFull(), "BULK UPDATE ", statusMsg + " crea preview foto " + statusMsg + " size " + j + " .....");
ScaleImage si = new ScaleImage(currentImageName, "" + size + "/" + size + "+", 0L, size, 0, false, false);
si.scaleIt();
}
}
}
}
}
public long getFlgRicaricaImmagini() {
return this.flgRicaricaImmagini;
}
public void setFlgRicaricaImmagini(long flgRicaricaImmagini) {
this.flgRicaricaImmagini = flgRicaricaImmagini;
}
public long getFlgPreventivoWwwArtBA() {
return this.flgPreventivoWwwArtBA;
}
public void setFlgPreventivoWwwArtBA(long flgPreventivoWwwArtBA) {
this.flgPreventivoWwwArtBA = flgPreventivoWwwArtBA;
}
public long getPercCostoSpedizioneBA() {
return this.percCostoSpedizioneBA;
}
public void setPercCostoSpedizioneBA(long percCostoSpedizioneBA) {
this.percCostoSpedizioneBA = percCostoSpedizioneBA;
}
public long getPercScontoOffertaBA() {
return this.percScontoOffertaBA;
}
public void setPercScontoOffertaBA(long percScontoOffertaBA) {
this.percScontoOffertaBA = percScontoOffertaBA;
}
public Date getDataScadenzaOffertaBA() {
return this.dataScadenzaOffertaBA;
}
public void setDataScadenzaOffertaBA(Date dataScadenzaOffertaBA) {
this.dataScadenzaOffertaBA = dataScadenzaOffertaBA;
}
public long getId_vetrinaBA() {
return this.id_vetrinaBA;
}
public void setId_vetrinaBA(long id_vetrinaBA) {
this.id_vetrinaBA = id_vetrinaBA;
}
public String getTagBA() {
return (this.tagBA == null) ? "" : this.tagBA.trim();
}
public void setTagBA(String tagBA) {
this.tagBA = tagBA;
}
public long getFlgTagActBA() {
return this.flgTagActBA;
}
public void setFlgTagActBA(long flgTagModBA) {
this.flgTagActBA = flgTagModBA;
}
public long getId_statoUsatoBA() {
return this.id_statoUsatoBA;
}
public void setId_statoUsatoBA(long id_statoUsato) {
this.id_statoUsatoBA = id_statoUsato;
}
public long getFlgTrovaprezziBA() {
return this.flgTrovaprezziBA;
}
public void setFlgTrovaprezziBA(long flgTrovaprezziBA) {
this.flgTrovaprezziBA = flgTrovaprezziBA;
}
public long getFlgIdealoBA() {
return this.flgIdealoBA;
}
public void setFlgIdealoBA(long flgIdealoBA) {
this.flgIdealoBA = flgIdealoBA;
}
public Tipo getTipoBA() {
if (this.tipoBA == null) {
this.tipoBA = new Tipo(getApFull());
this.tipoBA.findByPrimaryKey(getId_tipoBA());
}
return (this.tipoBA == null) ? new Tipo() : this.tipoBA;
}
public void setTipoBA(Tipo tipoBA) {
this.tipoBA = tipoBA;
}
public double getPrezzoPubblicoDaBA() {
return this.prezzoPubblicoDaBA;
}
public void setPrezzoPubblicoDaBA(double prezzoPubblicoDa) {
this.prezzoPubblicoDaBA = prezzoPubblicoDa;
}
public double getRicaricoOltreBA() {
return this.ricaricoOltreBA;
}
public void setRicaricoOltreBA(double ricaricoOltre) {
this.ricaricoOltreBA = ricaricoOltre;
}
public long getId_listinoAmazonBA() {
return this.id_listinoAmazonBA;
}
public void setId_listinoAmazonBA(long id_listinoAmazonBA) {
this.id_listinoAmazonBA = id_listinoAmazonBA;
}
public long getQtaAmazonBA() {
return this.qtaAmazonBA;
}
public void setQtaAmazonBA(long qtaAmzBA) {
this.qtaAmazonBA = qtaAmzBA;
}
public long getFlgAmazonBA() {
return this.flgAmazonBA;
}
public void setFlgAmazonBA(long flgAmzBA) {
this.flgAmazonBA = flgAmzBA;
}
public long getFlgCaricaAmazon() {
return this.flgCaricaAmazon;
}
public void setFlgCaricaAmazon(long flgCaricaAmazon) {
this.flgCaricaAmazon = flgCaricaAmazon;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,509 @@
package it.acxent.cc;
import it.acxent.anag.Clifor;
import it.acxent.anag.Comune;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import java.sql.Date;
public class AttivitaCR extends CRAdapter {
private long id_attivita;
private long id_tipoAttivita;
private long id_clifor;
private String nomeAttivita;
private String descrizioneAttivita;
private String indirizzoAttivita;
private String numeroCivicoAttivita;
private long id_comune;
private String descrizioneComuneAttivita;
private String descrizioneProvinciaAttivita;
private String capComuneAttivita;
private long flgGusti;
private Date dataIscrizione;
private String codiceAttivita;
private String noteAttivita;
private String imgTmst;
private long fglMainSxCategorie;
private long flgMainSxVetrinaBestseller;
private long flgMainSxVetrinaOfferte;
private long flgMainSxUltimiVisualizzati;
private String mainSxText;
private long flgMainBanner;
private long flgMainVetrina;
private long flgMainVetrinaCategorie;
private long flgTopTelefono;
private long flgTopLingue;
private long flgTopMail;
private String topColoreHex;
private long flgHeadCategorie;
private long flgHeadMarche;
private long flgHeadNewsType;
private long flgHeadPagine;
private String headColoreHex;
private long flgDetailReviews;
private long flgDetailRelatedProducts;
private String detailDxText;
private long flgDetailDxVetrinaBestseller;
private long flgDetailDxVetrinaOfferte;
private long flgCoupon;
private long flgCheckoutGuest;
private String accountFacebook;
private String accountTwitter;
private String accountInstagram;
private long flgSocialSide;
private long flgFooterSocial;
private TipoAttivita tipoAttivita;
private Clifor clifor;
private Comune comune;
public AttivitaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AttivitaCR() {}
public static final String getHeadNewsType(long l_flgHeadNewsType) {
return Attivita.getHeadNewsType(l_flgHeadNewsType);
}
public String getHeadNewsType() {
return getHeadNewsType(getFlgHeadNewsType());
}
public void setId_attivita(long newId_attivita) {
this.id_attivita = newId_attivita;
}
public void setId_tipoAttivita(long newId_tipoAttivita) {
this.id_tipoAttivita = newId_tipoAttivita;
setTipoAttivita(null);
}
public void setId_clifor(long newId_clifor) {
this.id_clifor = newId_clifor;
setClifor(null);
}
public void setNomeAttivita(String newNomeAttivita) {
this.nomeAttivita = newNomeAttivita;
}
public void setDescrizioneAttivita(String newDescrizioneAttivita) {
this.descrizioneAttivita = newDescrizioneAttivita;
}
public void setIndirizzoAttivita(String newIndirizzoAttivita) {
this.indirizzoAttivita = newIndirizzoAttivita;
}
public void setNumeroCivicoAttivita(String newNumeroCivicoAttivita) {
this.numeroCivicoAttivita = newNumeroCivicoAttivita;
}
public void setId_comune(long newId_comune) {
this.id_comune = newId_comune;
setComune(null);
}
public void setDescrizioneComuneAttivita(String newDescrizioneComuneAttivita) {
this.descrizioneComuneAttivita = newDescrizioneComuneAttivita;
}
public void setDescrizioneProvinciaAttivita(String newDescrizioneProvinciaAttivita) {
this.descrizioneProvinciaAttivita = newDescrizioneProvinciaAttivita;
}
public void setCapComuneAttivita(String newCapComuneAttivita) {
this.capComuneAttivita = newCapComuneAttivita;
}
public void setFlgGusti(long newFlgGusti) {
this.flgGusti = newFlgGusti;
}
public void setDataIscrizione(Date newDataIscrizione) {
this.dataIscrizione = newDataIscrizione;
}
public void setCodiceAttivita(String newCodiceAttivita) {
this.codiceAttivita = newCodiceAttivita;
}
public void setNoteAttivita(String newNoteAttivita) {
this.noteAttivita = newNoteAttivita;
}
public void setImgTmst(String newImgTmst) {
this.imgTmst = newImgTmst;
}
public void setFglMainSxCategorie(long newFglMainSxCategorie) {
this.fglMainSxCategorie = newFglMainSxCategorie;
}
public void setFlgMainSxVetrinaBestseller(long newFlgMainSxVetrinaBestseller) {
this.flgMainSxVetrinaBestseller = newFlgMainSxVetrinaBestseller;
}
public void setFlgMainSxVetrinaOfferte(long newFlgMainSxVetrinaOfferte) {
this.flgMainSxVetrinaOfferte = newFlgMainSxVetrinaOfferte;
}
public void setFlgMainSxUltimiVisualizzati(long newFlgMainSxUltimiVisualizzati) {
this.flgMainSxUltimiVisualizzati = newFlgMainSxUltimiVisualizzati;
}
public void setMainSxText(String newMainSxText) {
this.mainSxText = newMainSxText;
}
public void setFlgMainBanner(long newFlgMainBanner) {
this.flgMainBanner = newFlgMainBanner;
}
public void setFlgMainVetrina(long newFlgMainVetrina) {
this.flgMainVetrina = newFlgMainVetrina;
}
public void setFlgMainVetrinaCategorie(long newFlgMainVetrinaCategorie) {
this.flgMainVetrinaCategorie = newFlgMainVetrinaCategorie;
}
public void setFlgTopTelefono(long newFlgTopTelefono) {
this.flgTopTelefono = newFlgTopTelefono;
}
public void setFlgTopLingue(long newFlgTopLingue) {
this.flgTopLingue = newFlgTopLingue;
}
public void setFlgTopMail(long newFlgTopMail) {
this.flgTopMail = newFlgTopMail;
}
public void setTopColoreHex(String newTopColoreHex) {
this.topColoreHex = newTopColoreHex;
}
public void setFlgHeadCategorie(long newFlgHeadCategorie) {
this.flgHeadCategorie = newFlgHeadCategorie;
}
public void setFlgHeadMarche(long newFlgHeadMarche) {
this.flgHeadMarche = newFlgHeadMarche;
}
public void setFlgHeadNewsType(long newFlgHeadNewsType) {
this.flgHeadNewsType = newFlgHeadNewsType;
}
public void setFlgHeadPagine(long newFlgHeadPagine) {
this.flgHeadPagine = newFlgHeadPagine;
}
public void setHeadColoreHex(String newHeadColoreHex) {
this.headColoreHex = newHeadColoreHex;
}
public void setFlgDetailReviews(long newFlgDetailReviws) {
this.flgDetailReviews = newFlgDetailReviws;
}
public void setFlgDetailRelatedProducts(long newFlgDetailRelatedProducts) {
this.flgDetailRelatedProducts = newFlgDetailRelatedProducts;
}
public void setDetailDxText(String newDetailDxText) {
this.detailDxText = newDetailDxText;
}
public void setFlgDetailDxVetrinaBestseller(long newFlgDetailDxVetrinaBestseller) {
this.flgDetailDxVetrinaBestseller = newFlgDetailDxVetrinaBestseller;
}
public void setFlgDetailDxVetrinaOfferte(long newFlgDetailDxVetrinaOfferte) {
this.flgDetailDxVetrinaOfferte = newFlgDetailDxVetrinaOfferte;
}
public void setFlgCoupon(long newFlgCoupon) {
this.flgCoupon = newFlgCoupon;
}
public void setFlgCheckoutGuest(long newFlgCheckoutGuest) {
this.flgCheckoutGuest = newFlgCheckoutGuest;
}
public void setAccountFacebook(String newAccountFacebook) {
this.accountFacebook = newAccountFacebook;
}
public void setAccountTwitter(String newAccountTwitter) {
this.accountTwitter = newAccountTwitter;
}
public void setAccountInstagram(String newAccountInstagram) {
this.accountInstagram = newAccountInstagram;
}
public void setFlgSocialSide(long newFlgSocialSide) {
this.flgSocialSide = newFlgSocialSide;
}
public void setFlgFooterSocial(long newFlgFooterSocial) {
this.flgFooterSocial = newFlgFooterSocial;
}
public long getId_attivita() {
return this.id_attivita;
}
public long getId_tipoAttivita() {
return this.id_tipoAttivita;
}
public long getId_clifor() {
return this.id_clifor;
}
public String getNomeAttivita() {
return (this.nomeAttivita == null) ? "" : this.nomeAttivita.trim();
}
public String getDescrizioneAttivita() {
return (this.descrizioneAttivita == null) ? "" : this.descrizioneAttivita.trim();
}
public String getIndirizzoAttivita() {
return (this.indirizzoAttivita == null) ? "" : this.indirizzoAttivita.trim();
}
public String getNumeroCivicoAttivita() {
return (this.numeroCivicoAttivita == null) ? "" : this.numeroCivicoAttivita.trim();
}
public long getId_comune() {
return this.id_comune;
}
public String getDescrizioneComuneAttivita() {
return (this.descrizioneComuneAttivita == null) ? "" : this.descrizioneComuneAttivita.trim();
}
public String getDescrizioneProvinciaAttivita() {
return (this.descrizioneProvinciaAttivita == null) ? "" : this.descrizioneProvinciaAttivita.trim();
}
public String getCapComuneAttivita() {
return (this.capComuneAttivita == null) ? "" : this.capComuneAttivita.trim();
}
public long getFlgGusti() {
return this.flgGusti;
}
public Date getDataIscrizione() {
return this.dataIscrizione;
}
public String getCodiceAttivita() {
return (this.codiceAttivita == null) ? "" : this.codiceAttivita.trim();
}
public String getNoteAttivita() {
return (this.noteAttivita == null) ? "" : this.noteAttivita.trim();
}
public String getImgTmst() {
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
}
public long getFglMainSxCategorie() {
return this.fglMainSxCategorie;
}
public long getFlgMainSxVetrinaBestseller() {
return this.flgMainSxVetrinaBestseller;
}
public long getFlgMainSxVetrinaOfferte() {
return this.flgMainSxVetrinaOfferte;
}
public long getFlgMainSxUltimiVisualizzati() {
return this.flgMainSxUltimiVisualizzati;
}
public String getMainSxText() {
return (this.mainSxText == null) ? "" : this.mainSxText.trim();
}
public long getFlgMainBanner() {
return this.flgMainBanner;
}
public long getFlgMainVetrina() {
return this.flgMainVetrina;
}
public long getFlgMainVetrinaCategorie() {
return this.flgMainVetrinaCategorie;
}
public long getFlgTopTelefono() {
return this.flgTopTelefono;
}
public long getFlgTopLingue() {
return this.flgTopLingue;
}
public long getFlgTopMail() {
return this.flgTopMail;
}
public String getTopColoreHex() {
return (this.topColoreHex == null) ? "" : this.topColoreHex.trim();
}
public long getFlgHeadCategorie() {
return this.flgHeadCategorie;
}
public long getFlgHeadMarche() {
return this.flgHeadMarche;
}
public long getFlgHeadNewsType() {
return this.flgHeadNewsType;
}
public long getFlgHeadPagine() {
return this.flgHeadPagine;
}
public String getHeadColoreHex() {
return (this.headColoreHex == null) ? "" : this.headColoreHex.trim();
}
public long getFlgDetailReviews() {
return this.flgDetailReviews;
}
public long getFlgDetailRelatedProducts() {
return this.flgDetailRelatedProducts;
}
public String getDetailDxText() {
return (this.detailDxText == null) ? "" : this.detailDxText.trim();
}
public long getFlgDetailDxVetrinaBestseller() {
return this.flgDetailDxVetrinaBestseller;
}
public long getFlgDetailDxVetrinaOfferte() {
return this.flgDetailDxVetrinaOfferte;
}
public long getFlgCoupon() {
return this.flgCoupon;
}
public long getFlgCheckoutGuest() {
return this.flgCheckoutGuest;
}
public String getAccountFacebook() {
return (this.accountFacebook == null) ? "" : this.accountFacebook.trim();
}
public String getAccountTwitter() {
return (this.accountTwitter == null) ? "" : this.accountTwitter.trim();
}
public String getAccountInstagram() {
return (this.accountInstagram == null) ? "" : this.accountInstagram.trim();
}
public long getFlgSocialSide() {
return this.flgSocialSide;
}
public long getFlgFooterSocial() {
return this.flgFooterSocial;
}
public void setTipoAttivita(TipoAttivita newTipoAttivita) {
this.tipoAttivita = newTipoAttivita;
}
public TipoAttivita getTipoAttivita() {
this.tipoAttivita = (TipoAttivita)getSecondaryObject(this.tipoAttivita, TipoAttivita.class, getId_tipoAttivita());
return this.tipoAttivita;
}
public void setClifor(Clifor newClifor) {
this.clifor = newClifor;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setComune(Comune newComune) {
this.comune = newComune;
}
public Comune getComune() {
this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune());
return this.comune;
}
}

View file

@ -0,0 +1,112 @@
package it.acxent.cc;
import it.acxent.anag.TipoPagamento;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AttivitaTipoPagamento extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1587713686703L;
private long id_attivitaTipoPagamento;
private long id_attivita;
private long id_tipoPagamento;
private Attivita attivita;
private TipoPagamento tipoPagamento;
public AttivitaTipoPagamento(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AttivitaTipoPagamento() {}
public void setId_attivitaTipoPagamento(long newId_attivitaTipoPagamento) {
this.id_attivitaTipoPagamento = newId_attivitaTipoPagamento;
}
public void setId_attivita(long newId_attivita) {
this.id_attivita = newId_attivita;
setAttivita(null);
}
public void setId_tipoPagamento(long newId_tipoPagamento) {
this.id_tipoPagamento = newId_tipoPagamento;
setTipoPagamento(null);
}
public long getId_attivitaTipoPagamento() {
return this.id_attivitaTipoPagamento;
}
public long getId_attivita() {
return this.id_attivita;
}
public long getId_tipoPagamento() {
return this.id_tipoPagamento;
}
public void setAttivita(Attivita newAttivita) {
this.attivita = newAttivita;
}
public Attivita getAttivita() {
this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class,
getId_attivita());
return this.attivita;
}
public void setTipoPagamento(TipoPagamento newTipoPagamento) {
this.tipoPagamento = newTipoPagamento;
}
public TipoPagamento getTipoPagamento() {
this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class,
getId_tipoPagamento());
return this.tipoPagamento;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<AttivitaTipoPagamento> findByCR(AttivitaTipoPagamentoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ATTIVITA_TIPO_PAGAMENTO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,71 @@
package it.acxent.cc;
import it.acxent.anag.TipoPagamento;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class AttivitaTipoPagamentoCR extends CRAdapter {
private long id_attivitaTipoPagamento;
private long id_attivita;
private long id_tipoPagamento;
private Attivita attivita;
private TipoPagamento tipoPagamento;
public AttivitaTipoPagamentoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AttivitaTipoPagamentoCR() {}
public void setId_attivitaTipoPagamento(long newId_attivitaTipoPagamento) {
this.id_attivitaTipoPagamento = newId_attivitaTipoPagamento;
}
public void setId_attivita(long newId_attivita) {
this.id_attivita = newId_attivita;
setAttivita(null);
}
public void setId_tipoPagamento(long newId_tipoPagamento) {
this.id_tipoPagamento = newId_tipoPagamento;
setTipoPagamento(null);
}
public long getId_attivitaTipoPagamento() {
return this.id_attivitaTipoPagamento;
}
public long getId_attivita() {
return this.id_attivita;
}
public long getId_tipoPagamento() {
return this.id_tipoPagamento;
}
public void setAttivita(Attivita newAttivita) {
this.attivita = newAttivita;
}
public Attivita getAttivita() {
this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class,
getId_attivita());
return this.attivita;
}
public void setTipoPagamento(TipoPagamento newTipoPagamento) {
this.tipoPagamento = newTipoPagamento;
}
public TipoPagamento getTipoPagamento() {
this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class,
getId_tipoPagamento());
return this.tipoPagamento;
}
}

View file

@ -0,0 +1,45 @@
package it.acxent.cc;
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;
import it.acxent.util.Timer;
public class CCCronArticoloAutoOfferte implements CrontabInterface {
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));
CCCronArticoloAutoOfferte bean = new CCCronArticoloAutoOfferte();
bean.crontabJob(apTarget);
}
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
Timer timer = new Timer();
timer.start();
System.out.println("CCCronSitemapXml start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab CCCronArticoloAutoOfferte CC (" +
DBAdapter.getNow().toString() + ")\n#################");
ArticoloCR CR = new ArticoloCR(ap);
CR.setFlgReadyForWeb(1L);
CR.setFlgEscludiWeb(0L);
ArticoloAutoOfferte aao = new ArticoloAutoOfferte(ap);
aao.setId_vetrinaAO(2L);
aao.setNArticoliAO(50L);
aao.setNGiorniAO(3L);
aao.setGiacenzaMinimaAO(6L);
aao.setPercScontoOffertaAO(2.5D);
rp = aao.starAutoOfferte(ap, false);
msg.append("\n################# Fine crontab CCCronArticoloAutoOfferte CC (" +
DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg("\n" + rp.getMsg() + "\n" + msg.toString());
System.out.println(msg.toString());
return rp;
}
}

View file

@ -0,0 +1,48 @@
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 CCCronCreaIdealoXml implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
System.out.println("CCCronCreaTrovaprezziXml start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab IDEALO 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.setFlgQta(1L);
CR.setFlgIdealo(1L);
CR.setFileNameIdealo("idealo_f3.xml");
CR.setFlgReadyForWeb(1L);
CR.setFlgEscludiWeb(0L);
CR.setLangReadyForWeb("it");
Articolo art = new Articolo(ap);
if (art.isLocalhost());
rp = art.creaFileXmlIdealo(CR);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab IDEALO 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));
CCCronCreaIdealoXml bean = new CCCronCreaIdealoXml();
bean.crontabJob(apTarget);
}
}

View file

@ -0,0 +1,46 @@
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);
}
}

View file

@ -0,0 +1,35 @@
package it.acxent.cc;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Timer;
public class CCCronIcecatAuto implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
Timer timer = new Timer();
timer.start();
System.out.println("CCCrontIcecatAuto start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Icecat Auto CC (" +
DBAdapter.getNow().toString() + ")\n#################");
ArticoloCR CR = new ArticoloCR(ap);
CR.setFlgReadyForWeb(0L);
CR.setFlgEscludiWeb(-1L);
CR.setFlgQta(1L);
CR.setQtaDa(1L);
CR.setQtaA(9999L);
Articolo art = new Articolo(ap);
rp = art.startThreadIcecatAuto(ap, CR);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import Icecat Auto CC (" + DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg(msg.toString());
System.out.println(msg.toString());
return rp;
}
}

View file

@ -0,0 +1,108 @@
package it.acxent.cc;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.CrontabInterface;
import it.acxent.common.StatusMsg;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Timer;
import it.acxent.util.Vectumerator;
public class CCCronIcecatAutomatorGoogle implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
Timer timer = new Timer();
timer.start();
String TAG_THREAD_MSG = "ICECAT+AUTOMATOR+SITEMAP+GOOGLE ";
System.out.println("CCCrontIcecatAuto start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab " + TAG_THREAD_MSG + " (" +
DBAdapter.getNow().toString() + ")\n#################");
StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD ICECAT IN ESECUZIONE ......");
msg.append("************* THREAD ICECAT ***************+\n");
ResParm rp = new ResParm(true);
Articolo art = new Articolo(ap);
ArticoloCR ACR = new ArticoloCR(ap);
ACR.setFlgReadyForWeb(0L);
ACR.setFlgEscludiWeb(-1L);
ACR.setFlgQta(1L);
ACR.setQtaDa(1L);
ACR.setQtaA(9999L);
rp = art.startThreadIcecatAuto(ap, ACR);
msg.append(rp.getMsg());
msg.append("\n");
while (Articolo.isThreadIcecatAuto()) {
try {
Thread.sleep(3000L);
} catch (Exception e) {}
}
msg.append("\nfine ICECAT. Lap time:" + timer.getDurataHourMin());
StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD AUTOMATOR IN ESECUZIONE ......");
msg.append("\n\n************* THREAD AUTOMATOR ***************+\n");
rp = new ResParm(true);
WwwAutomator automator = new WwwAutomator(ap);
WwwAutomatorCR CRWA = new WwwAutomatorCR();
CRWA.setFlgAbilita(1L);
rp = automator.startAutomator(ap, CRWA, true);
msg.append(rp.getMsg());
msg.append("\n");
while (WwwAutomator.isThreadAttivo()) {
try {
Thread.sleep(3000L);
} catch (Exception e) {}
}
msg.append("\nfine AUTOMATOR. Lap time:" + timer.getDurataHourMin());
StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD SITEMAP IN ESECUZIONE ......");
msg.append("\n\n************* THREAD SITEMAP ***************+\n");
rp = art.startThreadCreaSitemaps(ap, ACR);
if (rp.getStatus()) {
Thread t = (Thread)rp.getExtraInfo("thread", null);
if (t != null)
try {
t.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
msg.append("\nfine SITEMAP. Lap time:" + timer.getDurataHourMin());
} else {
msg.append("\nErrore nella generazione delle sitemap: " + rp.getMsg() + "\n");
}
StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD GOOGLE MERCHANT IN ESECUZIONE ......");
msg.append("\n\n************* THREAD GOOGLE MERCHANT ***************+\n");
rp = new ResParm(true);
ACR = new ArticoloCR(ap);
ACR.setFlgQta(1L);
ACR.setFlgGoogle(1L);
ACR.setGoogleFeedFileName("offerte");
ACR.setFileNameGoogle("offerte.xml");
art = new Articolo(ap);
Vectumerator<Articolo> vec = art.findByCR(ACR, 0, 0);
CCImport bean = new CCImport();
if (!art.isLocalhost()) {
if (ap.getParmValue("GOOGLE_FTP_USER", "").equals("") ||
ap.getParmValue("GOOGLE_FTP_PASSWORD", "").equals("")) {
msg.append("parametri ftp google non impostati. impossibile inviare il feed via ftp a google\n");
} else {
rp = bean.startGoogleFtp(ap, ACR);
msg.append("Numero record inviati a google via ftp feed " + ACR.getGoogleFeedFileName() + ": " + vec.getTotNumberOfRecords() + "\n");
msg.append(rp.getMsg());
}
} else {
msg.append("thread google xml non avviato sulla crontab perché localhost!!\n");
msg.append(rp.getMsg());
}
while (CCImport.isThreadGoogleMerchant()) {
try {
Thread.sleep(3000L);
} catch (Exception e) {}
}
msg.append("\nfine GOOGLE MERCHANT. Lap time:" + timer.getDurataHourMin());
StatusMsg.deleteMsgByTag(ap, TAG_THREAD_MSG);
msg.append("\n################# Fine crontab " + TAG_THREAD_MSG + "(" + DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg(msg.toString());
System.out.println(msg.toString());
return rp;
}
}

View file

@ -0,0 +1,25 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportBestit implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import BESTIT CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
long[] flgTipoImportA = { 0L };
rp = ccImport.startImportBestit(ap, flgTipoImportA, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import BESTIT 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());
return rp;
}
}

View file

@ -0,0 +1,24 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportCgross implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import CGross CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
rp = ccImport.startImportCgross(ap, null, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import CGross 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());
return rp;
}
}

View file

@ -0,0 +1,24 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportDatamatic implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import DATAMATIC MAIL CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
rp = ccImport.startImportDatamaticMail(ap, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import DATAMATIC MAIL 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());
return rp;
}
}

View file

@ -0,0 +1,25 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportIngramMicroDispo implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import Ingrammicro DISPO CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
rp = ccImport.startImportIngramMicro(ap, 1L, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import Ingrammicro DISPO 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());
return rp;
}
}

View file

@ -0,0 +1,24 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportIngramMicroListino implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import Ingrammicro LISTINO CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
rp = ccImport.startImportIngramMicro(ap, 0L, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import Ingrammicro LISTINO 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());
return rp;
}
}

View file

@ -0,0 +1,24 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportLogicom implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import LOGICOM MAIL CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
rp = ccImport.startImportLogicomMail(ap, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import LOGICOM MAIL 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());
return rp;
}
}

View file

@ -0,0 +1,25 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
public class CCCronImportRunner implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import RUNNER CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
CCImport ccImport = new CCImport();
long[] flgTipoImportA = { 0L, 1L };
rp = ccImport.startImportRunner(ap, flgTipoImportA, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab Import RUNNER 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());
return rp;
}
}

View file

@ -0,0 +1,34 @@
package it.acxent.cc;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Timer;
public class CCCronIndexNowGiornaliero implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
Timer timer = new Timer();
timer.start();
System.out.println("CCCronIndexNowGiornaliero start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab INDEXNOW CC (" +
DBAdapter.getNow().toString() + ")\n#################");
Articolo bean = new Articolo(ap);
ArticoloCR CR = new ArticoloCR();
CR.setFlgOrderBy(10L);
CR.setFlgEscludiWeb(0L);
CR.setFlgReadyForWeb(1L);
CR.setLangReadyForWeb("it");
rp = bean.callIndexNow(CR);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab INDEXNOW CC (" + DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg(msg.toString());
System.out.println(msg.toString());
return rp;
}
}

View file

@ -0,0 +1,43 @@
package it.acxent.cc;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Vectumerator;
public class CCCronSendGoogleXml implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
System.out.println("CCCronSendGoogleXml start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import SEND GOOGLE XML OFFERTE CC (" +
DBAdapter.getNow().toString() + ")\n#################");
long t0 = System.currentTimeMillis();
ArticoloCR CR = new ArticoloCR(ap);
CR.setFlgQta(0L);
CR.setFlgGoogle(1L);
CR.setGoogleFeedFileName("merchant");
CR.setFileNameGoogle("merchant.xml");
Articolo art = new Articolo(ap);
Vectumerator<Articolo> vec = art.findByCR(CR, 0, 0);
System.out.println("numero record;" + vec.getTotNumberOfRecords());
CCImport bean = new CCImport();
if (!art.isLocalhost()) {
rp = bean.startGoogleFtp(ap, CR);
msg.append("Numero record inviati a google via ftp feed " + CR.getGoogleFeedFileName() + ": " + vec.getTotNumberOfRecords() + "\n");
msg.append(rp.getMsg());
} else {
msg.append("thread google xml non avviato sulla crontab perché localhost!!\n");
msg.append(rp.getMsg());
}
msg.append("\n################# Fine crontab Import SEND GOOGLE 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;
}
}

View file

@ -0,0 +1,51 @@
package it.acxent.cc;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Timer;
import it.acxent.www.Sitemap;
import it.acxent.www.SitemapCR;
public class CCCronSitemapXml implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
Timer timer = new Timer();
timer.start();
System.out.println("CCCronSitemapXml start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab CCCronSitemapXml CC (" +
DBAdapter.getNow().toString() + ")\n#################");
ArticoloCR ACR = new ArticoloCR(ap);
ACR.setFlgReadyForWeb(1L);
ACR.setFlgEscludiWeb(0L);
ACR.setLangReadyForWeb("it");
SitemapCR CR = new SitemapCR(ap);
CR.setACR(ACR);
Articolo art = new Articolo(ap);
String lang = art.getParm("LANG_AVAILABLE").getTesto();
StringTokenizer st = new StringTokenizer(lang, ",");
String filenamePre = "sitemap";
String filenameXml = ".xml";
while (st.hasMoreTokens()) {
String currentLang = st.nextToken();
msg.append("creazione sitemap in lingua " + currentLang + " file " + CR.getSitemapFilename() + ".xml\n");
CR.setLangSitemap(currentLang);
Sitemap sitemap = new Sitemap(ap);
CR.setSitemapFilename("sitemap");
CR.setFlgSitemapType(10L);
rp = sitemap.creaFileXmlSitemap(CR);
msg.append(rp.getMsg());
msg.append("\n");
}
msg.append("\n################# Fine crontab CCCronSitemapXml CC (" + DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg(msg.toString());
System.out.println(msg.toString());
return rp;
}
}

View file

@ -0,0 +1,29 @@
package it.acxent.cc;
import it.acxent.common.CrontabInterface;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Timer;
public class CCCronWwwAutomator implements CrontabInterface {
public ResParm crontabJob(ApplParmFull ap) {
ResParm rp = new ResParm(true);
Timer timer = new Timer();
timer.start();
System.out.println("CCCronWwwAutomator start...");
StringBuffer msg = new StringBuffer("\n################# Inizio crontab WWW AUTOMATOR CC (" +
DBAdapter.getNow().toString() + ")\n#################");
WwwAutomator bean = new WwwAutomator(ap);
WwwAutomatorCR CR = new WwwAutomatorCR();
CR.setFlgAbilita(1L);
rp = bean.startAutomator(ap, CR, true);
msg.append(rp.getMsg());
msg.append("\n################# Fine crontab WWW AUTOMATOR CC (" + DBAdapter.getNow().toString() + ")\n#################");
timer.stop();
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
rp.setMsg(msg.toString());
System.out.println(msg.toString());
return rp;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,97 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class CategoriaIngrammicro extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1635180606311L;
private long id_categoriaIngrammiro;
private String descrizione;
private String codice;
public CategoriaIngrammicro(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CategoriaIngrammicro() {}
public void setId_categoriaIngrammiro(long newId_categoriaIngrammiro) {
this.id_categoriaIngrammiro = newId_categoriaIngrammiro;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setCodice(String newCodice) {
this.codice = newCodice;
}
public long getId_categoriaIngrammiro() {
return this.id_categoriaIngrammiro;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getCodice() {
return (this.codice == null) ? "" : this.codice.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<CategoriaIngrammicro> findByCR(CategoriaIngrammicroCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from CATEGORIA_INGRAMMICRO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByCodice(String l_codice) {
String s_Sql_Find = "select A.* from CATEGORIA_INGRAMMICRO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.codice='" + l_codice + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
}

View file

@ -0,0 +1,42 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class CategoriaIngrammicroCR extends CRAdapter {
private long id_categoriaIngrammiro;
private String descrizione;
private String codice;
public CategoriaIngrammicroCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public CategoriaIngrammicroCR() {}
public void setId_categoriaIngrammiro(long newId_categoriaIngrammiro) {
this.id_categoriaIngrammiro = newId_categoriaIngrammiro;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setCodice(String newCodice) {
this.codice = newCodice;
}
public long getId_categoriaIngrammiro() {
return this.id_categoriaIngrammiro;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getCodice() {
return (this.codice == null) ? "" : this.codice.trim();
}
}

View file

@ -0,0 +1,82 @@
package it.acxent.cc;
import org.json.JSONObject;
public class GoogleReview {
public static String P_GOOGLE_REVIEW_DATE = "GOOGLE_REVIEW_DATE";
public static String P_GOOGLE_REVIEW_RATING = "GOOGLE_REVIEW_RATING";
public static String P_GOOGLE_REVIEW_USER_RATING_TOTALS = "GOOGLE_REVIEW_USER_RATING_TOTALS";
private String author_name;
private String author_url;
private String profile_photo_url;
private String relative_time_description;
private String text;
private long rating;
public GoogleReview(JSONObject jo) {
setAuthor_name(jo.getString("author_name"));
setAuthor_url(jo.getString("author_url"));
setProfile_photo_url(jo.getString("profile_photo_url"));
setRelative_time_description(jo.getString("relative_time_description"));
setRating(jo.getLong("rating"));
setText(jo.getString("text"));
}
public GoogleReview() {}
public String getAuthor_name() {
return (this.author_name == null) ? "" : this.author_name.trim();
}
public void setAuthor_name(String author_name) {
this.author_name = author_name;
}
public String getAuthor_url() {
return (this.author_url == null) ? "" : this.author_url.trim();
}
public void setAuthor_url(String author_url) {
this.author_url = author_url;
}
public String getProfile_photo_url() {
return (this.profile_photo_url == null) ? "" : this.profile_photo_url.trim();
}
public void setProfile_photo_url(String profile_photo_url) {
this.profile_photo_url = profile_photo_url;
}
public String getRelative_time_description() {
return (this.relative_time_description == null) ? "" : this.relative_time_description.trim();
}
public void setRelative_time_description(String relative_time_description) {
this.relative_time_description = relative_time_description;
}
public String getText() {
return (this.text == null) ? "" : this.text.trim();
}
public void setText(String text) {
this.text = text;
}
public long getRating() {
return this.rating;
}
public void setRating(long rating) {
this.rating = rating;
}
}

View file

@ -0,0 +1,75 @@
package it.acxent.cc;
import it.acxent.util.Vectumerator;
public class GoogleReviews {
private Vectumerator<GoogleReview> reviews;
private long userRatingsTotal;
private double rating;
private String msg;
private boolean status;
public Vectumerator<GoogleReview> getReviews() {
if (this.reviews == null)
this.reviews = new Vectumerator();
return this.reviews;
}
public void setReviews(Vectumerator<GoogleReview> reviews) {
this.reviews = reviews;
}
public long getUserRatingsTotal() {
return this.userRatingsTotal;
}
public String getFontAwesomeSvgRatingStars() {
String STAR_PIENA = "<i class=\"fas fa-star\"></i>";
String STAR_VUOTA = "<i class=\"far fa-star\"></i>";
String STAR_META = "<i class=\"fas fa-star-half-alt\"></i>";
StringBuilder sb = new StringBuilder();
double l_rating = getRating();
for (int i = 0; i <= 4; i++) {
if (l_rating <= (double)i + 0.25D) {
sb.append("<i class=\"far fa-star\"></i>");
} else if (l_rating <= (double)i + 0.75D) {
sb.append("<i class=\"fas fa-star-half-alt\"></i>");
} else {
sb.append("<i class=\"fas fa-star\"></i>");
}
}
return sb.toString();
}
public void setUserRatingsTotal(long userRatingsTotal) {
this.userRatingsTotal = userRatingsTotal;
}
public double getRating() {
return this.rating;
}
public void setRating(double rating) {
this.rating = rating;
}
public String getMsg() {
return (this.msg == null) ? "" : this.msg.trim();
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isStatus() {
return this.status;
}
public void setStatus(boolean status) {
this.status = status;
}
}

View file

@ -0,0 +1,73 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipoAttivita extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1586902588918L;
private long id_tipoAttivita;
private String descrizione;
public TipoAttivita(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoAttivita() {}
public void setId_tipoAttivita(long newId_tipoAttivita) {
this.id_tipoAttivita = newId_tipoAttivita;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoAttivita() {
return this.id_tipoAttivita;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TipoAttivita> findByCR(TipoAttivitaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from TIPO_ATTIVITA AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,32 @@
package it.acxent.cc;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class TipoAttivitaCR extends CRAdapter {
private long id_tipoAttivita;
private String descrizione;
public TipoAttivitaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoAttivitaCR() {}
public void setId_tipoAttivita(long newId_tipoAttivita) {
this.id_tipoAttivita = newId_tipoAttivita;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoAttivita() {
return this.id_tipoAttivita;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
}

View file

@ -0,0 +1,162 @@
package it.acxent.cc;
import it.acxent.anag.Listino;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.art.Marca;
import it.acxent.art.Tipo;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import it.acxent.util.DbConsole;
import it.acxent.util.Vectumerator;
import java.sql.Time;
import java.util.StringTokenizer;
public class UpdateArticoli extends DbConsole {
public static void main(String[] args) {
UpdateArticoli bean = new UpdateArticoli();
bean.doImport();
System.exit(0);
}
public void doImport() {
String db = "cc";
int i = 0;
int se1 = 10;
int se2 = 100;
String hostname = "10.0.0.5";
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 {
Articolo bean = new Articolo(apTarget);
long l_id_tipoEffettivo = 80L;
double ricarico = 13.0D;
long l_id_listinoEbay = 5L;
long l_qtaMax = 20L;
long l_qtaEbay = 15L;
String searchTxt = "ink";
long qtaMinRicerca = 5L;
long l_id_marcaRicerca = 2L;
long l_id_tipoRIcerca = 1L;
boolean caricaEbay = false;
long l_flgEbayPubblicato = -1L;
System.out.println("---------------- DATI DA INSERIRE ----------------");
temp = getCi().readLine("l_id_tipoEffettivo (" + l_id_tipoEffettivo + "):");
if (!temp.isEmpty())
l_id_tipoEffettivo = Long.parseLong(temp);
Tipo tipo = new Tipo(apTarget);
tipo.findByPrimaryKey(l_id_tipoEffettivo);
System.out.println("Tipo effettivo scelto: " + tipo.getDescrizioneCompleta());
temp = getCi().readLine("ricarico (" + ricarico + "):");
if (!temp.isEmpty())
ricarico = Double.parseDouble(temp);
temp = getCi().readLine("l_id_listinoEbay (" + l_id_listinoEbay + "):");
if (!temp.isEmpty())
l_id_listinoEbay = Long.parseLong(temp);
Listino listino = new Listino(apTarget);
listino.findByPrimaryKey(l_id_listinoEbay);
System.out.println("Listino ebay scelto: " + listino.getDescrizioneCompleta());
temp = getCi().readLine("l_qtaMax (" + l_qtaMax + "):");
if (!temp.isEmpty())
l_qtaMax = Long.parseLong(temp);
temp = getCi().readLine("l_qtaEbay (" + l_qtaEbay + "):");
if (!temp.isEmpty())
l_qtaEbay = Long.parseLong(temp);
temp = getCi().readLine("caricaebay (" + (caricaEbay ? "y" : "n") + " y/n):");
if (!temp.isEmpty())
caricaEbay = temp.toLowerCase().equals("y");
System.out.println("---------------- CRITERI DI RICERCA ----------------");
temp = getCi().readLine("l_id_tipoRIcerca (" + l_id_tipoRIcerca + "):");
if (!temp.isEmpty())
l_id_tipoRIcerca = Long.parseLong(temp);
tipo.findByPrimaryKey(l_id_tipoRIcerca);
System.out.println("Tipo ricerca scelto: " + tipo.getDescrizioneCompleta());
temp = getCi().readLine("searchTxt (" + searchTxt + "):");
if (!temp.isEmpty())
searchTxt = temp;
temp = getCi().readLine("qtaMinRicerca (" + qtaMinRicerca + "):");
if (!temp.isEmpty())
qtaMinRicerca = Long.parseLong(temp);
temp = getCi().readLine("l_id_marcaRicerca (" + l_id_marcaRicerca + "):");
if (!temp.isEmpty())
l_id_marcaRicerca = Long.parseLong(temp);
Marca marca = new Marca(apTarget);
marca.findByPrimaryKey(l_id_marcaRicerca);
System.out.println("Marca ricerca scelta: " + marca.getDescrizione());
temp = getCi().readLine("l_flgEbayPubblicato (" + l_flgEbayPubblicato + "):");
if (!temp.isEmpty())
l_flgEbayPubblicato = Long.parseLong(temp);
System.out.println("ciclo articoli");
ArticoloCR CR = new ArticoloCR();
CR.setSearchTxt(searchTxt);
CR.setFlgEscludiWeb(0L);
CR.setFlgQta(1L);
CR.setQtaDa(qtaMinRicerca);
CR.setId_marca(l_id_marcaRicerca);
CR.setId_tipo(l_id_tipoRIcerca);
CR.setFlgEbayPubblicato(l_flgEbayPubblicato);
Vectumerator<Articolo> vec = bean.findByCR(CR, 0, 0);
System.out.println("Tot Record: " + vec.getTotNumberOfRecords());
while (vec.hasMoreElements()) {
Articolo row = (Articolo)vec.nextElement();
System.out.println(row.getCodice() + " " + row.getCodice());
row.setId_tipo(l_id_tipoEffettivo);
row.superSave();
row.caricaIcecat();
row.setPercRicarico(ricarico);
row.setCostoNuovo(row.getCostoNetto());
row.setPrezzoIvatoBarrato(row.getStreetPriceIva());
row.setFlgEbay(1L);
row.setId_listinoEbay(l_id_listinoEbay);
row.setQtaMaxAcquistoWww(l_qtaMax);
row.setQtaEbay(l_qtaEbay);
row.setFlgGoogle(1L);
row.setFlgEscludiWebArt(0L);
row.save();
row.aggiornaPrezzoNettoConCostoNuovo();
if (caricaEbay && !row.isEbayPubblicato())
row.ebayPublishFull();
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println("" + i + " / " + i);
}
System.out.println("fine ciclo \n" + msg.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
protected Time getTimeFromString(String theTime) {
try {
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
StringTokenizer st = new StringTokenizer(theTime, ":");
int hour = Integer.parseInt(st.nextToken());
int min = Integer.parseInt(st.nextToken());
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
}
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
StringTokenizer st = new StringTokenizer(theTime, ":");
int hour = Integer.parseInt(st.nextToken());
int min = Integer.parseInt(st.nextToken());
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
}
return null;
} catch (Exception e) {
return null;
}
}
}

View file

@ -0,0 +1,449 @@
package it.acxent.cc;
import it.acxent.art.ArticoloCR;
import it.acxent.art.Tipo;
import it.acxent.common.StatusMsg;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.mail.MailProperties;
import it.acxent.util.Timer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class WwwAutomator extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1667311885432L;
private long id_wwwAutomator;
private long id_tipo;
private String categoriaImport;
private String searchTxt;
private String ultimaEsecuzione;
class ThreadAutomator extends Thread {
private String TAG_THREAD_MSG = "AUTOMATOR ";
private ApplParmFull apFull;
private boolean sendEmail;
private WwwAutomatorCR CR;
public ThreadAutomator(ApplParmFull apFull, WwwAutomatorCR CR, boolean sendEmail) {
this.apFull = apFull;
this.sendEmail = sendEmail;
this.CR = CR;
if (!WwwAutomator.isThreadAttivo()) {
WwwAutomator.threadAutomator = true;
start();
}
}
public void run() {
boolean debug = false;
Timer timer = new Timer();
timer.start();
StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, "...inizio ...");
ResParm rp = new ResParm(true);
StringBuilder sb = new StringBuilder();
int i = 1;
int se1 = 10;
int se2 = 100;
WwwAutomator bean = new WwwAutomator(this.apFull);
Vectumerator<WwwAutomator> vec = bean.findByCR(this.CR, 0, 0);
while (vec.hasMoreElements()) {
WwwAutomator row = (WwwAutomator)vec.nextElement();
String temp = "Aggiornamento " + i + " su " + vec.getTotNumberOfRecords() + " - " + row.getDescrizione();
StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, temp);
DBAdapter.printDebug(debug, this.TAG_THREAD_MSG + this.TAG_THREAD_MSG);
ArticoloBulkUpdate abu = new ArticoloBulkUpdate(this.apFull);
ArticoloCR CR = new ArticoloCR(this.apFull);
CR.setSearchTxt(row.getSearchTxt());
CR.setCategoriaImport(row.getCategoriaImport());
CR.setId_tipo(1L);
abu.setFlgGoogleBA(row.getFlgGoogle());
abu.setRicaricoBA(row.getRicarico());
abu.setPrezzoPubblicoDaBA(row.getPrezzoPubblicoDa());
abu.setRicaricoOltreBA(row.getRicaricoOltre());
abu.setQtaMaxAcquistoWwwBA(row.getQtaMaxAcquistoWww());
abu.setId_tipoBA(row.getId_tipo());
abu.setPreviewSizes("");
abu.setPreviewSizes1("");
abu.setFlgEscludiWebArtBA(0L);
rp = abu.starBulkUpdate(this.apFull, CR, row);
StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, " in attesa di bulk update ..." + temp);
while (true) {
if (ArticoloBulkUpdate.isThreadAttivo()) {
try {
sleep(3000L);
} catch (Exception e) {}
continue;
}
break;
}
if (row.getUltimaEsecuzione().indexOf("record processati: 0") < 0) {
sb.append("-------------------------------------------");
sb.append("<br/>");
sb.append(row.getDescrizione());
sb.append(" ");
sb.append(row.getUltimaEsecuzione());
sb.append("<br/>");
}
DBAdapter.printDebug(debug, this.TAG_THREAD_MSG + " FINE CICLO.... RIPARTO... " + this.TAG_THREAD_MSG + "\n");
i++;
if (se1 > 0 && i % se1 == 0)
System.out.print(".");
if (se2 > 0 && i % se2 == 0)
System.out.println("" + i + " / " + i);
}
timer.stop();
rp.setMsg(this.TAG_THREAD_MSG + " concluso. DURATA: " + this.TAG_THREAD_MSG);
if (this.sendEmail) {
MailProperties mp = new MailProperties();
String eMail = WwwAutomator.this.getApFull().getParm("TO").getTesto();
mp.put("TO", eMail);
mp.setProperty("FROM", WwwAutomator.this.getApFull().getParm("FROM").getTesto());
mp.put("SUBJECT", this.TAG_THREAD_MSG);
mp.put("ISHTML", "true");
mp.setProperty("BCC", "");
mp.setProperty("CC", "");
mp.put("MSG", this.TAG_THREAD_MSG + " concluso. DURATA: " + this.TAG_THREAD_MSG + "<br/>" +
timer.getDurataHourMin());
try {
WwwAutomator.this.sendMailMessage(mp);
} catch (Exception e) {
e.printStackTrace();
}
}
StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, rp.getMsg());
try {
sleep(10000L);
} catch (Exception e) {}
StatusMsg.deleteMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG);
WwwAutomator.threadAutomator = false;
System.out.println(rp.getMsg());
}
}
private long qtaMaxAcquistoWww = 5L;
private double ricarico = 7.0D;
private long flgGoogle = 1L;
private long flgAbilita = 1L;
private long ordine;
private Tipo tipo;
private double prezzoPubblicoDa;
private double ricaricoOltre;
private static boolean threadAutomator = false;
public WwwAutomator(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public void setId_wwwAutomator(long newId_wwwAutomator) {
this.id_wwwAutomator = newId_wwwAutomator;
}
public void setId_tipo(long newId_tipo) {
this.id_tipo = newId_tipo;
setTipo(null);
}
public void setCategoriaImport(String newCategoriaImport) {
this.categoriaImport = newCategoriaImport;
}
public void setSearchTxt(String newSearchTxt) {
this.searchTxt = newSearchTxt;
}
public void setQtaMaxAcquistoWww(long newQtaMaxAcquistoWww) {
this.qtaMaxAcquistoWww = newQtaMaxAcquistoWww;
}
public void setRicarico(double newRicaricoBA) {
this.ricarico = newRicaricoBA;
}
public void setFlgGoogle(long newFlgGoogle) {
this.flgGoogle = newFlgGoogle;
}
public long getId_wwwAutomator() {
return this.id_wwwAutomator;
}
public long getId_tipo() {
return this.id_tipo;
}
public String getCategoriaImport() {
return (this.categoriaImport == null) ? "" : this.categoriaImport.trim();
}
public String getSearchTxt() {
return (this.searchTxt == null) ? "" : this.searchTxt.trim();
}
public long getQtaMaxAcquistoWww() {
return this.qtaMaxAcquistoWww;
}
public double getRicarico() {
return this.ricarico;
}
public long getFlgGoogle() {
return this.flgGoogle;
}
public void setTipo(Tipo newTipo) {
this.tipo = newTipo;
}
public Tipo getTipo() {
this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo());
return this.tipo;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<WwwAutomator> findByCR(WwwAutomatorCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from WWW_AUTOMATOR AS A left join TIPO as B on A.id_tipo=B.id_tipo";
String s_Sql_Order = " ORDER BY A.ORDINE, B.descrizione, A.searchTxt, A.categoriaImport";
if (CR.getFlgOrderBy() == 99L)
s_Sql_Order = " ORDER BY B.descrizioneR,A.ORDINE, A.searchTxt, A.categoriaImport";
WcString wc = new WcString();
if (CR.getId_wwwAutomator() > 0L)
wc.addWc("A.id_wwwAutomator=" + CR.getId_wwwAutomator());
if (CR.getId_tipo() > 0L)
if (CR.getTipo().isFoglia()) {
wc.addWc("A.id_tipo=" + CR.getId_tipo());
} else {
Vectumerator<Tipo> vecTipo = CR.getTipo().findFigliAll(CR.getId_tipo(), true);
if (vecTipo.hasMoreElements()) {
StringBuilder sb = new StringBuilder("(");
while (vecTipo.hasMoreElements()) {
Tipo row = (Tipo)vecTipo.nextElement();
sb.append("A.id_tipo=" + row.getId_tipo());
if (vecTipo.hasMoreElements())
sb.append(" or ");
}
sb.append(")");
wc.addWc(sb.toString());
}
}
if (CR.getFlgAbilita() == 0L) {
wc.addWc("(A.flgAbilita = o or A.flgAbilita is null)");
} else if (CR.getFlgAbilita() > 0L) {
wc.addWc("A.flgAbilita=" + CR.getFlgAbilita());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getUltimaEsecuzione() {
return (this.ultimaEsecuzione == null) ? "" : this.ultimaEsecuzione.trim();
}
public void setUltimaEsecuzione(String ultimaEsecuzione) {
this.ultimaEsecuzione = ultimaEsecuzione;
}
public long getFlgAbilita() {
return this.flgAbilita;
}
public void setFlgAbilita(long flgAbilita) {
this.flgAbilita = flgAbilita;
}
public ResParm eseguiAutomator() {
ResParm rp = new ResParm();
if (getId_wwwAutomator() > 0L && getFlgAbilita() == 1L) {
WwwAutomatorCR CR = new WwwAutomatorCR();
CR.setId_wwwAutomator(getId_wwwAutomator());
startAutomator(getApFull(), CR, false);
}
return rp;
}
public final ResParm startAutomator(ApplParmFull apFull, WwwAutomatorCR CR, boolean sendEmail) {
boolean test = false;
if (!isThreadAttivo()) {
new ThreadAutomator(apFull, CR, sendEmail);
return new ResParm(true, "Thread AUTOMATOR avviato");
}
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
}
public static boolean isThreadAttivo() {
return threadAutomator;
}
public String getDescrizione() {
return "" + getOrdine() + " " + getOrdine() + " <b>" + getId_wwwAutomator() + "</b> cat: " + getTipo().getDescrizioneCompleta() + " search: " + getCategoriaImport();
}
protected void initFields() {
super.initFields();
setFlgGoogle(1L);
setFlgAbilita(1L);
setQtaMaxAcquistoWww(5L);
setRicarico(7.0D);
}
private long calcolaOrdine() {
try {
String s_sqlFind = "select max(ordine) as _max from WWW_AUTOMATOR WHERE id_wwwAutomator!=" + getId_wwwAutomator();
PreparedStatement ps = getConn().prepareStatement(s_sqlFind);
long res = (long)getMax(ps, true) + 1L;
long decine = res / 10L;
return (decine + 1L) * 10L;
} catch (Exception e) {
handleDebug(e);
return 0L;
}
}
public ResParm save() {
if (getOrdine() == 0L)
setOrdine(calcolaOrdine());
ResParm rp = super.save();
return rp;
}
public long getOrdine() {
return this.ordine;
}
public void setOrdine(long ordine) {
this.ordine = ordine;
}
public ResParm spostaGiu() {
ResParm rp = new ResParm();
if (getDBState() == 1) {
try {
long ordineBean = getOrdine();
String s_sqlFind = "select A.* from WWW_AUTOMATOR as A WHERE A.ordine>" + ordineBean + " order by A.ordine asc";
PreparedStatement ps = getConn().prepareStatement(s_sqlFind);
Vectumerator vec = findRows(ps);
if (vec.hasMoreElements()) {
WwwAutomator tg = (WwwAutomator)vec.nextElement();
long ordineTG = tg.getOrdine();
tg.setOrdine(-ordineBean);
rp = tg.save();
if (rp.getStatus()) {
setOrdine(ordineTG);
rp = save();
if (rp.getStatus()) {
tg.setOrdine(ordineBean);
rp = tg.save();
}
}
} else {
rp.setStatus(true);
rp.setMsg("Raggiunto valore massimo!");
}
} catch (Exception e) {
handleDebug(e);
}
} else {
rp.setStatus(false);
rp.setMsg("Errore!. Record non salvato");
}
return rp;
}
public ResParm spostaSu() {
ResParm rp = new ResParm();
if (getDBState() == 1) {
try {
long ordineBean = getOrdine();
String s_sqlFind = "select A.* from WWW_AUTOMATOR as A WHERE A.ordine< " + ordineBean + " order by A.ordine desc";
PreparedStatement ps = getConn().prepareStatement(s_sqlFind);
Vectumerator vec = findRows(ps);
if (vec.hasMoreElements()) {
WwwAutomator tg = (WwwAutomator)vec.nextElement();
long ordineTG = tg.getOrdine();
tg.setOrdine(-ordineBean);
rp = tg.save();
if (rp.getStatus()) {
setOrdine(ordineTG);
rp = save();
if (rp.getStatus()) {
tg.setOrdine(ordineBean);
rp = tg.save();
}
}
} else {
rp.setStatus(true);
rp.setMsg("Raggiunto valore minimo!");
}
} catch (Exception e) {
handleDebug(e);
}
} else {
rp.setStatus(false);
rp.setMsg("Errore!. Record non salvato");
}
return rp;
}
public ResParm ripristinoOrdine() {
WwwAutomatorCR CR = new WwwAutomatorCR();
CR.setFlgOrderBy(99L);
long currentOrdine = 10L;
Vectumerator<WwwAutomator> vec = findByCR(CR, 0, 0);
while (vec.hasMoreElements()) {
WwwAutomator row = (WwwAutomator)vec.nextElement();
row.setOrdine(currentOrdine);
row.save();
currentOrdine += 10L;
}
return new ResParm(true);
}
public double getPrezzoPubblicoDa() {
return this.prezzoPubblicoDa;
}
public void setPrezzoPubblicoDa(double prezzoPubblicoA) {
this.prezzoPubblicoDa = prezzoPubblicoA;
}
public double getRicaricoOltre() {
return this.ricaricoOltre;
}
public void setRicaricoOltre(double ricaricoOltre) {
this.ricaricoOltre = ricaricoOltre;
}
public WwwAutomator() {}
}

View file

@ -0,0 +1,107 @@
package it.acxent.cc;
import it.acxent.art.Tipo;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class WwwAutomatorCR extends CRAdapter {
private long id_wwwAutomator;
private long id_tipo;
private String categoriaImport;
private String searchTxt;
private long qtaMaxAcquistoWww;
private double ricarico;
private long flgGoogle;
private Tipo tipo;
private long flgAbilita = -1L;
public WwwAutomatorCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public WwwAutomatorCR() {}
public void setId_wwwAutomator(long newId_wwwAutomator) {
this.id_wwwAutomator = newId_wwwAutomator;
}
public void setId_tipo(long newId_tipo) {
this.id_tipo = newId_tipo;
setTipo(null);
}
public void setCategoriaImport(String newCategoriaImport) {
this.categoriaImport = newCategoriaImport;
}
public void setSearchTxt(String newSearchTxt) {
this.searchTxt = newSearchTxt;
}
public void setQtaMaxAcquistoWww(long newQtaMaxAcquistoWww) {
this.qtaMaxAcquistoWww = newQtaMaxAcquistoWww;
}
public void setRicarico(double newRicaricoBA) {
this.ricarico = newRicaricoBA;
}
public void setFlgGoogle(long newFlgGoogle) {
this.flgGoogle = newFlgGoogle;
}
public long getId_wwwAutomator() {
return this.id_wwwAutomator;
}
public long getId_tipo() {
return this.id_tipo;
}
public String getCategoriaImport() {
return (this.categoriaImport == null) ? "" : this.categoriaImport.trim();
}
public String getSearchTxt() {
return (this.searchTxt == null) ? "" : this.searchTxt.trim();
}
public long getQtaMaxAcquistoWww() {
return this.qtaMaxAcquistoWww;
}
public double getRicarico() {
return this.ricarico;
}
public long getFlgGoogle() {
return this.flgGoogle;
}
public void setTipo(Tipo newTipo) {
this.tipo = newTipo;
}
public Tipo getTipo() {
this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class,
getId_tipo());
return this.tipo;
}
public long getFlgAbilita() {
return this.flgAbilita;
}
public void setFlgAbilita(long flgAbilita) {
this.flgAbilita = flgAbilita;
}
}

View file

@ -0,0 +1,108 @@
package it.acxent.cc.api;
import it.acxent.api.ApiClientResult;
import it.acxent.api._AblApiClient;
import it.acxent.cc.Attivita;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class CcApi extends _AblApiClient {
public static final String API_PRODUCTION = "https://api.cupsolidale.it/api/v1/";
public static final String API_SANDBOX = "https://sandboxapi.cupsolidale.it/api/v1/";
private Attivita attivita;
private boolean debug = false;
private static final String URI_POST_IMPORT_CC = "/importcc/{id_documento}";
public CcApi(ApplParmFull apFull) {
super(apFull);
setUsername("acx-test");
setPassword("1qaz2wsx");
setUseSandbox(false);
}
public CcApi() {}
public static void main(String[] args) {
String hostname = "localhost";
String db = "misericordia";
ApplParmFull ap = new ApplParmFull(new ApplParm(17, "//" + hostname + ":3308/" + db, db, "root", "root", 1, 10, 300));
CcApi api = new CcApi(ap);
ApiClientResult res = api._postImportcc(1234L);
System.out.println(res.getMsg());
}
public Attivita getAttivita() {
if (this.attivita == null)
this.attivita = Attivita.getDefaultInstance(getApFull());
return this.attivita;
}
public String getEndpointProduction() {
return "https://atr.f3.com/api/";
}
public String getEndpointSandbox() {
return "http://localhost/atr4/api/";
}
public ApiClientResult _postImportcc(long l_id_documento) {
ApiClientResult resER = new ApiClientResult();
try {
if (this.debug)
System.out.println("CCApi --> _postImportcc");
CloseableHttpClient client = HttpClients.createDefault();
HttpPost request = new HttpPost(getEndpoint() + getEndpoint());
request.setHeader("Authorization", getBase64BasicCredential());
request.setHeader("Accept", "application/json");
request.setHeader("Content-Type", "application/json");
request.setHeader("Content-Language", "it-IT");
CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request);
String content = EntityUtils.toString(closeableHttpResponse.getEntity());
int statusCode = closeableHttpResponse.getStatusLine().getStatusCode();
if (this.debug) {
System.out.println("Status Code: " + statusCode);
System.out.println("\ncontent = " + content);
}
if (statusCode >= 400) {
resER.setOk(false);
JSONObject jo = new JSONObject(content);
resER.setMsg(jo.toString(2));
resER.setResult(jo);
} else {
JSONObject jo = new JSONObject(content);
if (this.debug)
System.out.println(jo.toString(4));
if (jo.has("success")) {
if (jo.getBoolean("success") == true) {
resER.setMsg(jo.getString("msg"));
resER.setOk(true);
resER.setResult(Long.valueOf(jo.getLong("id_rigaBolla")));
} else {
resER.setMsg(jo.getString("msg"));
resER.setOk(false);
}
} else {
resER.setMsg("Errore! Risposta non corretta!");
resER.setOk(false);
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
resER.setOk(false);
resER.setMsg(e.getMessage());
}
return resER;
}
}

View file

@ -0,0 +1 @@
package it.acxent.cc.api;

View file

@ -0,0 +1 @@
package it.acxent.cc;

View file

@ -0,0 +1,46 @@
package it.acxent.cc.servlet;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.common.Access;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.servlet.AblServletSvlt;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ArticoloSvlt extends AblServletSvlt {
private static final long serialVersionUID = 8449640401787842418L;
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new ArticoloCR(getApFull(req));
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
super.search(req, res);
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Articolo(getApFull(req));
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
protected String getBeanPageName(HttpServletRequest req) {
String temp = getBeanName(req);
Access access = new Access(getApFull(req));
access.findByPrimaryKey(Access.convertFieldToTableName(temp));
if (getRequestParameter(req, "sw").equals("1")) {
if (!access.getSuffissoE().isEmpty())
return temp + temp + "E";
return temp + "E";
}
return temp;
}
}

View file

@ -0,0 +1,149 @@
package it.acxent.cc.servlet;
import it.acxent.cc.Attivita;
import it.acxent.common.Blacklist;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.mail.MailMessage;
import it.acxent.mail.MailProperties;
import it.acxent.servlet.AcMailer;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CCMailer extends AcMailer {
private static final long serialVersionUID = 4639118494615519041L;
protected ResParm checkBlacklist(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ResParm rp = new ResParm(true);
if (apFull.getParm("MAIL_BLACKLIST_AUTO_FILL").isTrue()) {
System.out.println(getClass().getName());
Blacklist bl = new Blacklist(apFull);
bl.findByIp(apFull.getReqIpAddress(), false);
bl.setIpAddress(apFull.getReqIpAddress());
bl.setFatalCount(bl.getFatalCount() + 1L);
if (apFull.getParm("MAIL_BLACKLIST_AUTO_ENABLE").isTrue()) {
Timestamp tmstStartCount = bl.getTmstStartCount();
double secondiTraFatal = (double)((DBAdapter.getTimestamp().getTime() - tmstStartCount.getTime()) / 1000L);
if (secondiTraFatal < 60.0D) {
double l_fatalCountMax = apFull.getParm("MAIL_BLACKLIST_MAX_COUNT").getNumeroDouble() * secondiTraFatal / 60.0D;
System.out.println("#####\nsecondiFraInviiMailer: " + l_fatalCountMax + " current send mail count for " +
bl.getIpAddress() + ": " + bl.getFatalCount() + "\n#####");
if (l_fatalCountMax > 0.0D && (double)bl.getFatalCount() > l_fatalCountMax) {
bl.setTmstStartBlacklist(DBAdapter.getTimestamp());
bl.setDescrizione("Too many mailer send. Probably a sql injection attack!!!");
bl.setNotaBlacklist(apFull.getReqUrl());
bl.setFlgAttivo(1L);
sendDebugMailMessage(req, "ACXENT MAILER AUTO BLACKLIST :" + bl.getIpAddress(),
String.valueOf(bl.getTmstStartBlacklist()) + "\n\n" + String.valueOf(bl.getTmstStartBlacklist()));
rp.setStatus(false);
rp.setMsg(apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:",
getLang(req)) + " " + apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:", getLang(req)));
}
} else {
bl.setTmstStartCount(DBAdapter.getTimestamp());
bl.setFatalCount(1L);
}
}
bl.save();
}
return rp;
}
protected void sendMail(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
try {
ResParm rp = checkBlacklist(req, res);
if (rp.getStatus()) {
MailMessage mf = null;
String mailMessageFile = getMailMessageFile(req);
String lang = getLang(req);
String ipAddress = req.getRemoteHost() + " " + req.getRemoteHost();
Date d = new Date(System.currentTimeMillis());
if (!mailMessageFile.isEmpty()) {
mf = new MailMessage(apFull, mailMessageFile);
Attivita.sendMailStandardData(mf, lang, Attivita.getDefaultInstance(apFull), req);
}
Enumeration<String> enu = req.getParameterNames();
StringBuffer theMsg = new StringBuffer("");
String attName = "";
String attValue = "";
while (enu.hasMoreElements()) {
attName = enu.nextElement();
attValue = getRequestParameter(req, attName);
if (!attName.equals("cmd") && !attName.equals("act") && !attName.equals("mailFrom") &&
!attName.equals("MAIL_FROM_MAILER") && !attName.equals("MAIL_TO_MAILER") && !attName.equals("mailSubject") &&
!attName.equals("mailOkMsg") && !attName.equals("mailKoMsg") &&
!attName.equals("mailResponsePage") && !attName.equals("mailFile")) {
if (mf != null) {
mf.setString(attName, attValue);
continue;
}
theMsg.append(attName);
theMsg.append(": ");
theMsg.append(attValue);
theMsg.append("\n");
}
}
MailProperties prop = new MailProperties();
if (getRequestParameter(req, "mailTo").trim().isEmpty()) {
if (getRequestParameter(req, "MAIL_TO_MAILER").trim().isEmpty()) {
prop.setProperty("TO", getParm("MAIL_TO_MAILER").getTesto().trim());
} else {
prop.setProperty("TO", getParm(getRequestParameter(req, "MAIL_TO_MAILER")).getTesto().trim());
}
} else {
prop.setProperty("TO", getRequestParameter(req, getRequestParameter(req, "mailTo").trim()));
}
if (!getParm("MAIL_BCC_MAILER").getTesto().equals(""))
prop.setProperty("BCC", getParm("MAIL_BCC_MAILER").getTesto());
if (getRequestParameter(req, "mailFrom").equals("")) {
prop.setProperty("FROM", getParm(getRequestParameter(req, "MAIL_FROM_MAILER")).getTesto());
} else {
prop.setProperty("FROM", getRequestParameter(req, "mailFrom"));
}
prop.setProperty("SUBJECT", getRequestParameter(req, "mailSubject"));
if (mf != null) {
mf.setString("ip", ipAddress);
mf.setString("timestamp", d.toString());
prop.setProperty("MSG", mf.getMessage());
prop.setProperty("ISHTML", String.valueOf(isMessageHtml(mailMessageFile)));
} else {
theMsg.append("\nIP: ");
theMsg.append(ipAddress);
theMsg.append("\ntimestamp:");
theMsg.append(d.toString());
theMsg.append("\n");
prop.setProperty("MSG", theMsg.toString());
prop.setProperty("ISHTML", "false");
}
DBAdapter.logDebug(true, "\n" + prop.toString());
MailMessage mm = new MailMessage(getApFull());
mm.sendMailMessage(prop, false);
if (getRequestParameter(req, "mailOkMsg").equals("")) {
sendMessage(req, apFull.translate("La mail e' stata inviata correttamente.", getLang(req)));
} else {
sendMessage(req, getRequestParameter(req, "mailOkMsg"));
}
chiamaJsp(req, res);
} else {
sendMessage(req, rp.getMsg());
chiamaJsp(req, res);
}
} catch (Exception e) {
handleDebug(e);
if (getRequestParameter(req, "mailKoMsg").equals("")) {
sendMessage(req, apFull.translate("Impossibile inviare mail: ", getLang(req)) + " " + apFull.translate("Impossibile inviare mail: ", getLang(req)));
} else {
sendMessage(req, getRequestParameter(req, "mailKoMsg") + ": " + getRequestParameter(req, "mailKoMsg"));
}
chiamaJsp(req, res);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,583 @@
package it.acxent.cc.servlet;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.art.ArticoloComponente;
import it.acxent.art.ArticoloTaglia;
import it.acxent.art.ArticoloVariante;
import it.acxent.art.Lista;
import it.acxent.art.Marca;
import it.acxent.art.Tipo;
import it.acxent.art.TipoAccessorio;
import it.acxent.common.Users;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CatalogoSvlt extends it.acxent.www.servlet.CatalogoSvlt {
boolean debug = false;
private static final long serialVersionUID = -5684833919477899107L;
protected int getPageRow(HttpServletRequest req) {
int pr = (int)getRequestLongParameter(req, "pageRow");
if (pr == 0)
return 12;
return pr;
}
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
try {
req.setAttribute("listaPadri", getTipo(req).findPadri());
if (this.debugTs)
System.out.println("fillComboAfterDetail listaPadri: ms: " + this.timer.getDurataMilliSec());
Articolo bean = (Articolo)l_bean;
req.setAttribute("listaAccessori", bean.getAccessori());
if (this.debugTs)
System.out.println("fillComboAfterDetail listaAccessori: ms: " + this.timer.getDurataMilliSec());
req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll());
if (this.debugTs)
System.out.println("fillComboAfterDetail listaTipiAccessorio: ms: " + this.timer.getDurataMilliSec());
req.setAttribute("listaArticoloComponenti", new ArticoloComponente(apFull).findByArticolo(bean.getId_articolo()));
if (this.debugTs)
System.out.println("fillComboAfterDetail listaArticoloComponenti: ms: " + this.timer.getDurataMilliSec());
if (getAct(req).equals("zoom")) {
String imgNumber = getRequestParameter(req, "imgNumber");
req.setAttribute("imgNumber", imgNumber);
}
if (req.getAttribute("msg").equals("Lettura effettuata") || req.getAttribute("msg").equals("Read Ok"))
req.setAttribute("msg", "");
} catch (Exception e) {
e.printStackTrace();
}
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
if (this.debugTs)
this.timer.start();
if (this.debugTs)
System.out.println("\n############### showBean start: ms: " + this.timer.getDurataMilliSec());
ApplParmFull apFull = getApFull(req);
Articolo bean = new Articolo(apFull);
String url = (String)req.getAttribute("_requestUrl");
boolean vaiAvanti = true;
try {
String redirectLink = "index.html";
if (url.indexOf("Catalogo.abl?") > 0) {
vaiAvanti = false;
String codice = getRequestParameter(req, "id_articolo");
bean.findByCodice(codice);
if (bean.getId_articolo() > 0L) {
String lang = "it";
redirectLink = bean.getTipo().getDescrizioneCompletaPlus(lang) + "+" + bean.getTipo().getDescrizioneCompletaPlus(lang) + "+articolo-" + DBAdapter.convertStringToLink(bean.getDescrizioneNomeUrl()) + "--it.html";
}
}
if (!vaiAvanti) {
res.setStatus(301);
res.setHeader("Location", redirectLink);
res.setHeader("Connection", "close");
vaiAvanti = false;
}
} catch (Exception e) {}
if (this.debugTs)
System.out.println("showBean redirect: ms: " + this.timer.getDurataMilliSec());
if (vaiAvanti) {
ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR");
if (CR == null)
CR = new ArticoloCR(apFull);
CR.setSearchTxtWeb(getRequestParameter(req, "searchTxtWeb"));
CR.setLang(getLang(req));
if (this.debug)
System.out.println("attcr1" + CR.getFlgDisponibile());
req.setAttribute("CR", CR);
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
bean.findByPrimaryKey(l_id_articolo);
if (this.debugTs)
System.out.println("showBean findByPrimaryKey: ms: " + this.timer.getDurataMilliSec());
if (bean.getId_articolo() > 0L) {
if (!isRequestFromCrawler(req).getStatus()) {
Users user = getLoginUser(req);
if (user == null || user.getId_userProfile() != 1L)
Articolo.addImpression(bean);
}
req.setAttribute("act", "articolo");
} else {
sendMessage(req, bean.translate("Il prodotto che stai cercando non è più disponibile.", getLang(req)));
forceJspPage("/form-ricerca-prodotti.jsp", req);
}
if (this.debugTs)
System.out.println("showBean impression: ms: " + this.timer.getDurataMilliSec());
super.showBean(req, res);
if (this.debugTs) {
this.timer.stop();
System.out.println("--------------- stop ShowBean: ms: " + this.timer.getDurataMilliSec());
}
}
}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = (ArticoloCR)CRA;
req.setAttribute("listaPadri", CR.getTipo().findPadri());
}
protected DBAdapter getBean(HttpServletRequest req) {
ApplParmFull apFull = getApFull(req);
return new Articolo(apFull);
}
protected String getBeanPageName(HttpServletRequest req) {
return super.getBeanPageName(req);
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = new ArticoloCR(apFull);
Articolo bean = new Articolo(apFull);
String l_lang = getLang(req);
if (getAct(req).equals("back")) {
CR = (ArticoloCR)req.getSession().getAttribute("CR");
if (CR != null) {
if (CR.getPageNumber() > 0)
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
} else {
CR = new ArticoloCR(apFull);
}
} else {
fillObject(req, CR);
}
boolean faiRicerca = true;
if (this.debug)
System.out.println("catalogo 1");
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) {
if (this.debug)
System.out.println("catalogo 2");
CR.setCodice(CR.getSearchTxtWeb().substring(2));
CR.setSearchTxtWeb("");
bean.findByCodice(CR.getCodice());
if (bean.getId_articolo() > 0L) {
if (this.debug)
System.out.println("catalogo 3");
req.setAttribute("listaPadri", bean.getTipo().findPadri());
req.setAttribute("act", "articolo");
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
super.showBean(req, res);
faiRicerca = false;
}
} else {
if (this.debug)
System.out.println("catalogo 4");
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) {
if (this.debug)
System.out.println("catalogo 5");
CR.setTagArticolo(CR.getSearchTxtWeb().substring(1));
}
}
String url = (String)req.getAttribute("_requestUrl");
if (this.debug)
System.out.println("catalogo 6");
try {
boolean redirect = false;
if (url.indexOf("sendinblue") < 0)
if (url.indexOf("addItem") > 0) {
redirect = false;
} else if (url.indexOf("Catalogo.abl?") > 0) {
redirect = true;
} else if (url.indexOf("_") > 0) {
redirect = true;
}
if (redirect) {
if (this.debug)
System.out.println("catalogo 7");
res.setStatus(301);
res.setHeader("Location", "index.html");
res.setHeader("Connection", "close");
faiRicerca = false;
}
} catch (Exception e) {
System.out.println("----------------------------- ERRORE url\n" + url);
}
if (this.debug)
System.out.println("catalogo 8");
if (faiRicerca) {
if (this.debug)
System.out.println("catalogo 9");
if (CR.getPageRow() > 96) {
CR.setPageRow(96);
} else if (CR.getPageRow() <= 0) {
CR.setPageRow(12);
}
if (CR.getPageNumber() <= 0)
CR.setPageNumber(1);
if (!CR.getTag().isEmpty()) {
if (this.debug)
System.out.println("catalogo 10");
req.getSession().removeAttribute("tag");
}
CR.setId_tipo(CR.getId_tipoSel());
CR.setFlgNascondi(0L);
CR.setFlgEscludiWeb(0L);
if (!CR.getFiltri_id().isEmpty()) {
if (this.debug)
System.out.println("catalogo 11");
ArticoloCR.setCCCRFromtFiltriId(CR);
}
bean.setId_iva(bean.getCodiceIvaVendStd());
if (CR.getSearchTxtWeb().length() == 0) {
CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR));
CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR));
}
if (this.debug)
System.out.println("catalogo 12");
String tag = "";
if (req.getSession().getAttribute("tag") != null)
tag = (String)req.getSession().getAttribute("tag");
CR.setTag(tag);
if (this.debug)
System.out.println("catalogo 13");
Vectumerator<Articolo> list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req));
try {
if (this.debug)
System.out.println("catalogo 14");
ArticoloCR CRS = CR.getClone();
req.getSession().setAttribute("CR", CRS);
if (this.debug)
System.out.println("attcr2" + CR.getFlgDisponibile());
req.setAttribute("CR", CRS);
} catch (Exception e) {
e.printStackTrace();
}
if (this.debug)
System.out.println("catalogo 15");
if (list.getTotNumberOfRecords() > 0) {
if (this.debug)
System.out.println("catalogo 16");
req.setAttribute("list", list);
req.setAttribute("listaPadri", CR.getTipo().findPadri());
if (CR.getSearchTxtWeb().isEmpty()) {
req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag()));
} else {
req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0));
long id_tipoSel = CR.getId_tipoSel();
CR.setId_tipoSel(0L);
req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0));
CR.setId_tipoSel(id_tipoSel);
}
forceJspPage("/articoloCR.jsp", req);
} else {
forceJspPage("/form-ricerca-prodotti.jsp", req);
}
if (this.debug)
System.out.println("catalogo -------------------");
callJsp(req, res);
}
}
public void _aggiornaQuantitaTaglie(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_articoloTaglia = getRequestLongParameter(req, "id_articoloTaglia");
ArticoloTaglia at = new ArticoloTaglia(apFull);
at.findByPrimaryKey(l_id_articoloTaglia);
sendHtmlMsgResponse(req, res, String.valueOf((long)at.getQuantitaAt()));
}
public void _searchAv(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = new ArticoloCR(apFull);
fillObject(req, CR);
CR.setFlgNascondi(0L);
CR.setFlgEscludiWeb(0L);
req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)));
req.setAttribute("listaPadri", CR.getTipo().findPadri());
if (this.debug)
System.out.println("attcr3" + CR.getFlgDisponibile());
req.setAttribute("CR", CR);
forceJspPage("/articoloVarianteCR.jsp", req);
callJsp(req, res);
}
protected void searchVarianti(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = new ArticoloCR(apFull);
if (getAct(req).equals("back")) {
CR = (ArticoloCR)req.getSession().getAttribute("CR");
if (CR != null) {
if (CR.getPageNumber() > 0)
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
} else {
CR = new ArticoloCR(apFull);
}
} else {
fillObject(req, CR);
}
fillObject(req, CR);
CR.setId_tipo(CR.getId_tipoSel());
CR.setFlgNascondi(0L);
CR.setFlgEscludiWeb(0L);
req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)));
req.setAttribute("listaPadri", CR.getTipo().findPadri());
Lista lista = new Lista(getApFull(req));
req.setAttribute("listaCaratteristica1", lista.findLista(1L, 0, 0));
req.getSession().setAttribute("CR", CR);
req.setAttribute("listaFiltri", lista.findByTipo(CR.getId_tipo(), getLang(req)));
if (this.debug)
System.out.println("attcr4" + CR.getFlgDisponibile());
req.setAttribute("CR", CR);
forceJspPage("/articoloVarianteCR.jsp", req);
callJsp(req, res);
}
public void _level1(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = new ArticoloCR(apFull);
fillObject(req, CR);
if (!CR.getTag().isEmpty())
req.getSession().removeAttribute("tag");
if (this.debug)
System.out.println("attcr5" + CR.getFlgDisponibile());
req.setAttribute("CR", CR);
long l_id_tipoPadre = CR.getId_tipoSel();
Tipo tipo = new Tipo(apFull);
tipo.findByPrimaryKey(l_id_tipoPadre);
req.setAttribute("currentTipo", tipo);
forceJspPage("/level1.jsp", req);
callJsp(req, res);
}
private void updateCRFiltri(ArticoloCR CR, String currentFiltro, String currentValues) {
if (currentValues.endsWith(","))
currentValues = currentValues.substring(0, currentValues.length() - 1);
if (!currentFiltro.isEmpty() && !currentValues.isEmpty())
if (currentFiltro.toLowerCase().equals("m")) {
CR.setId_marche(currentValues);
} else if (currentFiltro.equals("pd")) {
CR.setPrezzoDa((double)Long.parseLong(currentValues));
} else if (currentFiltro.toLowerCase().equals("pa")) {
CR.setPrezzoA((double)Long.parseLong(currentValues));
} else if (currentFiltro.toLowerCase().equals("c")) {
CR.setFlgCondizioni(currentValues);
} else if (currentFiltro.toLowerCase().equals("d")) {
CR.setFlgDisponibilita(currentValues);
}
}
public void _mdCodice(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
String l_codice = getRequestParameter(req, "codice");
Articolo bean = new Articolo(apFull);
bean.findByCodice(l_codice);
if (bean.getId_articolo() > 0L) {
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
showBean(req, res);
} else {
forceJspPage("/index.html", req);
callJsp(req, res);
}
}
protected void searchOLD(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
ArticoloCR CR = new ArticoloCR(apFull);
Articolo bean = new Articolo(apFull);
String l_lang = getLang(req);
if (getAct(req).equals("back")) {
CR = (ArticoloCR)req.getSession().getAttribute("CR");
if (CR != null) {
if (CR.getPageNumber() > 0)
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
} else {
CR = new ArticoloCR(apFull);
}
} else {
fillObject(req, CR);
}
boolean faiRicerca = true;
if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) {
CR.setCodice(CR.getSearchTxtWeb().substring(2));
CR.setSearchTxtWeb("");
bean.findByCodice(CR.getCodice());
if (bean.getId_articolo() > 0L) {
req.setAttribute("listaPadri", bean.getTipo().findPadri());
req.setAttribute("act", "articolo");
req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo()));
super.showBean(req, res);
faiRicerca = false;
}
} else if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) {
CR.setTagArticolo(CR.getSearchTxtWeb().substring(1));
}
String url = (String)req.getAttribute("_requestUrl");
try {
boolean redirect = false;
if (url.indexOf("sendinblue") < 0)
if (url.indexOf("addItem") > 0) {
redirect = false;
} else if (url.indexOf("Catalogo.abl?") > 0) {
redirect = true;
} else if (url.indexOf("_") > 0) {
redirect = true;
}
if (redirect) {
res.setStatus(301);
res.setHeader("Location", "index.html");
res.setHeader("Connection", "close");
faiRicerca = false;
}
} catch (Exception e) {
System.out.println("----------------------------- ERRORE url\n" + url);
}
if (faiRicerca) {
if (CR.getPageRow() > 96) {
CR.setPageRow(96);
} else if (CR.getPageRow() <= 0) {
CR.setPageRow(12);
}
if (CR.getPageNumber() <= 0)
CR.setPageNumber(1);
if (!CR.getTag().isEmpty())
req.getSession().removeAttribute("tag");
CR.setId_tipo(CR.getId_tipoSel());
CR.setFlgNascondi(0L);
CR.setFlgEscludiWeb(0L);
if (!CR.getFiltri_id().isEmpty()) {
String filtri = "M,PD,PA,C,D,";
StringTokenizer st = new StringTokenizer(CR.getFiltri_id(), ",");
String currentFiltro = "";
StringBuilder currentValues = new StringBuilder();
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (filtri.contains(token + ",")) {
updateCRFiltri(CR, currentFiltro, currentValues.toString());
currentFiltro = token;
currentValues = new StringBuilder();
continue;
}
currentValues.append(token);
currentValues.append(",");
}
updateCRFiltri(CR, currentFiltro, currentValues.toString());
}
bean.setId_iva(bean.getCodiceIvaVendStd());
if (CR.getSearchTxtWeb().length() == 0) {
CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR));
CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR));
}
String tag = "";
if (req.getSession().getAttribute("tag") != null)
tag = (String)req.getSession().getAttribute("tag");
CR.setTag(tag);
Vectumerator<Articolo> list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req));
try {
ArticoloCR CRS = CR.getClone();
req.getSession().setAttribute("CR", CRS);
if (this.debug)
System.out.println("attcr6" + CR.getFlgDisponibile());
req.setAttribute("CR", CRS);
} catch (Exception e) {
e.printStackTrace();
}
if (list.getTotNumberOfRecords() > 0) {
req.setAttribute("list", list);
req.setAttribute("listaPadri", CR.getTipo().findPadri());
if (CR.getSearchTxtWeb().isEmpty()) {
req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag()));
} else {
req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0));
long id_tipoSel = CR.getId_tipoSel();
CR.setId_tipoSel(0L);
req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0));
CR.setId_tipoSel(id_tipoSel);
}
forceJspPage("/articoloCR.jsp", req);
} else {
forceJspPage("/form-ricerca-prodotti.jsp", req);
}
callJsp(req, res);
}
}
public void _fetchInclude(HttpServletRequest req, HttpServletResponse res) {
String items = getRequestParameter(req, "items").trim();
if (items.isEmpty()) {
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
} else {
String id_articolo = getRequestParameter(req, "id_articolo");
if (!id_articolo.equals("undefined"))
items = items.replace(id_articolo, "");
items = items.replaceAll(",,", "");
if (items.isEmpty() || items.equals(",")) {
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
} else {
ArticoloCR CR = new ArticoloCR();
CR.setLastItems(items);
req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0));
}
}
req.setAttribute("nf", getNf());
req.setAttribute("nf0", getNf0());
forceJspPage("/_inc_lastItems.jsp", req);
callJsp(req, res);
}
protected void callJsp(HttpServletRequest req, HttpServletResponse res) {
super.callJsp(req, res);
}
public void _infoProdotto(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_articolo = getRequestLongParameter(req, "id_articolo");
Articolo bean = new Articolo(apFull);
bean.findByPrimaryKey(l_id_articolo);
if (bean.getId_articolo() > 0L) {
ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR");
if (CR == null)
CR = new ArticoloCR(apFull);
CR.setLang(getLang(req));
if (this.debug)
System.out.println("attcr7" + CR.getFlgDisponibile());
req.setAttribute("CR", CR);
req.setAttribute("bean", bean);
forceJspPage("/form-info-prodotto.jsp", req);
callJsp(req, res);
} else {
forceJspPage("/form-ricerca-prodotti.jsp", req);
callJsp(req, res);
}
}
protected void fillObject(HttpServletRequest req, Object CRo) {
ArticoloCR CR = (ArticoloCR)CRo;
super.fillObject(req, CR);
String q = getRequestParameter(req, "q");
if (!q.isEmpty())
CR.setSearchTxtWeb(q);
}
public void _loadLastItems(HttpServletRequest req, HttpServletResponse res) {
String items = getRequestParameter(req, "items").trim();
if (items.isEmpty()) {
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
} else {
String id_articolo = getRequestParameter(req, "id_articolo");
if (!id_articolo.equals("undefined"))
items = items.replace(id_articolo, "");
items = items.replaceAll(",,", "");
if (items.isEmpty() || items.equals(",")) {
req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR);
} else {
ArticoloCR CR = new ArticoloCR();
CR.setLastItems(items);
req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0));
}
}
req.setAttribute("nf", getNf());
req.setAttribute("nf0", getNf0());
forceJspPage("/_inc_lastItems.jsp", req);
callJsp(req, res);
}
}

View file

@ -0,0 +1,42 @@
package it.acxent.cc.servlet;
import it.acxent.cc.Attivita;
import it.acxent.jsp.Ab;
import it.acxent.servlet.AcServlet;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class IndexWwwSvlt extends AcServlet {
private static final long serialVersionUID = -6624665938374872005L;
private static final String HTML = ".html";
private static final String INDEX = "index-";
private static final String LOCATION = "Location";
private static final String _INC_MENU_JSP = "_inc_menu.jsp";
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
try {
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
String currentLang = (String)req.getSession().getAttribute("LANG".toLowerCase());
if (currentLang == null || currentLang.isEmpty())
currentLang = Ab.getBrowserLang(req, Locale.ENGLISH.getLanguage());
if (attivita.getLangDisponibili().indexOf(currentLang) < 0)
currentLang = attivita.getLangSeNonDisponibile();
req.getSession().setAttribute("LANG".toLowerCase(), currentLang);
String url = req.getRequestURL().toString();
System.out.println("INDEX.HTML Incomming URL = " + url + " lang_:" + currentLang);
res.setStatus(301);
res.setHeader("Location", attivita.getWwwAddress() + "index-" + attivita.getWwwAddress() + ".html");
} catch (Exception e) {
handleDebug(e);
}
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
}

View file

@ -0,0 +1,64 @@
package it.acxent.cc.servlet;
import it.acxent.common.Users;
import it.acxent.db.ApplParmFull;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogonSvlt extends it.acxent.servlet.LogonSvlt {
protected boolean checkLoginProfile(HttpServletRequest req) {
try {
if (getLoginUser(req) == null) {
forceJspPage(getLoginPage(req, null), req);
return true;
}
if (getLoginUser(req).getFlgValido().equals("N")) {
forceJspPage(getLoginPage(req, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return false;
}
if (getLoginUser(req).getId_userProfile() == getParm("USER_PROFILE_ID_WWW").getNumeroLong()) {
forceJspPage(getLoginPage(req, null), req);
return true;
}
forceJspPage(getLoginPage(req, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return false;
} catch (Exception e) {
handleDebug(e);
return false;
}
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return getRequestParameter(req, "thePage");
}
protected Users getUser(HttpServletRequest req) {
ApplParmFull apFull = getApFull();
return new it.acxent.anag.Users(apFull);
}
protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception {
ApplParmFull apFull = getApFull(req);
req.setAttribute("msg", "");
req.setAttribute("cmd", "updateCart");
setJspPage("Cart.abl", req);
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
rd.forward((ServletRequest)req, (ServletResponse)res);
}
protected boolean useControlCodeAccess() {
return false;
}
protected void loginKO(HttpServletRequest req, HttpServletResponse res) {
super.loginKO(req, res);
forceMessage(req, "Login errato o inesistente!");
}
}

View file

@ -0,0 +1,274 @@
package it.acxent.cc.servlet;
import it.acxent.anag.TipoPagamento;
import it.acxent.anag.Users;
import it.acxent.cc.Attivita;
import it.acxent.common.Access;
import it.acxent.contab.Documento;
import it.acxent.contab.DocumentoCR;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.AbMessages;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class OrdineSvlt extends it.acxent.www.servlet.OrdineSvlt {
private static final long serialVersionUID = 8880000554136161006L;
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)l_bean;
req.setAttribute("listaTipoPagamento", new TipoPagamento(
getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"),
(bean.getFlgDeliveryType() == 2L)));
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
if (req.getAttribute("msg").equals("Lettura effettuata"))
req.setAttribute("msg", "");
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Documento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void payBonifico(HttpServletRequest req, HttpServletResponse res) {
try {
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id_documento);
bean.setDataPagamento(DBAdapter.getToday());
ResParm rp = bean.save();
String theMsg = "";
if (rp.getStatus());
} catch (Exception e) {
e.printStackTrace();
forceMessage(req, e.getMessage());
}
showBean(req, res);
}
protected void payCc(HttpServletRequest req, HttpServletResponse res) {
try {
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id_documento);
long l_flgTipoPagamento = getRequestLongParameter(req, "flgTipoPagamento");
ResParm rp = bean.save();
String theMsg = "";
req.setAttribute("bean", bean);
if (rp.getStatus()) {
forceJspPageRelative("DocumentoCc.jsp", req);
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
callJsp(req, res);
}
} catch (Exception e) {
e.printStackTrace();
forceMessage(req, e.getMessage());
showBean(req, res);
}
}
protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) {
try {
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id_documento);
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
bean.setId_tipoPagamento(l_id_tipoPagamento);
ResParm rp = bean.save();
String theMsg = "";
req.setAttribute("bean", bean);
forceJspPageRelative("Documento.jsp", req);
callJsp(req, res);
} catch (Exception e) {
e.printStackTrace();
forceMessage(req, e.getMessage());
showBean(req, res);
}
}
protected void cancelOrder(HttpServletRequest req, HttpServletResponse res) {
try {
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id_documento);
bean.setFlgStatoOrdineWww(99L);
bean.setFlgStatoPrenotazione(100L);
ResParm rp = bean.save();
String theMsg = "";
req.setAttribute("bean", bean);
sendMessage(req, "Documento annullato");
showBean(req, res);
} catch (Exception e) {
e.printStackTrace();
forceMessage(req, e.getMessage());
showBean(req, res);
}
}
protected void sendMailOrder(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Documento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_documento");
bean = new Documento(apFull);
try {
bean.findByPrimaryKey(l_id);
Attivita attivita = Attivita.getDefaultInstance(apFull);
Users utente = (Users)getLoginUser(req);
rp = attivita.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
sendMessage(req, rp.getMsg());
} catch (Exception e) {
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
}
showBean(req, res);
}
protected String getCRAttribute(HttpServletRequest req) {
return "CROrd";
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = new DocumentoCR(getApFull(req));
fillObject(req, CR);
if (getLoginUserId(req) != null && getLoginUserId(req) > 0L) {
Users user = (Users)getLoginUser(req);
System.out.println("ordinesvlt beforeSearch: id_clifor " + user.getId_clifor());
if (user.getId_clifor() == 0L) {
req.setAttribute("id_clifor", "-1");
} else {
req.setAttribute("id_clifor", String.valueOf(user.getId_clifor()));
}
req.setAttribute("id_tipoDocumento", Long.valueOf(getParm("ID_DOC_ORDINE_WWW").getNumeroLong()));
if (CR.getFlgStatoOrdineWww() < 0L)
req.setAttribute("flgStatoOrdineWww", "0");
req.setAttribute("id_users", "0");
} else {
sendMessage(req, "&nbsp;");
}
return new ResParm(true);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
String idCryptParm = "idcrypt";
String l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm);
if (l_id_ordineCript != null && !l_id_ordineCript.isEmpty()) {
_vediOrdineCrypt(req, res);
} else {
String cmd = getCmd(req);
if (cmd.equals("payBon")) {
payBonifico(req, res);
} else if (cmd.equals("payCc")) {
payCc(req, res);
} else if (cmd.equals("refreshPayment")) {
refreshPayment(req, res);
} else if (cmd.equals("cancelOrder")) {
cancelOrder(req, res);
} else if (cmd.equals("sendMailOrder")) {
sendMailOrder(req, res);
} else {
forceJspPageRelative("documentoCR.jsp", req);
search(req, res);
}
}
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
long l_id_documento = getRequestLongParameter(req, "id_documento");
Documento bean = new Documento(getApFull(req));
bean.findByPrimaryKey(l_id_documento);
if (bean.getDBState() == 1 && bean.getId_tipoPagamento() == 4L && bean.getFlgProcediPagamento() == 1L &&
bean.getDescTransaction().isEmpty())
bean.agiornaNuovoId_documentoXpay();
super.showBean(req, res);
}
public void _impostaMP(HttpServletRequest req, HttpServletResponse res) {
Users user = (Users)getLoginUser(req);
ApplParmFull apFull = getApFull(req);
Attivita attivita = Attivita.getDefaultInstance(apFull);
if (user != null && user.getDBState() == 1) {
Documento bean = new Documento(apFull);
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
bean.findByPrimaryKey(l_id_documento);
if (bean.getId_documento() > 0L) {
bean.setId_tipoPagamento(l_id_tipoPagamento);
bean.setSpeseTrasporto(bean.getDeliveryCostOrdine(user.getClifor()));
ResParm rp = bean.save();
if (rp.getStatus())
attivita.sendOrderMailMessageCC(bean, user, user.getLang(), true, true, true, false, req);
}
showBean(req, res);
} else {
showBean(req, res);
}
}
public void _aggiornaRichiediFattura(HttpServletRequest req, HttpServletResponse res) {
Users user = (Users)getLoginUser(req);
ApplParmFull apFull = getApFull(req);
if (user != null && user.getDBState() == 1) {
Documento bean = new Documento(apFull);
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura");
bean.findByPrimaryKey(l_id_documento);
if (bean.getId_documento() > 0L) {
bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura);
bean.superSave();
}
}
}
protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
return super.beforeSave(beanA, req, res);
}
protected String getBeanPageName(HttpServletRequest req) {
String temp = getBeanName(req);
Users user = (Users)getLoginUser(req);
ApplParmFull apFull = getApFull(req);
Access access = new Access(getApFull(req));
access.findByPrimaryKey(Access.convertFieldToTableName(temp));
if (getRequestParameter(req, "sw").equals("1")) {
if (!access.getSuffissoE().isEmpty())
return temp + temp + "E";
return temp + "E";
}
return temp;
}
public void _aggiornaRichiediFatturaMd(HttpServletRequest req, HttpServletResponse res) {
Users user = (Users)getLoginUser(req);
ApplParmFull apFull = getApFull(req);
if (user != null && user.getDBState() == 1) {
Documento bean = new Documento(apFull);
long l_id_documento = getRequestLongParameter(req, "id_documento");
long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura");
bean.findByPrimaryKey(l_id_documento);
if (bean.getId_documento() > 0L) {
bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura);
bean.superSave();
}
showBean(req, res);
}
}
protected String getBEANAttribute(HttpServletRequest req) {
return super.getBEANAttribute(req);
}
protected boolean isCostoSpedizioneFull() {
return getParm("CC_COSTO_SPED_FULL").isTrue();
}
}

View file

@ -0,0 +1,61 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Users;
import it.acxent.bank.paypal.PayPalResp;
import it.acxent.cart.Cart;
import it.acxent.cc.Attivita;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.gtm.GoogleDataLayer;
import it.acxent.gtm.GoogleDataLayerBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PayPalDoPaymentSvlt extends PayPalSvlt {
protected static ApplParmFull ap2;
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
ApplParmFull apFull = getApFull(req);
Users utente = (Users)getLoginUser(req);
if (ppResponse != null && ppResponse.isPaymentDone()) {
long l_id_ordine = ppResponse.getId_ordine();
Documento bean = new Documento(apFull);
System.out.println("paypaldopayment recordOrder: " + l_id_ordine);
bean.findByProgOrdineWww(l_id_ordine);
bean.setDataPagamento(DBAdapter.getToday());
bean.setDataTransaction(DBAdapter.getToday());
bean.setDescTransaction(ppResponse.getTRANSACTIONID());
bean.setFlgPagata(1L);
ResParm rp = bean.save();
if (rp.getStatus())
rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
Attivita attivita = Attivita.getDefaultInstance(apFull);
if (attivita.isTagManagerAttivo()) {
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
req.setAttribute("_gdl", gdl);
}
}
}
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
long l_id_ordine = 0L;
if (ppResponse != null)
l_id_ordine = ppResponse.getId_ordine();
Documento bean = new Documento(getApFull());
bean.findByProgOrdineWww(l_id_ordine);
req.setAttribute("bean", bean);
}
protected String getCheckOutMailMessage() {
return getParm(Cart.P_CHECKOUTMSG).getTesto();
}
protected ApplParmFull getAp2() {
if (ap2 == null)
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
return ap2;
}
}

View file

@ -0,0 +1,35 @@
package it.acxent.cc.servlet;
import it.acxent.bank.paypal.PayPalResp;
import it.acxent.bank.servlet.paypal.GetPayPalResponseSvlt;
import it.acxent.cart.Cart;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PayPalResponseSvlt extends GetPayPalResponseSvlt {
private static final long serialVersionUID = -7370187024494888710L;
protected static ApplParmFull ap2;
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
long l_id_ordine = 0L;
if (ppResponse != null)
l_id_ordine = ppResponse.getId_ordine();
Documento bean = new Documento(getApFull());
bean.findByProgOrdineWww(l_id_ordine);
req.setAttribute("bean", bean);
}
protected String getCheckOutMailMessage() {
return getParm(Cart.P_CHECKOUTMSG).getTesto();
}
protected ApplParmFull getAp2() {
if (ap2 == null)
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
return ap2;
}
}

View file

@ -0,0 +1,65 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Users;
import it.acxent.bank.paypal.PayPalResp;
import it.acxent.cart.Cart;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PayPalSvlt extends it.acxent.bank.servlet.paypal.PayPalSvlt {
private static final long serialVersionUID = -7977873008193998783L;
protected static ApplParmFull ap2;
protected String getCheckOutMailMessage() {
return getParm(Cart.P_CHECKOUTMSG).getTesto();
}
protected ApplParmFull getAp2() {
if (ap2 == null)
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
return ap2;
}
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
long l_id_ordine = 0L;
if (ppResponse != null)
l_id_ordine = ppResponse.getId_ordine();
Documento bean = new Documento(getApFull());
bean.findByProgOrdineWww(l_id_ordine);
req.setAttribute("bean", bean);
}
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
ApplParmFull apFull = getApFull(req);
Users utente = (Users)getLoginUser(req);
if (ppResponse != null && ppResponse.isPaymentDone()) {
long l_id_ordine = ppResponse.getId_ordine();
Documento bean = new Documento(apFull);
System.out.println("paypalsvlt recordOrder: " + l_id_ordine);
bean.findByProgOrdineWww(l_id_ordine);
bean.setDataPagamento(DBAdapter.getToday());
bean.setDataTransaction(DBAdapter.getToday());
bean.setDescTransaction(ppResponse.getTRANSACTIONID());
bean.setFlgPagata(1L);
ResParm rp = bean.save();
if (rp.getStatus()) {
if (bean.getFlgWwwRichiedeFattura() == 1L) {
long l = 22L;
} else {
long l = 23L;
}
rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
}
}
}
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
super.processRequest(req, res);
}
}

View file

@ -0,0 +1,77 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Users;
import it.acxent.bank.paypalcheckout.PayPalReq;
import it.acxent.cc.Attivita;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.gtm.GoogleDataLayer;
import it.acxent.gtm.GoogleDataLayerBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
public class PaypalCheckoutSvlt extends it.acxent.bank.servlet.paypalcheckout.PaypalCheckoutSvlt {
private static final long serialVersionUID = 5775575153032080843L;
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) {
ApplParmFull apFull = getApFull(req);
String orderId = jso.getString("id");
String status = jso.getString("status");
System.out.println("paypalsvltcheckout recordOrder prog www: status" + status + " orderid:" + orderId);
if (status.equals("COMPLETED")) {
Documento bean = new Documento(apFull);
bean.findByDescTransaction(orderId);
System.out.println("paypalsvltcheckout recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO");
bean.setDataPagamento(DBAdapter.getToday());
bean.setDataTransaction(DBAdapter.getToday());
bean.setDescTransaction(orderId);
bean.setFlgPagata(1L);
ResParm rp = bean.save();
if (rp.getStatus()) {
if (bean.getFlgWwwRichiedeFattura() == 1L) {
long l = 22L;
} else {
long l = 23L;
}
Attivita attivita1 = Attivita.getDefaultInstance(apFull);
Users utente = (Users)getLoginUser(req);
rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
}
Attivita attivita = Attivita.getDefaultInstance(apFull);
if (attivita.isTagManagerAttivo()) {
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
req.setAttribute("_gdl", gdl);
}
}
}
protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
PayPalReq pReq = new PayPalReq();
String l_id_docCrypt = getRequestParameter(req, "id");
long l_id = 0L;
try {
l_id = Long.parseLong(DBAdapter.deCrypt(l_id_docCrypt));
} catch (Exception e) {}
if (l_id > 0L) {
Documento doc = new Documento(apFull);
doc.findByPrimaryKey(l_id);
pReq.setId_ordine(doc.getId_documento());
pReq.setAmt(doc.getTotaleDocumento());
}
return pReq;
}
protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) {
ApplParmFull apFull = getApFull(req);
Documento doc = new Documento(apFull);
doc.findByPrimaryKey(pReq.getId_ordine());
if (doc.getId_documento() > 0L) {
doc.setDescTransaction(pReq.getPaypalOrderId());
doc.superSave();
}
}
}

View file

@ -0,0 +1,78 @@
package it.acxent.cc.servlet;
import it.acxent.contab.Documento;
import it.acxent.contab.DocumentoCR;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.AbMessages;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ResoSvlt extends it.acxent.www.servlet.ResoSvlt {
private static final long serialVersionUID = -1875981812979270687L;
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)l_bean;
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
if (req.getAttribute("msg").equals("Lettura effettuata"))
req.setAttribute("msg", "");
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Documento(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new DocumentoCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void sendMailReso(HttpServletRequest req, HttpServletResponse res) {
Documento bean = null;
ResParm rp = new ResParm(true, "");
long l_id = getRequestLongParameter(req, "id_ordine");
bean = new Documento(getApFull(req));
try {
bean.findByPrimaryKey(l_id);
rp = bean.sendResoMailMessage();
sendMessage(req, rp.getMsg());
} catch (Exception e) {
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
}
showBean(req, res);
}
protected String getCRAttribute(HttpServletRequest req) {
return "CRRes";
}
protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) {
DocumentoCR CR = new DocumentoCR(getApFull(req));
if (getLoginUserId(req) != null)
req.setAttribute("id_users", String.valueOf(getLoginUserId(req).longValue()));
return new ResParm(true);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
String cmd = getCmd(req);
if (cmd.equals("sendMailReso")) {
sendMailReso(req, res);
} else {
search(req, res);
}
}
protected String getBeanPageName(HttpServletRequest req) {
return "reso";
}
protected ResParm afterSave(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
Documento bean = (Documento)l_bean;
return bean.sendResoMailMessage();
}
}

View file

@ -0,0 +1,76 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Users;
import it.acxent.bank.sella.SellaResp;
import it.acxent.bank.servlet.sella.GetSellaResponseSvlt;
import it.acxent.cart.Cart;
import it.acxent.cc.Attivita;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.gtm.GoogleDataLayer;
import it.acxent.gtm.GoogleDataLayerBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RicevutaSellaSvlt extends GetSellaResponseSvlt {
private static final long serialVersionUID = -5795730239132540019L;
protected static ApplParmFull ap2;
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
boolean debug = false;
ApplParmFull apFull = getApFull(req);
Users utente = (Users)getLoginUser(req);
if (sellaRes != null && sellaRes.getMyerrorcode().equals("0")) {
long l_id_ordine = sellaRes.getId_ordine();
if (debug)
l_id_ordine = 48081L;
Documento bean = new Documento(apFull);
System.out.println("sella recordOrder: " + l_id_ordine);
bean.findByProgOrdineWww(l_id_ordine);
bean.setDataPagamento(DBAdapter.getToday());
bean.setDataTransaction(DBAdapter.getToday());
bean.setDescTransaction(sellaRes.getMyauthcode());
bean.setFlgPagata(1L);
ResParm rp = bean.save();
if (rp.getStatus())
rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false);
Attivita attivita = Attivita.getDefaultInstance(apFull);
if (attivita.isTagManagerAttivo()) {
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
req.setAttribute("_gdl", gdl);
}
}
}
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
boolean debug = false;
long l_id_ordine = 0L;
if (sellaRes != null)
l_id_ordine = sellaRes.getId_ordine();
if (debug)
l_id_ordine = 48081L;
Documento bean = new Documento(getApFull());
bean.findByProgOrdineWww(l_id_ordine);
if (debug) {
sellaRes.setMyerrorcode("0");
recordOrder(req, res, sellaRes);
}
req.setAttribute("bean", bean);
}
protected String getCheckOutMailMessage() {
return getParm(Cart.P_CHECKOUTMSG).getTesto();
}
protected ApplParmFull getAp2() {
if (ap2 == null)
ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()));
return ap2;
}
public void _test(HttpServletRequest req, HttpServletResponse res) {}
}

View file

@ -0,0 +1,40 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Users;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ShowOrdineSvlt extends it.acxent.www.servlet.ShowOrdineSvlt {
private static final long serialVersionUID = 3253536598483259418L;
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
super.otherCommands(req, res);
}
public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) {
String l_id_userCript = getRequestParameter(req, "uc");
if (l_id_userCript.isEmpty()) {
super._vediOrdineCrypt(req, res);
} else {
String l_login = DBAdapter.deCrypt(l_id_userCript);
if (!l_login.isEmpty()) {
ApplParmFull apFull = getApFull(req);
Users user = new Users(apFull);
user.findByLogin(l_login);
if (user.isNoReg()) {
String ip = req.getRemoteHost();
user.setCurrentIp(ip);
req.getSession().setAttribute("utenteLogon", user);
req.getSession().setAttribute("loginUser_id", new Long(user.getId_users()));
super._vediOrdineCrypt(req, res);
} else {
search(req, res);
}
} else {
search(req, res);
}
}
}
}

View file

@ -0,0 +1,77 @@
package it.acxent.cc.servlet;
import it.acxent.anag.TipoPagamento;
import it.acxent.anag.Users;
import it.acxent.bank.servlet.stripe._StripeResponseSvlt;
import it.acxent.bank.stripe.StripeResp;
import it.acxent.cc.Attivita;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.gtm.GoogleDataLayer;
import it.acxent.gtm.GoogleDataLayerBuilder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class StripeResponseSvlt extends _StripeResponseSvlt {
private static final long serialVersionUID = -4056911711739700875L;
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) {
boolean debug = false;
ApplParmFull apFull = getApFull(req);
String status = stripeRes.getRedirect_status();
String clientSecret = stripeRes.getPayment_intent_client_secret();
if (debug)
System.out.println("StripeSvlt recordOrder prog www: status" + status + " clientSecret:" + clientSecret);
if (status.equals("succeeded")) {
Documento bean = new Documento(apFull);
bean.findByDescTransactionStripe(stripeRes.getPayment_intent_client_secret());
if (debug)
System.out.println("StripeSvlt recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO");
bean.setDataPagamento(DBAdapter.getToday());
bean.setDataTransaction(DBAdapter.getToday());
bean.setDescTransaction(clientSecret);
bean.setFlgPagata(1L);
ResParm rp = bean.save();
if (rp.getStatus()) {
if (bean.getFlgWwwRichiedeFattura() == 1L) {
long l = 22L;
} else {
long l = 23L;
}
Attivita attivita1 = Attivita.getDefaultInstance(apFull);
Users utente = (Users)getLoginUser(req);
rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req);
}
Attivita attivita = Attivita.getDefaultInstance(apFull);
if (attivita.isTagManagerAttivo()) {
GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean));
req.setAttribute("_gdl", gdl);
}
}
}
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) {
boolean debug = false;
ApplParmFull apFull = getApFull(req);
String clientSecret = null;
if (stripeRes != null) {
String status = stripeRes.getRedirect_status();
clientSecret = stripeRes.getPayment_intent_client_secret();
}
Documento bean = new Documento(apFull);
bean.findByDescTransactionStripe(clientSecret);
if (debug) {
clientSecret = "xxx";
stripeRes.setRedirect_status("succeeded");
recordOrder(req, res, stripeRes);
}
req.setAttribute("bean", bean);
req.setAttribute("listaTipoPagamento", new TipoPagamento(
getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"),
(bean.getFlgDeliveryType() == 2L)));
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
}
}

View file

@ -0,0 +1,28 @@
package it.acxent.cc.servlet;
import it.acxent.bank.servlet.stripe._StripeSvlt;
import it.acxent.contab.Documento;
import it.acxent.db.ResParm;
import javax.servlet.http.HttpServletRequest;
public class StripeSvlt extends _StripeSvlt {
private static final long serialVersionUID = -1087656160829384851L;
protected ResParm saveClientSecret(HttpServletRequest req, long l_id, String l_clientSecret) {
Documento doc = new Documento(getApFull(req));
doc.findByPrimaryKey(l_id);
if (doc.getId_documento() > 0L) {
doc.setDescTransactionStripe(l_clientSecret);
return doc.superSave();
}
return new ResParm(false, "no doc found:" + l_id);
}
protected long getAmount(HttpServletRequest req, long l_id) {
Documento doc = new Documento(getApFull(req));
doc.findByPrimaryKey(l_id);
if (doc.getId_documento() > 0L)
return Math.round(doc.getTotaleDocumento() * 100.0D);
return 0L;
}
}

View file

@ -0,0 +1,544 @@
package it.acxent.cc.servlet;
import it.acxent.anag.Cliente;
import it.acxent.anag.Clifor;
import it.acxent.anag.DestinazioneDiversa;
import it.acxent.anag.Nazione;
import it.acxent.anag.NazioneCR;
import it.acxent.anag.Users;
import it.acxent.anag.UsersCR;
import it.acxent.cc.Attivita;
import it.acxent.contab.Documento;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.reg.EcDc;
import it.acxent.util.CodiceFiscale;
import it.acxent.util.Vectumerator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class UsersSvlt extends it.acxent.www.servlet.UsersSvlt {
private static final long serialVersionUID = 2411106203332570806L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
NazioneCR nCR = new NazioneCR();
nCR.setLang(getLang(req));
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
if (req.getAttribute("msg").equals("Lettura effettuata"))
req.setAttribute("msg", "");
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Users(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new UsersCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
NazioneCR nCR = new NazioneCR();
nCR.setLang(getLang(req));
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
sendMessage(req, "");
Users bean = new Users(apFull);
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileWww());
bean.setId_nazione("I");
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
try {
req.getSession().removeAttribute("utenteLogon");
req.getSession().removeAttribute("loginUser_id");
} catch (Exception e) {}
req.setAttribute("bean", bean);
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
protected String getBeanPageName(HttpServletRequest req) {
String temp = super.getBeanPageName(req);
Users user = (Users)getLoginUser(req);
ApplParmFull apFull = getApFull(req);
if (user != null && user.getDBState() == 1 &&
user.isProfileNoReg())
temp = "usersNoReg";
return temp;
}
protected String getCmd(HttpServletRequest req) {
if (super.getCmd(req).isEmpty())
return "ni";
return super.getCmd(req);
}
protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Users bean = (Users)beanA;
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
req.setAttribute("bean", bean);
return "";
}
private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) {
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
return attivita.sendUserDataMailMessageCC(bean, getLang(req), req).getStatus();
}
protected String getRegistrazioneMailMessage() {
return getParm("MAIL_REG").getTesto();
}
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
String l_lang = getLang(req);
Users bean = new Users(apFull);
long l_id_users = getRequestLongParameter(req, "id_users");
if (l_id_users > 0L)
bean.findByPrimaryKey(l_id_users);
fillObject(req, bean);
bean.setEMail(bean.getLogin());
req.setAttribute("eMail", bean.getLogin());
Cliente cli = new Cliente(getApFull(req));
if (bean.getId_users() > 0L)
cli.findByPrimaryKey(bean.getId_clifor());
fillObject(req, cli);
DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req));
fillObject(req, dd);
cli.setCurrentDD(dd);
bean.setClifor(cli);
String msg = bean.translate("Impossibile Registrare un nuovo utente:", l_lang);
boolean continuoRegistrazione = true;
if (l_id_users == 0L || (l_id_users > 0L && bean.isProfileNoReg()))
if (bean.isEmailDuplicated()) {
Users userMl = new Users(getApFull(req));
userMl.findUsersByEmail(bean.getEMail());
if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) {
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
req.setAttribute("flgValido", "S");
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users()));
saveUserAndClifor(req, res);
} else if (userMl.getId_userProfile() == bean.getIdUserProfileNoReg()) {
if (userMl.getClifor().getCodFisc().toLowerCase().equals(bean.getCodFisc().toLowerCase())) {
req.setAttribute("id_users", String.valueOf(userMl.getId_users()));
req.setAttribute("flgValido", "S");
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users()));
saveUserAndClifor(req, res);
} else {
msg = msg + " Email associata ad un codice fiscale diverso!";
forceMessage(req, msg);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
fillComboAfterDetail((DBAdapter)bean, req, res);
req.setAttribute("beanUser", bean);
callJsp(req, res);
}
} else {
msg = msg + " " + msg;
forceMessage(req, msg);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
fillComboAfterDetail((DBAdapter)bean, req, res);
req.setAttribute("beanUser", bean);
continuoRegistrazione = false;
callJsp(req, res);
}
} else if (cli.isCodFiscDuplicated()) {
msg = msg + " " + msg;
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
cli.setCodFisc("");
bean.setCodFisc("");
bean.setClifor(cli);
req.setAttribute("beanUser", bean);
continuoRegistrazione = false;
callJsp(req, res);
} else if (cli.isPIvaDuplicated()) {
msg = msg + " " + msg;
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
bean.setPIva("");
cli.setPIva("");
bean.setPIva("");
bean.setClifor(cli);
req.setAttribute("beanUser", bean);
continuoRegistrazione = false;
callJsp(req, res);
} else if (!cli.getCodFisc().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") &&
!CodiceFiscale.controlloFormale(cli.getCodFisc())) {
msg = msg + " " + msg;
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
cli.setCodFisc("");
bean.setCodFisc("");
bean.setClifor(cli);
req.setAttribute("beanUser", bean);
continuoRegistrazione = false;
callJsp(req, res);
} else if (!cli.getPIva().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") && cli.getPIva().length() != 11) {
msg = msg + " " + msg;
forceMessage(req, msg);
fillComboAfterDetail((DBAdapter)bean, req, res);
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
bean.setPIva("");
cli.setPIva("");
bean.setPIva("");
bean.setClifor(cli);
req.setAttribute("beanUser", bean);
continuoRegistrazione = false;
callJsp(req, res);
}
if (continuoRegistrazione) {
if (bean.isProfileNoReg() || bean.isProfilML()) {
req.setAttribute("flgValido", "N");
} else {
req.setAttribute("flgValido", "S");
}
if (bean.getId_userProfile() == 0L)
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
saveUserAndClifor(req, res);
}
}
protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita attivita = Attivita.getDefaultInstance(apFull);
String l_lang = getLang(req);
Users bean = new Users(apFull);
fillObject(req, bean);
ResParm rp = new ResParm();
String msg = attivita.translate("Impossibile Registrare utente ML:", l_lang);
if (bean.isEmailDuplicated()) {
msg = msg + " " + msg + " - " + attivita.translate("Email già presente in archivio", l_lang);
rp.setStatus(false);
rp.setMsg(msg);
if (bean.isEmailDuplicatedNoMl()) {
rp.setErrorCode(1L);
} else {
rp.setErrorCode(2L);
}
req.setAttribute("RP", rp);
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
} else {
bean.setFlgValido("N");
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileMailingList());
bean.setLangMl(getRequestParameter(req, "langMl"));
bean.setLogin(bean.getEMail());
bean.setCognome("MLC_" + bean.getEMail());
bean.setNome("MLN_" + bean.getEMail());
if (bean.getLogin().length() > 30)
bean.setLogin(bean.getLogin().substring(0, 30));
if (bean.getCognome().length() > 30)
bean.setCognome(bean.getCognome().substring(0, 30));
if (bean.getNome().length() > 30)
bean.setNome(bean.getNome().substring(0, 30));
rp = bean.save();
if (rp.getStatus()) {
Clifor clifor = new Clifor(apFull);
clifor.setFlgTipo("C");
clifor.setCognome(bean.getCognome());
clifor.setNome(bean.getNome());
clifor.setEMail(bean.getEMail());
clifor.setFlgMl(1L);
rp = clifor.save();
if (rp.getStatus()) {
bean.setId_clifor(clifor.getId_clifor());
rp.append(bean.save());
}
if (!rp.getStatus())
handleDebug("recordMailingList: " + rp.getMsg(), 0);
attivita.sendMLMailMessage(bean, getLang(req), req);
}
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
}
}
protected void checkCc(HttpServletRequest req, HttpServletResponse res) {
Users bean = new Users(getApFull(req));
fillObject(req, bean);
ResParm rp = new ResParm();
String msg = bean.translate("Impossibile Registrare utente ML:", getLang(req));
if (bean.isEmailDuplicated()) {
msg = msg + " Email già presente in archivio - " + msg;
rp.setStatus(false);
rp.setMsg(msg);
if (bean.isEmailDuplicatedNoMl()) {
rp.setErrorCode(1L);
} else {
rp.setErrorCode(2L);
}
req.setAttribute("RP", rp);
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
} else {
bean.setFlgValido("N");
bean.setFlgMl(1L);
bean.setId_userProfile(bean.getIdUserProfileMailingList());
bean.setLogin("ML_" + bean.getEMail());
bean.setCognome("MLC_" + bean.getEMail());
bean.setNome("MLN_" + bean.getEMail());
rp = bean.save();
if (rp.getStatus())
bean.sendMLMailMessageOLD(req.getRemoteHost() + " " + req.getRemoteHost());
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
}
}
protected it.acxent.common.Users getUser(HttpServletRequest req) {
return new Users(getApFull(req));
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
String msg;
Users bean = (Users)beanA;
ApplParmFull apFull = getApFull(req);
String l_lang = getLang(req);
Attivita attivita = Attivita.getDefaultInstance(apFull);
long l_id_user = getRequestLongParameter(req, "id_users");
if (bean.getDBState() == 1) {
msg = attivita.translate("Salvataggio effettuato", l_lang);
req.getSession().setAttribute("utenteLogon", bean);
req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users()));
if (req.getSession().getAttribute("_sendUserMail") != null || l_id_user == 0L) {
req.getSession().removeAttribute("_sendUserMail");
if (!mailConfermaCambiamentoDati(req, bean)) {
msg = msg + " " + msg;
bean.setFlgEmailOk(0L);
} else {
msg = msg + " Inviata mail di conferma.";
bean.setFlgEmailOk(1L);
}
} else {
bean.setFlgEmailOk(1L);
}
setJspPageRelative(getBeanPageName(req) + "Reg.jsp", req);
} else {
msg = attivita.translate("ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso", l_lang);
}
forceMessage(req, msg);
return new ResParm(true);
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("ML")) {
recordMailingList(req, res);
} else if (getCmd(req).equals("MLF")) {
recordMailingListF(req, res);
} else if (getCmd(req).equals("checkCC")) {
recordMailingList(req, res);
} else if (getCmd(req).equals("checkUCF")) {
checkUserCF(req, res);
} else {
super.otherCommands(req, res);
}
}
protected void saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Users user = new Users(apFull);
long l_id_users = getRequestLongParameter(req, "id_users");
String l_lang = getLang(req);
user.findByPrimaryKey(l_id_users);
fillObject(req, user);
if (user.getId_nazione().toLowerCase().equals("i")) {
user.setLangMl("it");
user.setLang("it");
} else {
user.setLangMl("en");
user.setLang("en");
}
Clifor cliente = user.getClifor();
fillObject(req, cliente);
cliente.setFlgTipo("C");
if (cliente.getFlgAzienda() == 1L) {
cliente.setNome("");
cliente.setCognome(getRequestParameter(req, "ragioneSociale"));
}
cliente.setContatto(user.getCognomeNome());
ResParm rp = cliente.save();
if (rp.getStatus()) {
DestinazioneDiversa dd = cliente.getCurrentDD();
fillObject(req, dd);
if (dd.getIndirizzoDD().isEmpty()) {
if (dd.getId_destinazioneDiversa() != 0L)
rp.append(dd.delete());
} else {
dd.setId_clifor(cliente.getId_clifor());
dd.setFlgDDDefault(1L);
dd.setDescrizioneDD("Sped. WWW");
rp.append(dd.save());
}
}
if (rp.getStatus()) {
user.setId_clifor(cliente.getId_clifor());
if (user.getId_userProfile() == 0L)
user.setId_userProfile(user.getIdUserProfileWww());
user.setFlgValido("S");
rp.append(user.save());
}
if (rp.getStatus()) {
afterSave((DBAdapter)user, req, res);
forceMessage(req, user.translate("Record salvato correttamente", l_lang));
String callingJsp = getRequestParameter(req, "callingJsp");
if (callingJsp.isEmpty()) {
req.setAttribute("bean", user);
forceJspPage("/usersReg.jsp", req);
callJsp(req, res);
} else {
long l_id_documento = getRequestLongParameter(req, "id_documento");
if (l_id_documento > 0L) {
Documento documento = new Documento(apFull);
documento.findByPrimaryKey(l_id_documento);
if (documento.getId_documento() > 0L) {
documento.setSpeseTrasporto(documento.getDeliveryCostOrdine(user.getClifor()));
rp = documento.save();
}
}
if (callingJsp.endsWith("html")) {
try {
res.sendRedirect(callingJsp);
} catch (Exception e) {
e.printStackTrace();
}
} else {
forceJspPage("/" + callingJsp, req);
callJsp(req, res);
}
}
} else {
sendMessage(req, user.translate("Impossibile salvare: ", l_lang) + user.translate("Impossibile salvare: ", l_lang));
forceJspPage("/users.jsp", req);
req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req)));
req.setAttribute("bean", user);
callJsp(req, res);
}
}
protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
String l_cf = getRequestParameter(req, "codFiscR");
String l_lang = getLang(req);
Attivita attivita = Attivita.getDefaultInstance(apFull);
ResParm rp = new ResParm(true);
if (l_cf.isEmpty()) {
rp.setStatus(false);
rp.setMsg("Codice Fiscale errato!");
} else {
Clifor clifor = new Clifor(getApFull(req));
clifor.findByCF(l_cf, "C");
if (clifor.getDBState() == 0) {
rp.setStatus(false);
rp.setMsg(attivita.translate("Il Codice Fiscale richiesto non è nei nostri database.", l_lang));
} else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) {
rp.setStatus(false);
rp.setMsg(
attivita.translate("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.", l_lang));
} else {
Users user = new Users(getApFull(req));
Vectumerator<Users> vec = user.findByClifor(clifor.getId_clifor(), 1, 1);
if (vec.getTotNumberOfRecords() == 0) {
user.setCognome(clifor.getCognome());
user.setNome(clifor.getNome());
if (clifor.getFlgAzienda() == 1L)
user.setNominativo(clifor.getCognome());
user.setFlgValido("S");
user.setId_userProfile(user.getIdUserProfileWww());
user.setId_clifor(clifor.getId_clifor());
user.setEMail(clifor.getEMail());
if (!clifor.getCellulare().isEmpty()) {
user.setTelefono(clifor.getCellulare());
} else {
user.setTelefono(clifor.getTelefono());
}
user.setLogin(user.getEMail());
user.setPwd(String.valueOf(Math.random() * 1000000.0D).substring(0, 6));
rp = user.save();
if (rp.getStatus()) {
rp = user.sendUserDataMailMessage();
if (rp.getStatus())
rp.setMsg(attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang) + " " + attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang));
} else {
rp.setStatus(false);
rp.setMsg(attivita.translate("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.", l_lang));
}
} else {
rp.setStatus(false);
rp.setMsg(attivita.translate("Attenzione! Il codice fiscale è nei nostri database ma esiste già un utente web associato. Richiedi i dati di accesso attraverso il recupero del login tramite indirizzo email.", l_lang));
}
}
}
if (rp.getStatus()) {
forceJspPage("/usersReg.jsp", req);
} else {
forceJspPage("/usersRegError.jsp", req);
}
sendMessage(req, rp.getMsg());
callJsp(req, res);
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
long l_id_usersDoc = getRequestLongParameter(req, "id_usersDoc");
req.setAttribute("id_users", String.valueOf(getLoginUserId(req)));
if (l_id_usersDoc > 0L)
req.setAttribute("id_users", Long.valueOf(l_id_usersDoc));
super.showBean(req, res);
}
protected void recordMailingListF(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
String l_lang = getLang(req);
Attivita attivita = Attivita.getDefaultInstance(apFull);
Users bean = new Users(getApFull(req));
String l_eMail = EcDc.decode64String(getRequestParameter(req, "eMail"));
ResParm rp = new ResParm(false);
String msg = attivita.translate("Impossibile Registrare utente : ", l_lang);
bean.findByEmail(l_eMail);
if (bean.getDBState() == 1) {
if (bean.getFlgValido().equals("N")) {
msg = msg + "Email " + msg + l_eMail;
rp.setErrorCode(9L);
} else if (bean.getFlgMl() == 1L) {
msg = msg + "Email " + msg + l_eMail;
rp.setErrorCode(9L);
} else {
bean.setFlgMl(1L);
rp = bean.save();
msg = "Email " + l_eMail + " iscritta correttamente alla newsletter.";
if (rp.getStatus())
rp.append(bean.sendMLMailMessage(req.getRemoteHost() + " " + req.getRemoteHost(), bean.getLang()));
if (!rp.getStatus()) {
msg = msg + msg + " " + attivita.translate(" Attenzione. Ci sono stati problemi nella registrazione o nell'invio della mail di conferma: ", l_lang);
rp.setErrorCode(9L);
}
}
} else {
msg = msg + "Email " + msg + " " + l_eMail;
rp.setErrorCode(9L);
}
sendMessage(req, msg);
rp.setMsg(msg);
req.setAttribute("RP", rp);
forceJspPageRelative("mailingListUser.jsp", req);
callJsp(req, res);
}
protected String getBEANAttribute(HttpServletRequest req) {
return super.getBEANAttribute(req) + "User";
}
}

View file

@ -0,0 +1,106 @@
package it.acxent.cc.servlet;
import it.acxent.cart.Cart;
import it.acxent.common.Users;
import it.acxent.db.ApplParmFull;
import it.acxent.servlet.AblServletSvlt;
import java.text.NumberFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public abstract class _CCvlt extends AblServletSvlt {
public static final String PARM_PRONTA_CONSEGNA = "flgProntaConsegna";
private static NumberFormat nf0;
protected boolean checkLoginProfile(HttpServletRequest req) {
try {
if (getLoginUser(req) == null) {
forceJspPage(getLoginPage(null, null), req);
return true;
}
if (getLoginUser(req).getFlgValido().equals("N")) {
forceJspPage(super.getLoginPage(null, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return false;
}
if (getLoginUser(req).getId_userProfile() > 0L)
return true;
forceJspPage(super.getLoginPage(null, null), req);
req.getSession().removeAttribute("loginUser_id");
req.getSession().removeAttribute("utenteLogon");
return true;
} catch (Exception e) {
handleDebug(e);
return false;
}
}
protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) {
return super.getLoginUserGrant(req, l_permesso);
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return "Registra.abl";
}
protected Users getUser(HttpServletRequest req) {
ApplParmFull apFull = getApFull();
return new it.acxent.anag.Users(apFull);
}
protected boolean useAlwaysSendRedirect() {
return true;
}
protected boolean isSecureServlet(HttpServletRequest req) {
return false;
}
public String getPathImgArticoli() {
return getDocBase() + "/" + getDocBase();
}
public long getHomeType() {
return getParm("HOME_TYPE").getNumeroLong();
}
protected int getPageRow(HttpServletRequest req) {
int pageRow = getParm("PAGE_ROW").getNumeroInt();
return (pageRow == 0) ? 4 : pageRow;
}
public NumberFormat getNf0(HttpServletRequest req) {
if (nf0 == null) {
nf0 = NumberFormat.getInstance(getLocale(req));
nf0.setMaximumFractionDigits(0);
nf0.setMinimumFractionDigits(0);
}
return nf0;
}
protected double getDeliveryCost(HttpServletRequest req) {
return getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
}
protected double getMoreCost(HttpServletRequest req) {
return getParm(Cart.P_MORE_COST).getNumeroDouble();
}
protected double getDeliveryWarnCost(HttpServletRequest req) {
return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble();
}
protected long getFlgProntaConsegna(HttpServletRequest req) {
if (req.getSession().getAttribute("flgProntaConsegna") == null || ((String)
req.getSession().getAttribute("flgProntaConsegna")).isEmpty())
return 0L;
try {
return Long.parseLong((String)req.getSession().getAttribute("flgProntaConsegna"));
} catch (Exception e) {
handleDebug(e, 2);
return 0L;
}
}
}

View file

@ -0,0 +1,184 @@
package it.acxent.cc.servlet.admin;
import it.acxent.art.Articolo;
import it.acxent.art.ArticoloCR;
import it.acxent.cc.Attivita;
import it.acxent.cc.CCCronSendGoogleXml;
import it.acxent.cc.CCImport;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ArticoloSvlt extends it.acxent.art.servlet.ArticoloSvlt {
private static final long serialVersionUID = -2291450542550759704L;
public void _sendGoogleXml(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCCronSendGoogleXml sgx = new CCCronSendGoogleXml();
ResParm rp = sgx.crontabJob(apFull);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importListinoIngramMicro(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportIngramMicro(apFull, 0L, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importDispoIngramMicro(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportIngramMicro(apFull, 1L, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliDatamaticMail(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportDatamaticMail(apFull, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliEsprinet(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileCsv = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportEsprinet(apFull, fileCsv, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliBrevi(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileCsv = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportBrevi(apFull, fileCsv, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
super.fillComboAfterDetail(l_bean, req, res);
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
super.fillComboAfterSearch(CR, req, res);
}
public void _importArticoliLogicom(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileCsv = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportLogicom(apFull, fileCsv, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliDatamatic(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileCsv = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportDatamatic(apFull, fileCsv, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliLogicomMail(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportLogicomMail(apFull, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliFlexit(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileCsv = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportFlexit(apFull, fileCsv, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliFlexitMail(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportFlexitMail(apFull, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importRunner(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String s_flgTipoImport = getRequestParameter(req, "flgTipoImportRunner");
String[] s_flgTipoImportA = s_flgTipoImport.split(",");
long[] result = new long[s_flgTipoImportA.length];
for (int i = 0; i < s_flgTipoImportA.length; i++)
result[i] = Long.parseLong(s_flgTipoImportA[i]);
ResParm rp = bean.startImportRunner(apFull, result, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importSiaeIngramMicro(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportIngramMicro(apFull, 2L, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliCgross(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
ResParm rp = bean.startImportCgross(apFull, null, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importArticoliCgrossWeb(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String fileZip = getPathTmpFull() + getPathTmpFull();
ResParm rp = bean.startImportCgross(apFull, fileZip, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _importBestit(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
CCImport bean = new CCImport();
String s_flgTipoImport = getRequestParameter(req, "flgTipoImportBestit");
String[] s_flgTipoImportA = s_flgTipoImport.split(",");
long[] result = new long[s_flgTipoImportA.length];
for (int i = 0; i < s_flgTipoImportA.length; i++)
result[i] = Long.parseLong(s_flgTipoImportA[i]);
ResParm rp = bean.startImportBestit(apFull, result, true);
sendMessage(req, rp.getMsg());
search(req, res);
}
public void _creaSitemapsStandard(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Articolo art = new Articolo(apFull);
ArticoloCR ACR = new ArticoloCR(apFull);
ACR.setFlgReadyForWeb(0L);
ACR.setFlgEscludiWeb(-1L);
ACR.setFlgQta(1L);
ACR.setQtaDa(1L);
ACR.setQtaA(9999L);
ResParm rp = art.startThreadCreaSitemaps(getApFull(), ACR);
sendMessage(req, rp.getMsg());
search(req, res);
}
}

View file

@ -0,0 +1,306 @@
package it.acxent.cc.servlet.admin;
import it.acxent.anag.Listino;
import it.acxent.cc.Attivita;
import it.acxent.cc.AttivitaCR;
import it.acxent.cc.TipoAttivita;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.mail.MailMessage;
import it.acxent.servlet.AblServletSvlt;
import it.acxent.servlet.AddImgSvlt;
import java.io.File;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/cc/Attivita.abl"})
public class AttivitaSvlt extends AblServletSvlt implements AddImgSvlt {
private static final long serialVersionUID = 4963856767196841700L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
}
protected DBAdapter getBean(HttpServletRequest req) {
return new Attivita(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new AttivitaCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll());
}
protected boolean isSimpleServlet(HttpServletRequest req) {
return false;
}
protected boolean isLoadImageServlet() {
return true;
}
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
req.getSession().removeAttribute("attivita");
Attivita.resetDefaultInstance();
return super.afterSave(beanA, req, res);
}
public void _mdd(HttpServletRequest req, HttpServletResponse res) {
Attivita attivita = Attivita.getDefaultInstance(getApFull(req));
req.setAttribute("id_attivita", Long.valueOf(attivita.getId_attivita()));
showBean(req, res);
}
public void _caricaPrivacy(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
fillObject(req, bean);
String l_fileName = getDocBase() + "admin/cc/_template/privacy-" + getDocBase() + ".html";
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
MailMessage mf = new MailMessage(apFull, l_fileName);
mf.setString("ragioneSociale", bean.getNomeAttivita());
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
mf.setString("cf", bean.getCodFisc());
mf.setString("responsabileTrattamento", bean.getContatto());
bean.setDescTxtLang("privacy", bean.getCurrentLang(), mf.getMessage());
bean.save();
}
showBean(req, res);
}
public void _caricaCookiePolicy(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
fillObject(req, bean);
String l_fileName = getDocBase() + "admin/cc/_template/cookiePolicy-" + getDocBase() + ".html";
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
MailMessage mf = new MailMessage(apFull, l_fileName);
mf.setString("ragioneSociale", bean.getNomeAttivita());
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
mf.setString("cf", bean.getCodFisc());
mf.setString("pec", bean.getPec());
mf.setString("email", bean.getEmailAttivita());
mf.setString("sito", req.getHeader("Host"));
mf.setString("pIva", bean.getPIva());
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
mf.setString("responsabileTrattamento", bean.getContatto());
bean.setDescTxtLang("cookiePolicyText", bean.getCurrentLang(), mf.getMessage());
bean.save();
}
showBean(req, res);
}
protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Attivita bean = (Attivita)beanA;
if (bean.getWwwAddress().isEmpty()) {
String serverName;
if (req.getHeader("x-forwarded-proto") == null) {
serverName = req.getScheme() + "://" + req.getScheme() + req.getServerName() + "/";
} else {
serverName = req.getHeader("x-forwarded-proto") + "://" + req.getHeader("x-forwarded-proto") + req.getServerName() + "/";
}
bean.setWwwAddress(serverName);
}
return super.beforeSave(beanA, req, res);
}
public void _caricaFooter(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
fillObject(req, bean);
String l_fileName = getDocBase() + "admin/cc/_template/footer-" + getDocBase() + ".html";
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
MailMessage mf = new MailMessage(apFull, l_fileName);
mf.setString("ragioneSociale", bean.getNomeAttivita());
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
mf.setString("cf", bean.getCodFisc());
mf.setString("telefono", bean.getTelefonoAttivita());
mf.setString("email", bean.getEmailAttivita());
mf.setString("pIva", bean.getPIva());
mf.setString("sdi", bean.getCodiceIdentificativoFE());
mf.setString("pec", bean.getPec());
bean.setDescTxtLang("footerText", bean.getCurrentLang(), mf.getMessage());
bean.save();
}
showBean(req, res);
}
public void _caricaTermsConditions(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
fillObject(req, bean);
String l_fileName = getDocBase() + "admin/cc/_template/termsConditions-" + getDocBase() + ".html";
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
MailMessage mf = new MailMessage(apFull, l_fileName);
mf.setString("ragioneSociale", bean.getNomeAttivita());
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
mf.setString("cf", bean.getCodFisc());
mf.setString("email", bean.getEmailAttivita());
mf.setString("sito", req.getHeader("Host"));
mf.setString("pIva", bean.getPIva());
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
mf.setString("responsabileTrattamento", bean.getContatto());
bean.setDescTxtLang("termConditions", bean.getCurrentLang(), mf.getMessage());
bean.save();
}
showBean(req, res);
}
public void _sendNotificheWishlist(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
ResParm rp = bean.startThreadNotifiche();
System.out.println(rp.getMsg());
showBean(req, res);
}
public void _ebayCreaMerchantLocationKey(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita bean = new Attivita(apFull);
long l_id = getRequestLongParameter(req, "id_attivita");
bean.findByPrimaryKey(l_id);
if (bean.getId_attivita() > 0L) {
fillObject(req, bean);
ResParm rp = bean.save();
if (rp.getStatus()) {
rp = bean.ebayCreaMerchantLocationKey();
if (rp.getStatus()) {
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, rp.getErrMsg());
}
} else {
sendMessage(req, rp.getErrMsg());
}
showBean(req, res);
} else {
sendMessage(req, "Errore! Attivita non trovato");
search(req, res);
}
}
public void _ebayReturnPolicyId(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita bean = new Attivita(apFull);
long l_id = getRequestLongParameter(req, "id_attivita");
bean.findByPrimaryKey(l_id);
if (bean.getId_attivita() > 0L) {
ResParm rp = bean.ebayUpdateReturnPolicyId();
if (rp.getStatus()) {
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, rp.getErrMsg());
}
showBean(req, res);
} else {
sendMessage(req, "Errore! Attivita non trovato");
search(req, res);
}
}
public void _amzUpdateTokens(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita bean = new Attivita(apFull);
long l_id = getRequestLongParameter(req, "id_attivita");
bean.findByPrimaryKey(l_id);
if (bean.getId_attivita() > 0L) {
ResParm rp = bean.amzUpdateTokens(false);
if (rp.getStatus()) {
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, rp.getErrMsg());
}
showBean(req, res);
} else {
sendMessage(req, "Errore! Attivita non trovato");
search(req, res);
}
}
public void _ebayFulfillmentPolicyId(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita bean = new Attivita(apFull);
long l_id = getRequestLongParameter(req, "id_attivita");
bean.findByPrimaryKey(l_id);
if (bean.getId_attivita() > 0L) {
ResParm rp = bean.ebayUpdateFulfillmentPolicyId();
if (rp.getStatus()) {
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, rp.getErrMsg());
}
showBean(req, res);
} else {
sendMessage(req, "Errore! Attivita non trovato");
search(req, res);
}
}
public void _caricaDirittoDiRecesso(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id_attivita = getRequestLongParameter(req, "id_attivita");
Attivita bean = new Attivita(apFull);
bean.findByPrimaryKey(l_id_attivita);
fillObject(req, bean);
String l_fileName = getDocBase() + "admin/cc/_template/dirittoDiRecesso-" + getDocBase() + ".html";
if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) {
MailMessage mf = new MailMessage(apFull, l_fileName);
mf.setString("ragioneSociale", bean.getNomeAttivita());
mf.setString("sedeLegale", bean.getIndirizzoCompletoSede());
mf.setString("cf", bean.getCodFisc());
mf.setString("pec", bean.getPec());
mf.setString("email", bean.getEmailAttivita());
mf.setString("sito", req.getHeader("Host"));
mf.setString("pIva", bean.getPIva());
mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita());
mf.setString("responsabileTrattamento", bean.getContatto());
bean.setDescTxtLang("dirittoDiRecesso", bean.getCurrentLang(), mf.getMessage());
bean.save();
}
showBean(req, res);
}
public void _ebayPaymentPolicyId(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
Attivita bean = new Attivita(apFull);
long l_id = getRequestLongParameter(req, "id_attivita");
bean.findByPrimaryKey(l_id);
if (bean.getId_attivita() > 0L) {
ResParm rp = bean.ebayUpdatePaymentPolicyId();
if (rp.getStatus()) {
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, rp.getErrMsg());
}
showBean(req, res);
} else {
sendMessage(req, "Errore! Attivita non trovato");
search(req, res);
}
}
}

View file

@ -0,0 +1,33 @@
package it.acxent.cc.servlet.admin;
import it.acxent.cc.TipoAttivita;
import it.acxent.cc.TipoAttivitaCR;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.servlet.AblServletSvlt;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/cc/TipoAttivita.abl"})
public class TipoAttivitaSvlt extends AblServletSvlt {
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new TipoAttivita(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new TipoAttivitaCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return true;
}
}

View file

@ -0,0 +1,122 @@
package it.acxent.cc.servlet.admin;
import it.acxent.cc.WwwAutomator;
import it.acxent.cc.WwwAutomatorCR;
import it.acxent.cc.servlet._CCvlt;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns = {"/admin/cc/WwwAutomator.abl"})
public class WwwAutomatorSvlt extends _CCvlt {
private static final long serialVersionUID = 5418623699135974920L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new WwwAutomator(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new WwwAutomatorCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return false;
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
search(req, res);
}
public void _duplicaAutomator(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
WwwAutomator bean = new WwwAutomator(apFull);
bean.findByPrimaryKey(l_id);
if (bean.getId_wwwAutomator() > 0L) {
bean.setId_wwwAutomator(0L);
bean.setDBState(0);
bean.setUltimaEsecuzione("");
req.setAttribute("bean", bean);
forceMessage(req, "Attenzione! Il Record è stato Duplicato!!");
}
showBean(req, res);
}
public void _eseguiAutomatorFullCR(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
WwwAutomator bean = new WwwAutomator(apFull);
WwwAutomatorCR CR = new WwwAutomatorCR();
fillObject(req, CR);
CR.setFlgAbilita(1L);
bean.startAutomator(getApFull(), CR, false);
search(req, res);
}
public void _spostaGiu(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta");
WwwAutomator bean = new WwwAutomator(apFull);
bean.findByPrimaryKey(l_id);
if (bean.getId_wwwAutomator() > 0L) {
ResParm rp = bean.spostaGiu();
sendMessage(req, rp.getMsg());
}
search(req, res);
}
public void _spostaSu(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta");
WwwAutomator bean = new WwwAutomator(apFull);
bean.findByPrimaryKey(l_id);
if (bean.getId_wwwAutomator() > 0L) {
ResParm rp = bean.spostaSu();
sendMessage(req, rp.getMsg());
}
search(req, res);
}
public void _eseguiAutomatorCR(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
WwwAutomator bean = new WwwAutomator(apFull);
bean.findByPrimaryKey(l_id);
if (bean.getId_wwwAutomator() > 0L) {
ResParm rp = bean.eseguiAutomator();
sendMessage(req, rp.getMsg());
}
search(req, res);
}
public void _eseguiAutomator(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
long l_id = getRequestLongParameter(req, "id_wwwAutomator");
WwwAutomator bean = new WwwAutomator(apFull);
bean.findByPrimaryKey(l_id);
if (bean.getId_wwwAutomator() > 0L) {
ResParm rp = bean.eseguiAutomator();
sendMessage(req, rp.getMsg());
}
showBean(req, res);
}
public void _ripristinoOrdine(HttpServletRequest req, HttpServletResponse res) {
ApplParmFull apFull = getApFull(req);
WwwAutomator bean = new WwwAutomator(apFull);
bean.ripristinoOrdine();
sendMessage(req, "Ordine tipo + ordine ripristinato");
search(req, res);
}
}

View file

@ -0,0 +1 @@
package it.acxent.cc.servlet;

View file

@ -0,0 +1,20 @@
package it.acxent.cc.taglib;
import it.acxent.cc.Attivita;
import it.acxent.taglib.AbstractDbTag;
import javax.servlet.jsp.JspException;
public class AttivitaTag extends AbstractDbTag {
private static final long serialVersionUID = 5692636146746905942L;
public int doAfterBody() throws JspException {
return 0;
}
public int doStartTag() {
Attivita bean = Attivita.getDefaultInstance(getApFull());
getReq().setAttribute("_listaLangAtt", bean.findLangAttivita());
getReq().getSession().setAttribute("attivita", bean);
return 2;
}
}

View file

@ -0,0 +1,34 @@
package it.acxent.cc.taglib;
import it.acxent.cc.Attivita;
import it.acxent.cc.GoogleReviews;
import it.acxent.taglib.AbstractDbTag;
import javax.servlet.jsp.JspException;
public class GoogleReviewTag extends AbstractDbTag {
private static final long serialVersionUID = 5692636146746905942L;
private boolean userreview = false;
public int doAfterBody() throws JspException {
return 0;
}
public int doStartTag() {
Attivita bean = Attivita.getDefaultInstance(getApFull());
GoogleReviews rev = bean.getReview(isUserreview());
getReq().setAttribute("_rating", getNf1().format(rev.getRating()));
getReq().setAttribute("_reviews", rev.getReviews());
getReq().setAttribute("_userRatingsTotal", getNf0().format(rev.getUserRatingsTotal()));
getReq().setAttribute("_starsFAS", rev.getFontAwesomeSvgRatingStars());
return 2;
}
public boolean isUserreview() {
return this.userreview;
}
public void setUserreview(boolean userreview) {
this.userreview = userreview;
}
}

View file

@ -0,0 +1,77 @@
package it.acxent.cc.taglib;
import it.acxent.cc.Attivita;
import it.acxent.cc.GoogleReview;
import it.acxent.cc.GoogleReviews;
import it.acxent.taglib.AbstractDbTag;
import it.acxent.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class GoogleReviewsTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator<GoogleReview> theList;
private boolean soloattivi = true;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
GoogleReview row = (GoogleReview)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
Attivita bean = Attivita.getDefaultInstance(getApFull());
GoogleReviews rev = bean.getReview(true);
this.theList = rev.getReviews();
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
GoogleReview row = (GoogleReview)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nfV", getNf());
this.pageContext.setAttribute("nf0V", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
return getApFull().getNf2();
}
public NumberFormat getNf0() {
return getApFull().getNf0();
}
public boolean isSoloattivi() {
return this.soloattivi;
}
public void setSoloattivi(boolean soloattivi) {
this.soloattivi = soloattivi;
}
}

View file

@ -0,0 +1,13 @@
package it.acxent.cc.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class GoogleReviewsTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
String rowBeanClass = "it.acxent.cc.GoogleReview";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) };
}
}

View file

@ -0,0 +1,63 @@
package it.acxent.cc.taglib;
import it.acxent.art.Marca;
import it.acxent.taglib.AbstractDbTag;
import it.acxent.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class MarcaTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator<Marca> theList;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
Marca row = (Marca)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
this.theList = new Marca(getApFull()).findMarchePresentiByTipoTag(0L, null);
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
Marca row = (Marca)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nfV", getNf());
this.pageContext.setAttribute("nf0V", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
return getApFull().getNf2();
}
public NumberFormat getNf0() {
return getApFull().getNf0();
}
}

View file

@ -0,0 +1,13 @@
package it.acxent.cc.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class MarcaTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
String rowBeanClass = "it.acxent.art.Marca";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) };
}
}

View file

@ -0,0 +1,77 @@
package it.acxent.cc.taglib;
import it.acxent.anag.Nazione;
import it.acxent.taglib.AbstractDbTag;
import it.acxent.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class NazioneTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator<Nazione> theList;
private boolean soloattivi = true;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
Nazione row = (Nazione)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
if (isSoloattivi()) {
this.theList = new Nazione(getApFull()).findAllAttive(getLang());
} else {
this.theList = new Nazione(getApFull()).findAll(getLang());
}
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
Nazione row = (Nazione)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nfV", getNf());
this.pageContext.setAttribute("nf0V", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
return getApFull().getNf2();
}
public NumberFormat getNf0() {
return getApFull().getNf0();
}
public boolean isSoloattivi() {
return this.soloattivi;
}
public void setSoloattivi(boolean soloattivi) {
this.soloattivi = soloattivi;
}
}

View file

@ -0,0 +1,13 @@
package it.acxent.cc.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class NazioneTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
String rowBeanClass = "it.acxent.anag.Nazione";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) };
}
}

View file

@ -0,0 +1,63 @@
package it.acxent.cc.taglib;
import it.acxent.art.StatoUsato;
import it.acxent.taglib.AbstractDbTag;
import it.acxent.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class StatoUsatoTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator<StatoUsato> theList;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
StatoUsato row = (StatoUsato)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
this.theList = new StatoUsato(getApFull()).findSoloUsato();
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
StatoUsato row = (StatoUsato)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nfV", getNf());
this.pageContext.setAttribute("nf0V", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
return getApFull().getNf2();
}
public NumberFormat getNf0() {
return getApFull().getNf0();
}
}

View file

@ -0,0 +1,13 @@
package it.acxent.cc.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class StatoUsatoTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
String rowBeanClass = "it.acxent.art.StatoUsato";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) };
}
}

View file

@ -0,0 +1,63 @@
package it.acxent.cc.taglib;
import it.acxent.anag.TipoPagamento;
import it.acxent.taglib.AbstractDbTag;
import it.acxent.util.Vectumerator;
import java.io.IOException;
import java.text.NumberFormat;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
public class TipoPagamentoTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator<TipoPagamento> theList;
public int doAfterBody() throws JspException {
try {
if (this.theList.hasMoreElements()) {
TipoPagamento row = (TipoPagamento)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
String body = getBodyContent().getString();
this.bodyContent.getEnclosingWriter().print(body);
return 0;
} catch (IOException ex) {
throw new JspTagException(ex.toString());
}
}
public int doStartTag() {
this.theList = new TipoPagamento(getApFull()).findPagamentiWww(false, false);
if (this.theList == null)
return 0;
this.theList.moveFirst();
if (this.theList.hasMoreElements()) {
TipoPagamento row = (TipoPagamento)this.theList.nextElement();
this.pageContext.setAttribute(getRowbeanname(), row);
this.pageContext.setAttribute("nfV", getNf());
this.pageContext.setAttribute("nf0V", getNf());
this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex()));
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public NumberFormat getNf() {
return getApFull().getNf2();
}
public NumberFormat getNf0() {
return getApFull().getNf0();
}
}

View file

@ -0,0 +1,13 @@
package it.acxent.cc.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class TipoPagamentoTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
String rowBeanClass = "it.acxent.anag.TipoPagamento";
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) };
}
}

View file

@ -0,0 +1 @@
package it.acxent.cc.taglib;