first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
407
rus/WEB-INF/lib/pg_src/com/ablia/pg/Coupon.java
Normal file
407
rus/WEB-INF/lib/pg_src/com/ablia/pg/Coupon.java
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import com.lowagie.text.Chunk;
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Element;
|
||||
import com.lowagie.text.Font;
|
||||
import com.lowagie.text.Image;
|
||||
import com.lowagie.text.PageSize;
|
||||
import com.lowagie.text.Phrase;
|
||||
import com.lowagie.text.pdf.Barcode128;
|
||||
import com.lowagie.text.pdf.PdfContentByte;
|
||||
import com.lowagie.text.pdf.PdfPCell;
|
||||
import com.lowagie.text.pdf.PdfPTable;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
import java.awt.Color;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Coupon extends _PgAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 1453818572610L;
|
||||
|
||||
private long id_coupon;
|
||||
|
||||
private String codice;
|
||||
|
||||
private long nFoto;
|
||||
|
||||
private String serie;
|
||||
|
||||
private Timestamp printTmst;
|
||||
|
||||
private long totCoupon;
|
||||
|
||||
private long id_rigaDocumento;
|
||||
|
||||
private RigaDocumento rigaDocumento;
|
||||
|
||||
public Coupon(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public Coupon() {}
|
||||
|
||||
public void setId_coupon(long newId_coupon) {
|
||||
this.id_coupon = newId_coupon;
|
||||
}
|
||||
|
||||
public void setCodice(String newCodice) {
|
||||
this.codice = newCodice;
|
||||
}
|
||||
|
||||
public void setNFoto(long newNFoto) {
|
||||
this.nFoto = newNFoto;
|
||||
}
|
||||
|
||||
public long getId_coupon() {
|
||||
return this.id_coupon;
|
||||
}
|
||||
|
||||
public String getCodice() {
|
||||
return (this.codice == null) ? "" : this.codice.trim();
|
||||
}
|
||||
|
||||
public long getNFoto() {
|
||||
return this.nFoto;
|
||||
}
|
||||
|
||||
public boolean isValido() {
|
||||
if (getId_coupon() > 0L) {
|
||||
if (getId_rigaDocumento() == 0L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator<Coupon> findByCR(CouponCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from COUPON AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getSerie().isEmpty())
|
||||
wc.addWc("A.serie like '%" + CR.getSerie() + "%'");
|
||||
if (!CR.getCodice().isEmpty()) {
|
||||
if (CR.getCodice().indexOf("'") > 0)
|
||||
CR.setCodice(CR.getCodice().replace("'", "-"));
|
||||
wc.addWc("A.codice='" + CR.getCodice() + "'");
|
||||
}
|
||||
if (CR.getFlgAttivi() == 0L) {
|
||||
wc.addWc("(A.id_rigaDocumento is null or A.id_rigaDocumento=0)");
|
||||
} else if (CR.getFlgAttivi() == 1L) {
|
||||
wc.addWc("A.id_rigaDocumento >0");
|
||||
}
|
||||
if (CR.getFlgUtilizzato() == 0L) {
|
||||
wc.addWc("(A.flgUtilizzato is null or A.flgUtilizzato=0)");
|
||||
} else if (CR.getFlgUtilizzato() > 0L) {
|
||||
wc.addWc("A.flgUtilizzato =" + CR.getFlgUtilizzato());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSerie() {
|
||||
return (this.serie == null) ? "" : this.serie.trim();
|
||||
}
|
||||
|
||||
public void setSerie(String serie) {
|
||||
this.serie = serie;
|
||||
}
|
||||
|
||||
public void findByCodice(String l_coupon) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from COUPON AS A";
|
||||
String s_Sql_Order = " order by A.serie";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.codice='" + l_coupon + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return String.valueOf(getSerie()) + " " + getCodice();
|
||||
}
|
||||
|
||||
public Vectumerator<Coupon> findSerieByGaraCompact(long l_id_gara, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select A.serie, A.nFoto, A.nFotoWeb, A.id_gara , count(A.id_gara) as totCoupon from COUPON AS A group by A.serie, A.nFoto, A.nFotoWeb, A.id_gara ";
|
||||
String s_Sql_Order = " order by A.serie";
|
||||
WcString wc = new WcString();
|
||||
wc.addHavingWc("A.id_gara=" + l_id_gara);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getTotCoupon() {
|
||||
return this.totCoupon;
|
||||
}
|
||||
|
||||
public void setTotCoupon(long totCoupon) {
|
||||
this.totCoupon = totCoupon;
|
||||
}
|
||||
|
||||
public Vectumerator<Coupon> findBySerie(String l_serie, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from COUPON AS A";
|
||||
String s_Sql_Order = " order by A.serie";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.serie ='" + l_serie + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator<Coupon> findByGara(long l_id_gara) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from COUPON AS A";
|
||||
String s_Sql_Order = " order by A.serie";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getId_rigaDocumento() {
|
||||
return this.id_rigaDocumento;
|
||||
}
|
||||
|
||||
public RigaDocumento getRigaDocumento() {
|
||||
this.rigaDocumento = (RigaDocumento)getSecondaryObject((DBAdapter)this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
|
||||
return this.rigaDocumento;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumento(long newId_rigaDocumento) {
|
||||
this.id_rigaDocumento = newId_rigaDocumento;
|
||||
setRigaDocumento(null);
|
||||
}
|
||||
|
||||
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
|
||||
this.rigaDocumento = newRigaDocumento;
|
||||
}
|
||||
|
||||
public ResParm creaCoupon(String serie, long nFoto, long nCoupon) {
|
||||
ResParm rp;
|
||||
try {
|
||||
for (int i = 0; (long)i < nCoupon; i++) {
|
||||
Coupon c = new Coupon(getApFull());
|
||||
c.setNFoto(nFoto);
|
||||
c.setSerie(serie);
|
||||
String codice = String.valueOf(String.valueOf(Calendar.getInstance().getTimeInMillis())) + zeroLeft((int)(Math.random() * 1.0E7D), 7);
|
||||
System.out.println(codice);
|
||||
codice = String.valueOf(codice.substring(0, 4)) + "-" + codice.substring(4, 8) + "-" + codice.substring(8, 12) + "-" +
|
||||
codice.substring(12, 16) + "-" + codice.substring(16, 20);
|
||||
System.out.println(String.valueOf(i) + " " + codice);
|
||||
c.setCodice(codice);
|
||||
c.save();
|
||||
}
|
||||
rp = new ResParm(true, "Creati " + nCoupon + " coupon");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
rp = new ResParm(false, e);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ByteArrayOutputStream stampaCouponA4Pdf(String l_serie, long blankLabels) {
|
||||
long pHMarg = 6L;
|
||||
long l_indent = 4L;
|
||||
ByteArrayOutputStream ba = new ByteArrayOutputStream();
|
||||
try {
|
||||
this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.writer = PdfWriter.getInstance(this.document, ba);
|
||||
this.document.open();
|
||||
long labelNumber = 0L;
|
||||
int nCol = 3;
|
||||
int nRow = 8;
|
||||
float[] widths = { 0.33F, 0.33F, 0.33F };
|
||||
this.pdfPcorpo = new PdfPTable(widths);
|
||||
this.pdfPcorpo.setWidthPercentage(100.0F);
|
||||
if (blankLabels > 0L) {
|
||||
PdfPCell cell = new PdfPCell();
|
||||
cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow);
|
||||
cell.setIndent((float)l_indent);
|
||||
cell.setBorder(0);
|
||||
for (int i = 0; (long)i < blankLabels; i++) {
|
||||
labelNumber++;
|
||||
this.pdfPcorpo.addCell(cell);
|
||||
}
|
||||
}
|
||||
Vectumerator<Coupon> vec = findBySerie(l_serie, 0, 0);
|
||||
while (vec.hasMoreElements()) {
|
||||
Coupon rowBean = (Coupon)vec.nextElement();
|
||||
labelNumber += (long)rowBean.addUnCouponA4Pdf(DBAdapter.convertHtmlToString(rowBean.getSerie()), nRow, 1L,
|
||||
rowBean.getCodice(), rowBean.getNFoto());
|
||||
}
|
||||
if (labelNumber == 0L) {
|
||||
Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!");
|
||||
PdfPCell cell = new PdfPCell(ph);
|
||||
cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow);
|
||||
cell.setIndent((float)l_indent);
|
||||
cell.setBorder(0);
|
||||
cell.setColspan(nCol);
|
||||
this.pdfPcorpo.addCell(cell);
|
||||
} else {
|
||||
long numberBlankCell = (long)nCol - labelNumber % (long)nCol;
|
||||
PdfPCell cell = new PdfPCell();
|
||||
cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow);
|
||||
cell.setIndent((float)l_indent);
|
||||
cell.setBorder(0);
|
||||
if (numberBlankCell != (long)nCol)
|
||||
for (int i = 0; (long)i < numberBlankCell; i++)
|
||||
this.pdfPcorpo.addCell(cell);
|
||||
}
|
||||
this.document.add((Element)this.pdfPcorpo);
|
||||
this.document.close();
|
||||
this.document = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ba;
|
||||
}
|
||||
|
||||
public int addUnCouponA4PdfCodBarre(String titolo, int nRow, long numberOflabel, String l_descrizione) {
|
||||
long pHMarg = 0L;
|
||||
long l_indent = 4L;
|
||||
int totNumbOflabel = 0;
|
||||
try {
|
||||
int margineTop = 40;
|
||||
int altezzaCod = 60;
|
||||
int larghezzaCod = 160;
|
||||
PdfContentByte cb = this.writer.getDirectContent();
|
||||
Barcode128 codeBar = new Barcode128();
|
||||
codeBar.setCodeType(9);
|
||||
for (int i = 0; (long)i < numberOflabel; i++) {
|
||||
totNumbOflabel++;
|
||||
PdfPCell cell = new PdfPCell();
|
||||
cell.setBorder(0);
|
||||
codeBar.setCode(getCodice());
|
||||
Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null);
|
||||
imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod);
|
||||
cell.addElement(new Chunk(" " + l_descrizione, PDF_fMedioB));
|
||||
cell.addElement(new Chunk(imgBarcode, 10.0F, (float)(-margineTop + 10)));
|
||||
cell.setVerticalAlignment(4);
|
||||
cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow);
|
||||
cell.setIndent((float)l_indent);
|
||||
this.pdfPcorpo.addCell(cell);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return totNumbOflabel;
|
||||
}
|
||||
|
||||
public Timestamp getPrintTmst() {
|
||||
return this.printTmst;
|
||||
}
|
||||
|
||||
public void setPrintTmst(Timestamp printTmst) {
|
||||
this.printTmst = printTmst;
|
||||
}
|
||||
|
||||
public String getPrintTmstS() {
|
||||
return convertTimestampToString(getPrintTmst());
|
||||
}
|
||||
|
||||
public int addUnCouponA4Pdf(String l_serie, int nRow, long numberOflabel, String l_codice, long l_nFoto) {
|
||||
long pHMarg = 2L;
|
||||
long l_indent = 4L;
|
||||
boolean border = false;
|
||||
Font fontCodice = new Font(2, 15.0F, 1, Color.DARK_GRAY);
|
||||
Font fontSerie = new Font(2, 12.0F, 1, Color.DARK_GRAY);
|
||||
Font fontWww = new Font(2, 10.0F, 1, Color.DARK_GRAY);
|
||||
Font fontNumero = new Font(2, 7.0F, 1, Color.DARK_GRAY);
|
||||
l_serie = "REGALAMI UN SORRISO";
|
||||
int totNumbOflabel = 0;
|
||||
try {
|
||||
String logoFileName = String.valueOf(getDocBase()) + "/images/layout/regalami-un-sorriso.png";
|
||||
int margineTop = 40;
|
||||
int altezzaCod = 60;
|
||||
int larghezzaCod = 160;
|
||||
float imgLogoWidth = 40.0F;
|
||||
Image imgLogo = Image.getInstance(logoFileName);
|
||||
imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth);
|
||||
imgLogo.setAlignment(5);
|
||||
for (int i = 0; (long)i < numberOflabel; i++) {
|
||||
totNumbOflabel++;
|
||||
PdfPCell cell = new PdfPCell();
|
||||
if (border) {
|
||||
cell.setBorderColor(Color.gray);
|
||||
cell.setBorderWidth(2.0F);
|
||||
} else {
|
||||
cell.setBorder(0);
|
||||
}
|
||||
cell.addElement(new Chunk(imgLogo, 2.0F, -20.0F));
|
||||
cell.addElement(new Chunk(" " + l_serie + " ", fontSerie));
|
||||
cell.addElement(new Chunk(" " + l_codice, fontCodice));
|
||||
cell.addElement(new Chunk(" #" + l_nFoto + "# ", fontNumero));
|
||||
cell.addElement(new Chunk(" www.regalamiunsorriso.it ", fontWww));
|
||||
cell.setVerticalAlignment(4);
|
||||
cell.setHorizontalAlignment(1);
|
||||
cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow);
|
||||
cell.setIndent((float)l_indent);
|
||||
this.pdfPcorpo.addCell(cell);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return totNumbOflabel;
|
||||
}
|
||||
|
||||
public boolean hasCouponRegaloByCliente(long l_id_clifor) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from COUPON AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento inner join DOCUMENTO AS C on B.id_documento=C.id_documento";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.nFoto<100");
|
||||
wc.addWc("C.id_clifor=" + l_id_clifor);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
Vectumerator vec = findRows(stmt, 1, 1);
|
||||
if (vec.hasMoreElements())
|
||||
return true;
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
122
rus/WEB-INF/lib/pg_src/com/ablia/pg/CouponCR.java
Normal file
122
rus/WEB-INF/lib/pg_src/com/ablia/pg/CouponCR.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
|
||||
public class CouponCR extends CRAdapter {
|
||||
private long id_coupon;
|
||||
|
||||
private String codice;
|
||||
|
||||
private long nFoto;
|
||||
|
||||
private long nFotoWeb;
|
||||
|
||||
private long flgUtilizzato = -1L;
|
||||
|
||||
private String serie;
|
||||
|
||||
private long id_rigaDocumento;
|
||||
|
||||
private RigaDocumento rigaDocumento;
|
||||
|
||||
private long flgAttivi = -1L;
|
||||
|
||||
public CouponCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public CouponCR() {}
|
||||
|
||||
public void setId_coupon(long newId_coupon) {
|
||||
this.id_coupon = newId_coupon;
|
||||
}
|
||||
|
||||
public void setCodice(String newCodice) {
|
||||
this.codice = newCodice;
|
||||
}
|
||||
|
||||
public void setNFoto(long newNFoto) {
|
||||
this.nFoto = newNFoto;
|
||||
}
|
||||
|
||||
public void setNFotoWeb(long newNFotoWeb) {
|
||||
this.nFotoWeb = newNFotoWeb;
|
||||
}
|
||||
|
||||
public void setFlgUtilizzato(long newFlgUtilizzato) {
|
||||
this.flgUtilizzato = newFlgUtilizzato;
|
||||
}
|
||||
|
||||
public long getId_coupon() {
|
||||
return this.id_coupon;
|
||||
}
|
||||
|
||||
public String getCodice() {
|
||||
return (this.codice == null) ? "" : this.codice.trim();
|
||||
}
|
||||
|
||||
public long getNFoto() {
|
||||
return this.nFoto;
|
||||
}
|
||||
|
||||
public long getNFotoWeb() {
|
||||
return this.nFotoWeb;
|
||||
}
|
||||
|
||||
public long getFlgUtilizzato() {
|
||||
return this.flgUtilizzato;
|
||||
}
|
||||
|
||||
public String getSerie() {
|
||||
return (this.serie == null) ? "" : this.serie.trim();
|
||||
}
|
||||
|
||||
public void setSerie(String serie) {
|
||||
this.serie = serie;
|
||||
}
|
||||
|
||||
public long getId_rigaDocumento() {
|
||||
return this.id_rigaDocumento;
|
||||
}
|
||||
|
||||
public RigaDocumento getRigaDocumento() {
|
||||
this.rigaDocumento = (RigaDocumento)getSecondaryObject((DBAdapter)this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento());
|
||||
return this.rigaDocumento;
|
||||
}
|
||||
|
||||
public void setId_rigaDocumento(long newId_rigaDocumento) {
|
||||
this.id_rigaDocumento = newId_rigaDocumento;
|
||||
setRigaDocumento(null);
|
||||
}
|
||||
|
||||
public void setRigaDocumento(RigaDocumento newRigaDocumento) {
|
||||
this.rigaDocumento = newRigaDocumento;
|
||||
}
|
||||
|
||||
public long getFlgAttivi() {
|
||||
return this.flgAttivi;
|
||||
}
|
||||
|
||||
public static final String getAttivi(long l_flgAttivi) {
|
||||
switch ((int)l_flgAttivi) {
|
||||
case -1:
|
||||
return "Tutti";
|
||||
case 0:
|
||||
return "No";
|
||||
case 1:
|
||||
return "Si";
|
||||
}
|
||||
return "??";
|
||||
}
|
||||
|
||||
public String getAttivi() {
|
||||
return getAttivi(getFlgAttivi());
|
||||
}
|
||||
|
||||
public void setFlgAttivi(long flgAttivi) {
|
||||
this.flgAttivi = flgAttivi;
|
||||
}
|
||||
}
|
||||
381
rus/WEB-INF/lib/pg_src/com/ablia/pg/Foto.java
Normal file
381
rus/WEB-INF/lib/pg_src/com/ablia/pg/Foto.java
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Foto extends DBAdapter implements Serializable {
|
||||
public static final String SEP_PETTORALE = ",";
|
||||
|
||||
private long id_foto;
|
||||
|
||||
private String file;
|
||||
|
||||
private long impression;
|
||||
|
||||
private Date dataUltimaVisual;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private long id_puntoFoto;
|
||||
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
private String pettorali;
|
||||
|
||||
public Foto(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public Foto() {}
|
||||
|
||||
public void setId_foto(long newId_foto) {
|
||||
this.id_foto = newId_foto;
|
||||
}
|
||||
|
||||
public void setFile(String newFile) {
|
||||
String temp = newFile;
|
||||
temp.replace('/', '_');
|
||||
this.file = temp;
|
||||
}
|
||||
|
||||
public void setImpression(long newNVisual) {
|
||||
this.impression = newNVisual;
|
||||
}
|
||||
|
||||
public void setDataUltimaVisual(Date newDataUltimaVisual) {
|
||||
this.dataUltimaVisual = newDataUltimaVisual;
|
||||
}
|
||||
|
||||
public long getId_foto() {
|
||||
return this.id_foto;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return (this.file == null) ? "" : this.file.trim();
|
||||
}
|
||||
|
||||
public long getImpression() {
|
||||
return this.impression;
|
||||
}
|
||||
|
||||
public Date getDataUltimaVisual() {
|
||||
return this.dataUltimaVisual;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(FotoCR CR, int pageNumber, int pageRows) {
|
||||
StringBuilder s_Sql_Find = new StringBuilder("select DISTINCT A.* from FOTO AS A");
|
||||
String s_Sql_Order = " order by A.file";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_gara() != 0L)
|
||||
wc.addWc("A.id_gara=" + CR.getId_gara());
|
||||
if (CR.getId_puntoFoto() != 0L)
|
||||
wc.addWc("A.id_puntoFoto=" + CR.getId_puntoFoto());
|
||||
if (!CR.getFile().isEmpty())
|
||||
wc.addWc("A.file like '%" + CR.getFile() + "%'");
|
||||
if (!CR.getTipoPuntoFoto().isEmpty()) {
|
||||
s_Sql_Find.append(", PUNTO_FOTO AS B");
|
||||
wc.addWc("A.id_puntoFoto=B.id_puntoFoto");
|
||||
wc.addWc("B.tipoPuntoFoto ='" + CR.getTipoPuntoFoto() + "'");
|
||||
}
|
||||
if (!CR.getPettorale().isEmpty())
|
||||
wc.addWc("A.pettorali like'%," + CR.getPettorale() + ",%'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public static final synchronized ResParm addImpression(String foto, ApplParmFull ap) {
|
||||
Foto bean = new Foto(ap);
|
||||
bean.findByFoto(foto);
|
||||
if (bean.getDBState() == 1) {
|
||||
bean.setImpression(bean.getImpression() + 1L);
|
||||
} else {
|
||||
bean.setFile(foto);
|
||||
bean.setImpression(1L);
|
||||
}
|
||||
bean.setDataUltimaVisual(getToday());
|
||||
return bean.save();
|
||||
}
|
||||
|
||||
public static final synchronized ResParm addImpression(Foto bean, ApplParmFull ap) {
|
||||
ResParm rp;
|
||||
if (bean.getDBState() == 1) {
|
||||
bean.setImpression(bean.getImpression() + 1L);
|
||||
bean.setDataUltimaVisual(getToday());
|
||||
rp = bean.save();
|
||||
} else {
|
||||
rp = new ResParm(false,
|
||||
"Errore! Tentativo di incrementare un impression su una foto non valida. Id_foto: " + bean.getId_foto());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public void findByFoto(String foto) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from FOTO AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("file = '" + fotoToFile(foto) + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getNextId_foto(FotoCR CR) {
|
||||
long l_id_foto = getId_foto();
|
||||
StringBuilder s_Sql_Find = new StringBuilder("select DISTINCT A.* from FOTO AS A");
|
||||
String s_Sql_Order = " order by A.file";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_gara() != 0L)
|
||||
wc.addWc("A.id_gara=" + CR.getId_gara());
|
||||
if (CR.getId_puntoFoto() != 0L)
|
||||
wc.addWc("A.id_puntoFoto=" + CR.getId_puntoFoto());
|
||||
if (!CR.getFile().isEmpty())
|
||||
wc.addWc("A.file > '" + CR.getFile() + "'");
|
||||
if (!CR.getTipoPuntoFoto().isEmpty()) {
|
||||
s_Sql_Find.append(", PUNTO_FOTO AS B");
|
||||
wc.addWc("A.id_puntoFoto=B.id_puntoFoto");
|
||||
wc.addWc("B.tipoPuntoFoto ='" + CR.getTipoPuntoFoto() + "'");
|
||||
}
|
||||
if (!CR.getPettorale().isEmpty())
|
||||
wc.addWc("A.pettorali like'%," + CR.getPettorale() + ",%'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order);
|
||||
Vectumerator vec = findRows(stmt, 1, 1);
|
||||
while (vec.hasMoreElements()) {
|
||||
if (vec.hasMoreElements()) {
|
||||
Foto row = (Foto)vec.nextElement();
|
||||
l_id_foto = row.getId_foto();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
return l_id_foto;
|
||||
}
|
||||
|
||||
public long getPrevId_foto(FotoCR CR) {
|
||||
long l_id_foto = getId_foto();
|
||||
StringBuilder s_Sql_Find = new StringBuilder("select DISTINCT A.* from FOTO AS A");
|
||||
String s_Sql_Order = " order by A.file desc";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_gara() != 0L)
|
||||
wc.addWc("A.id_gara=" + CR.getId_gara());
|
||||
if (CR.getId_puntoFoto() != 0L)
|
||||
wc.addWc("A.id_puntoFoto=" + CR.getId_puntoFoto());
|
||||
if (!CR.getFile().isEmpty())
|
||||
wc.addWc("A.file <'" + CR.getFile() + "'");
|
||||
if (!CR.getTipoPuntoFoto().isEmpty()) {
|
||||
s_Sql_Find.append(", PUNTO_FOTO AS B");
|
||||
wc.addWc("A.id_puntoFoto=B.id_puntoFoto");
|
||||
wc.addWc("B.tipoPuntoFoto ='" + CR.getTipoPuntoFoto() + "'");
|
||||
}
|
||||
if (!CR.getPettorale().isEmpty())
|
||||
wc.addWc("A.pettorali like'%," + CR.getPettorale() + ",%'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order);
|
||||
Vectumerator vec = findRows(stmt, 1, 1);
|
||||
while (vec.hasMoreElements()) {
|
||||
if (vec.hasMoreElements()) {
|
||||
Foto row = (Foto)vec.nextElement();
|
||||
l_id_foto = row.getId_foto();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
return l_id_foto;
|
||||
}
|
||||
|
||||
public long getImpression(String foto) {
|
||||
findByFoto(foto);
|
||||
if (getDBState() == 1)
|
||||
return getImpression();
|
||||
return 0L;
|
||||
}
|
||||
|
||||
private String fotoToFile(String foto) {
|
||||
String temp = foto;
|
||||
temp = temp.replace('/', '_');
|
||||
temp = temp.replace(':', '_');
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getDataUltimaVisual(String foto) {
|
||||
findByFoto(foto);
|
||||
if (getDBState() == 1)
|
||||
return getDataFormat().format(getDataUltimaVisual());
|
||||
return "";
|
||||
}
|
||||
|
||||
protected void prepareSave(PreparedStatement ps) throws Exception {
|
||||
setFile(fotoToFile(getFile()));
|
||||
synchronized (this) {
|
||||
String temp = getPettorali().trim();
|
||||
if (!temp.isEmpty()) {
|
||||
if (!temp.startsWith(","))
|
||||
temp = "," + temp;
|
||||
if (!temp.endsWith(","))
|
||||
temp = String.valueOf(temp) + ",";
|
||||
}
|
||||
setPettorali(temp);
|
||||
}
|
||||
super.prepareSave(ps);
|
||||
}
|
||||
|
||||
public void findByFilenamePuntoFoto(String l_filename, long l_id_puntoFoto) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from FOTO AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.file='" + l_filename + "'");
|
||||
wc.addWc("A.id_puntoFoto=" + l_id_puntoFoto);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void findByFilenameGara(String l_filename, long l_id_gara) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from FOTO AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.file='" + l_filename + "'");
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public void setId_gara(long id_gara) {
|
||||
this.id_gara = id_gara;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public void setId_puntoFoto(long id_puntoFoto) {
|
||||
this.id_puntoFoto = id_puntoFoto;
|
||||
setPuntoFoto(null);
|
||||
}
|
||||
|
||||
public ResParm deleteFotoByPuntoFoto(long l_id_puntoFoto) {
|
||||
ResParm rp;
|
||||
if (l_id_puntoFoto > 0L) {
|
||||
rp = delete("delete from FOTO where (impression is null or impression=0 ) and id_puntoFoto=" + l_id_puntoFoto);
|
||||
} else {
|
||||
rp = new ResParm(false, "ERRORE! punto foto non valido");
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getPathCompletoFile() {
|
||||
return String.valueOf(getPuntoFoto().getPathCompletoFoto()) + getFile();
|
||||
}
|
||||
|
||||
public String getPathCompletoFileTn() {
|
||||
return String.valueOf(getPuntoFoto().getPathCompletoFoto()) + "tn_" + getFile();
|
||||
}
|
||||
|
||||
public PuntoFoto getPuntoFoto() {
|
||||
this.puntoFoto = (PuntoFoto)getSecondaryObject(this.puntoFoto, PuntoFoto.class, getId_puntoFoto());
|
||||
return this.puntoFoto;
|
||||
}
|
||||
|
||||
public void setPuntoFoto(PuntoFoto newPuntoFoto) {
|
||||
this.puntoFoto = newPuntoFoto;
|
||||
}
|
||||
|
||||
public long getTotFoto() {
|
||||
StringBuilder s_Sql_Find = new StringBuilder("select count(*) as _cnt from FOTO AS A");
|
||||
WcString wc = new WcString();
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString());
|
||||
return getCount(stmt, "_cnt");
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
public String getFileURI() {
|
||||
if (getFile().isEmpty())
|
||||
return getFile();
|
||||
int idxDot = getFile().lastIndexOf(".");
|
||||
return String.valueOf(getFile().substring(0, idxDot)) + "-" + getId_foto() + getFile().substring(idxDot, getFile().length()).toLowerCase();
|
||||
}
|
||||
|
||||
public String getPettorali() {
|
||||
if (this.pettorali != null)
|
||||
this.pettorali = this.pettorali.replace('.', ',');
|
||||
return (this.pettorali == null) ? "" : this.pettorali;
|
||||
}
|
||||
|
||||
public void setPettorali(String pettorali) {
|
||||
this.pettorali = pettorali;
|
||||
}
|
||||
|
||||
public Vectumerator<Foto> findByPettoraliCR(FotoCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from FOTO AS A";
|
||||
String s_Sql_Order = " order by A.fileName ";
|
||||
if ((pageNumber == 0 && pageRows == 0) || pageRows == 999)
|
||||
s_Sql_Order = " order by rand() ";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_puntoFoto() == 0L || !CR.getTipoPuntoFoto().isEmpty()) {
|
||||
s_Sql_Find = String.valueOf(s_Sql_Find) + ", PUNTO_FOTO AS B";
|
||||
wc.addWc("A.id_puntoFoto=B.id_puntoFoto");
|
||||
}
|
||||
if (CR.getId_gara() != 0L)
|
||||
wc.addWc("A.id_gara=" + CR.getId_gara());
|
||||
if (CR.getId_puntoFoto() != 0L)
|
||||
wc.addWc("A.id_puntoFoto=" + CR.getId_puntoFoto());
|
||||
if (!CR.getTipoPuntoFoto().isEmpty())
|
||||
wc.addWc("B.tipoPuntoFoto='" + CR.getTipoPuntoFoto() + "'");
|
||||
if (CR.getId_puntoFoto() == 0L)
|
||||
CR.getTipoPuntoFoto().isEmpty();
|
||||
if (!CR.getFileName().isEmpty())
|
||||
wc.addWc("A.fileName like '%" + CR.getFileName() + "%'");
|
||||
if (!CR.getPettorale().isEmpty())
|
||||
wc.addWc("A.pettorali like'%," + CR.getPettorale() + ",%'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
413
rus/WEB-INF/lib/pg_src/com/ablia/pg/FotoCR.java
Normal file
413
rus/WEB-INF/lib/pg_src/com/ablia/pg/FotoCR.java
Normal file
|
|
@ -0,0 +1,413 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class FotoCR extends CRAdapter {
|
||||
private long flgTipoEvento;
|
||||
|
||||
private long id_foto;
|
||||
|
||||
private String file;
|
||||
|
||||
private Date dataUltimaVisual;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private long id_puntoFoto;
|
||||
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
private long anno;
|
||||
|
||||
private Date dataGaraInizio;
|
||||
|
||||
private Date dataGaraInizioDa;
|
||||
|
||||
private long id_tipoGara;
|
||||
|
||||
private TipoGara tipoGara;
|
||||
|
||||
private String tipoPuntoFoto;
|
||||
|
||||
private long flgEventoInLinea = -1L;
|
||||
|
||||
private Date dataGaraInizioFE;
|
||||
|
||||
private Date dataGaraInizioFS;
|
||||
|
||||
private long id_tipoGaraFE;
|
||||
|
||||
private long id_tipoGaraFS;
|
||||
|
||||
private Date dataGaraInizioA;
|
||||
|
||||
private String localita;
|
||||
|
||||
private String localitaFE;
|
||||
|
||||
private String localitaFS;
|
||||
|
||||
private long flgMese;
|
||||
|
||||
private long annoFS;
|
||||
|
||||
private long annoFE;
|
||||
|
||||
private long flgMeseFS;
|
||||
|
||||
private long flgMeseFE;
|
||||
|
||||
private long pageNumberFE = 1L;
|
||||
|
||||
private long pageNumberFS = 1L;
|
||||
|
||||
private long flgVisCompatta;
|
||||
|
||||
private String flgVisCompattaS;
|
||||
|
||||
private String pettorale;
|
||||
|
||||
private long flgTh;
|
||||
|
||||
public FotoCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public FotoCR() {}
|
||||
|
||||
public void setId_foto(long newId_foto) {
|
||||
this.id_foto = newId_foto;
|
||||
}
|
||||
|
||||
public void setFile(String newFile) {
|
||||
this.file = newFile;
|
||||
}
|
||||
|
||||
public void setDataUltimaVisual(Date newDataUltimaVisual) {
|
||||
this.dataUltimaVisual = newDataUltimaVisual;
|
||||
}
|
||||
|
||||
public long getId_foto() {
|
||||
return this.id_foto;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return (this.file == null) ? "" : this.file.trim();
|
||||
}
|
||||
|
||||
public Date getDataUltimaVisual() {
|
||||
return this.dataUltimaVisual;
|
||||
}
|
||||
|
||||
public Gara getGara() {
|
||||
this.gara = (Gara)getSecondaryObject(this.gara, Gara.class, getId_gara());
|
||||
return this.gara;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public PuntoFoto getPuntoFoto() {
|
||||
this.puntoFoto = (PuntoFoto)getSecondaryObject(this.puntoFoto, PuntoFoto.class, getId_puntoFoto());
|
||||
return this.puntoFoto;
|
||||
}
|
||||
|
||||
public void setGara(Gara newGara) {
|
||||
this.gara = newGara;
|
||||
}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
setGara(null);
|
||||
}
|
||||
|
||||
public void setId_puntoFoto(long newId_puntoFoto) {
|
||||
this.id_puntoFoto = newId_puntoFoto;
|
||||
setPuntoFoto(null);
|
||||
}
|
||||
|
||||
public void setPuntoFoto(PuntoFoto newPuntoFoto) {
|
||||
this.puntoFoto = newPuntoFoto;
|
||||
}
|
||||
|
||||
public static final String getEventoInLinea(long l_flgEventoInLinea) {
|
||||
return Gara.getEventoInLinea(l_flgEventoInLinea);
|
||||
}
|
||||
|
||||
public long getAnno() {
|
||||
return this.anno;
|
||||
}
|
||||
|
||||
public void setAnno(long anno) {
|
||||
this.anno = anno;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioA() {
|
||||
return this.dataGaraInizioA;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioA(Date dataGaraInizioA) {
|
||||
this.dataGaraInizioA = dataGaraInizioA;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioDa() {
|
||||
return this.dataGaraInizioDa;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioDa(Date dataGaraInizioDa) {
|
||||
this.dataGaraInizioDa = dataGaraInizioDa;
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGara() {
|
||||
this.tipoGara = (TipoGara)getSecondaryObject(this.tipoGara, TipoGara.class, getId_tipoGara());
|
||||
return this.tipoGara;
|
||||
}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
setTipoGara(null);
|
||||
}
|
||||
|
||||
public void setTipoGara(TipoGara newTipoGara) {
|
||||
this.tipoGara = newTipoGara;
|
||||
}
|
||||
|
||||
public String getTipoPuntoFoto() {
|
||||
return (this.tipoPuntoFoto == null) ? "" : this.tipoPuntoFoto.trim();
|
||||
}
|
||||
|
||||
public void setTipoPuntoFoto(String tipoPuntoFoto) {
|
||||
this.tipoPuntoFoto = tipoPuntoFoto;
|
||||
}
|
||||
|
||||
public long getFlgEventoInLinea() {
|
||||
return this.flgEventoInLinea;
|
||||
}
|
||||
|
||||
public void setFlgEventoInLinea(long flgEventoInLinea) {
|
||||
this.flgEventoInLinea = flgEventoInLinea;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioFE() {
|
||||
return this.dataGaraInizioFE;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioFS() {
|
||||
return this.dataGaraInizioFS;
|
||||
}
|
||||
|
||||
public long getId_tipoGaraFE() {
|
||||
return this.id_tipoGaraFE;
|
||||
}
|
||||
|
||||
public long getId_tipoGaraFS() {
|
||||
return this.id_tipoGaraFS;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioFE(Date dataGaraInizioFE) {
|
||||
this.dataGaraInizioFE = dataGaraInizioFE;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioFS(Date dataGaraInizioFS) {
|
||||
this.dataGaraInizioFS = dataGaraInizioFS;
|
||||
}
|
||||
|
||||
public void setId_tipoGaraFE(long id_tipoGaraFE) {
|
||||
this.id_tipoGaraFE = id_tipoGaraFE;
|
||||
}
|
||||
|
||||
public void setId_tipoGaraFS(long id_tipoGaraFS) {
|
||||
this.id_tipoGaraFS = id_tipoGaraFS;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizio() {
|
||||
return this.dataGaraInizio;
|
||||
}
|
||||
|
||||
public void setDataGaraInizio(Date dataGaraInizio) {
|
||||
this.dataGaraInizio = dataGaraInizio;
|
||||
}
|
||||
|
||||
public String getLocalita() {
|
||||
return (this.localita == null) ? "" : this.localita.trim();
|
||||
}
|
||||
|
||||
public void setLocalita(String localita) {
|
||||
this.localita = localita;
|
||||
}
|
||||
|
||||
public String getLocalitaFE() {
|
||||
return (this.localitaFE == null) ? "" : this.localitaFE.trim();
|
||||
}
|
||||
|
||||
public void setLocalitaFE(String localitaFE) {
|
||||
this.localitaFE = localitaFE;
|
||||
}
|
||||
|
||||
public String getLocalitaFS() {
|
||||
return (this.localitaFS == null) ? "" : this.localitaFS.trim();
|
||||
}
|
||||
|
||||
public void setLocalitaFS(String localitaFS) {
|
||||
this.localitaFS = localitaFS;
|
||||
}
|
||||
|
||||
public static final String getMese(long l_flgMese) {
|
||||
switch ((int)l_flgMese) {
|
||||
case 1:
|
||||
return "Gennaio";
|
||||
case 2:
|
||||
return "Febbraio";
|
||||
case 3:
|
||||
return "Marzo";
|
||||
case 4:
|
||||
return "Aprile";
|
||||
case 5:
|
||||
return "Maggio";
|
||||
case 6:
|
||||
return "Giugno";
|
||||
case 7:
|
||||
return "Luglio";
|
||||
case 8:
|
||||
return "Agosto";
|
||||
case 9:
|
||||
return "Settembre";
|
||||
case 10:
|
||||
return "Ottobre";
|
||||
case 11:
|
||||
return "Novembre";
|
||||
case 12:
|
||||
return "Dicembre";
|
||||
}
|
||||
return "Seleziona Mese";
|
||||
}
|
||||
|
||||
public static final String getMeseFE(long l_flgMese) {
|
||||
return getMese(l_flgMese);
|
||||
}
|
||||
|
||||
public String getMese() {
|
||||
return getMese(getFlgMese());
|
||||
}
|
||||
|
||||
public void setFlgMese(long mese) {
|
||||
this.flgMese = mese;
|
||||
}
|
||||
|
||||
public long getFlgMese() {
|
||||
return this.flgMese;
|
||||
}
|
||||
|
||||
public long getAnnoFS() {
|
||||
return this.annoFS;
|
||||
}
|
||||
|
||||
public void setAnnoFS(long annoFS) {
|
||||
this.annoFS = annoFS;
|
||||
}
|
||||
|
||||
public long getAnnoFE() {
|
||||
return this.annoFE;
|
||||
}
|
||||
|
||||
public void setAnnoFE(long annoFE) {
|
||||
this.annoFE = annoFE;
|
||||
}
|
||||
|
||||
public long getFlgMeseFS() {
|
||||
return this.flgMeseFS;
|
||||
}
|
||||
|
||||
public void setFlgMeseFS(long flgMeseFS) {
|
||||
this.flgMeseFS = flgMeseFS;
|
||||
}
|
||||
|
||||
public long getFlgMeseFE() {
|
||||
return this.flgMeseFE;
|
||||
}
|
||||
|
||||
public void setFlgMeseFE(long flgMeseFE) {
|
||||
this.flgMeseFE = flgMeseFE;
|
||||
}
|
||||
|
||||
public String getMeseFS() {
|
||||
return getMese(getFlgMese());
|
||||
}
|
||||
|
||||
public String getMeseFE() {
|
||||
return getMese(getFlgMese());
|
||||
}
|
||||
|
||||
public long getPageNumberFE() {
|
||||
return this.pageNumberFE;
|
||||
}
|
||||
|
||||
public long getPageNumberFS() {
|
||||
return this.pageNumberFS;
|
||||
}
|
||||
|
||||
public void setPageNumberFE(long pageNumberFE) {
|
||||
this.pageNumberFE = pageNumberFE;
|
||||
}
|
||||
|
||||
public void setPageNumberFS(long pageNumberFS) {
|
||||
this.pageNumberFS = pageNumberFS;
|
||||
}
|
||||
|
||||
public static final String getMeseFS(long l_flgMese) {
|
||||
return getMese(l_flgMese);
|
||||
}
|
||||
|
||||
public long getFlgTipoEvento() {
|
||||
return this.flgTipoEvento;
|
||||
}
|
||||
|
||||
public void setFlgTipoEvento(long flgTipoEvento) {
|
||||
this.flgTipoEvento = flgTipoEvento;
|
||||
}
|
||||
|
||||
public long getFlgVisCompatta() {
|
||||
return this.flgVisCompatta;
|
||||
}
|
||||
|
||||
public void setFlgVisCompatta(long flgVisCompatta) {
|
||||
this.flgVisCompatta = flgVisCompatta;
|
||||
}
|
||||
|
||||
public String getFlgVisCompattaS() {
|
||||
return (this.flgVisCompattaS == null) ? "" : this.flgVisCompattaS;
|
||||
}
|
||||
|
||||
public void setFlgVisCompattaS(String flgVisCompattaS) {
|
||||
this.flgVisCompattaS = flgVisCompattaS;
|
||||
}
|
||||
|
||||
public String getPettorale() {
|
||||
return (this.pettorale == null) ? "" : this.pettorale.trim();
|
||||
}
|
||||
|
||||
public void setPettorale(String pettorale) {
|
||||
this.pettorale = pettorale;
|
||||
}
|
||||
|
||||
public long getFlgTh() {
|
||||
return this.flgTh;
|
||||
}
|
||||
|
||||
public void setFlgTh(long flgTh) {
|
||||
this.flgTh = flgTh;
|
||||
}
|
||||
}
|
||||
569
rus/WEB-INF/lib/pg_src/com/ablia/pg/Gara.java
Normal file
569
rus/WEB-INF/lib/pg_src/com/ablia/pg/Gara.java
Normal file
|
|
@ -0,0 +1,569 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.common.CrontabInterface;
|
||||
import com.ablia.db.AddImgInterface;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.SimpleDateFormat;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Gara extends _PgAdapter implements Serializable, AddImgInterface, CrontabInterface {
|
||||
private static final long serialVersionUID = 1511425418987L;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private long id_tipoGara;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String localita;
|
||||
|
||||
private Date dataGaraInizio;
|
||||
|
||||
private Date dataGaraFine;
|
||||
|
||||
private String pathBase;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
private TipoGara tipoGara;
|
||||
|
||||
private long flgEventoInLinea;
|
||||
|
||||
private long nDownload;
|
||||
|
||||
private Date dataDownload;
|
||||
|
||||
class ThreadCreaPuntiFoto extends Thread {
|
||||
private boolean indicizza = false;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private long id_users;
|
||||
|
||||
public ThreadCreaPuntiFoto(Gara gara, boolean indicizza, long id_users) {
|
||||
if (!Gara.isThreadAttivo()) {
|
||||
Gara.threadCreaPuntiFoto = true;
|
||||
this.gara = gara;
|
||||
this.indicizza = indicizza;
|
||||
this.id_users = id_users;
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
boolean debug = false;
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("##############\nCREA PUNTI FOTO\nSTART: " + start.toString());
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
ApplParmFull ap = this.gara.getApFull();
|
||||
Gara.threadCreaPuntiFotoMsg = "Attenzione! Thread CREA PUNTI FOTO in esecuzione!!! Aggiornamento articoli attuali ";
|
||||
String dirBase = String.valueOf(this.gara.getPathBaseFoto()) + this.gara.getPathBase();
|
||||
if (new File(dirBase).exists()) {
|
||||
File dir = new File(dirBase);
|
||||
File[] puntiFotos = dir.listFiles();
|
||||
File thePuntoFotoDir = null;
|
||||
try {
|
||||
for (int j = 0; j < puntiFotos.length; j++) {
|
||||
thePuntoFotoDir = puntiFotos[j];
|
||||
String theDir = thePuntoFotoDir.getAbsolutePath();
|
||||
if (new File(theDir).isDirectory()) {
|
||||
String path = theDir.substring(dirBase.length());
|
||||
PuntoFoto pf = new PuntoFoto(ap);
|
||||
pf.findByGaraPath(this.gara.getId_gara(), path);
|
||||
if (pf.getDBState() == 0) {
|
||||
Gara.threadCreaPuntiFotoMsg = "Creazione punto foto " + path;
|
||||
pf.setId_gara(this.gara.getId_gara());
|
||||
pf.setPathRelativoFoto(path);
|
||||
pf.setDescrizionePuntoFoto(path.replace("/", ""));
|
||||
rp = pf.save();
|
||||
if (rp.getStatus() &&
|
||||
this.indicizza) {
|
||||
Gara.threadCreaPuntiFotoMsg = "Indicizzazione punto foto " + path;
|
||||
pf.indexFoto(this.id_users);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gara.threadCreaPuntiFotoMsg = "Creazione punto foto gara " + this.gara.getDescrizione() + " ok!";
|
||||
sleep(8000L);
|
||||
Gara.threadCreaPuntiFotoMsg = "";
|
||||
} catch (Exception e) {
|
||||
Gara.this.handleDebug(e);
|
||||
Gara.threadCreaPuntiFotoMsg = "Errore! CREA PUNTO FOTO" + thePuntoFotoDir.getName() + "<br>" + e.getMessage();
|
||||
}
|
||||
} else {
|
||||
Gara.threadCreaPuntiFotoMsg = "Errore! Percorso base errato: " + dirBase;
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println("STOP: " + start.toString());
|
||||
SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss ");
|
||||
System.out.println("DURATA: " + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "Risultato import:\n" +
|
||||
rp.getMsg() + "\n\nIMPORT CREA PUNTI FOTO concluso\n****************");
|
||||
Gara.threadCreaPuntiFoto = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean threadCreaPuntiFoto = false;
|
||||
|
||||
public static String threadCreaPuntiFotoMsg = "";
|
||||
|
||||
public static final int FLG_EVENTO_NON_IN_LINEA = 0;
|
||||
|
||||
public static final int FLG_EVENTO_STAND_BY = 1;
|
||||
|
||||
public static final int FLG_EVENTO_IN_LINEA = 2;
|
||||
|
||||
public Gara(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public Gara() {}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
setTipoGara(null);
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setLocalita(String newLocalita) {
|
||||
this.localita = newLocalita;
|
||||
}
|
||||
|
||||
public void setDataGaraInizio(Date newDataGaraInizio) {
|
||||
this.dataGaraInizio = newDataGaraInizio;
|
||||
}
|
||||
|
||||
public void setDataGaraFine(Date newDataGaraFine) {
|
||||
this.dataGaraFine = newDataGaraFine;
|
||||
}
|
||||
|
||||
public void setPathBase(String newPathBase) {
|
||||
this.pathBase = newPathBase;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public String getLocalita() {
|
||||
return (this.localita == null) ? "" : this.localita.trim();
|
||||
}
|
||||
|
||||
public Date getDataGaraInizio() {
|
||||
return this.dataGaraInizio;
|
||||
}
|
||||
|
||||
public Date getDataGaraFine() {
|
||||
return this.dataGaraFine;
|
||||
}
|
||||
|
||||
public String getPathBase() {
|
||||
return (this.pathBase == null) ? "" : this.pathBase.trim();
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
|
||||
}
|
||||
|
||||
public void setTipoGara(TipoGara newTipoGara) {
|
||||
this.tipoGara = newTipoGara;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGara() {
|
||||
this.tipoGara = (TipoGara)getSecondaryObject(this.tipoGara, TipoGara.class, getId_tipoGara());
|
||||
return this.tipoGara;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator<Gara> findByCR(GaraCR CR, int pageNumber, int pageRows) {
|
||||
StringBuilder s_Sql_Find = new StringBuilder("select DISTINCT A.* from GARA AS A");
|
||||
String s_Sql_Order = " order by A.dataGaraInizio desc";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_tipoGara() != 0L)
|
||||
s_Sql_Find.append(" inner join TIPO_GARA AS C ON C.id_tipoGara=A.id_tipoGara");
|
||||
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.descrizione like '%" + token + "%' or A.localita like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
if (!CR.getDescrizioneGara().trim().isEmpty()) {
|
||||
StringTokenizer st = new StringTokenizer(CR.getDescrizioneGara().trim(), " ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
txt.append("(A.descrizione like '%" + token + "%' or A.localita like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
if (CR.getId_tipoGara() != 0L)
|
||||
wc.addWc("(A.id_tipogara=" + CR.getId_tipoGara() + " or C.indici like'%:" + CR.getId_tipoGara() + ":%')");
|
||||
if (CR.getDataGaraInizioDa() != null)
|
||||
wc.addWc("(A.dataGaraInizio>=? )");
|
||||
if (CR.getDataGaraInizioA() != null)
|
||||
wc.addWc("(A.dataGaraInizio<=? )");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + wc.toString() + s_Sql_Order);
|
||||
int numData = 1;
|
||||
if (CR.getDataGaraInizioDa() != null) {
|
||||
stmt.setDate(numData, CR.getDataGaraInizioDa());
|
||||
numData++;
|
||||
}
|
||||
if (CR.getDataGaraInizioA() != null) {
|
||||
stmt.setDate(numData, CR.getDataGaraInizioA());
|
||||
numData++;
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm addPuntoFoto(PuntoFoto ab) {
|
||||
PuntoFoto bean = new PuntoFoto(getApFull());
|
||||
if (ab.getId_puntoFoto() == 0L) {
|
||||
ab.setDBState(0);
|
||||
} else {
|
||||
bean.findByPrimaryKey(ab.getId_puntoFoto());
|
||||
if (bean != null) {
|
||||
ab.setDBState(bean.getDBState());
|
||||
} else {
|
||||
ab.setDBState(0);
|
||||
}
|
||||
}
|
||||
ab.setId_gara(getId_gara());
|
||||
return ab.save();
|
||||
}
|
||||
|
||||
public ResParm delPuntoFoto(long l_id) {
|
||||
PuntoFoto bean = new PuntoFoto(getApFull());
|
||||
bean.findByPrimaryKey(l_id);
|
||||
return bean.delete();
|
||||
}
|
||||
|
||||
public String getDescrizioneGaraCompleta() {
|
||||
if (getId_gara() == 0L)
|
||||
return "";
|
||||
return String.valueOf(getDataFormat().format(getDataGaraInizio())) + " - " + getDataFormat().format(getDataGaraFine()) + " - " + getDescrizione();
|
||||
}
|
||||
|
||||
public String getDescrizioneGaraHtml() {
|
||||
return convertStringToHtml(getDescrizione());
|
||||
}
|
||||
|
||||
public Vectumerator getPuntiFoto(int pageNumber, int pageRows) {
|
||||
return new PuntoFoto(getApFull()).findPuntiFotoByGara(getId_gara(), pageNumber, pageRows);
|
||||
}
|
||||
|
||||
public boolean isIndexManuale() {
|
||||
if (getId_gara() == 0L)
|
||||
return false;
|
||||
PuntoFoto pf = new PuntoFoto(getApFull());
|
||||
PuntoFotoCR CR = new PuntoFotoCR(getApFull());
|
||||
CR.setId_gara(getId_gara());
|
||||
CR.setFlgIndexOk(2L);
|
||||
Vectumerator<PuntoFoto> vec = pf.findByCR(CR, 1, 1);
|
||||
if (vec.hasMoreElements())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Vectumerator findWebByCR(FotoCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from GARA AS A";
|
||||
String s_Sql_Order = " order by A.flgEventoInLinea, A.dataGaraInizio desc";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_tipoGara() > 0L)
|
||||
s_Sql_Find = String.valueOf(s_Sql_Find) + " inner join TIPO_GARA AS C ON A.id_tipoGara=C.id_tipoGara";
|
||||
if (CR.getId_tipoGara() > 0L)
|
||||
wc.addWc("(A.id_tipoGara=" + CR.getId_tipoGara() + " or C.indici like'%:" + CR.getId_tipoGara() + ":%')");
|
||||
if (!CR.getLocalita().isEmpty())
|
||||
wc.addWc("A.localita like '%" + CR.getLocalita() + "%'");
|
||||
wc.addWc("A.flgEventoInLinea>0");
|
||||
if (CR.getAnno() > 0L) {
|
||||
wc.addWc("A.dataGaraInizio>=?");
|
||||
wc.addWc("A.dataGaraInizio<=?");
|
||||
}
|
||||
if (CR.getFlgMese() > 0L)
|
||||
wc.addWc("MONTH(A.dataGaraInizio)=" + CR.getFlgMese());
|
||||
if (CR.getDataGaraInizio() != null)
|
||||
wc.addWc("(A.dataGaraInizio<=? and (A.dataGaraFine>=? || A.dataGaraFine is null))");
|
||||
if (CR.getDataGaraInizioDa() != null)
|
||||
wc.addWc("(A.dataGaraInizio>=? or A.dataGaraFine>=?)");
|
||||
if (CR.getDataGaraInizioA() != null)
|
||||
wc.addWc("(A.dataGaraInizio<=? or A.dataGaraFine<=?)");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
int numData = 1;
|
||||
if (CR.getAnno() > 0L) {
|
||||
stmt.setDate(1, DBAdapter.getFirstOfYear((int)CR.getAnno()));
|
||||
numData++;
|
||||
stmt.setDate(2, DBAdapter.getLastOfYear((int)CR.getAnno()));
|
||||
numData++;
|
||||
}
|
||||
if (CR.getDataGaraInizio() != null) {
|
||||
stmt.setDate(numData, CR.getDataGaraInizio());
|
||||
numData++;
|
||||
stmt.setDate(numData, CR.getDataGaraInizio());
|
||||
numData++;
|
||||
}
|
||||
if (CR.getDataGaraInizioDa() != null) {
|
||||
stmt.setDate(numData, CR.getDataGaraInizioDa());
|
||||
numData++;
|
||||
stmt.setDate(numData, CR.getDataGaraInizioDa());
|
||||
numData++;
|
||||
}
|
||||
if (CR.getDataGaraInizioA() != null) {
|
||||
stmt.setDate(numData, CR.getDataGaraInizioA());
|
||||
numData++;
|
||||
stmt.setDate(numData, CR.getDataGaraInizioA());
|
||||
numData++;
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public long getFlgEventoInLinea() {
|
||||
return this.flgEventoInLinea;
|
||||
}
|
||||
|
||||
public void setFlgEventoInLinea(long flgEventoInLinea) {
|
||||
this.flgEventoInLinea = flgEventoInLinea;
|
||||
}
|
||||
|
||||
public static final String getEventoInLinea(long l_flgEventoInLinea) {
|
||||
switch ((int)l_flgEventoInLinea) {
|
||||
case 0:
|
||||
return "Non In Linea";
|
||||
case 1:
|
||||
return "Stand By";
|
||||
case 2:
|
||||
return "In Linea";
|
||||
}
|
||||
return "--";
|
||||
}
|
||||
|
||||
public String getEventoInLinea() {
|
||||
return getEventoInLinea(getFlgEventoInLinea());
|
||||
}
|
||||
|
||||
public ResParm save() {
|
||||
if (!getPathBase().isEmpty() && !getPathBase().endsWith("/"))
|
||||
setPathBase(String.valueOf(getPathBase()) + "/");
|
||||
ResParm rp = super.save();
|
||||
if (rp.getStatus() &&
|
||||
getPathBase().isEmpty() && getDataGaraInizio() != null) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(getDataGaraInizio());
|
||||
int year = cal.get(1);
|
||||
setPathBase(String.valueOf(year) + "/" + getId_gara() + "/");
|
||||
rp.append(super.save());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public final ResParm startCreaPuntiFoto(Gara l_gara, boolean l_indicizza, long l_id_users) {
|
||||
if (!isThreadAttivo())
|
||||
return new ResParm(true, "Thread Creazione Punti foto avviato");
|
||||
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
|
||||
}
|
||||
|
||||
public static boolean isThreadAttivo() {
|
||||
return threadCreaPuntiFoto;
|
||||
}
|
||||
|
||||
public long getNDownload() {
|
||||
return this.nDownload;
|
||||
}
|
||||
|
||||
public void setNDownload(long nDownload) {
|
||||
this.nDownload = nDownload;
|
||||
}
|
||||
|
||||
public Date getDataDownload() {
|
||||
return this.dataDownload;
|
||||
}
|
||||
|
||||
public void setDataDownload(Date dataDownload) {
|
||||
this.dataDownload = dataDownload;
|
||||
}
|
||||
|
||||
public ResParm crontabJob(ApplParmFull ap) {
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer msg = new StringBuffer(
|
||||
"\n################# Inizio crontab Giornaliera PG (" + DBAdapter.getNow().toString() + ")\n#################");
|
||||
long t0 = System.currentTimeMillis();
|
||||
Gara bean = new Gara(ap);
|
||||
rp = bean.aggiornaStatistiche();
|
||||
msg.append(rp.getMsg());
|
||||
long totFoto = new Foto(ap).getTotFoto();
|
||||
msg.append(" TOTALI FOTO PRESENTI: " + ap.getNf().format(totFoto));
|
||||
msg.append("\n################# Fine crontab Giornaliera PG (" + 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;
|
||||
}
|
||||
|
||||
public ResParm aggiornaStatistiche() {
|
||||
ResParm rp = new ResParm(false);
|
||||
if (getApFull() != null) {
|
||||
Gara bean = new Gara(getApFull());
|
||||
String s_Sql_Find = "select count(*) as nDownload , B.id_gara from LOG_FOTO AS A INNER JOIN FOTO AS B ON A.id_foto=B.id_foto GROUP BY B.id_gara;";
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find);
|
||||
long totDownload = 0L;
|
||||
Vectumerator<Gara> vec = findRows(stmt);
|
||||
while (vec.hasMoreElements()) {
|
||||
Gara row = (Gara)vec.nextElement();
|
||||
bean.findByPrimaryKey(row.getId_gara());
|
||||
bean.setNDownload(row.getNDownload());
|
||||
bean.setDataDownload(getToday());
|
||||
bean.save();
|
||||
totDownload += row.getNDownload();
|
||||
}
|
||||
rp.setMsg("Aggiornati " + vec.getTotNumberOfRecords() + " records. Tot. download: " + totDownload);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(e);
|
||||
}
|
||||
} else {
|
||||
rp.setMsg("ERRORE!! AP null");
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public boolean isImportFileExist() {
|
||||
String theFile = getImpCsvFileName();
|
||||
return isFileExist(theFile);
|
||||
}
|
||||
|
||||
public String getImpCsvFileName() {
|
||||
return String.valueOf(getDocBase()) + "admin/csv/" + getId_gara() + ".csv";
|
||||
}
|
||||
|
||||
public ResParm indexFotoPisa(String l_fileName) {
|
||||
ResParm rp = new ResParm();
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
int i = 0;
|
||||
int nrighe = 0;
|
||||
int fotoTrovate = 0;
|
||||
int fotoNonTrovate = 0;
|
||||
StringBuffer errMsg = new StringBuffer();
|
||||
if (getId_gara() == 0L) {
|
||||
rp.setMsg("Indicizzazione foto: Bean gara non caricato");
|
||||
rp.setStatus(false);
|
||||
handleDebug("Indicizzazione foto: Bean gara non caricato", 2);
|
||||
return rp;
|
||||
}
|
||||
BufferedReader reader = null;
|
||||
Foto foto = new Foto(getApFull());
|
||||
try {
|
||||
reader = new BufferedReader(new FileReader(l_fileName));
|
||||
if (reader != null) {
|
||||
String currentLine;
|
||||
while ((currentLine = reader.readLine()) != null) {
|
||||
nrighe++;
|
||||
int firstComma = currentLine.indexOf(",");
|
||||
String nomeFoto = currentLine.substring(0, firstComma - 1);
|
||||
String pettorali = currentLine.substring(firstComma + 1);
|
||||
System.out.println(String.valueOf(nomeFoto) + " " + pettorali);
|
||||
foto.findByFilenameGara(nomeFoto, getId_gara());
|
||||
if (foto.getDBState() == 1) {
|
||||
fotoTrovate++;
|
||||
foto.setPettorali(pettorali);
|
||||
foto.save();
|
||||
} else {
|
||||
fotoNonTrovate++;
|
||||
}
|
||||
i++;
|
||||
if (se1 > 0)
|
||||
i % se1;
|
||||
if (se2 > 0)
|
||||
i % se2;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rp.setStatus(false);
|
||||
rp.appendMsg("-------------------\nECCEZIONE !!!\n");
|
||||
rp.appendMsg(e.getMessage());
|
||||
rp.appendMsg(" \n Numero righe importate: " + nrighe);
|
||||
rp.appendMsg(" \nFoto Trovate: " + fotoTrovate + " foto Non trovate: " + fotoNonTrovate);
|
||||
} finally {
|
||||
if (reader != null)
|
||||
try {
|
||||
reader.close();
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (rp.getStatus())
|
||||
rp.setMsg(
|
||||
" Numero righe importate: " + nrighe + " \nFoto Trovate: " + fotoTrovate + " foto Non trovate: " + fotoNonTrovate);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getPathAttach() {
|
||||
return "_img/_gara/";
|
||||
}
|
||||
}
|
||||
143
rus/WEB-INF/lib/pg_src/com/ablia/pg/GaraCR.java
Normal file
143
rus/WEB-INF/lib/pg_src/com/ablia/pg/GaraCR.java
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class GaraCR extends CRAdapter {
|
||||
private long id_gara;
|
||||
|
||||
private long id_tipoGara;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String localita;
|
||||
|
||||
private Date dataGaraInizioDa;
|
||||
|
||||
private String pathBase;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
private TipoGara tipoGara;
|
||||
|
||||
private Date dataGaraInizioA;
|
||||
|
||||
private long anno;
|
||||
|
||||
private long flgEventoInLinea = -1L;
|
||||
|
||||
private String descrizioneGara;
|
||||
|
||||
public GaraCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public GaraCR() {}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
setTipoGara(null);
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setLocalita(String newLocalita) {
|
||||
this.localita = newLocalita;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioA(Date newDataGaraInizio) {
|
||||
this.dataGaraInizioA = newDataGaraInizio;
|
||||
}
|
||||
|
||||
public void setPathBase(String newPathBase) {
|
||||
this.pathBase = newPathBase;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public String getLocalita() {
|
||||
return (this.localita == null) ? "" : this.localita.trim();
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioA() {
|
||||
return this.dataGaraInizioA;
|
||||
}
|
||||
|
||||
public String getPathBase() {
|
||||
return (this.pathBase == null) ? "" : this.pathBase.trim();
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
|
||||
}
|
||||
|
||||
public void setTipoGara(TipoGara newTipoGara) {
|
||||
this.tipoGara = newTipoGara;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGara() {
|
||||
this.tipoGara = (TipoGara)getSecondaryObject(this.tipoGara, TipoGara.class, getId_tipoGara());
|
||||
return this.tipoGara;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioDa() {
|
||||
return this.dataGaraInizioDa;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioDa(Date dataGaraInizioDa) {
|
||||
this.dataGaraInizioDa = dataGaraInizioDa;
|
||||
}
|
||||
|
||||
public long getAnno() {
|
||||
return this.anno;
|
||||
}
|
||||
|
||||
public void setAnno(long anno) {
|
||||
this.anno = anno;
|
||||
}
|
||||
|
||||
public long getFlgEventoInLinea() {
|
||||
return this.flgEventoInLinea;
|
||||
}
|
||||
|
||||
public void setFlgEventoInLinea(long flgEventoInLinea) {
|
||||
this.flgEventoInLinea = flgEventoInLinea;
|
||||
}
|
||||
|
||||
public static final String getEventoInLinea(long l_flgEventoInLinea) {
|
||||
return Gara.getEventoInLinea(l_flgEventoInLinea);
|
||||
}
|
||||
|
||||
public String getEventoInLinea() {
|
||||
return Gara.getEventoInLinea(getFlgEventoInLinea());
|
||||
}
|
||||
|
||||
public String getDescrizioneGara() {
|
||||
return (this.descrizioneGara == null) ? "" : this.descrizioneGara.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneGara(String descrizioneGara) {
|
||||
this.descrizioneGara = descrizioneGara;
|
||||
}
|
||||
}
|
||||
133
rus/WEB-INF/lib/pg_src/com/ablia/pg/LogFoto.java
Normal file
133
rus/WEB-INF/lib/pg_src/com/ablia/pg/LogFoto.java
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class LogFoto extends DBAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 1512855275515L;
|
||||
|
||||
private long id_logFoto;
|
||||
|
||||
private Date dataLog;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private long id_users;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private long id_foto;
|
||||
|
||||
private Users users;
|
||||
|
||||
private Foto foto;
|
||||
|
||||
public LogFoto(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public LogFoto() {}
|
||||
|
||||
public void setId_logFoto(long newId_logFoto) {
|
||||
this.id_logFoto = newId_logFoto;
|
||||
}
|
||||
|
||||
public void setDataLog(Date newDataLog) {
|
||||
this.dataLog = newDataLog;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setId_users(long newId_users) {
|
||||
this.id_users = newId_users;
|
||||
setUsers(null);
|
||||
}
|
||||
|
||||
public void setIpAddress(String newIpAddress) {
|
||||
this.ipAddress = newIpAddress;
|
||||
}
|
||||
|
||||
public void setId_foto(long newId_foto) {
|
||||
this.id_foto = newId_foto;
|
||||
setFoto(null);
|
||||
}
|
||||
|
||||
public long getId_logFoto() {
|
||||
return this.id_logFoto;
|
||||
}
|
||||
|
||||
public Date getDataLog() {
|
||||
return this.dataLog;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public long getId_users() {
|
||||
return this.id_users;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
|
||||
}
|
||||
|
||||
public long getId_foto() {
|
||||
return this.id_foto;
|
||||
}
|
||||
|
||||
public void setUsers(Users newUsers) {
|
||||
this.users = newUsers;
|
||||
}
|
||||
|
||||
public Users getUsers() {
|
||||
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
||||
return this.users;
|
||||
}
|
||||
|
||||
public void setFoto(Foto newFoto) {
|
||||
this.foto = newFoto;
|
||||
}
|
||||
|
||||
public Foto getFoto() {
|
||||
this.foto = (Foto)getSecondaryObject(this.foto, Foto.class, getId_foto());
|
||||
return this.foto;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator<LogFoto> findByCR(LogFotoCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from LOG_FOTO AS A";
|
||||
String s_Sql_Order = " order by createTmst desc";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_users() > 0L)
|
||||
wc.addWc("A.id_users=" + CR.getId_users());
|
||||
if (!CR.getDescrizione().isEmpty())
|
||||
wc.addWc("(A.descrizione like '%" + CR.getDescrizione() + "%') ");
|
||||
if (!CR.getDescrizioneFotoNuove().isEmpty()) {
|
||||
s_Sql_Find = String.valueOf(s_Sql_Find) + " inner join FOTO AS B ON A.id_foto=B.id_foto";
|
||||
wc.addWc(" B.file like '%" + CR.getDescrizioneFotoNuove() + "%' ");
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
rus/WEB-INF/lib/pg_src/com/ablia/pg/LogFotoCR.java
Normal file
115
rus/WEB-INF/lib/pg_src/com/ablia/pg/LogFotoCR.java
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class LogFotoCR extends CRAdapter {
|
||||
private long id_logFoto;
|
||||
|
||||
private Date dataLog;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private long id_users;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private long id_foto;
|
||||
|
||||
private Users users;
|
||||
|
||||
private Foto foto;
|
||||
|
||||
private String descrizioneFotoNuove;
|
||||
|
||||
public LogFotoCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public LogFotoCR() {}
|
||||
|
||||
public void setId_logFoto(long newId_logFoto) {
|
||||
this.id_logFoto = newId_logFoto;
|
||||
}
|
||||
|
||||
public void setDataLog(Date newDataLog) {
|
||||
this.dataLog = newDataLog;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setId_users(long newId_users) {
|
||||
this.id_users = newId_users;
|
||||
setUsers(null);
|
||||
}
|
||||
|
||||
public void setIpAddress(String newIpAddress) {
|
||||
this.ipAddress = newIpAddress;
|
||||
}
|
||||
|
||||
public void setId_foto(long newId_foto) {
|
||||
this.id_foto = newId_foto;
|
||||
setFoto(null);
|
||||
}
|
||||
|
||||
public long getId_logFoto() {
|
||||
return this.id_logFoto;
|
||||
}
|
||||
|
||||
public Date getDataLog() {
|
||||
return this.dataLog;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public long getId_users() {
|
||||
return this.id_users;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
|
||||
}
|
||||
|
||||
public long getId_foto() {
|
||||
return this.id_foto;
|
||||
}
|
||||
|
||||
public void setUsers(Users newUsers) {
|
||||
this.users = newUsers;
|
||||
}
|
||||
|
||||
public Users getUsers() {
|
||||
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
||||
return this.users;
|
||||
}
|
||||
|
||||
public void setFoto(Foto newFoto) {
|
||||
this.foto = newFoto;
|
||||
}
|
||||
|
||||
public Foto getFoto() {
|
||||
this.foto = (Foto)getSecondaryObject(this.foto, Foto.class, getId_foto());
|
||||
return this.foto;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
if (getId_foto() > 0L || getId_users() > 0L || !getDescrizione().isEmpty() || !getDescrizioneFotoNuove().isEmpty() ||
|
||||
!getIpAddress().isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDescrizioneFotoNuove() {
|
||||
return (this.descrizioneFotoNuove == null) ? "" : this.descrizioneFotoNuove.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneFotoNuove(String descrizioneFotoNuove) {
|
||||
this.descrizioneFotoNuove = descrizioneFotoNuove;
|
||||
}
|
||||
}
|
||||
292
rus/WEB-INF/lib/pg_src/com/ablia/pg/PuntoFoto.java
Normal file
292
rus/WEB-INF/lib/pg_src/com/ablia/pg/PuntoFoto.java
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class PuntoFoto extends _PgAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 1511425419487L;
|
||||
|
||||
public static final long INDEX_TYPE_NONE = 0L;
|
||||
|
||||
public static final long INDEX_TYPE_TEMPI = 1L;
|
||||
|
||||
public static final long INDEX_TYPE_MANUALE = 2L;
|
||||
|
||||
private long id_puntoFoto;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private String descrizionePuntoFoto;
|
||||
|
||||
private String pathRelativoFoto;
|
||||
|
||||
private String tipoPuntoFoto;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private String tipoPuntoFotoNew;
|
||||
|
||||
private long flgIndexOk;
|
||||
|
||||
public PuntoFoto(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public PuntoFoto() {}
|
||||
|
||||
public void setId_puntoFoto(long newId_puntoFoto) {
|
||||
this.id_puntoFoto = newId_puntoFoto;
|
||||
}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
setGara(null);
|
||||
}
|
||||
|
||||
public void setPathRelativoFoto(String newPathRelativoFoto) {
|
||||
this.pathRelativoFoto = newPathRelativoFoto;
|
||||
}
|
||||
|
||||
public void setTipoPuntoFoto(String newTipoPuntoFoto) {
|
||||
this.tipoPuntoFoto = newTipoPuntoFoto;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public String getPathRelativoFoto() {
|
||||
return (this.pathRelativoFoto == null) ? "" : this.pathRelativoFoto.trim();
|
||||
}
|
||||
|
||||
public String getTipoPuntoFoto() {
|
||||
return (this.tipoPuntoFoto == null) ? "" : this.tipoPuntoFoto.trim();
|
||||
}
|
||||
|
||||
public void setGara(Gara newGara) {
|
||||
this.gara = newGara;
|
||||
}
|
||||
|
||||
public Gara getGara() {
|
||||
this.gara = (Gara)getSecondaryObject(this.gara, Gara.class, getId_gara());
|
||||
return this.gara;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {
|
||||
ResParm rp = noIndexFoto();
|
||||
if (!rp.getStatus())
|
||||
System.out.println("Attenzione. Cancellazione punto foto: " + rp.getMsg());
|
||||
}
|
||||
|
||||
public Vectumerator<PuntoFoto> findByCR(PuntoFotoCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from PUNTO_FOTO AS A";
|
||||
String s_Sql_Order = " order by A.descrizionePuntoFoto";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_gara() > 0L)
|
||||
wc.addWc("A.id_gara=" + CR.getId_gara());
|
||||
if (CR.getFlgIndexOk() == 0L) {
|
||||
wc.addWc("(A.flgIndexOk is null or A.flgIndexOk =0)");
|
||||
} else if (CR.getFlgIndexOk() > 0L) {
|
||||
wc.addWc("A.flgIndexOk =" + CR.getFlgIndexOk());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator findPuntiFotoByGara(long l_id_gara, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from PUNTO_FOTO AS A";
|
||||
String s_Sql_Order = " order by A.descrizionePuntoFoto";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator findTipiPuntoFoto(long l_id_gara) {
|
||||
String s_Sql_Find = "select DISTINCT B.tipoPuntoFoto from (select A.tipoPuntoFoto, A.pathRelativoFoto from PUNTO_FOTO AS A ";
|
||||
String s_Sql_OrderBy = " order by A.pathRelativoFoto, A.tipoPuntoFoto";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_OrderBy + ") as B");
|
||||
return findRows(stmt);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescrizioneCompleta() {
|
||||
return String.valueOf(getTipoPuntoFoto()) + " " + getGara().getDescrizione() + "-" + getDescrizionePuntoFoto();
|
||||
}
|
||||
|
||||
public String getPathCompletoFoto() {
|
||||
String temp = String.valueOf(getPathBaseFoto()) + getGara().getPathBase() + getPathRelativoFoto();
|
||||
if (!temp.endsWith("/"))
|
||||
temp = String.valueOf(temp) + "/";
|
||||
return temp;
|
||||
}
|
||||
|
||||
public ResParm indexFoto(long l_id_user) {
|
||||
ResParm rp = new ResParm();
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
int nuovefoto = 0;
|
||||
int fotoErrate = 0;
|
||||
int totFoto = 0;
|
||||
StringBuffer errMsg = new StringBuffer();
|
||||
if (getId_gara() == 0L) {
|
||||
rp.setMsg("Indicizzazione foto: Bean gara non caricato");
|
||||
rp.setStatus(false);
|
||||
handleDebug("Indicizzazione foto: Bean gara non caricato", 2);
|
||||
return rp;
|
||||
}
|
||||
String dirFoto = getPathCompletoFoto();
|
||||
if (new File(dirFoto).exists()) {
|
||||
File dir = new File(dirFoto);
|
||||
File[] fotos = dir.listFiles();
|
||||
Foto foto = new Foto(getApFull());
|
||||
Foto currentFoto = new Foto(getApFull());
|
||||
File theFoto = null;
|
||||
try {
|
||||
for (int i = 0; i < fotos.length; i++) {
|
||||
theFoto = fotos[i];
|
||||
if (!theFoto.getName().toLowerCase().startsWith("tn_") && theFoto.getName().toLowerCase().endsWith(".jpg")) {
|
||||
totFoto++;
|
||||
foto.findByFilenamePuntoFoto(theFoto.getName(), getId_puntoFoto());
|
||||
if (foto.getDBState() == 0)
|
||||
nuovefoto++;
|
||||
foto.setId_gara(getId_gara());
|
||||
foto.setId_puntoFoto(getId_puntoFoto());
|
||||
foto.setFile(theFoto.getName());
|
||||
foto.setLastUpdId_user(l_id_user);
|
||||
rp = foto.save();
|
||||
if (!rp.getStatus()) {
|
||||
System.out.println("ERRORE INDICIZZAZIONE: " + theFoto.getName() + ": " + rp.getMsg());
|
||||
fotoErrate++;
|
||||
errMsg.append("<br>Attenzione " + theFoto.getName() + ": " + rp.getMsg());
|
||||
}
|
||||
} else {
|
||||
handleDebug("File non jpg:" + theFoto.getName(), 1);
|
||||
}
|
||||
}
|
||||
System.out.println(" fine indicizzazione...");
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
errMsg.append("\nIndicizzazione fallita sul file " + theFoto.getName() + "<br>" + e.getMessage());
|
||||
}
|
||||
rp.setMsg("Indicizzazione completata.<br>Numero foto indicizzate:" + totFoto + "<br>numero di foto nuove indicizzate: " +
|
||||
nuovefoto + "<br>numero di foto NON indicizzate: " + fotoErrate + "<br>" + errMsg.toString());
|
||||
rp.setStatus(true);
|
||||
} else {
|
||||
rp.setMsg("Errore! Percorso foto errato: " + dirFoto);
|
||||
rp.setStatus(false);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm noIndexFoto() {
|
||||
ResParm rp = new ResParm();
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
int nuovefoto = 0;
|
||||
int fotoErrate = 0;
|
||||
int totFoto = 0;
|
||||
StringBuffer errMsg = new StringBuffer();
|
||||
if (getId_gara() == 0L || getId_puntoFoto() == 0L) {
|
||||
rp.setMsg("Indicizzazione foto: Bean gara non caricato");
|
||||
rp.setStatus(false);
|
||||
handleDebug("Indicizzazione foto: Bean gara non caricato", 2);
|
||||
return rp;
|
||||
}
|
||||
rp = new Foto(getApFull()).deleteFotoByPuntoFoto(getId_puntoFoto());
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getTipoPuntoFotoNew() {
|
||||
return (this.tipoPuntoFotoNew == null) ? "" : this.tipoPuntoFotoNew.trim();
|
||||
}
|
||||
|
||||
public void setTipoPuntoFotoNew(String tipoPuntoFotoNew) {
|
||||
this.tipoPuntoFotoNew = tipoPuntoFotoNew;
|
||||
}
|
||||
|
||||
public String getDescrizionePuntoFoto() {
|
||||
return (this.descrizionePuntoFoto == null) ? "" : this.descrizionePuntoFoto.trim();
|
||||
}
|
||||
|
||||
public void setDescrizionePuntoFoto(String descrizionePuntoFoto) {
|
||||
this.descrizionePuntoFoto = descrizionePuntoFoto;
|
||||
}
|
||||
|
||||
protected void prepareSave(PreparedStatement ps) throws SQLException, Exception {
|
||||
if (!getTipoPuntoFotoNew().isEmpty())
|
||||
setTipoPuntoFoto(getTipoPuntoFotoNew());
|
||||
if (!getPathRelativoFoto().isEmpty() && !getPathRelativoFoto().endsWith("/"))
|
||||
setPathRelativoFoto(String.valueOf(getPathRelativoFoto()) + "/");
|
||||
super.prepareSave(ps);
|
||||
}
|
||||
|
||||
public void findByGaraPath(long l_id_gara, String l_pathRelativoFoto) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from PUNTO_FOTO AS A";
|
||||
String s_Sql_Order = " order by A.pathRelativoFoto";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
if (!l_pathRelativoFoto.isEmpty() && !l_pathRelativoFoto.endsWith("/"))
|
||||
l_pathRelativoFoto = String.valueOf(l_pathRelativoFoto) + "/";
|
||||
wc.addWc("A.pathRelativoFoto='" + l_pathRelativoFoto.trim() + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String getIndexOk(long l_flgIndexOk) {
|
||||
if (l_flgIndexOk == 2L)
|
||||
return "Manuale";
|
||||
if (l_flgIndexOk == 0L)
|
||||
return "Nessuna";
|
||||
if (l_flgIndexOk == 1L)
|
||||
return "Tempi";
|
||||
return "??";
|
||||
}
|
||||
|
||||
public long getFlgIndexOk() {
|
||||
return this.flgIndexOk;
|
||||
}
|
||||
|
||||
public void setFlgIndexOk(long flgIndexOk) {
|
||||
this.flgIndexOk = flgIndexOk;
|
||||
}
|
||||
|
||||
public String getIndexOk() {
|
||||
return getIndexOk(getFlgIndexOk());
|
||||
}
|
||||
}
|
||||
86
rus/WEB-INF/lib/pg_src/com/ablia/pg/PuntoFotoCR.java
Normal file
86
rus/WEB-INF/lib/pg_src/com/ablia/pg/PuntoFotoCR.java
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class PuntoFotoCR extends CRAdapter {
|
||||
private long id_puntoFoto;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private String descrizionePuntoFoto;
|
||||
|
||||
private String pathRelativoFoto;
|
||||
|
||||
private String tipoPuntoFoto;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private long flgIndexOk = -1L;
|
||||
|
||||
public PuntoFotoCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public PuntoFotoCR() {}
|
||||
|
||||
public void setId_puntoFoto(long newId_puntoFoto) {
|
||||
this.id_puntoFoto = newId_puntoFoto;
|
||||
}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
setGara(null);
|
||||
}
|
||||
|
||||
public void setDescrizionePuntoFoto(String newDescrizione) {
|
||||
this.descrizionePuntoFoto = newDescrizione;
|
||||
}
|
||||
|
||||
public void setPathRelativoFoto(String newPathRelativoFoto) {
|
||||
this.pathRelativoFoto = newPathRelativoFoto;
|
||||
}
|
||||
|
||||
public void setTipoPuntoFoto(String newTipoPuntoFoto) {
|
||||
this.tipoPuntoFoto = newTipoPuntoFoto;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public String getDescrizionePuntoFoto() {
|
||||
return (this.descrizionePuntoFoto == null) ? "" : this.descrizionePuntoFoto.trim();
|
||||
}
|
||||
|
||||
public String getPathRelativoFoto() {
|
||||
return (this.pathRelativoFoto == null) ? "" : this.pathRelativoFoto.trim();
|
||||
}
|
||||
|
||||
public String getTipoPuntoFoto() {
|
||||
return (this.tipoPuntoFoto == null) ? "" : this.tipoPuntoFoto.trim();
|
||||
}
|
||||
|
||||
public void setGara(Gara newGara) {
|
||||
this.gara = newGara;
|
||||
}
|
||||
|
||||
public Gara getGara() {
|
||||
this.gara = (Gara)getSecondaryObject(
|
||||
this.gara,
|
||||
Gara.class, getId_gara());
|
||||
return this.gara;
|
||||
}
|
||||
|
||||
public long getFlgIndexOk() {
|
||||
return this.flgIndexOk;
|
||||
}
|
||||
|
||||
public void setFlgIndexOk(long flgIndexOk) {
|
||||
this.flgIndexOk = flgIndexOk;
|
||||
}
|
||||
}
|
||||
414
rus/WEB-INF/lib/pg_src/com/ablia/pg/TipoGara.java
Normal file
414
rus/WEB-INF/lib/pg_src/com/ablia/pg/TipoGara.java
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.art.Tipo;
|
||||
import com.ablia.db.AddImgInterface;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TipoGara extends DBAdapter implements Serializable, AddImgInterface {
|
||||
private static final long serialVersionUID = 1511425420021L;
|
||||
|
||||
private static final String INDICE_DELIM = ":";
|
||||
|
||||
private long id_tipoGara;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String indici;
|
||||
|
||||
private long ordine;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
private long id_tipoGaraPadre;
|
||||
|
||||
private TipoGara tipoGaraPadre;
|
||||
|
||||
private long flgFoglia;
|
||||
|
||||
private long flgNascondi = 0L;
|
||||
|
||||
private long livello;
|
||||
|
||||
private String descrizioneR;
|
||||
|
||||
public TipoGara(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoGara() {}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setIndici(String newIndici) {
|
||||
this.indici = newIndici;
|
||||
}
|
||||
|
||||
public void setOrdine(long newOrdine) {
|
||||
this.ordine = newOrdine;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public void setId_tipoGaraPadre(long newId_tipoGaraPadre) {
|
||||
this.id_tipoGaraPadre = newId_tipoGaraPadre;
|
||||
setTipoGaraPadre(null);
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public String getIndici() {
|
||||
return (this.indici == null) ? "" : this.indici.trim();
|
||||
}
|
||||
|
||||
public long getOrdine() {
|
||||
return this.ordine;
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
|
||||
}
|
||||
|
||||
public long getId_tipoGaraPadre() {
|
||||
return this.id_tipoGaraPadre;
|
||||
}
|
||||
|
||||
public void setTipoGaraPadre(TipoGara newTipoGaraPadre) {
|
||||
this.tipoGaraPadre = newTipoGaraPadre;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGaraPadre() {
|
||||
this.tipoGaraPadre = (TipoGara)getSecondaryObject(this.tipoGaraPadre, TipoGara.class, getId_tipoGaraPadre());
|
||||
return this.tipoGaraPadre;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
public Vectumerator<TipoGara> findByCR(TipoGaraCR CR, int pageNumber, int pageRows) {
|
||||
if (!CR.getSearchTxt().trim().isEmpty() || CR.getFlgSoloFoglie() != 0L) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from TIPO_GARA AS A";
|
||||
String s_Sql_Order = " order by A.livello, A.ordine, A.descrizione";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getSearchTxt().trim().isEmpty()) {
|
||||
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().replace("*", "%").trim(), " ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
txt.append("(A.descrizione like '%" + token + "%' or A.descrizioneR like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
if (CR.getId_tipoGaraPadre() > 0L)
|
||||
wc.addWc("A.id_tipoGaraPadre=" + CR.getId_tipoGaraPadre());
|
||||
if (!CR.getDescrizione().isEmpty())
|
||||
wc.addWc("A.descrizione='" + CR.getDescrizione() + "'");
|
||||
if (CR.getFlgSoloFoglie() == 0L) {
|
||||
wc.addWc("(A.flgFoglia=0 or A.flgFoglia is null)");
|
||||
} else if (CR.getFlgSoloFoglie() == 1L) {
|
||||
wc.addWc("A.flgFoglia=1");
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
return findFigli(CR, pageNumber, pageRows, false);
|
||||
}
|
||||
|
||||
public void risalvaTutto() {
|
||||
Vectumerator vec = findAll();
|
||||
while (vec.hasMoreElements()) {
|
||||
Tipo row = (Tipo)vec.nextElement();
|
||||
row.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void ordinaAlfabeticoFigli(TipoGara beanPadre) {
|
||||
if (beanPadre.getId_tipoGara() == 0L)
|
||||
update("update TIPO_GARA set ordine=null");
|
||||
Vectumerator<TipoGara> vec = beanPadre.findFigli(0, 0, false);
|
||||
while (vec.hasMoreElements()) {
|
||||
Tipo row = (Tipo)vec.nextElement();
|
||||
row.save();
|
||||
row.ordinaAlfabeticoFigli(row);
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator<TipoGara> findFigli(int pageNumber, int pageRows) {
|
||||
TipoGaraCR CR = new TipoGaraCR(getApFull());
|
||||
return findFigli(CR, pageNumber, pageRows, false);
|
||||
}
|
||||
|
||||
public Vectumerator<TipoGara> findFigli(int pageNumber, int pageRows, boolean ordineAlfabetico) {
|
||||
TipoGaraCR CR = new TipoGaraCR(getApFull());
|
||||
return findFigli(CR, pageNumber, pageRows, ordineAlfabetico);
|
||||
}
|
||||
|
||||
public Vectumerator<TipoGara> findFigli(TipoGaraCR CR, int pageNumber, int pageRows, boolean ordineAlfabetico) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from TIPO_GARA AS A";
|
||||
String s_Sql_Order = " order by A.ordine, A.descrizione";
|
||||
if (ordineAlfabetico)
|
||||
s_Sql_Order = " order by A.descrizione";
|
||||
WcString wc = new WcString();
|
||||
if (getId_tipoGara() == 0L) {
|
||||
wc.addWc("(A.id_tipoGaraPadre=0 or A.id_tipoGaraPadre is null)");
|
||||
} else {
|
||||
wc.addWc("A.id_tipoGaraPadre=" + getId_tipoGara());
|
||||
}
|
||||
if (CR.getFlgSoloFoglie() == 0L) {
|
||||
wc.addWc("(A.flgFoglia=0 or A.flgFoglia is null)");
|
||||
} else if (CR.getFlgSoloFoglie() == 1L) {
|
||||
wc.addWc("A.flgFoglia=1");
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator findPadri() {
|
||||
Vectumerator vec = new Vectumerator();
|
||||
TipoGara currentPadre = getTipoGaraPadre();
|
||||
while (currentPadre.getId_tipoGara() != 0L) {
|
||||
vec.add(currentPadre);
|
||||
currentPadre = currentPadre.getTipoGaraPadre();
|
||||
}
|
||||
vec.setOrderBackward();
|
||||
return vec;
|
||||
}
|
||||
|
||||
public long getFlgFoglia() {
|
||||
return this.flgFoglia;
|
||||
}
|
||||
|
||||
public void setFlgFoglia(long flgFoglia) {
|
||||
this.flgFoglia = flgFoglia;
|
||||
}
|
||||
|
||||
public long getFlgNascondi() {
|
||||
return this.flgNascondi;
|
||||
}
|
||||
|
||||
public void setFlgNascondi(long flgNascondi) {
|
||||
this.flgNascondi = flgNascondi;
|
||||
}
|
||||
|
||||
public String getNascondi() {
|
||||
if (this.flgNascondi == 0L)
|
||||
return "Vis.";
|
||||
if (this.flgNascondi == 1L)
|
||||
return "Nasc.";
|
||||
return "??";
|
||||
}
|
||||
|
||||
private String calcolaIndici() {
|
||||
StringBuffer idx = new StringBuffer(":");
|
||||
idx.append(calcolaIndiciR());
|
||||
idx.append(":");
|
||||
return idx.toString();
|
||||
}
|
||||
|
||||
private StringBuffer calcolaIndiciR() {
|
||||
StringBuffer idx = new StringBuffer(String.valueOf(getId_tipoGara()));
|
||||
if (getId_tipoGaraPadre() != 0L) {
|
||||
idx.insert(0, ":");
|
||||
idx.insert(0, (CharSequence)getTipoGaraPadre().calcolaIndiciR());
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
private long calcolaOrdine() {
|
||||
try {
|
||||
String s_sqlFind = "select max(ordine) as _max from TIPO_GARA WHERE id_tipo_gara!=" + getId_tipoGara();
|
||||
if (getId_tipoGaraPadre() != 0L) {
|
||||
s_sqlFind = String.valueOf(s_sqlFind) + " and id_tipoPadre=" + getId_tipoGaraPadre();
|
||||
} else {
|
||||
s_sqlFind = String.valueOf(s_sqlFind) + " and (id_tipoGaraPadre=0 or id_tipoGaraPadre is null)";
|
||||
}
|
||||
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 delete() {
|
||||
TipoGara tipoPadre = null;
|
||||
if (getId_tipoGaraPadre() > 0L && getTipoGaraPadre().getFlgFoglia() == 0L)
|
||||
tipoPadre = getTipoGaraPadre();
|
||||
ResParm rp = super.delete();
|
||||
if (rp.getStatus() && tipoPadre != null)
|
||||
rp.append(tipoPadre.save());
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected void deleteCascade() {
|
||||
Vectumerator<TipoGara> figli = findFigli(new TipoGaraCR(), 0, 0, false);
|
||||
while (figli.hasMoreElements())
|
||||
((Tipo)figli.nextElement()).delete();
|
||||
}
|
||||
|
||||
public ResParm delTipoFiglio(Tipo l_tipo) {
|
||||
Tipo bean = new Tipo(getApFull());
|
||||
bean.findByPrimaryKey(l_tipo.getId_tipo());
|
||||
return bean.delete();
|
||||
}
|
||||
|
||||
public boolean hasFiglio(long l_id_tipo) {
|
||||
if (l_id_tipo == 0L)
|
||||
return false;
|
||||
String s_Sql_Find = "select DISTINCT A.* from TIPO_GARA AS A";
|
||||
String s_Sql_Order = "";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.indici like'%:" + l_id_tipo + ":%'");
|
||||
wc.addWc("A.indici like'%:" + getId_tipoGara() + ":%'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
Tipo bean = (Tipo)getFirstRecord(stmt);
|
||||
if (bean != null)
|
||||
return true;
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean indiciContains(long l_key) {
|
||||
StringTokenizer st = new StringTokenizer(getIndici(), ":");
|
||||
String s_key = String.valueOf(l_key);
|
||||
while (st.hasMoreTokens()) {
|
||||
if (st.nextToken().equals(s_key))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void initFields() {
|
||||
super.initFields();
|
||||
}
|
||||
|
||||
public boolean isFoglia() {
|
||||
if (getDBState() == 0)
|
||||
return true;
|
||||
Vectumerator<TipoGara> vec = findFigli(1, 1);
|
||||
if (vec.hasMoreElements())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ordinaAlfabeticoFigli(Tipo beanPadre) {
|
||||
if (beanPadre.getId_tipo() == 0L)
|
||||
update("update TIPO set ordine=null");
|
||||
Vectumerator vec = beanPadre.findFigli(0, 0, false);
|
||||
while (vec.hasMoreElements()) {
|
||||
Tipo row = (Tipo)vec.nextElement();
|
||||
row.save();
|
||||
row.ordinaAlfabeticoFigli(row);
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareSave(PreparedStatement ps) throws SQLException, Exception {
|
||||
super.prepareSave(ps);
|
||||
}
|
||||
|
||||
public ResParm save() {
|
||||
setFlgFoglia((long)(isFoglia() ? 1L : 0L));
|
||||
if (getOrdine() == 0L)
|
||||
setOrdine(calcolaOrdine());
|
||||
if (getId_tipoGaraPadre() == 0L) {
|
||||
setLivello(0L);
|
||||
} else {
|
||||
setLivello(getTipoGaraPadre().getLivello() + 1L);
|
||||
}
|
||||
setIndici(calcolaIndici());
|
||||
setDescrizioneR(getDescrizioneCompletaFull());
|
||||
boolean newRecord = (getId_tipoGara() == 0L);
|
||||
String idxPadre = getTipoGaraPadre().getIndici();
|
||||
String temp = ":" + getId_tipoGara() + ":";
|
||||
if (getId_tipoGara() == 0L || idxPadre.indexOf(temp) < 0 || (getId_tipoGara() != 0L && getId_tipoGara() != getId_tipoGaraPadre())) {
|
||||
ResParm resParm = super.save();
|
||||
if (resParm.getStatus() && newRecord) {
|
||||
setIndici(calcolaIndici());
|
||||
resParm = super.save();
|
||||
if (getId_tipoGaraPadre() > 0L && getTipoGaraPadre().getFlgFoglia() == 1L)
|
||||
resParm = getTipoGaraPadre().save();
|
||||
}
|
||||
return resParm;
|
||||
}
|
||||
ResParm rp = new ResParm(false, "Impossibile salvare!. Legame circolare.");
|
||||
return rp;
|
||||
}
|
||||
|
||||
public long getLivello() {
|
||||
return this.livello;
|
||||
}
|
||||
|
||||
public void setLivello(long livello) {
|
||||
this.livello = livello;
|
||||
}
|
||||
|
||||
public String getDescrizioneR() {
|
||||
return (this.descrizioneR == null) ? "" : this.descrizioneR.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneR(String descrizioneR) {
|
||||
this.descrizioneR = descrizioneR;
|
||||
}
|
||||
|
||||
public String getDescrizioneCompleta() {
|
||||
String temp = getDescrizioneCompletaFull();
|
||||
if (temp.length() > 254)
|
||||
return temp.substring(0, 254);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public String getDescrizioneCompletaFull() {
|
||||
if (getId_tipoGaraPadre() == 0L)
|
||||
return getDescrizione();
|
||||
return String.valueOf(getTipoGaraPadre().getDescrizioneCompleta()) + " » " + getDescrizione();
|
||||
}
|
||||
|
||||
public String getDescrizioneHtml() {
|
||||
return convertStringToHtml(getDescrizione());
|
||||
}
|
||||
|
||||
public String getPathAttach() {
|
||||
return "_img/_tipoGara/";
|
||||
}
|
||||
}
|
||||
106
rus/WEB-INF/lib/pg_src/com/ablia/pg/TipoGaraCR.java
Normal file
106
rus/WEB-INF/lib/pg_src/com/ablia/pg/TipoGaraCR.java
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class TipoGaraCR extends CRAdapter {
|
||||
private long id_tipoGara;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String indici;
|
||||
|
||||
private long ordine;
|
||||
|
||||
private String imgTmst;
|
||||
|
||||
private long id_tipoGaraPadre = -1L;
|
||||
|
||||
private TipoGara tipoGaraPadre;
|
||||
|
||||
private long flgNascondi = -1L;
|
||||
|
||||
private long flgSoloFoglie = -1L;
|
||||
|
||||
public TipoGaraCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoGaraCR() {}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setIndici(String newIndici) {
|
||||
this.indici = newIndici;
|
||||
}
|
||||
|
||||
public void setOrdine(long newOrdine) {
|
||||
this.ordine = newOrdine;
|
||||
}
|
||||
|
||||
public void setImgTmst(String newImgTmst) {
|
||||
this.imgTmst = newImgTmst;
|
||||
}
|
||||
|
||||
public void setId_tipoGaraPadre(long newId_tipoGaraPadre) {
|
||||
this.id_tipoGaraPadre = newId_tipoGaraPadre;
|
||||
setTipoGaraPadre(null);
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public String getIndici() {
|
||||
return (this.indici == null) ? "" : this.indici.trim();
|
||||
}
|
||||
|
||||
public long getOrdine() {
|
||||
return this.ordine;
|
||||
}
|
||||
|
||||
public String getImgTmst() {
|
||||
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
|
||||
}
|
||||
|
||||
public long getId_tipoGaraPadre() {
|
||||
return this.id_tipoGaraPadre;
|
||||
}
|
||||
|
||||
public void setTipoGaraPadre(TipoGara newTipoGaraPadre) {
|
||||
this.tipoGaraPadre = newTipoGaraPadre;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGaraPadre() {
|
||||
this.tipoGaraPadre = (TipoGara)getSecondaryObject(
|
||||
this.tipoGaraPadre,
|
||||
TipoGara.class, getId_tipoGaraPadre());
|
||||
return this.tipoGaraPadre;
|
||||
}
|
||||
|
||||
public long getFlgNascondi() {
|
||||
return this.flgNascondi;
|
||||
}
|
||||
|
||||
public void setFlgNascondi(long flgNascondi) {
|
||||
this.flgNascondi = flgNascondi;
|
||||
}
|
||||
|
||||
public long getFlgSoloFoglie() {
|
||||
return this.flgSoloFoglie;
|
||||
}
|
||||
|
||||
public void setFlgSoloFoglie(long flgSoloFoglie) {
|
||||
this.flgSoloFoglie = flgSoloFoglie;
|
||||
}
|
||||
}
|
||||
535
rus/WEB-INF/lib/pg_src/com/ablia/pg/Users.java
Normal file
535
rus/WEB-INF/lib/pg_src/com/ablia/pg/Users.java
Normal file
|
|
@ -0,0 +1,535 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalReq;
|
||||
import com.ablia.bank.poste.PeReq;
|
||||
import com.ablia.bank.sella.SellaReq;
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.mail.MailMessage;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class Users extends com.ablia.anag.Users {
|
||||
private Date dataScadenza;
|
||||
|
||||
private Date dataVisual;
|
||||
|
||||
private long nFotoVisual;
|
||||
|
||||
private long nFotoVisualOggi;
|
||||
|
||||
private long nFotoMax;
|
||||
|
||||
private long flgVisCompatta;
|
||||
|
||||
private long flgMailFotoScadenza;
|
||||
|
||||
private long flgMiniature;
|
||||
|
||||
private long flgMailFotoMax;
|
||||
|
||||
public Users(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public Users() {}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public synchronized void incrementaFotoVisual() {
|
||||
if (getDBState() == 1) {
|
||||
setNFotoVisual(getNFotoVisual() + 1L);
|
||||
if (getDataVisual() == null || getDateDiff(getDataVisual(), getToday()) != 0L) {
|
||||
setNFotoVisualOggi(0L);
|
||||
setDataVisual(getToday());
|
||||
}
|
||||
setNFotoVisualOggi(getNFotoVisualOggi() + 1L);
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDataScadenza() {
|
||||
return this.dataScadenza;
|
||||
}
|
||||
|
||||
public void setDataScadenza(Date dataScadenza) {
|
||||
this.dataScadenza = dataScadenza;
|
||||
}
|
||||
|
||||
public long getNFotoMax() {
|
||||
return this.nFotoMax;
|
||||
}
|
||||
|
||||
public void setNFotoMax(long fotoMax) {
|
||||
this.nFotoMax = fotoMax;
|
||||
}
|
||||
|
||||
public long getNFotoVisual() {
|
||||
return this.nFotoVisual;
|
||||
}
|
||||
|
||||
public void setNFotoVisual(long fotoVisual) {
|
||||
this.nFotoVisual = fotoVisual;
|
||||
}
|
||||
|
||||
public boolean isCodFiscDuplicated(String l_codFisc) {
|
||||
String s_Sql_Find = "select * from " + getTableBeanName() + " AS A ";
|
||||
String s_Sql_Order = "";
|
||||
String wc = "";
|
||||
wc = buildWc(wc, "A.codFisc='" + l_codFisc + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_Order);
|
||||
DBAdapter bean = (DBAdapter)getFirstRecord(stmt);
|
||||
if (bean != null && bean.getDBState() == 1)
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public Vectumerator findByCR(UsersCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select A.* from USERS AS A";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("dataFineVld is null");
|
||||
wc = managePolicyFind(CR, wc);
|
||||
if (!CR.isCode1())
|
||||
wc.addWc("A.id_users <>1");
|
||||
if (!CR.getFlgValido().isEmpty())
|
||||
wc.addWc("A.flgValido='" + CR.getFlgValido() + "'");
|
||||
if (!CR.getSearchTxt().trim().isEmpty()) {
|
||||
String temp = CR.getSearchTxt().trim().replace("*", "%");
|
||||
StringTokenizer st = new StringTokenizer(temp, " ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
int countToken = 0;
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = prepareSqlString(st.nextToken());
|
||||
countToken++;
|
||||
if (countToken > 1)
|
||||
token = "%" + token;
|
||||
txt.append("(A.nome like'%" + token + "%' or A.cognome like'%" + token + "%' or A.eMail like'%" + token +
|
||||
"%' or A.codFisc like'%" + token + "%' or A.login like'%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
if (!CR.getEMail().isEmpty())
|
||||
wc.addWc("A.eMail like'%" + CR.getEMail() + "%'");
|
||||
if (CR.getFlgMiniature() == 0L) {
|
||||
wc.addWc("(A.flgMiniature is null or A.flgMiniature=0)");
|
||||
} else if (CR.getFlgMiniature() == 1L) {
|
||||
wc.addWc("A.flgMiniature=1");
|
||||
}
|
||||
if (CR.getFlgScaduto() == 0L) {
|
||||
wc.addWc("A.dataScadenza>=?");
|
||||
wc.addWc("A.nFotoMax>=A.nFotoVisual");
|
||||
} else if (CR.getFlgScaduto() == 1L) {
|
||||
wc.addWc("(A.dataScadenza<? || A.nFotoMax<A.nFotoVisual)");
|
||||
}
|
||||
if (CR.getFlgMl() == 0L) {
|
||||
wc.addWc("(A.flgMl is null or A.flgMl=0)");
|
||||
} else if (CR.getFlgMl() > 0L) {
|
||||
wc.addWc("A.flgMl =" + CR.getFlgMl());
|
||||
}
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc);
|
||||
int dataCount = 0;
|
||||
if (CR.getFlgScaduto() >= 0L) {
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, getToday());
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm azzeraFotoPrelevate() {
|
||||
String s_Sql = "delete from LOG where id_users=" + getId_users();
|
||||
return delete(s_Sql);
|
||||
}
|
||||
|
||||
public Date getDataVisual() {
|
||||
return this.dataVisual;
|
||||
}
|
||||
|
||||
public void setDataVisual(Date dataVisual) {
|
||||
this.dataVisual = dataVisual;
|
||||
}
|
||||
|
||||
public long getNFotoVisualOggi() {
|
||||
if (getDataVisual() == null || getDateDiff(getDataVisual(), getToday()) != 0L)
|
||||
return 0L;
|
||||
return this.nFotoVisualOggi;
|
||||
}
|
||||
|
||||
public void setNFotoVisualOggi(long fotoVisualOggi) {
|
||||
this.nFotoVisualOggi = fotoVisualOggi;
|
||||
}
|
||||
|
||||
public ResParm sendUserDataMailMessageCrypt(String l_password) {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
NumberFormat nf = getNf();
|
||||
String userMailMessage = getUserMailMessage("it");
|
||||
if (!getControlCode().isEmpty())
|
||||
userMailMessage = String.valueOf(userMailMessage.substring(0, userMailMessage.length() - 5)) + "CC" +
|
||||
userMailMessage.substring(userMailMessage.length() - 5, userMailMessage.length());
|
||||
MailMessage mf = new MailMessage(getApFull(), userMailMessage);
|
||||
mf.setQuestionMark(false);
|
||||
if (!getControlCode().isEmpty())
|
||||
mf.setString("controlCode", getControlCode());
|
||||
mf.setString("data", getDataFormat().format(new java.util.Date()));
|
||||
mf.setString("login", getLogin());
|
||||
if (l_password.isEmpty()) {
|
||||
mf.setString("pwd", "******");
|
||||
} else {
|
||||
mf.setString("pwd", l_password);
|
||||
}
|
||||
mf.setString("nome", getNome());
|
||||
mf.setString("cognome", getCognome());
|
||||
mf.setString("citta", getCitta());
|
||||
mf.setString("telefono", getTelefono());
|
||||
mf.setString("eMail", getEMail());
|
||||
mf.setString("indirizzo", getIndirizzo());
|
||||
mf.setString("numeroCivico", getNumeroCivico());
|
||||
mf.setString("codFisc", getCodFisc());
|
||||
mf.setString("gruppoSportivo", getContatto());
|
||||
mf.setString("motivo", getNota());
|
||||
rp = mf.sendMailMessageSystem(getEMail(), String.valueOf(mf.getMailSubject()) + " Dati Registrazione ", true);
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Email non in archivio!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(e.getMessage());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm sendRinnovoMailMessage() {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
String rinnovoMailMsg = String.valueOf(getDocBase()) + getParm("MAIL_MSG_RINNOVO").getTesto();
|
||||
MailMessage mf = new MailMessage(getApFull(), rinnovoMailMsg);
|
||||
mf.setQuestionMark(false);
|
||||
mf.setString("data", getDataFormat().format(new java.util.Date()));
|
||||
mf.setString("nome", getNome());
|
||||
mf.setString("cognome", getCognome());
|
||||
rp = mf.sendMailMessageSystem(getEMail(), "Regalami un Sorriso - Rinnovo ", true);
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Email non in archivio!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("ERRORE INVIO MAIL: " + e.getMessage());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
protected String getUserMailMessage() {
|
||||
return getParm("MAIL_REG").getTesto();
|
||||
}
|
||||
|
||||
protected String getNoMorePicNumberMailMessage() {
|
||||
return String.valueOf(getDocBase()) + getParm("MAIL_NO_MORE").getTesto();
|
||||
}
|
||||
|
||||
protected boolean isUseControCodeAccess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getFlgMailFotoMax() {
|
||||
return this.flgMailFotoMax;
|
||||
}
|
||||
|
||||
public void setFlgMailFotoMax(long flgMailFotoMax) {
|
||||
this.flgMailFotoMax = flgMailFotoMax;
|
||||
}
|
||||
|
||||
public ResParm sendNoMorePictureMessageScad() {
|
||||
ResParm rp = new ResParm(true);
|
||||
if (getFlgMailFotoScadenza() == 0L)
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
NumberFormat nf = getNf();
|
||||
String userMailMessage = getNoMorePicScadMailMessage();
|
||||
if (!getControlCode().isEmpty())
|
||||
userMailMessage = String.valueOf(userMailMessage.substring(0, userMailMessage.length() - 5)) + "CC" +
|
||||
userMailMessage.substring(userMailMessage.length() - 5, userMailMessage.length());
|
||||
MailMessage mf = new MailMessage(getApFull(), userMailMessage);
|
||||
mf.setQuestionMark(false);
|
||||
mf.setString("data", getDataFormat().format(new java.util.Date()));
|
||||
mf.setString("nome", getNome());
|
||||
mf.setString("cognome", getCognome());
|
||||
rp = mf.sendMailMessageSystem(getEMail(), String.valueOf(mf.getMailSubject()) + " Account Scaduto ", true);
|
||||
if (rp.getStatus()) {
|
||||
setFlgMailFotoScadenza(1L);
|
||||
save();
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Email non in archivio");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(e.getMessage());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public long getFlgMailFotoScadenza() {
|
||||
return this.flgMailFotoScadenza;
|
||||
}
|
||||
|
||||
public void setFlgMailFotoScadenza(long flgMailFotoScadenza) {
|
||||
this.flgMailFotoScadenza = flgMailFotoScadenza;
|
||||
}
|
||||
|
||||
protected String getNoMorePicScadMailMessage() {
|
||||
return String.valueOf(getDocBase()) + getParm("MAIL_NO_MORE_SCAD").getTesto();
|
||||
}
|
||||
|
||||
public long getFlgMiniature() {
|
||||
return this.flgMiniature;
|
||||
}
|
||||
|
||||
public void setFlgMiniature(long flgMiniature) {
|
||||
this.flgMiniature = flgMiniature;
|
||||
}
|
||||
|
||||
public void initApplicationParms(ApplParmFull ap) {
|
||||
if (ap != null) {
|
||||
super.initApplicationParms(ap);
|
||||
PeReq.initApplicationParms(ap);
|
||||
SellaReq.initApplicationParms(ap);
|
||||
PayPalReq.initApplicationParms(ap);
|
||||
String l_tipoParm = "";
|
||||
Parm bean = new Parm(ap);
|
||||
l_tipoParm = "GIACOMELLI";
|
||||
bean.findByCodice("PATHFOTO");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PATHFOTO");
|
||||
bean.setDescrizione("PATHFOTO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/home/sites/regalamiunsorriso/RUS/");
|
||||
bean.setNota(
|
||||
"Percorso ASSOLUTO dove risiedono tutte le foto sorgenti.<BR>Produzione: /home/sites/regalamiunsorriso/RUS/<br>Test: /Users/acolzi/Documents/webapps/rus/mypics2/RUS/");
|
||||
bean.save();
|
||||
bean.findByCodice("MAIL_MSG_RINNOVO");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MAIL_MSG_RINNOVO");
|
||||
bean.setDescrizione("MAIL_MSG_RINNOVO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("mailMessage/rinnovoMsg.html");
|
||||
bean.setNota("Percorso RELATIVO messaggio rinnovo");
|
||||
bean.save();
|
||||
bean.findByCodice("MAIL_MSG_COUPON_OMAGGIO");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MAIL_MSG_COUPON_OMAGGIO");
|
||||
bean.setDescrizione("MAIL_MSG_COUPON_OMAGGIO");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("mailMessage/couponOmaggioMsg.html");
|
||||
bean.setNota("Percorso RELATIVO messaggio COUPON OMAGGIO");
|
||||
bean.save();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isScaduto() {
|
||||
return isScaduto(true);
|
||||
}
|
||||
|
||||
public boolean isFotoMaxRaggiunto() {
|
||||
if (getId_users() == 0L)
|
||||
return true;
|
||||
if (getNFotoMax() > 0L && getNFotoVisual() >= getNFotoMax()) {
|
||||
sendNoMorePictureMessageNumber();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean puoScaricareFoto() {
|
||||
return !(isFotoMaxRaggiunto() || isScaduto());
|
||||
}
|
||||
|
||||
public long getGgAScadenza() {
|
||||
if (getId_users() == 0L)
|
||||
return -1L;
|
||||
return DBAdapter.getDateDiff(DBAdapter.getToday(), getDataScadenza());
|
||||
}
|
||||
|
||||
public static final synchronized void addLogFoto(Users user, Foto row, ApplParmFull ap) {
|
||||
LogFoto log = new LogFoto(ap);
|
||||
log.setIpAddress(ap.getReqIpAddress());
|
||||
log.setDataLog(DBAdapter.getToday());
|
||||
log.setId_foto(row.getId_foto());
|
||||
log.setId_users(user.getId_users());
|
||||
ResParm rp = log.save();
|
||||
user.incrementaFotoVisual();
|
||||
Foto.addImpression(row, ap);
|
||||
}
|
||||
|
||||
public static final synchronized void addLogFoto(Users user, String fileName, ApplParmFull ap) {
|
||||
LogFoto log = new LogFoto(ap);
|
||||
log.setIpAddress(ap.getReqIpAddress());
|
||||
log.setDataLog(DBAdapter.getToday());
|
||||
if (fileName.indexOf("mypics2") > 0) {
|
||||
log.setDescrizione(fileName.substring(fileName.indexOf("mypics2")));
|
||||
} else if (fileName.indexOf("mypics") > 0) {
|
||||
log.setDescrizione(fileName.substring(fileName.indexOf("mypics")));
|
||||
} else {
|
||||
log.setDescrizione(fileName);
|
||||
}
|
||||
log.setId_users(user.getId_users());
|
||||
ResParm rp = log.save();
|
||||
user.incrementaFotoVisual();
|
||||
Foto.addImpression(fileName, ap);
|
||||
}
|
||||
|
||||
public long getFlgVisCompatta() {
|
||||
return this.flgVisCompatta;
|
||||
}
|
||||
|
||||
public void setFlgVisCompatta(long flgVisCompatta) {
|
||||
this.flgVisCompatta = flgVisCompatta;
|
||||
}
|
||||
|
||||
public void aggiornaVisCompatta(long l_flgVisCompatta) {
|
||||
if (getId_users() > 0L) {
|
||||
setFlgVisCompatta(l_flgVisCompatta);
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm rinnovaAnno(long n_foto) {
|
||||
if (n_foto == 0L)
|
||||
n_foto = 1000L;
|
||||
if (getId_users() == 0L)
|
||||
return new ResParm(false, "ERRORE! Tentativo di rinnovare utente nullo.");
|
||||
if (isDaRinnovare()) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(1, 1);
|
||||
setDataScadenza(new Date(cal.getTimeInMillis()));
|
||||
setFlgMailFotoMax(0L);
|
||||
setFlgMailFotoScadenza(0L);
|
||||
setFlgMiniature(0L);
|
||||
setNFotoVisual(0L);
|
||||
setNFotoMax(n_foto);
|
||||
ResParm rp = save();
|
||||
if (rp.getStatus())
|
||||
rp.setMsg("Utente " + getCognomeNome() + " rinnovato fino al " + getDataFormat().format(getDataScadenza()) + " per " +
|
||||
getNFotoMax() + " foto<br>");
|
||||
return rp;
|
||||
}
|
||||
return new ResParm(false, "Attenzione! Tentativo di rinnovare utente non ancora scaduto.");
|
||||
}
|
||||
|
||||
public ResParm rinnovaAnno() {
|
||||
return rinnovaAnno(0L);
|
||||
}
|
||||
|
||||
public boolean isScaduto(boolean inviaMail) {
|
||||
if (getId_users() == 0L)
|
||||
return true;
|
||||
if (getDataScadenza() != null && DBAdapter.getDateDiff(DBAdapter.getToday(), getDataScadenza()) < 0L) {
|
||||
if (inviaMail)
|
||||
sendNoMorePictureMessageScad();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDaRinnovare() {
|
||||
return !(!isScaduto(true) && !isFotoMaxRaggiunto() && getFlgMiniature() != 1L);
|
||||
}
|
||||
|
||||
public boolean isDatiPaypalOk() {
|
||||
if (getCognomeNome().isEmpty() || getIndirizzo().isEmpty() || getCap().isEmpty() || getProvincia().isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ResParm sendNoMorePictureMessageNumber() {
|
||||
ResParm rp = new ResParm(true);
|
||||
if (getFlgMailFotoMax() == 0L)
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
NumberFormat nf = getNf();
|
||||
String userMailMessage = getNoMorePicNumberMailMessage();
|
||||
if (!getControlCode().isEmpty())
|
||||
userMailMessage = String.valueOf(userMailMessage.substring(0, userMailMessage.length() - 5)) + "CC" +
|
||||
userMailMessage.substring(userMailMessage.length() - 5, userMailMessage.length());
|
||||
MailMessage mf = new MailMessage(getApFull(), userMailMessage);
|
||||
mf.setQuestionMark(false);
|
||||
mf.setString("data", getDataFormat().format(new java.util.Date()));
|
||||
mf.setString("nome", getNome());
|
||||
mf.setString("cognome", getCognome());
|
||||
rp = mf.sendMailMessageSystem(getEMail(), String.valueOf(mf.getMailSubject()) + " Max num. foto raggiunto ", true);
|
||||
if (rp.getStatus()) {
|
||||
setFlgMailFotoMax(1L);
|
||||
save();
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Email non in archivio");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(e.getMessage());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public ResParm sendCouponOmaggioMailMessage() {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
String rinnovoMailMsg = String.valueOf(getDocBase()) + getParm("MAIL_MSG_COUPON_OMAGGIO").getTesto();
|
||||
MailMessage mf = new MailMessage(getApFull(), rinnovoMailMsg);
|
||||
mf.setQuestionMark(false);
|
||||
mf.setString("data", getDataFormat().format(new java.util.Date()));
|
||||
mf.setString("nome", getNome());
|
||||
mf.setString("cognome", getCognome());
|
||||
rp = mf.sendMailMessageSystem(getEMail(), String.valueOf(mf.getMailSubject()) + " Coupon Omaggio ", true);
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Email non in archivio!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(e.getMessage());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
35
rus/WEB-INF/lib/pg_src/com/ablia/pg/UsersCR.java
Normal file
35
rus/WEB-INF/lib/pg_src/com/ablia/pg/UsersCR.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
|
||||
public class UsersCR extends com.ablia.common.UsersCR {
|
||||
private long flgMiniature = -1L;
|
||||
|
||||
private long flgScaduto = -1L;
|
||||
|
||||
public boolean isCode1() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public UsersCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public UsersCR() {}
|
||||
|
||||
public long getFlgMiniature() {
|
||||
return this.flgMiniature;
|
||||
}
|
||||
|
||||
public void setFlgMiniature(long flgMiniature) {
|
||||
this.flgMiniature = flgMiniature;
|
||||
}
|
||||
|
||||
public long getFlgScaduto() {
|
||||
return this.flgScaduto;
|
||||
}
|
||||
|
||||
public void setFlgScaduto(long flgScaduto) {
|
||||
this.flgScaduto = flgScaduto;
|
||||
}
|
||||
}
|
||||
173
rus/WEB-INF/lib/pg_src/com/ablia/pg/XFotoGara.java
Normal file
173
rus/WEB-INF/lib/pg_src/com/ablia/pg/XFotoGara.java
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
|
||||
public class XFotoGara extends DBAdapter implements Serializable {
|
||||
private static final long serialVersionUID = 1511425418975L;
|
||||
|
||||
private long id_fotoGara;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private long id_puntoFoto;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Time tempo;
|
||||
|
||||
private long flgStato;
|
||||
|
||||
private String pettorali;
|
||||
|
||||
private long impression;
|
||||
|
||||
private Date dataUltimaVisual;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
public XFotoGara(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public XFotoGara() {}
|
||||
|
||||
public void setId_fotoGara(long newId_fotoGara) {
|
||||
this.id_fotoGara = newId_fotoGara;
|
||||
}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
setGara(null);
|
||||
}
|
||||
|
||||
public void setId_puntoFoto(long newId_puntoFoto) {
|
||||
this.id_puntoFoto = newId_puntoFoto;
|
||||
setPuntoFoto(null);
|
||||
}
|
||||
|
||||
public void setFileName(String newFileName) {
|
||||
this.fileName = newFileName;
|
||||
}
|
||||
|
||||
public void setTempo(Time newTempo) {
|
||||
this.tempo = newTempo;
|
||||
}
|
||||
|
||||
public void setFlgStato(long newFlgStato) {
|
||||
this.flgStato = newFlgStato;
|
||||
}
|
||||
|
||||
public void setPettorali(String newPettorali) {
|
||||
this.pettorali = newPettorali;
|
||||
}
|
||||
|
||||
public void setImpression(long newImpression) {
|
||||
this.impression = newImpression;
|
||||
}
|
||||
|
||||
public void setDataUltimaVisual(Date newDataUltimaVisual) {
|
||||
this.dataUltimaVisual = newDataUltimaVisual;
|
||||
}
|
||||
|
||||
public long getId_fotoGara() {
|
||||
return this.id_fotoGara;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return (this.fileName == null) ? "" : this.fileName.trim();
|
||||
}
|
||||
|
||||
public Time getTempo() {
|
||||
return this.tempo;
|
||||
}
|
||||
|
||||
public long getFlgStato() {
|
||||
return this.flgStato;
|
||||
}
|
||||
|
||||
public String getPettorali() {
|
||||
return (this.pettorali == null) ? "" : this.pettorali.trim();
|
||||
}
|
||||
|
||||
public long getImpression() {
|
||||
return this.impression;
|
||||
}
|
||||
|
||||
public Date getDataUltimaVisual() {
|
||||
return this.dataUltimaVisual;
|
||||
}
|
||||
|
||||
public void setGara(Gara newGara) {
|
||||
this.gara = newGara;
|
||||
}
|
||||
|
||||
public Gara getGara() {
|
||||
this.gara = (Gara)getSecondaryObject(
|
||||
this.gara,
|
||||
Gara.class, getId_gara());
|
||||
return this.gara;
|
||||
}
|
||||
|
||||
public void setPuntoFoto(PuntoFoto newPuntoFoto) {
|
||||
this.puntoFoto = newPuntoFoto;
|
||||
}
|
||||
|
||||
public PuntoFoto getPuntoFoto() {
|
||||
this.puntoFoto = (PuntoFoto)getSecondaryObject(
|
||||
this.puntoFoto,
|
||||
PuntoFoto.class, getId_puntoFoto());
|
||||
return this.puntoFoto;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator<XFotoGara> findByCR(XFotoGaraCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from FOTO_GARA 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(String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
198
rus/WEB-INF/lib/pg_src/com/ablia/pg/XFotoGaraCR.java
Normal file
198
rus/WEB-INF/lib/pg_src/com/ablia/pg/XFotoGaraCR.java
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
|
||||
public class XFotoGaraCR extends CRAdapter {
|
||||
private long id_fotoGara;
|
||||
|
||||
private long id_gara;
|
||||
|
||||
private long id_puntoFoto;
|
||||
|
||||
private String fileName;
|
||||
|
||||
private Time tempo;
|
||||
|
||||
private long flgStato;
|
||||
|
||||
private String pettorali;
|
||||
|
||||
private long impression;
|
||||
|
||||
private Date dataUltimaVisual;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
private long id_tipoGara;
|
||||
|
||||
private TipoGara tipoGara;
|
||||
|
||||
private long flgEventoInLinea = -1L;
|
||||
|
||||
private long anno;
|
||||
|
||||
private Date dataGaraInizioA;
|
||||
|
||||
private Date dataGaraInizioDa;
|
||||
|
||||
public XFotoGaraCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public XFotoGaraCR() {}
|
||||
|
||||
public void setId_fotoGara(long newId_fotoGara) {
|
||||
this.id_fotoGara = newId_fotoGara;
|
||||
}
|
||||
|
||||
public void setId_gara(long newId_gara) {
|
||||
this.id_gara = newId_gara;
|
||||
setGara(null);
|
||||
}
|
||||
|
||||
public void setId_puntoFoto(long newId_puntoFoto) {
|
||||
this.id_puntoFoto = newId_puntoFoto;
|
||||
setPuntoFoto(null);
|
||||
}
|
||||
|
||||
public void setFileName(String newFileName) {
|
||||
this.fileName = newFileName;
|
||||
}
|
||||
|
||||
public void setTempo(Time newTempo) {
|
||||
this.tempo = newTempo;
|
||||
}
|
||||
|
||||
public void setFlgStato(long newFlgStato) {
|
||||
this.flgStato = newFlgStato;
|
||||
}
|
||||
|
||||
public void setPettorali(String newPettorali) {
|
||||
this.pettorali = newPettorali;
|
||||
}
|
||||
|
||||
public void setImpression(long newImpression) {
|
||||
this.impression = newImpression;
|
||||
}
|
||||
|
||||
public void setDataUltimaVisual(Date newDataUltimaVisual) {
|
||||
this.dataUltimaVisual = newDataUltimaVisual;
|
||||
}
|
||||
|
||||
public long getId_fotoGara() {
|
||||
return this.id_fotoGara;
|
||||
}
|
||||
|
||||
public long getId_gara() {
|
||||
return this.id_gara;
|
||||
}
|
||||
|
||||
public long getId_puntoFoto() {
|
||||
return this.id_puntoFoto;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return (this.fileName == null) ? "" : this.fileName.trim();
|
||||
}
|
||||
|
||||
public Time getTempo() {
|
||||
return this.tempo;
|
||||
}
|
||||
|
||||
public long getFlgStato() {
|
||||
return this.flgStato;
|
||||
}
|
||||
|
||||
public String getPettorali() {
|
||||
return (this.pettorali == null) ? "" : this.pettorali.trim();
|
||||
}
|
||||
|
||||
public long getImpression() {
|
||||
return this.impression;
|
||||
}
|
||||
|
||||
public Date getDataUltimaVisual() {
|
||||
return this.dataUltimaVisual;
|
||||
}
|
||||
|
||||
public void setGara(Gara newGara) {
|
||||
this.gara = newGara;
|
||||
}
|
||||
|
||||
public Gara getGara() {
|
||||
this.gara = (Gara)getSecondaryObject(
|
||||
this.gara,
|
||||
Gara.class, getId_gara());
|
||||
return this.gara;
|
||||
}
|
||||
|
||||
public void setPuntoFoto(PuntoFoto newPuntoFoto) {
|
||||
this.puntoFoto = newPuntoFoto;
|
||||
}
|
||||
|
||||
public PuntoFoto getPuntoFoto() {
|
||||
this.puntoFoto = (PuntoFoto)getSecondaryObject(
|
||||
this.puntoFoto,
|
||||
PuntoFoto.class, getId_puntoFoto());
|
||||
return this.puntoFoto;
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public TipoGara getTipoGara() {
|
||||
this.tipoGara = (TipoGara)getSecondaryObject(this.tipoGara, TipoGara.class, getId_tipoGara());
|
||||
return this.tipoGara;
|
||||
}
|
||||
|
||||
public void setId_tipoGara(long newId_tipoGara) {
|
||||
this.id_tipoGara = newId_tipoGara;
|
||||
setTipoGara(null);
|
||||
}
|
||||
|
||||
public void setTipoGara(TipoGara newTipoGara) {
|
||||
this.tipoGara = newTipoGara;
|
||||
}
|
||||
|
||||
public static final String getEventoInLinea(long l_flgEventoInLinea) {
|
||||
return Gara.getEventoInLinea(l_flgEventoInLinea);
|
||||
}
|
||||
|
||||
public long getFlgEventoInLinea() {
|
||||
return this.flgEventoInLinea;
|
||||
}
|
||||
|
||||
public void setFlgEventoInLinea(long flgEventoInLinea) {
|
||||
this.flgEventoInLinea = flgEventoInLinea;
|
||||
}
|
||||
|
||||
public long getAnno() {
|
||||
return this.anno;
|
||||
}
|
||||
|
||||
public void setAnno(long anno) {
|
||||
this.anno = anno;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioA() {
|
||||
return this.dataGaraInizioA;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioA(Date dataGaraInizioA) {
|
||||
this.dataGaraInizioA = dataGaraInizioA;
|
||||
}
|
||||
|
||||
public Date getDataGaraInizioDa() {
|
||||
return this.dataGaraInizioDa;
|
||||
}
|
||||
|
||||
public void setDataGaraInizioDa(Date dataGaraInizioDa) {
|
||||
this.dataGaraInizioDa = dataGaraInizioDa;
|
||||
}
|
||||
}
|
||||
110
rus/WEB-INF/lib/pg_src/com/ablia/pg/_PgAdapter.java
Normal file
110
rus/WEB-INF/lib/pg_src/com/ablia/pg/_PgAdapter.java
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
package com.ablia.pg;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.Font;
|
||||
import com.lowagie.text.Table;
|
||||
import com.lowagie.text.pdf.PdfPCell;
|
||||
import com.lowagie.text.pdf.PdfPTable;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
import java.awt.Color;
|
||||
|
||||
public class _PgAdapter extends DBAdapter {
|
||||
public static final String P_PATHFOTO = "PATHFOTO";
|
||||
|
||||
public static final String P_MAIL_MSG_RINNOVO = "MAIL_MSG_RINNOVO";
|
||||
|
||||
public static final String P_MAIL_MSG_COUPON_OMAGGIO = "MAIL_MSG_COUPON_OMAGGIO";
|
||||
|
||||
protected PdfPCell blankCell = new PdfPCell();
|
||||
|
||||
protected Document document;
|
||||
|
||||
protected Table pdfcorpo;
|
||||
|
||||
protected PdfPTable pdfPcorpo;
|
||||
|
||||
protected PdfWriter writer;
|
||||
|
||||
public static final Font PDF_fGrande = new Font(2, 12.0F, 0);
|
||||
|
||||
public static final Font PDF_fGrandeB = new Font(2, 12.0F, 1);
|
||||
|
||||
public static final Font PDF_fGrandeBianco = new Font(2, 14.0F, 1, Color.white);
|
||||
|
||||
public static final Font PDF_fGrandeBlu = new Font(2, 12.0F, 1, Color.blue);
|
||||
|
||||
public static final Font PDF_fGrandeRouge = new Font(2, 12.0F, 1, Color.magenta);
|
||||
|
||||
public static final Font PDF_fGrandissimo = new Font(2, 14.0F, 0);
|
||||
|
||||
public static final Font PDF_fGrandissimoB = new Font(2, 14.0F, 1);
|
||||
|
||||
public static final Font PDF_fGrandissimoBianco = new Font(2, 14.0F, 1, Color.white);
|
||||
|
||||
public static final Font PDF_fGrandissimoBlu = new Font(2, 14.0F, 1, Color.blue);
|
||||
|
||||
public static final Font PDF_fGrandissimoRouge = new Font(2, 14.0F, 1, Color.magenta);
|
||||
|
||||
public static final Font PDF_fIntestazione = new Font(2, 14.0F, 1);
|
||||
|
||||
public static final Font PDF_fMedio = new Font(2, 10.0F, 0);
|
||||
|
||||
public static final Font PDF_fMedioB = new Font(2, 10.0F, 1);
|
||||
|
||||
public static final Font PDF_fMedioBianco = new Font(2, 10.0F, 1, Color.white);
|
||||
|
||||
public static final Font PDF_fMedioBlu = new Font(2, 10.0F, 0, Color.blue);
|
||||
|
||||
public static final Font PDF_fMedioGrigio = new Font(2, 10.0F, 1, Color.GRAY);
|
||||
|
||||
public static final Font PDF_fMedioRosso = new Font(2, 10.0F, 0, Color.red);
|
||||
|
||||
public static final Font PDF_fMedioRouge = new Font(2, 10.0F, 0, Color.magenta);
|
||||
|
||||
public static final Font PDF_fPiccolissimo = new Font(2, 7.0F, 0);
|
||||
|
||||
public static final Font PDF_fPiccolissimo4 = new Font(2, 4.0F, 0);
|
||||
|
||||
public static final Font PDF_fPiccolissimo4B = new Font(2, 4.0F, 1);
|
||||
|
||||
public static final Font PDF_fPiccolissimo5 = new Font(2, 5.0F, 0);
|
||||
|
||||
public static final Font PDF_fPiccolissimo5B = new Font(2, 5.0F, 1);
|
||||
|
||||
public static final Font PDF_fPiccolissimo6 = new Font(2, 6.0F, 0);
|
||||
|
||||
public static final Font PDF_fPiccolissimo6B = new Font(2, 6.0F, 1);
|
||||
|
||||
public static final Font PDF_fPiccolissimoB = new Font(2, 7.0F, 1);
|
||||
|
||||
public static final Font PDF_fPiccolo = new Font(2, 8.0F, 0);
|
||||
|
||||
public static final Font PDF_fPiccoloB = new Font(2, 8.0F, 1);
|
||||
|
||||
public static final Font PDF_fPiccoloBianco = new Font(2, 8.0F, 1, Color.white);
|
||||
|
||||
public static final Font PDF_fPiccoloBlu = new Font(2, 8.0F, 0, Color.blue);
|
||||
|
||||
public static final Font PDF_fPiccoloRosso = new Font(2, 8.0F, 0, Color.red);
|
||||
|
||||
public _PgAdapter() {}
|
||||
|
||||
public _PgAdapter(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public String getPathBaseFoto() {
|
||||
if (getApFull() == null)
|
||||
return "/";
|
||||
return getParm("PATHFOTO").getTesto();
|
||||
}
|
||||
}
|
||||
112
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/Foto2Svlt.java
Normal file
112
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/Foto2Svlt.java
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Foto;
|
||||
import com.ablia.pg.FotoCR;
|
||||
import com.ablia.pg.PuntoFoto;
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.pg.XFotoGara;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class Foto2Svlt extends _PgPageSvlt {
|
||||
private static final long serialVersionUID = -3730505807508646299L;
|
||||
|
||||
public static final String SESS_FLG_VISTA_COMPATTA = "_FVC";
|
||||
|
||||
protected void caricaCombo(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void chiamaJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative("fotoCR.jsp", req);
|
||||
try {
|
||||
caricaCombo(req, res);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void print(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
XFotoGara bean = (XFotoGara)beanA;
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Foto(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new FotoCR(getApFull());
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
FotoCR CR = new FotoCR(getApFull());
|
||||
Users user = new Users(getApFull(req));
|
||||
user.findByPrimaryKey(getLoginUserId(req));
|
||||
req.setAttribute("user", user);
|
||||
if (getAct(req).equals("back")) {
|
||||
CR = (FotoCR)req.getSession().getAttribute("CR_FOTO");
|
||||
if (CR.getPageNumber() > 0)
|
||||
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
|
||||
} else {
|
||||
fillObject(req, CR);
|
||||
}
|
||||
long FVC = (req.getSession().getAttribute("_FVC") == null) ? 0L :
|
||||
Long.parseLong((String)req.getSession().getAttribute("_FVC"));
|
||||
if (CR.getFlgVisCompattaS().endsWith("C")) {
|
||||
FVC = 1L;
|
||||
req.getSession().setAttribute("_FVC", "1");
|
||||
} else if (CR.getFlgVisCompattaS().endsWith("E")) {
|
||||
FVC = 0L;
|
||||
req.getSession().setAttribute("_FVC", "0");
|
||||
}
|
||||
CR.setFlgVisCompatta(FVC);
|
||||
if (CR.getId_gara() != 0L) {
|
||||
int l_pageRow = CR.getPageRow();
|
||||
req.setAttribute("listaTipiPuntoFoto", new PuntoFoto(getApFull()).findTipiPuntoFoto(CR.getId_gara()));
|
||||
req.setAttribute("listaPuntiFoto", new PuntoFoto(getApFull()).findPuntiFotoByGara(CR.getId_gara(), 0, 0));
|
||||
req.getSession().setAttribute("id_gara", String.valueOf(CR.getId_gara()));
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("bean", CR.getGara());
|
||||
req.getSession().setAttribute("CR_FOTO", CR);
|
||||
req.setAttribute("list", new Foto(getApFull()).findByCR(CR, getPageNumber(req), l_pageRow));
|
||||
}
|
||||
chiamaJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void _mostraFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
Foto bean = new Foto(getApFull());
|
||||
long l_id_foto = getRequestLongParameter(req, "id_foto");
|
||||
bean.findByPrimaryKey(l_id_foto);
|
||||
req.setAttribute("bean", bean);
|
||||
Users user = new Users(getApFull(req));
|
||||
user.findByPrimaryKey(getLoginUserId(req));
|
||||
req.setAttribute("user", user);
|
||||
setJspPage("/fotoView.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _vistaEstesa(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.getSession().setAttribute("_FVC", "0");
|
||||
}
|
||||
|
||||
public void _vistaCompatta(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.getSession().setAttribute("_FVC", "1");
|
||||
}
|
||||
}
|
||||
58
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/FotoSvlt.java
Normal file
58
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/FotoSvlt.java
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Foto;
|
||||
import com.ablia.pg.FotoCR;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class FotoSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
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 Foto(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new FotoCR(getApFull());
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
|
||||
String l_foto = getRequestParameter(req, "foto");
|
||||
Foto bean = new Foto(getApFull(req));
|
||||
try {
|
||||
bean.findByFoto(l_foto);
|
||||
req.setAttribute("bean", bean);
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL"));
|
||||
}
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
107
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GaraSvlt.java
Normal file
107
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GaraSvlt.java
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.FotoCR;
|
||||
import com.ablia.pg.Gara;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GaraSvlt extends _PgPageSvlt {
|
||||
private static final long serialVersionUID = -3730345807508646299L;
|
||||
|
||||
protected void caricaCombo(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void chiamaJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
setJspPageRelative("fotoCR.jsp", req);
|
||||
try {
|
||||
caricaCombo(req, res);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void print(HttpServletRequest req, HttpServletResponse 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 Gara(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Gara bean = new Gara(apFull);
|
||||
FotoCR CR = new FotoCR(apFull);
|
||||
long flgTipoEvento = getRequestLongParameter(req, "flgTipoEvento");
|
||||
String datarange = "";
|
||||
if (flgTipoEvento == 0L) {
|
||||
datarange = getRequestParameter(req, "datarangeFe");
|
||||
} else {
|
||||
datarange = getRequestParameter(req, "datarangeFer");
|
||||
}
|
||||
if (!datarange.isEmpty()) {
|
||||
req.setAttribute("dataInizioGaraDa", datarange.substring(0, 10));
|
||||
req.setAttribute("dataInizioGaraA", datarange.substring(13, 23));
|
||||
}
|
||||
fillObject(req, CR);
|
||||
req.setAttribute("list", bean.findWebByCR(CR, 0, 0));
|
||||
req.setAttribute("CR", CR);
|
||||
setJspPage("/garaCR.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _searchIndex(HttpServletRequest req, HttpServletResponse res) {
|
||||
Gara bean = new Gara(getApFull());
|
||||
FotoCR CR = new FotoCR();
|
||||
fillObject(req, CR);
|
||||
long flgTipoEvento = getRequestLongParameter(req, "flgTipoEvento");
|
||||
int pageNumber = 1;
|
||||
String datarange = "";
|
||||
if (flgTipoEvento == 0L) {
|
||||
pageNumber = (int)CR.getPageNumberFS();
|
||||
if (CR.getId_tipoGaraFS() > 0L) {
|
||||
CR.setId_tipoGara(CR.getId_tipoGaraFS());
|
||||
} else {
|
||||
CR.setId_tipoGara(1L);
|
||||
}
|
||||
if (!CR.getLocalitaFS().isEmpty())
|
||||
CR.setLocalita(CR.getLocalitaFS());
|
||||
CR.setDataGaraInizio(CR.getDataGaraInizioFS());
|
||||
CR.setAnno(CR.getAnnoFS());
|
||||
CR.setFlgMese(CR.getFlgMeseFS());
|
||||
} else {
|
||||
pageNumber = (int)CR.getPageNumberFE();
|
||||
if (CR.getId_tipoGaraFE() > 0L) {
|
||||
CR.setId_tipoGara(CR.getId_tipoGaraFE());
|
||||
} else {
|
||||
CR.setId_tipoGara(2L);
|
||||
}
|
||||
if (!CR.getLocalitaFE().isEmpty())
|
||||
CR.setLocalita(CR.getLocalitaFE());
|
||||
CR.setDataGaraInizio(CR.getDataGaraInizioFE());
|
||||
CR.setAnno(CR.getAnnoFE());
|
||||
CR.setFlgMese(CR.getFlgMeseFE());
|
||||
}
|
||||
req.setAttribute("CR", CR);
|
||||
req.setAttribute("list", bean.findWebByCR(CR, pageNumber, 4));
|
||||
setJspPage("/garaCRIndex.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetFileOrigSvlt extends GetFileTnSvlt {
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileOriginale(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileOriginale(req, res);
|
||||
}
|
||||
}
|
||||
107
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GetFileSvlt.java
Normal file
107
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GetFileSvlt.java
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Users;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetFileSvlt extends com.ablia.servlet.GetFileSvlt {
|
||||
protected String getFileName(HttpServletRequest req, HttpServletResponse res) {
|
||||
String fileName = getFileName(req);
|
||||
if (fileName.indexOf("tn_") <= 0) {
|
||||
if (fileName.indexOf("_X") > 0 && getLoginUser(req).getId_userProfile() != 1L)
|
||||
return getParm("NO_FOTOX").getTesto();
|
||||
if (fileName.indexOf("_Y") > 0 && getLoginUser(req).getId_userProfile() != 1L)
|
||||
return getParm("NO_FOTOY").getTesto();
|
||||
if (fileName.indexOf("_Z") > 0 && getLoginUser(req).getId_userProfile() != 1L)
|
||||
return getParm("NO_FOTOZ").getTesto();
|
||||
Users bean = (Users)getLoginUser(req);
|
||||
Users.addLogFoto(bean, fileName, getApFull(req));
|
||||
Users user = new Users(getApFull());
|
||||
user.findByPrimaryKey(getLoginUserId(req));
|
||||
if (user.getFlgMiniature() == 1L) {
|
||||
int idx = fileName.lastIndexOf("/") + 1;
|
||||
String temp = String.valueOf(fileName.substring(0, idx)) + "tn_" + fileName.substring(idx);
|
||||
fileName = temp;
|
||||
}
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "/logonRedirect.jsp";
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
req.getSession().removeAttribute("msgS");
|
||||
String fileName = getFileName(req);
|
||||
if (fileName.indexOf("tn_") > 0 || fileName.indexOf("_X") > 0)
|
||||
return true;
|
||||
String msg = "";
|
||||
Users bean = (Users)getLoginUser(req);
|
||||
if (bean == null) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return false;
|
||||
}
|
||||
if (bean.getFlgValido().equals("N")) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
forceMessage(req, "Utente non valido. Contattare l'amministratore del sito.");
|
||||
req.getSession().setAttribute("msgS", "Utente non valido. Contattare l'amministratore del sito.");
|
||||
return false;
|
||||
}
|
||||
if (bean.getDataScadenza() != null && DBAdapter.getDateDiff(DBAdapter.getToday(), bean.getDataScadenza()) < 0L) {
|
||||
forceMessage(req, "Utente non valido. Utente scaduto.");
|
||||
req.getSession().setAttribute("msgS", "ATTENZIONE!! Account scaduto");
|
||||
bean.sendNoMorePictureMessageScad();
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
if (bean.getNFotoMax() > 0L && bean.getNFotoVisual() >= bean.getNFotoMax()) {
|
||||
forceMessage(req, "Utente non valido. Numero massimo di foto visualizzate raggiunto.");
|
||||
req.getSession().setAttribute("msgS", "ATTENZIONE!! Numero massimo di foto visualizzate raggiunto.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
bean.sendNoMorePictureMessageNumber();
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getFileName(HttpServletRequest req) {
|
||||
String fileName;
|
||||
String temp = req.getRequestURL().toString();
|
||||
if (temp.indexOf("/mypics2") > 0) {
|
||||
fileName = String.valueOf(getDocBase()) + temp.substring(temp.indexOf("/mypics2"));
|
||||
} else {
|
||||
fileName = String.valueOf(getDocBase()) + temp.substring(temp.indexOf("/mypics"));
|
||||
}
|
||||
if (fileName.startsWith("/usr"))
|
||||
fileName = fileName.substring(4);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
String fileName = getFileName(req);
|
||||
if (fileName.indexOf("tn_") > 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
146
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GetFileTnSvlt.java
Normal file
146
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/GetFileTnSvlt.java
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.pg.Foto;
|
||||
import com.ablia.pg.Users;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetFileTnSvlt extends _PgPageSvlt {
|
||||
private static final long serialVersionUID = -3037980260742696647L;
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "/documentoCR.jsp";
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileTn(req, res);
|
||||
}
|
||||
|
||||
protected void sendFile(String fileName, HttpServletRequest req, HttpServletResponse res) {
|
||||
File theFile = null;
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
theFile = new File(fileName);
|
||||
String ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length());
|
||||
res.setHeader("Content-Type", "image/jpg");
|
||||
res.setContentType("application/" + ext.toLowerCase());
|
||||
if (theFile.exists()) {
|
||||
fis = new FileInputStream(theFile);
|
||||
byte[] temp = new byte[1024];
|
||||
int nByte = 0;
|
||||
ServletOutputStream sos = res.getOutputStream();
|
||||
while ((nByte = fis.read(temp)) != -1)
|
||||
sos.write(temp, 0, nByte);
|
||||
sos.flush();
|
||||
fis.close();
|
||||
sos.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
theFile = null;
|
||||
if (fis != null)
|
||||
fis = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void _fileTn(HttpServletRequest req, HttpServletResponse res) {
|
||||
inviaFile(true, req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileTn(req, res);
|
||||
}
|
||||
|
||||
public void _fileOriginale(HttpServletRequest req, HttpServletResponse res) {
|
||||
boolean inviaFile = true;
|
||||
boolean inviaTn = false;
|
||||
Users bean = new Users(getApFull(req));
|
||||
bean.findByPrimaryKey(getLoginUserId(req));
|
||||
if (bean.getFlgMiniature() == 1L)
|
||||
inviaTn = true;
|
||||
if (bean == null) {
|
||||
inviaFile = false;
|
||||
} else if (bean.getFlgValido().equals("N")) {
|
||||
inviaFile = false;
|
||||
} else if (bean.isScaduto()) {
|
||||
forceMessage(req, "Utente non valido. Utente scaduto.");
|
||||
req.getSession().setAttribute("msgS", "ATTENZIONE!! Account scaduto");
|
||||
bean.sendNoMorePictureMessageScad();
|
||||
inviaFile = false;
|
||||
} else if (bean.isFotoMaxRaggiunto()) {
|
||||
forceMessage(req, "Utente non valido. Numero massimo di foto visualizzate raggiunto.");
|
||||
req.getSession().setAttribute("msgS", "ATTENZIONE!! Numero massimo di foto visualizzate raggiunto.");
|
||||
bean.sendNoMorePictureMessageNumber();
|
||||
inviaFile = false;
|
||||
}
|
||||
if (inviaFile) {
|
||||
inviaFile(inviaTn, req, res);
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!. Account scaduto o raggiunto n. foto massimo");
|
||||
}
|
||||
}
|
||||
|
||||
private void inviaFile(boolean inviaTn, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String fileName = "";
|
||||
long l_id_foto = getRequestLongParameter(req, "id_foto");
|
||||
Foto foto = new Foto(apFull);
|
||||
if (l_id_foto == 0L) {
|
||||
String requestURI = req.getRequestURI();
|
||||
int idx_ = requestURI.lastIndexOf("-");
|
||||
if (idx_ > 0) {
|
||||
int idxDot = requestURI.lastIndexOf(".");
|
||||
try {
|
||||
l_id_foto = Long.valueOf(requestURI.substring(idx_ + 1, idxDot));
|
||||
} catch (Exception e) {
|
||||
l_id_foto = 0L;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_id_foto == 0L) {
|
||||
fileName = String.valueOf(getDocBase()) + "_img/_imgNotFound.png";
|
||||
} else {
|
||||
foto.findByPrimaryKey(l_id_foto);
|
||||
if (foto.getDBState() == 1) {
|
||||
if (inviaTn) {
|
||||
fileName = foto.getPathCompletoFileTn();
|
||||
} else {
|
||||
fileName = foto.getPathCompletoFile();
|
||||
}
|
||||
if (!inviaTn) {
|
||||
if (fileName.indexOf("_X") > 0 && getLoginUser(req).getId_userProfile() != 1L) {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!. Questa Foto non puo' essere scaricata!!");
|
||||
fileName = null;
|
||||
}
|
||||
if (fileName.indexOf("_Y") > 0 && getLoginUser(req).getId_userProfile() != 1L) {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!. Questa Foto non puo' essere scaricata!!");
|
||||
fileName = null;
|
||||
}
|
||||
if (fileName.indexOf("_Z") > 0 && getLoginUser(req).getId_userProfile() != 111L) {
|
||||
sendHtmlMsgResponse(req, res, "Attenzione!. Questa Foto non puo' essere scaricata!!");
|
||||
fileName = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fileName = String.valueOf(getDocBase()) + "_img/_imgNotFound.png";
|
||||
}
|
||||
}
|
||||
if (fileName != null) {
|
||||
if (!inviaTn && foto.getId_foto() > 0L) {
|
||||
Users user = new Users(apFull);
|
||||
user.findByPrimaryKey(getLoginUserId(req));
|
||||
Users.addLogFoto(user, foto, apFull);
|
||||
}
|
||||
sendFile(fileName, req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/IndexSvlt.java
Normal file
11
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/IndexSvlt.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class IndexSvlt extends _PgPageSvlt {
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
forceJspPageRelative("index.jsp", req);
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
116
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/Logon2Svlt.java
Normal file
116
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/Logon2Svlt.java
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.contab.RigaDocumentoCR;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Users;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class Logon2Svlt extends com.ablia.servlet.LogonSvlt {
|
||||
protected long checkLoginName(HttpServletRequest req, HttpServletResponse res) {
|
||||
long result = super.checkLoginName(req, res);
|
||||
ApplParmFull apFUll = getApFull(req);
|
||||
if (result == 5L) {
|
||||
Users user = new Users(apFUll);
|
||||
user.findByPrimaryKey(getLoginUserId(req));
|
||||
req.getSession().setAttribute("user", user);
|
||||
req.setAttribute("user", user);
|
||||
if (user.getId_clifor() > 0L) {
|
||||
RigaDocumento rd = new RigaDocumento(apFUll);
|
||||
RigaDocumentoCR rdCR = new RigaDocumentoCR(apFUll);
|
||||
rdCR.setId_clifor(user.getId_clifor());
|
||||
req.setAttribute("listRD", rd.findByCR(rdCR, 0, 0));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
String msg = "";
|
||||
Users bean = (Users)getLoginUser(req);
|
||||
if (bean == null) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return false;
|
||||
}
|
||||
if (bean.getFlgValido().equals("N")) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
forceMessage(req, "Utente non valido. Contattare l'amministratore del sito.");
|
||||
return false;
|
||||
}
|
||||
if (bean.getDataScadenza() != null && DBAdapter.getDateDiff(DBAdapter.getToday(), bean.getDataScadenza()) < 0L) {
|
||||
forceMessage(req, "Utente non valido. Utente scaduto.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
bean.sendNoMorePictureMessageScad();
|
||||
return true;
|
||||
}
|
||||
if (bean.getNFotoMax() > 0L && bean.getNFotoVisual() > bean.getNFotoMax()) {
|
||||
forceMessage(req, "Utente non valido. Numero massimo di foto visualizzate raggiunto.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
bean.sendNoMorePictureMessageNumber();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserId(req) > 0L && !getRequestParameter(req, "thePage").isEmpty()) {
|
||||
String thePage = getRequestParameter(req, "thePage");
|
||||
int idx = thePage.substring(8).indexOf("/") + 8;
|
||||
return thePage.substring(idx);
|
||||
}
|
||||
return "/documentoCR.jsp";
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser(HttpServletRequest req) {
|
||||
return new Users(getApFull(req));
|
||||
}
|
||||
|
||||
protected boolean useControlCodeAccess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void logOff(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.getSession().removeAttribute("user");
|
||||
super.logOff(req, res);
|
||||
}
|
||||
|
||||
public void _logout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("user");
|
||||
setJspPageRelative("index.jsp", req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
|
||||
if (getCmd(req).equals("logout")) {
|
||||
_logout(req, res);
|
||||
} else {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
88
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/LogonSvlt.java
Normal file
88
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/LogonSvlt.java
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Users;
|
||||
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 com.ablia.servlet.LogonSvlt {
|
||||
protected long checkLoginName(HttpServletRequest req, HttpServletResponse res) {
|
||||
return super.checkLoginName(req, res);
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
String msg = "";
|
||||
Users bean = (Users)getLoginUser(req);
|
||||
if (bean == null) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return false;
|
||||
}
|
||||
if (bean.getFlgValido().equals("N")) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
forceMessage(req,
|
||||
"Utente non valido. Contattare l'amministratore del sito.");
|
||||
return false;
|
||||
}
|
||||
if (bean.getDataScadenza() != null &&
|
||||
DBAdapter.getDateDiff(DBAdapter.getToday(),
|
||||
bean.getDataScadenza()) < 0L) {
|
||||
forceMessage(req, "Utente non valido. Utente scaduto.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
bean.sendNoMorePictureMessageScad();
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
if (bean.getNFotoMax() > 0L &&
|
||||
bean.getNFotoVisual() > bean.getNFotoMax()) {
|
||||
forceMessage(req,
|
||||
"Utente non valido. Numero massimo di foto visualizzate raggiunto.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
bean.sendNoMorePictureMessageNumber();
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "/pg/logon.jsp";
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useControlCodeAccess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void _logout(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("user");
|
||||
setJspPageRelative("index.jsp", req);
|
||||
try {
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
326
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/OrdineSvlt.java
Normal file
326
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/OrdineSvlt.java
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.anag.TipoPagamento;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.contab.DocumentoCR;
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.contab.RigaDocumentoCR;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Coupon;
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class OrdineSvlt extends com.ablia.www.servlet.OrdineSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
Documento bean = (Documento)l_bean;
|
||||
ApplParmFull apFUll = getApFull(req);
|
||||
req.setAttribute("listaTipoPagamento", new TipoPagamento(apFUll).findPagamentiWww(bean.getFlgRitiroNegozio()));
|
||||
RigaDocumento rd = new RigaDocumento(apFUll);
|
||||
RigaDocumentoCR rdCR = new RigaDocumentoCR(apFUll);
|
||||
long l_id_users = getLoginUserId(req);
|
||||
Users users = new Users(apFUll);
|
||||
users.findByPrimaryKey(l_id_users);
|
||||
if (users.getId_clifor() > 0L) {
|
||||
rdCR.setId_clifor(users.getId_clifor());
|
||||
req.setAttribute("listRD", rd.findByCR(rdCR, 0, 0));
|
||||
}
|
||||
if (req.getAttribute("msg").equals("Lettura effettuata"))
|
||||
req.setAttribute("msg", "");
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
sendMessage(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 = "";
|
||||
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) {
|
||||
Documento bean = null;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = getRequestLongParameter(req, "id_documento");
|
||||
bean = new Documento(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
rp = bean.sendOrderMailMessageRavinale(getLang(req), true, true, false);
|
||||
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) {
|
||||
com.ablia.anag.Users user = (com.ablia.anag.Users)getLoginUser(req);
|
||||
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, " ");
|
||||
}
|
||||
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 {
|
||||
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 _aggiornaRichiediFatturaMd(HttpServletRequest req, HttpServletResponse res) {
|
||||
com.ablia.anag.Users user = (com.ablia.anag.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);
|
||||
}
|
||||
}
|
||||
|
||||
public void _inviaCoupon(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users user = new Users(apFull);
|
||||
long l_id_users = getLoginUserId(req);
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
ResParm rp = new ResParm(true);
|
||||
if (user != null && user.getDBState() == 1) {
|
||||
if (user.isDaRinnovare()) {
|
||||
Coupon coupon = new Coupon(apFull);
|
||||
String l_coupon = getRequestParameter(req, "coupon");
|
||||
coupon.findByCodice(l_coupon);
|
||||
if (coupon.isValido()) {
|
||||
if (user.getId_clifor() == 0L) {
|
||||
Clifor clifor = new Clifor(apFull);
|
||||
clifor.setFlgTipo("C");
|
||||
clifor.setNome(user.getNome());
|
||||
clifor.setCognome(user.getCognome());
|
||||
clifor.setIndirizzo(user.getIndirizzo());
|
||||
clifor.setNumeroCivico(user.getNumeroCivico());
|
||||
clifor.setFlgSesso(user.getFlgSesso());
|
||||
clifor.setDescrizioneComune(user.getCitta());
|
||||
clifor.setCapComune(user.getCap());
|
||||
clifor.setId_nazione(user.getId_nazione());
|
||||
clifor.setCodFisc(user.getCodFisc());
|
||||
clifor.setTelefono(user.getTelefono());
|
||||
clifor.setContatto(user.getContatto());
|
||||
rp = clifor.save();
|
||||
if (rp.getStatus()) {
|
||||
user.setId_clifor(clifor.getId_clifor());
|
||||
rp = user.save();
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
if (coupon.getNFoto() < 100L)
|
||||
coupon.hasCouponRegaloByCliente(user.getId_clifor());
|
||||
Documento doc = new Documento(apFull);
|
||||
long l_id_tipo_doc_ordine_www = getParm("ID_DOC_ORDINE_WWW").getNumeroLong();
|
||||
doc.setId_tipoDocumento(l_id_tipo_doc_ordine_www);
|
||||
doc.setDataDocumento(DBAdapter.getToday());
|
||||
doc.setId_clifor(user.getId_clifor());
|
||||
doc.setFlgPagata(1L);
|
||||
doc.setDataPagamento(DBAdapter.getToday());
|
||||
rp = doc.save();
|
||||
if (rp.getStatus()) {
|
||||
RigaDocumento rd = new RigaDocumento(apFull);
|
||||
rd.setId_documento(doc.getId_documento());
|
||||
rd.setDescrizioneRiga("Rinnovo abbonamento coupon " + l_coupon);
|
||||
rd.setQuantita(1.0D);
|
||||
rd.setId_iva(getParm("CODICE_IVA_STD_ACQ").getNumeroLong());
|
||||
rp = rd.save();
|
||||
if (rp.getStatus())
|
||||
rp = user.rinnovaAnno(coupon.getNFoto());
|
||||
if (rp.getStatus()) {
|
||||
coupon.setId_rigaDocumento(rd.getId_rigaDocumento());
|
||||
rp = coupon.save();
|
||||
}
|
||||
}
|
||||
if (coupon.getNFoto() == 1000L) {
|
||||
user.sendRinnovoMailMessage();
|
||||
} else if (coupon.getNFoto() < 100L) {
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Attenzione! Coupon non trovato o non valido!!");
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Attenzione! Il tuo account non e' da rinnovare");
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Attenzione! Utente non valido");
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
forceMessage(req, "Rinnovo eseguito correttamente");
|
||||
} else {
|
||||
forceMessage(req, "Attenzione! Impossibile utilizzare il coupon: " + rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (getLoginUserId(req) > 0L) {
|
||||
Users bean = new Users(apFull);
|
||||
bean.findByPrimaryKey(getLoginUserId(req));
|
||||
req.setAttribute("user", bean);
|
||||
RigaDocumento rd = new RigaDocumento(apFull);
|
||||
RigaDocumentoCR rdCR = new RigaDocumentoCR();
|
||||
rdCR.setId_clifor(bean.getId_clifor());
|
||||
if (bean.getId_clifor() > 0L)
|
||||
req.setAttribute("listRD", rd.findByCR(rdCR, 1, 10));
|
||||
}
|
||||
super.search(req, res);
|
||||
}
|
||||
|
||||
public void _aggiornaRichiediFattura(HttpServletRequest req, HttpServletResponse res) {
|
||||
com.ablia.anag.Users user = (com.ablia.anag.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.bank.servlet.paypal.PayPalSvlt;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.contab.RigaDocumento;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Users;
|
||||
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);
|
||||
ResParm rp = new ResParm(true);
|
||||
if (ppResponse != null && ppResponse.isPaymentDone()) {
|
||||
long l_id_users = ppResponse.getId_ordine();
|
||||
Users user = new Users(apFull);
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
if (user.getId_clifor() == 0L) {
|
||||
Clifor clifor = new Clifor(apFull);
|
||||
clifor.setFlgTipo("C");
|
||||
clifor.setNome(user.getNome());
|
||||
clifor.setCognome(user.getCognome());
|
||||
clifor.setIndirizzo(user.getIndirizzo());
|
||||
clifor.setNumeroCivico(user.getNumeroCivico());
|
||||
clifor.setFlgSesso(user.getFlgSesso());
|
||||
clifor.setDescrizioneComune(user.getCitta());
|
||||
clifor.setCapComune(user.getCap());
|
||||
clifor.setId_nazione(user.getId_nazione());
|
||||
clifor.setCodFisc(user.getCodFisc());
|
||||
clifor.setTelefono(user.getTelefono());
|
||||
clifor.setContatto(user.getContatto());
|
||||
rp = clifor.save();
|
||||
if (rp.getStatus()) {
|
||||
user.setId_clifor(clifor.getId_clifor());
|
||||
rp = user.save();
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
Documento doc = new Documento(apFull);
|
||||
long l_id_tipo_doc_ordine_www = getParm("ID_DOC_ORDINE_WWW").getNumeroLong();
|
||||
doc.setId_tipoDocumento(l_id_tipo_doc_ordine_www);
|
||||
doc.setDataDocumento(DBAdapter.getToday());
|
||||
doc.setId_clifor(user.getId_clifor());
|
||||
doc.setFlgPagata(1L);
|
||||
doc.setDataPagamento(DBAdapter.getToday());
|
||||
doc.setDescTransaction(ppResponse.getTRANSACTIONID());
|
||||
rp = doc.save();
|
||||
if (rp.getStatus()) {
|
||||
RigaDocumento rd = new RigaDocumento(apFull);
|
||||
rd.setId_documento(doc.getId_documento());
|
||||
rd.setDescrizioneRiga("Rinnovo abbonamento tramite PayPal trans.#" + ppResponse.getTRANSACTIONID());
|
||||
rd.setQuantita(1.0D);
|
||||
rd.setImponibile(20.0D);
|
||||
rd.setId_iva(3L);
|
||||
rp = rd.save();
|
||||
if (rp.getStatus())
|
||||
rp = user.rinnovaAnno(1000L);
|
||||
req.setAttribute("bean", doc);
|
||||
}
|
||||
user.sendRinnovoMailMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_users = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_users = ppResponse.getId_ordine();
|
||||
Users user = new Users(getApFull());
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
req.setAttribute("user", user);
|
||||
}
|
||||
|
||||
protected String getCheckOutMailMessage() {
|
||||
return getParm(Cart.P_CHECKOUTMSG).getTesto();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.bank.paypal.PayPalResp;
|
||||
import com.ablia.bank.servlet.paypal.GetPayPalResponseSvlt;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.pg.Users;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class PayPalResponseSvlt extends GetPayPalResponseSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {
|
||||
long l_id_users = 0L;
|
||||
if (ppResponse != null)
|
||||
l_id_users = ppResponse.getId_ordine();
|
||||
Users user = new Users(getApFull());
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
req.setAttribute("user", user);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
76
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/PgSvlt.java
Normal file
76
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/PgSvlt.java
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.common.Users;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class PgSvlt extends AblServletSvlt {
|
||||
protected String getPathStampeIva() {
|
||||
return getApFull(null).getResource("pathStampeIva");
|
||||
}
|
||||
|
||||
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 4L;
|
||||
}
|
||||
|
||||
protected String getAct3(HttpServletRequest req) {
|
||||
return getRequestParameter(req, "act3");
|
||||
}
|
||||
|
||||
protected String getCmd3(HttpServletRequest req) {
|
||||
return getRequestParameter(req, "cmd3");
|
||||
}
|
||||
|
||||
protected String getImgPath() {
|
||||
return getApFull(null).getResource("imgPath");
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "/admin/menu/menu.jsp";
|
||||
}
|
||||
|
||||
protected String getPathStampeFatture() {
|
||||
return getApFull(null).getResource("pathStampeFatture");
|
||||
}
|
||||
|
||||
protected String getPathStampeRicevute() {
|
||||
return getApFull(null).getResource("pathStampeRicevute");
|
||||
}
|
||||
|
||||
protected Users getUser() {
|
||||
return new com.ablia.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
126
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/RegistraSvlt.java
Normal file
126
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/RegistraSvlt.java
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.pg.UsersCR;
|
||||
import com.ablia.util.CodiceFiscale;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RegistraSvlt extends PgSvlt {
|
||||
private static final String PARM_REG_VLD = "REG_VLD";
|
||||
|
||||
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 Users(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new UsersCR(getApFull());
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return "registra";
|
||||
}
|
||||
|
||||
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) {
|
||||
String msg;
|
||||
Users bean = (Users)beanA;
|
||||
if (bean.getDBState() == 1) {
|
||||
msg = "Salvataggio effettuato";
|
||||
if (!mailConfermaCambiamentoDati(req, bean)) {
|
||||
msg = String.valueOf(msg) +
|
||||
" Attenzione!! Impossibile mandare email di conferma.";
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Inviata mail di conferma.";
|
||||
}
|
||||
setJspPageRelative("registraOk.jsp", req);
|
||||
} else {
|
||||
msg = "ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso";
|
||||
}
|
||||
forceMessage(req, msg);
|
||||
return "";
|
||||
}
|
||||
|
||||
private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) {
|
||||
return bean.sendUserDataMailMessage().getStatus();
|
||||
}
|
||||
|
||||
protected String getRegistrazioneMailMessage() {
|
||||
return getParm("MAIL_REG").getTesto();
|
||||
}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull());
|
||||
fillObject(req, bean);
|
||||
String msg = "Impossibile Registrare un nuovo utente:";
|
||||
if (bean.isLogonDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Login già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative("registra.jsp", req);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (bean.isEmailDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative("registra.jsp", req);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (bean.isCodFiscDuplicated(bean.getCodFisc())) {
|
||||
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative("registra.jsp", req);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (!bean.getCodFisc().isEmpty() &&
|
||||
!CodiceFiscale.controlloFormale(bean.getCodFisc())) {
|
||||
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative("registra.jsp", req);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
if ((long)getParm("REG_VLD").getNumeroInt() == 1L) {
|
||||
req.setAttribute("flgValido", "S");
|
||||
} else {
|
||||
req.setAttribute("flgValido", "N");
|
||||
}
|
||||
if (getParm("GG_VALIDITA").getNumeroInt() > 0) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(6, getParm("GG_VALIDITA")
|
||||
.getNumeroInt());
|
||||
req.setAttribute("dataScadenza",
|
||||
getDataFormat().format(new Date(cal.getTimeInMillis())));
|
||||
}
|
||||
if (getParm("N_FOTO_MAX").getNumeroInt() > 0)
|
||||
req.setAttribute("nFotoMax",
|
||||
String.valueOf(getParm("N_FOTO_MAX").getNumeroLong()));
|
||||
req.setAttribute("flgMiniature", "1");
|
||||
super.sqlActions(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.bank.sella.SellaResp;
|
||||
import com.ablia.bank.servlet.sella.GetSellaResponseSvlt;
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.contab.Documento;
|
||||
import com.ablia.db.ApplParm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class RicevutaSellaSvlt extends GetSellaResponseSvlt {
|
||||
protected static ApplParmFull ap2;
|
||||
|
||||
protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
if (sellaRes != null && sellaRes.getMyerrorcode().equals("0")) {
|
||||
long l_id_ordine = sellaRes.getId_ordine();
|
||||
Documento bean = new Documento(apFull);
|
||||
bean.findByPrimaryKey(l_id_ordine);
|
||||
bean.setDataPagamento(DBAdapter.getToday());
|
||||
bean.setDataTransaction(DBAdapter.getToday());
|
||||
bean.setDescTransaction(sellaRes.getMyauthcode());
|
||||
bean.setFlgPagata(1L);
|
||||
bean.setFlgStatoOrdineWww(1L);
|
||||
ResParm rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
if (bean.getFlgWwwRichiedeFattura() == 1L) {
|
||||
long l_id_tipodocFatturaDifferita = 22L;
|
||||
bean.creaDocumentoFiglio(bean.getId_clifor(), l_id_tipodocFatturaDifferita, null, false, 0L);
|
||||
} else {
|
||||
long l_id_tipodocRicevuta = 23L;
|
||||
bean.creaDocumentoFiglio(bean.getId_clifor(), l_id_tipodocRicevuta, null, false, 0L);
|
||||
}
|
||||
rp = bean.sendOrderMailMessageRavinale(getLang(req), true, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) {
|
||||
long l_id_ordine = 0L;
|
||||
if (sellaRes != null)
|
||||
l_id_ordine = sellaRes.getId_ordine();
|
||||
Documento bean = new Documento(getApFull());
|
||||
bean.findByPrimaryKey(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;
|
||||
}
|
||||
|
||||
public void _test(HttpServletRequest req, HttpServletResponse res) {}
|
||||
}
|
||||
450
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/UsersSvlt.java
Normal file
450
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/UsersSvlt.java
Normal file
|
|
@ -0,0 +1,450 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.anag.Cliente;
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.anag.Nazione;
|
||||
import com.ablia.anag.NazioneCR;
|
||||
import com.ablia.cart.CartStatus;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.pg.UsersCR;
|
||||
import com.ablia.servlet.AcCartSvlt;
|
||||
import com.ablia.util.CodiceFiscale;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class UsersSvlt extends com.ablia.www.servlet.UsersSvlt {
|
||||
private static final String PARM_REG_VLD = "REG_VLD";
|
||||
|
||||
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) {
|
||||
NazioneCR nCR = new NazioneCR();
|
||||
nCR.setLang(getLang(req));
|
||||
req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req)));
|
||||
sendMessage(req, "");
|
||||
Users bean = new Users(getApFull(req));
|
||||
if (getLoginUserId(req) > 0L) {
|
||||
bean.findByPrimaryKey(getLoginUserId(req));
|
||||
} else {
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileWww());
|
||||
}
|
||||
bean.setCallingJsp(getRequestParameter(req, "callingJsp"));
|
||||
bean.setId_documento(getRequestLongParameter(req, "id_documento"));
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String getBeanPageName(HttpServletRequest req) {
|
||||
return super.getBeanPageName(req);
|
||||
}
|
||||
|
||||
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, String passwordIscrizione) {
|
||||
return bean.sendUserDataMailMessageCrypt(passwordIscrizione).getStatus();
|
||||
}
|
||||
|
||||
protected String getRegistrazioneMailMessage() {
|
||||
return getParm("MAIL_REG").getTesto();
|
||||
}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull(req));
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
if (l_id_users > 0L)
|
||||
bean.findByPrimaryKey(l_id_users);
|
||||
fillObject(req, bean);
|
||||
Cliente cli = new Cliente(getApFull(req));
|
||||
if (bean.getId_users() > 0L)
|
||||
cli.findByPrimaryKey(bean.getId_clifor());
|
||||
fillObject(req, cli);
|
||||
bean.setClifor((Clifor)cli);
|
||||
String msg = "Impossibile Registrare un nuovo utente:";
|
||||
if (bean.isLogonDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Login già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else 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()));
|
||||
saveUserAndClifor(req, res);
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else if (bean.isCodFiscDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Codice Fiscale già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (cli.isPIvaDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Partita Iva già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
callJsp(req, res);
|
||||
} else if (!bean.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(bean.getCodFisc())) {
|
||||
msg = String.valueOf(msg) + " Il codice fiscale non è valido:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) {
|
||||
msg = String.valueOf(msg) + " Partita iva non valida:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + ".jsp", req);
|
||||
bean.setPIva("");
|
||||
cli.setPIva("");
|
||||
bean.setPIva("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
req.setAttribute("flgValido", "S");
|
||||
req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww()));
|
||||
if ((long)getParm("REG_VLD").getNumeroInt() == 1L) {
|
||||
req.setAttribute("flgValido", "S");
|
||||
} else {
|
||||
req.setAttribute("flgValido", "N");
|
||||
}
|
||||
if (bean.getId_users() == 0L) {
|
||||
if (getParm("GG_VALIDITA").getNumeroInt() > 0) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(6, getParm("GG_VALIDITA").getNumeroInt());
|
||||
req.setAttribute("dataScadenza", getDataFormat().format(new Date(cal.getTimeInMillis())));
|
||||
}
|
||||
if (getParm("N_FOTO_MAX").getNumeroInt() > 0)
|
||||
req.setAttribute("nFotoMax", String.valueOf(getParm("N_FOTO_MAX").getNumeroLong()));
|
||||
req.setAttribute("flgMiniature", "1");
|
||||
}
|
||||
saveUserAndClifor(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users bean = new Users(getApFull(req));
|
||||
fillObject(req, bean);
|
||||
ResParm rp = new ResParm();
|
||||
String msg = "Impossibile Registrare utente ML:";
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
|
||||
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("ML_" + 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())
|
||||
bean.sendMLMailMessageOLD(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
|
||||
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 = "Impossibile Registrare utente ML:";
|
||||
if (bean.isEmailDuplicated()) {
|
||||
msg = String.valueOf(msg) + " Email già presente in archivio - " + bean.getEMail();
|
||||
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(String.valueOf(req.getRemoteHost()) + " " + req.getRemoteAddr());
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected com.ablia.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;
|
||||
long l_id_user = getRequestLongParameter(req, "id_users");
|
||||
String l_passwordIscrizione = getRequestParameter(req, "pwd");
|
||||
if (bean.getDBState() == 1) {
|
||||
msg = "Salvataggio effettuato";
|
||||
if (l_id_user == 0L) {
|
||||
if (!mailConfermaCambiamentoDati(req, bean, l_passwordIscrizione)) {
|
||||
msg = String.valueOf(msg) + " Attenzione!! Impossibile mandare email di conferma.";
|
||||
bean.setFlgEmailOk(0L);
|
||||
} else {
|
||||
msg = String.valueOf(msg) + " Inviata mail di conferma.";
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
} else {
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
setJspPageRelative(String.valueOf(getBeanPageName(req)) + "Reg.jsp", req);
|
||||
} else {
|
||||
msg = "ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso";
|
||||
}
|
||||
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("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) {
|
||||
Users user = new Users(getApFull(req));
|
||||
long l_id_users = getRequestLongParameter(req, "id_users");
|
||||
user.findByPrimaryKey(l_id_users);
|
||||
fillObject(req, user);
|
||||
if (user.getId_nazione().isEmpty() || 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);
|
||||
String nominativo = getRequestParameter(req, "nominativo");
|
||||
if (!nominativo.isEmpty()) {
|
||||
cliente.setFlgAzienda(1L);
|
||||
cliente.setCognome(nominativo);
|
||||
cliente.setNome("");
|
||||
}
|
||||
cliente.setFlgTipo("C");
|
||||
ResParm rp = cliente.save();
|
||||
rp.getStatus();
|
||||
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 (l_id_users > 0L) {
|
||||
if (!getRequestParameter(req, "newpwd").isEmpty())
|
||||
user.salvaNuovaPassword(getRequestParameter(req, "newpwd"));
|
||||
} else {
|
||||
rp = user.salvaNuovaPassword(user.getPwd());
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
afterSave((DBAdapter)user, req, res);
|
||||
sendMessage(req, "Record salvato correttamente");
|
||||
setJspPage("/usersReg.jsp", req);
|
||||
} else {
|
||||
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
|
||||
setJspPage("/users.jsp", req);
|
||||
}
|
||||
req.setAttribute("bean", user);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) {
|
||||
String l_cf = getRequestParameter(req, "codFiscR");
|
||||
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("Il Codice Fiscale richiesto non è nei nostri database. ");
|
||||
} else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.");
|
||||
} else {
|
||||
Users user = new Users(getApFull(req));
|
||||
Vectumerator 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(10L);
|
||||
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("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email " + user.getEMail());
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.");
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(
|
||||
"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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
public void _lostPasword(HttpServletRequest req, HttpServletResponse res) {
|
||||
_lostPassword(req, res);
|
||||
}
|
||||
|
||||
protected ResParm sendLostPasswordMessage(HttpServletRequest req, HttpServletResponse res) {
|
||||
Users user = new Users(getApFull(req));
|
||||
String lostEmail = getRequestParameter(req, AcCartSvlt.ATTR_LOSTPWDEMAIL);
|
||||
if (lostEmail.isEmpty())
|
||||
return new ResParm(false, "Email errata");
|
||||
return user.sendLostPasswordMailMessageCrypt(lostEmail);
|
||||
}
|
||||
|
||||
public void _lostPassword(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
CartStatus cs = new CartStatus();
|
||||
ResParm rp = sendLostPasswordMessage(req, res);
|
||||
if (!rp.getStatus()) {
|
||||
forceMessage(req, rp.getMsg());
|
||||
cs.setStatus(CartStatus.ST_LOSTPWD_SEND_ERROR);
|
||||
req.setAttribute(AcCartSvlt.ATTR_CART_STATUS, cs);
|
||||
} else {
|
||||
forceMessage(req, rp.getMsg());
|
||||
cs.setStatus(CartStatus.ST_LOSTPWD_SEND_OK);
|
||||
req.setAttribute(AcCartSvlt.ATTR_CART_STATUS, cs);
|
||||
}
|
||||
setJspPageRelative(AcCartSvlt.JSP_LOSTPASSWORD, req);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.getMessage());
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
109
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/_PgPageSvlt.java
Normal file
109
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/_PgPageSvlt.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
package com.ablia.pg.servlet;
|
||||
|
||||
import com.ablia.cart.Cart;
|
||||
import com.ablia.common.Users;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import java.text.NumberFormat;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class _PgPageSvlt extends AblServletSvlt {
|
||||
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 3L;
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "Registra.abl";
|
||||
}
|
||||
|
||||
protected Users getUser(HttpServletRequest req) {
|
||||
return new com.ablia.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPathImgArticoli() {
|
||||
return String.valueOf(getDocBase()) + "/" + getParm("PATH_IMG_ART").getTesto();
|
||||
}
|
||||
|
||||
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 long getId_gara(HttpServletRequest req) {
|
||||
long l_id_gara = getRequestLongParameter(req, "id_gara");
|
||||
return l_id_gara;
|
||||
}
|
||||
|
||||
protected void callJsp(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.callJsp(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 null;
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Coupon;
|
||||
import com.ablia.pg.CouponCR;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class CouponSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = -3103317969344235586L;
|
||||
|
||||
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 Coupon(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new CouponCR(getApFull());
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
return super.afterSave(beanA, req, res);
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.prepareNewRecord(req, res);
|
||||
}
|
||||
|
||||
protected String[] getFileNameTypesForLoadAttachServlet(HttpServletRequest req) {
|
||||
return super.getFileNameTypesForLoadAttachServlet(req);
|
||||
}
|
||||
|
||||
public void _resetCoupon(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_coupon = getRequestLongParameter(req, "id_coupon");
|
||||
System.out.println(l_id_coupon);
|
||||
Coupon bean = new Coupon(getApFull());
|
||||
bean.findByPrimaryKey(l_id_coupon);
|
||||
if (bean.getId_coupon() > 0L) {
|
||||
bean.save();
|
||||
sendMessage(req, "Coupon " + bean.getCodice() + " disattivato");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _attivaCoupon(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_coupon = getRequestLongParameter(req, "id_coupon");
|
||||
System.out.println(l_id_coupon);
|
||||
Coupon bean = new Coupon(getApFull());
|
||||
bean.findByPrimaryKey(l_id_coupon);
|
||||
if (bean.getId_coupon() > 0L) {
|
||||
bean.save();
|
||||
sendMessage(req, "Coupon " + bean.getCodice() + " ATTIVATO!!");
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _generaCoupon(HttpServletRequest req, HttpServletResponse res) {
|
||||
Coupon bean = new Coupon(getApFull(req));
|
||||
long nCoupon = getRequestLongParameter(req, "numCoupon");
|
||||
long nFoto = getRequestLongParameter(req, "nFoto1");
|
||||
String serie = getRequestParameter(req, "serie1");
|
||||
ResParm rp = bean.creaCoupon(serie, nFoto, nCoupon);
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Creazione di " + nCoupon + " Coupon effettuata correttamente");
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
}
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _stampaCoupon(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_blankLabels = getRequestLongParameter(req, "numLabel");
|
||||
String serie = getRequestParameter(req, "serie");
|
||||
Coupon c = new Coupon(getApFull());
|
||||
sendPdf(res, c.stampaCouponA4Pdf(serie, l_blankLabels));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Foto;
|
||||
import com.ablia.pg.FotoCR;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class FotoSvlt extends _PgAdminSvlt {
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getCmd(req).equals("foto")) {
|
||||
Object object = null;
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void print(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
FotoCR CR = (FotoCR)CRA;
|
||||
if (CR.getId_gara() > 0L)
|
||||
req.setAttribute("listaPuntiFoto", CR.getGara().getPuntiFoto(0, 0));
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Foto(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new FotoCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
FotoCR CR = new FotoCR(getApFull(req));
|
||||
fillObject(req, CR);
|
||||
if (CR.getId_gara() > 0L || getAct(req).equals("back")) {
|
||||
super.search(req, res);
|
||||
} else {
|
||||
req.setAttribute("CR", CR);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
FotoCR CR = new FotoCR(getApFull());
|
||||
Foto bean = (Foto)beanA;
|
||||
long l_id = 0L;
|
||||
CR = (FotoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
|
||||
if (CR != null) {
|
||||
CR.setFile(bean.getFile());
|
||||
if (getAct2(req).equals("next")) {
|
||||
l_id = bean.getNextId_foto(CR);
|
||||
} else if (getAct2(req).equals("prev")) {
|
||||
l_id = bean.getPrevId_foto(CR);
|
||||
}
|
||||
if (l_id > 0L) {
|
||||
req.setAttribute("id_foto", String.valueOf(l_id));
|
||||
bean.findByPrimaryKey(l_id);
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
}
|
||||
return super.afterSave(beanA, req, res);
|
||||
}
|
||||
}
|
||||
290
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/admin/GaraSvlt.java
Normal file
290
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/admin/GaraSvlt.java
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.common.TtFont;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.pg.Gara;
|
||||
import com.ablia.pg.GaraCR;
|
||||
import com.ablia.pg.PuntoFoto;
|
||||
import com.ablia.util.AbMessages;
|
||||
import java.io.File;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg/Gara.abl"})
|
||||
public class GaraSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = -3103317969344235586L;
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _addPuntoFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserGrant(req, new Gara().getTableBeanName()) >= 3L) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = 0L;
|
||||
Gara bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean = new Gara(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
fillObject(req, bean);
|
||||
rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
PuntoFoto beangr = new PuntoFoto(getApFull());
|
||||
fillObject(req, beangr);
|
||||
rp = bean.addPuntoFoto(beangr);
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _noIndexFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id = 0L;
|
||||
l_id = getRequestLongParameter(req, "id_puntoFotoIdx");
|
||||
PuntoFoto bean = new PuntoFoto(getApFull());
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
if (bean.getDBState() == 1) {
|
||||
ResParm rp = bean.noIndexFoto();
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Impossibile importare: codice gara =0");
|
||||
}
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
Gara bean = (Gara)beanA;
|
||||
req.setAttribute("listaPuntoFoto", bean.getPuntiFoto(0, 0));
|
||||
req.setAttribute("listaTtf", TtFont.getInstance(getApFull()).findAll());
|
||||
req.setAttribute("listaTipiPuntoFoto", new PuntoFoto(getApFull()).findTipiPuntoFoto(bean.getId_gara()));
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Gara(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new GaraCR(getApFull());
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserGrant(req, new Gara().getTableBeanName()) >= 3L) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = 0L;
|
||||
Gara bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean = new Gara(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
fillObject(req, bean);
|
||||
rp = bean.save();
|
||||
if (!rp.getStatus()) {
|
||||
req.setAttribute("bean", bean);
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("msg", "Impossibile aggiornare i record");
|
||||
showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTtf", TtFont.getInstance(getApFull()).findAll());
|
||||
Gara bean = new Gara(getApFull());
|
||||
req.setAttribute("bean", bean);
|
||||
super.prepareNewRecord(req, res);
|
||||
}
|
||||
|
||||
private void preview(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id = 0L;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
l_id = getRequestLongParameter(req, "id_puntoFotoIdx");
|
||||
PuntoFoto bean = new PuntoFoto(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
String dirFoto = String.valueOf(getParm("PATHFOTO").getTesto()) + bean.getPathRelativoFoto();
|
||||
int scaledWidth = (int)getParm("PREVIEW").getNumero();
|
||||
String rpath = bean.getPathRelativoFoto();
|
||||
if (rpath.lastIndexOf("/") > 0)
|
||||
rpath = rpath.substring(rpath.lastIndexOf("/") + 1);
|
||||
sendMessage(req, "Thread avviato!");
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] getFileNameTypesForLoadAttachServlet(HttpServletRequest req) {
|
||||
return super.getFileNameTypesForLoadAttachServlet(req);
|
||||
}
|
||||
|
||||
public void _delPuntoFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserGrant(req, new Gara().getTableBeanName()) >= 3L) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = 0L;
|
||||
Gara bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean = new Gara(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
fillObject(req, bean);
|
||||
rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
long l_id_puntoFoto = getRequestLongParameter(req, "id_puntoFoto");
|
||||
if (l_id_puntoFoto != 0L) {
|
||||
bean.delPuntoFoto(l_id_puntoFoto);
|
||||
sendMessage(req, "Cancellazione punto foto Effettuata");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _indexFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id = 0L;
|
||||
l_id = getRequestLongParameter(req, "id_puntoFotoIdx");
|
||||
PuntoFoto bean = new PuntoFoto(getApFull());
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
if (bean.getDBState() == 1) {
|
||||
ResParm rp = bean.indexFoto(getLoginUserId(req).longValue());
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Impossibile importare: codice gara =0");
|
||||
}
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _modPuntoFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserGrant(req, new Gara().getTableBeanName()) >= 3L) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = 0L;
|
||||
Gara bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean = new Gara(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
fillObject(req, bean);
|
||||
rp = bean.save();
|
||||
if (rp.getStatus()) {
|
||||
PuntoFoto beangr = new PuntoFoto(getApFull());
|
||||
long l_id_gr = getRequestLongParameter(req, "id_puntoFoto");
|
||||
beangr.findByPrimaryKey(l_id_gr);
|
||||
req.setAttribute("puntoFoto", beangr);
|
||||
sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK"));
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _creaPuntiFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getLoginUserGrant(req, new Gara().getTableBeanName()) >= 3L) {
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = 0L;
|
||||
Gara bean = null;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean = new Gara(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id);
|
||||
if (bean.getId_gara() > 0L) {
|
||||
rp = bean.startCreaPuntiFoto(bean, true, getLoginUserId(req).longValue());
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Errore! Gara non valida.");
|
||||
}
|
||||
} else {
|
||||
sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW"));
|
||||
showBean(req, res);
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _indexCsvPisa(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id = 0L;
|
||||
l_id = getRequestLongParameter(req, "id_gara");
|
||||
Gara bean = new Gara(getApFull());
|
||||
bean.findByPrimaryKey(new Long(l_id));
|
||||
String filename = bean.getImpCsvFileName();
|
||||
if (bean.getDBState() == 1) {
|
||||
ResParm rp = bean.indexFotoPisa(filename);
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Impossibile importare: codice gara =0");
|
||||
}
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void _salvaFileCsv(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Gara bean = new Gara(getApFull());
|
||||
long l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
String l_fileName = String.valueOf(getDocBase()) + "tmp/" + getRequestParameter(req, "fileNameOnServer_1");
|
||||
if (new File(l_fileName).exists()) {
|
||||
String targetFile = String.valueOf(getDocBase()) + "admin/csv/" + bean.getId_gara() + ".csv";
|
||||
try {
|
||||
DBAdapter.copyFile(l_fileName, targetFile);
|
||||
} catch (Exception e) {
|
||||
sendMessage(req, "ERRORE! File csv NON caricato");
|
||||
}
|
||||
new File(l_fileName).delete();
|
||||
sendMessage(req, "File csv caricato");
|
||||
} else {
|
||||
sendMessage(req, "Errore! File csv non trovato!");
|
||||
}
|
||||
req.setAttribute("act", "refresh");
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.common.TtFont;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.Gara;
|
||||
import com.ablia.pg.LogFoto;
|
||||
import com.ablia.pg.LogFotoCR;
|
||||
import com.ablia.pg.PuntoFoto;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg/LogFoto.abl"})
|
||||
public class LogFotoSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = -3103317969344235586L;
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
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 LogFoto(getApFull());
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new LogFotoCR(getApFull());
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("listaTtf", TtFont.getInstance(getApFull()).findAll());
|
||||
Gara bean = new Gara(getApFull());
|
||||
req.setAttribute("bean", bean);
|
||||
super.prepareNewRecord(req, res);
|
||||
}
|
||||
|
||||
private void preview(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id = 0L;
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
l_id = getRequestLongParameter(req, "id_puntoFotoIdx");
|
||||
PuntoFoto bean = new PuntoFoto(apFull);
|
||||
bean.findByPrimaryKey(l_id);
|
||||
String dirFoto = String.valueOf(getParm("PATHFOTO").getTesto()) + bean.getPathRelativoFoto();
|
||||
int scaledWidth = (int)getParm("PREVIEW").getNumero();
|
||||
String rpath = bean.getPathRelativoFoto();
|
||||
if (rpath.lastIndexOf("/") > 0)
|
||||
rpath = rpath.substring(rpath.lastIndexOf("/") + 1);
|
||||
sendMessage(req, "Thread avviato!");
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] getFileNameTypesForLoadAttachServlet(HttpServletRequest req) {
|
||||
return super.getFileNameTypesForLoadAttachServlet(req);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
LogFotoCR CR = new LogFotoCR();
|
||||
fillObject(req, CR);
|
||||
if (CR.isEmpty()) {
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
super.search(req, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.servlet.LogonSvlt;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class MenuSvlt extends LogonSvlt {
|
||||
protected long checkLoginName(HttpServletRequest req, HttpServletResponse res) {
|
||||
return super.checkLoginName(req, res);
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
String msg = "";
|
||||
Users bean = (Users)getLoginUser(req);
|
||||
if (bean == null) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return false;
|
||||
}
|
||||
if (bean.getFlgValido().equals("N")) {
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
sendMessage(req,
|
||||
"Utente non valido. Contattare l'amministratore del sito.");
|
||||
return false;
|
||||
}
|
||||
if (bean.getId_userProfile() != 1L) {
|
||||
sendMessage(req, "Utente non valido. Permessi mancanti.");
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
req.getSession().removeAttribute("loginUser_id");
|
||||
req.getSession().removeAttribute("utenteLogon");
|
||||
return false;
|
||||
}
|
||||
forceJspPage(getLoginPage(null, null), req);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return getJspPage(req).isEmpty() ? "/admin/menu/menu.jsp" :
|
||||
getJspPage(req);
|
||||
}
|
||||
|
||||
protected com.ablia.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.anag.Listino;
|
||||
import com.ablia.art.Reparto;
|
||||
import com.ablia.art.TipoTaglia;
|
||||
import com.ablia.art.TipologiaArticolo;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.pg.TipoGara;
|
||||
import com.ablia.pg.TipoGaraCR;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg/TipoGara.abl"})
|
||||
public class TipoGaraSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
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) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
TipoGara tipoPadre = null;
|
||||
long l_id_lista = getRequestLongParameter(req, "id_tipoGaraPadre");
|
||||
tipoPadre = new TipoGara(apFull);
|
||||
tipoPadre.findByPrimaryKey(l_id_lista);
|
||||
req.setAttribute("tipoGaraPadre", tipoPadre);
|
||||
req.setAttribute("list", tipoPadre.findFigli(0, 0));
|
||||
req.setAttribute("listaReparti", new Reparto(apFull).findAll());
|
||||
req.setAttribute("listaPadri", tipoPadre.findPadri());
|
||||
req.setAttribute("listaListini", new Listino(apFull).findAll());
|
||||
req.setAttribute("listaTipiTaglie", new TipoTaglia(apFull).findAll());
|
||||
req.setAttribute("listaTipologieArticoli", new TipologiaArticolo(apFull).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new TipoGara(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new TipoGaraCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getCmd(req).equals("ordinaAlfabetico")) {
|
||||
TipoGara bean = new TipoGara(getApFull(req));
|
||||
bean.ordinaAlfabeticoFigli(bean);
|
||||
search(req, res);
|
||||
} else {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void _ordinaAlfabetico(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
TipoGara bean = new TipoGara(getApFull(req));
|
||||
bean.ordinaAlfabeticoFigli(bean);
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _indici(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
TipoGara bean = new TipoGara(getApFull(req));
|
||||
bean.risalvaTutto();
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
117
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/admin/UsersSvlt.java
Normal file
117
rus/WEB-INF/lib/pg_src/com/ablia/pg/servlet/admin/UsersSvlt.java
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.common.UserAccess;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.newsletter.CodaMessaggi;
|
||||
import com.ablia.newsletter.TemplateMsg;
|
||||
import com.ablia.pg.Users;
|
||||
import com.ablia.pg.UsersCR;
|
||||
import com.ablia.util.AbMessages;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/config/Users.abl"})
|
||||
public class UsersSvlt extends com.ablia.anag.servlet.UsersSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
super.fillComboAfterDetail(bean, req, res);
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
super.fillComboAfterSearch(CR, req, res);
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Users(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
UsersCR CR = new UsersCR();
|
||||
CR.setPolicy(getLoginUser(req).getUserProfile().getPolicy());
|
||||
return (CRAdapter)CR;
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.prepareNewRecord(req, res);
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = 0L;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
l_id = getRequestLongParameter(req, "id_users");
|
||||
Users bean = new Users(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
long l_id_incasso = 0L;
|
||||
if (getAct(req).equals("addAccess")) {
|
||||
UserAccess up = new UserAccess(getApFull(req));
|
||||
fillObject(req, up);
|
||||
rp = bean.addAccess(up);
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
} else if (getAct(req).equals("delAccess")) {
|
||||
UserAccess up = new UserAccess(getApFull(req));
|
||||
fillObject(req, up);
|
||||
rp = bean.delAccess(up);
|
||||
sendMessage(req, String.valueOf(AbMessages.getMessage(getLocale(req), "SAVE_OK")) + ": Permesso Cancellato");
|
||||
showBean(req, res);
|
||||
} else if (getAct(req).equals("delLog")) {
|
||||
rp = bean.azzeraFotoPrelevate();
|
||||
sendMessage(req, String.valueOf(AbMessages.getMessage(getLocale(req), "DELETE_OK")) + ": LogFoto Cancellati");
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _rinnovaAnnoCR(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users bean = new Users(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_users");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
ResParm rp = bean.rinnovaAnno();
|
||||
rp.append(bean.sendRinnovoMailMessage());
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _rinnovaAnno(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users bean = new Users(apFull);
|
||||
long l_id = getRequestLongParameter(req, "id_users");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
ResParm rp = bean.rinnovaAnno();
|
||||
rp.append(bean.sendRinnovoMailMessage());
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _creaCodaMsg(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Users bean = new Users(apFull);
|
||||
UsersCR CR = new UsersCR(apFull);
|
||||
fillObject(req, CR);
|
||||
CR.setFlgMl(1L);
|
||||
CR.setFlgScaduto(0L);
|
||||
Vectumerator<Users> vec = bean.findByCR(CR, 0, 0);
|
||||
long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg");
|
||||
TemplateMsg ts = new TemplateMsg(apFull);
|
||||
ts.findByPrimaryKey(l_id_templateMsg);
|
||||
CodaMessaggi cm = new CodaMessaggi(apFull);
|
||||
int num = 0;
|
||||
while (vec.hasMoreElements()) {
|
||||
Users row = (Users)vec.nextElement();
|
||||
ResParm rp = cm.addCodaMessaggioByTemplate(row.getEMail(), ts);
|
||||
if (rp.getStatus())
|
||||
num++;
|
||||
}
|
||||
sendMessage(req, "Creata coda messaggi con " + num + " indirizzi email.");
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.ablia.pg.servlet.admin;
|
||||
|
||||
import com.ablia.common.Users;
|
||||
import com.ablia.pg.Gara;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public abstract class _PgAdminSvlt extends AblServletSvlt {
|
||||
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) {
|
||||
try {
|
||||
return getLoginUser(req).getGrantType(l_permesso);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getAct3(HttpServletRequest req) {
|
||||
return getRequestParameter(req, "act3");
|
||||
}
|
||||
|
||||
protected String getCmd3(HttpServletRequest req) {
|
||||
return getRequestParameter(req, "cmd3");
|
||||
}
|
||||
|
||||
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
|
||||
return "/admin/menu/menu.jsp";
|
||||
}
|
||||
|
||||
protected Users getUser() {
|
||||
return new com.ablia.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void _aggiornaThreadMsg(HttpServletRequest req, HttpServletResponse res) {
|
||||
sendHtmlMsgResponse(req, res, Gara.threadCreaPuntiFotoMsg.trim());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ablia.pg.taglib;
|
||||
|
||||
import com.ablia.pg.FotoCR;
|
||||
import com.ablia.pg.Gara;
|
||||
import com.ablia.taglib.AbstractFillListTag;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.JspException;
|
||||
|
||||
public class CaricaGaraTag extends AbstractFillListTag {
|
||||
private long id_tipoGara;
|
||||
|
||||
public int doStartTag() throws JspException {
|
||||
try {
|
||||
HttpServletRequest req = (HttpServletRequest)this.pageContext.getRequest();
|
||||
Gara bean = new Gara(getApFull());
|
||||
FotoCR CR = new FotoCR(getApFull());
|
||||
CR.setId_tipoGara(getId_tipoGara());
|
||||
Vectumerator vec = bean.findWebByCR(CR, 1, 4);
|
||||
req.setAttribute(getNomelista(), vec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new JspException("Errore per lista " + getNomelista() + ": " + e.getMessage());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getId_tipoGara() {
|
||||
return this.id_tipoGara;
|
||||
}
|
||||
|
||||
public void setId_tipoGara(long id_tipoPadre) {
|
||||
this.id_tipoGara = id_tipoPadre;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ablia.pg.taglib;
|
||||
|
||||
import com.ablia.pg.TipoGara;
|
||||
import com.ablia.taglib.AbstractFillListTag;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.JspException;
|
||||
|
||||
public class CaricaTipoGaraTag extends AbstractFillListTag {
|
||||
private long id_tipoGaraPadre;
|
||||
|
||||
public int doStartTag() throws JspException {
|
||||
try {
|
||||
HttpServletRequest req = (HttpServletRequest)this.pageContext.getRequest();
|
||||
TipoGara bean = new TipoGara(getApFull());
|
||||
bean.setId_tipoGara(getId_tipoGaraPadre());
|
||||
req.setAttribute(getNomelista(), bean.findFigli(0, 0, true));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new JspException("Errore per lista " + getNomelista() + ": " + e.getMessage());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public long getId_tipoGaraPadre() {
|
||||
return this.id_tipoGaraPadre;
|
||||
}
|
||||
|
||||
public void setId_tipoGaraPadre(long id_tipoPadre) {
|
||||
this.id_tipoGaraPadre = id_tipoPadre;
|
||||
}
|
||||
}
|
||||
122
rus/WEB-INF/lib/pg_src/com/ablia/pg/taglib/WhileTipoGaraTag.java
Normal file
122
rus/WEB-INF/lib/pg_src/com/ablia/pg/taglib/WhileTipoGaraTag.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package com.ablia.pg.taglib;
|
||||
|
||||
import com.ablia.pg.TipoGara;
|
||||
import com.ablia.pg.TipoGaraCR;
|
||||
import com.ablia.taglib.AbstractDbTag;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import javax.servlet.jsp.JspException;
|
||||
|
||||
public class WhileTipoGaraTag extends AbstractDbTag {
|
||||
private String rowbeanname;
|
||||
|
||||
private Vectumerator<TipoGara> theList;
|
||||
|
||||
private String lang;
|
||||
|
||||
private long id_tipoPadre;
|
||||
|
||||
private long id_tipoPadreSelected;
|
||||
|
||||
private long flgWww;
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
boolean flgOk = false;
|
||||
TipoGara obj = null;
|
||||
while (this.theList.hasMoreElements()) {
|
||||
obj = (TipoGara)this.theList.nextElement();
|
||||
if (!obj.getDescrizione().equals("")) {
|
||||
flgOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flgOk) {
|
||||
this.pageContext.setAttribute(getRowbeanname(), obj);
|
||||
return 2;
|
||||
}
|
||||
this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter());
|
||||
return 0;
|
||||
} catch (IOException ioexception) {
|
||||
throw new JspException(ioexception.getMessage());
|
||||
} catch (Exception exception) {
|
||||
throw new JspException(exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void doInitBody() {}
|
||||
|
||||
public int doStartTag() {
|
||||
try {
|
||||
if (getId_tipoPadre() != 0L && getId_tipoPadre() != getId_tipoPadreSelected())
|
||||
return 0;
|
||||
TipoGara bean = new TipoGara(getApFull());
|
||||
if (getId_tipoPadre() != 0L)
|
||||
bean.findByPrimaryKey(getId_tipoPadre());
|
||||
TipoGaraCR CR = new TipoGaraCR();
|
||||
CR.setFlgNascondi(0L);
|
||||
this.theList = bean.findFigli(CR, 0, 0, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.theList = new Vectumerator();
|
||||
}
|
||||
if (this.theList == null)
|
||||
return 0;
|
||||
this.pageContext.getRequest().setAttribute("listaTipi", this.theList);
|
||||
this.theList.moveFirst();
|
||||
boolean flgOk = false;
|
||||
TipoGara obj = null;
|
||||
while (this.theList.hasMoreElements()) {
|
||||
if (!(obj = (TipoGara)this.theList.nextElement()).getDescrizione().equals("")) {
|
||||
flgOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flgOk) {
|
||||
this.pageContext.setAttribute(getRowbeanname(), obj);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getRowbeanname() {
|
||||
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
|
||||
}
|
||||
|
||||
public void setRowbeanname(String s) {
|
||||
this.rowbeanname = s;
|
||||
}
|
||||
|
||||
public long getId_tipoPadreSelected() {
|
||||
return this.id_tipoPadreSelected;
|
||||
}
|
||||
|
||||
public void setId_tipoPadreSelected(long id_tipoPadreSelected) {
|
||||
this.id_tipoPadreSelected = id_tipoPadreSelected;
|
||||
}
|
||||
|
||||
public String getLang() {
|
||||
return (this.lang == null) ? "" : this.lang;
|
||||
}
|
||||
|
||||
public void setLang(String lang) {
|
||||
this.lang = lang;
|
||||
}
|
||||
|
||||
public long getId_tipoPadre() {
|
||||
return this.id_tipoPadre;
|
||||
}
|
||||
|
||||
public void setId_tipoPadre(long id_tipoPadre) {
|
||||
this.id_tipoPadre = id_tipoPadre;
|
||||
}
|
||||
|
||||
public long getFlgWww() {
|
||||
return this.flgWww;
|
||||
}
|
||||
|
||||
public void setFlgWww(long flgWww) {
|
||||
this.flgWww = flgWww;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ablia.pg.taglib;
|
||||
|
||||
import javax.servlet.jsp.tagext.TagData;
|
||||
import javax.servlet.jsp.tagext.TagExtraInfo;
|
||||
import javax.servlet.jsp.tagext.VariableInfo;
|
||||
|
||||
public class WhileTipoGaraTagExtraInfo extends TagExtraInfo {
|
||||
public VariableInfo[] getVariableInfo(TagData tagdata) {
|
||||
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ?
|
||||
tagdata.getAttributeString("rowbeanname") :
|
||||
"rowBean";
|
||||
String rowBeanClass = "com.ablia.pg.TipoGara";
|
||||
return
|
||||
new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) };
|
||||
}
|
||||
}
|
||||
31
rus/WEB-INF/lib/pg_src/com/ablia/pg/versionLog.txt
Normal file
31
rus/WEB-INF/lib/pg_src/com/ablia/pg/versionLog.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
PG_1_01_0_051112
|
||||
05-11-2012 allineamento ablia.jar + mail scadenza foto
|
||||
|
||||
|
||||
19-11-2011 corretto log utenti
|
||||
|
||||
13-12-2011 aggiunto mypics2 (!)
|
||||
|
||||
10-09-2009 aggiornato a nuova versione ablia.jar impression foto
|
||||
|
||||
13-02-2009 modificato gestione prelievo foto invio mail anche se
|
||||
passa la scadenza
|
||||
|
||||
08-09-2008 verifica control code (abl_9_15)
|
||||
|
||||
16-06-2008 aggiornamento permessi: Richiede Abl.9.00.160609
|
||||
|
||||
31-01-08 gestione invio email al raggiungimento fine foto
|
||||
|
||||
09-11-07 controlCode aggiornamento alla lib ablia.jar
|
||||
|
||||
17-10-07 gestione controlCode
|
||||
|
||||
11-07-07 alllinetato con abla.jar 6
|
||||
|
||||
02-06-07 ricorretto definitivamente errore n_foto_max... devo passare
|
||||
sempre stringe negli attributi....
|
||||
|
||||
19-05-07 corretto errore foto massimo
|
||||
|
||||
14-05-07 inizio. copiato da ecom
|
||||
Loading…
Add table
Add a link
Reference in a new issue