www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
6
decompiled-libs/www/cli-rus-2.1.9/META-INF/MANIFEST.MF
Normal file
6
decompiled-libs/www/cli-rus-2.1.9/META-INF/MANIFEST.MF
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Manifest-Version: 1.0
|
||||
Archiver-Version: Plexus Archiver
|
||||
Created-By: Apache Maven 3.8.7
|
||||
Built-By: jenkins
|
||||
Build-Jdk: 17.0.17
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Wed Sep 03 15:33:23 CEST 2025
|
||||
artifactId=cli-rus
|
||||
groupId=com.ablia
|
||||
version=2.1.9
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ablia</groupId>
|
||||
<artifactId>cli-rus</artifactId>
|
||||
<version>2.1.9</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-toolchains-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>toolchain</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<toolchains>
|
||||
<jdk>
|
||||
<version>11</version>
|
||||
</jdk>
|
||||
</toolchains>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>github-repo</id>
|
||||
<name>GitHub acolzi Apache Maven Packages</name>
|
||||
<url>https://maven.pkg.github.com/acolzi/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>jakarta.ws.rs</groupId>
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.acxent</groupId>
|
||||
<artifactId>acxent-face</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
70
decompiled-libs/www/cli-rus-2.1.9/TestMailUsers.java
Normal file
70
decompiled-libs/www/cli-rus-2.1.9/TestMailUsers.java
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.util.DbConsole;
|
||||
import java.sql.Time;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
public class TestMailUsers extends DbConsole {
|
||||
public static void main(String[] args) {
|
||||
TestMailUsers bean = new TestMailUsers();
|
||||
bean.doImport();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void doImport() {
|
||||
String db = "pg";
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
String hostname = "localhost:3308";
|
||||
String temp = getCi().readLine("Hostname (" + hostname + "):");
|
||||
if (!temp.isEmpty())
|
||||
hostname = temp;
|
||||
temp = getCi().readLine("Database name (" + db + "):");
|
||||
if (!temp.isEmpty())
|
||||
db = temp;
|
||||
System.out.println("Db: " + db);
|
||||
ApplParmFull apTarget = new ApplParmFull(new ApplParm(17, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300));
|
||||
apTarget.setDebug(false);
|
||||
StringBuffer msg = new StringBuffer();
|
||||
try {
|
||||
Users user = new Users(apTarget);
|
||||
user.findByPrimaryKey(18773L);
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
DBAdapter.sleepInSecond(11);
|
||||
user.sendCouponOmaggioMailMessage();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected Time getTimeFromString(String theTime) {
|
||||
try {
|
||||
if (theTime.matches("[0-9][0-9][0-9][0-9]"))
|
||||
theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2);
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) {
|
||||
StringTokenizer st = new StringTokenizer(theTime, ":");
|
||||
int hour = Integer.parseInt(st.nextToken());
|
||||
int min = Integer.parseInt(st.nextToken());
|
||||
int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0;
|
||||
return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000));
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
package com.ablia.pg;
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
RUS.2.1.1.180723
|
||||
18-07-2023 controllo human
|
||||
16-04-2023 allineamento abliajar 326 + mysql8
|
||||
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
|
||||
430
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Coupon.java
Normal file
430
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Coupon.java
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
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 it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.FileWr;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.awt.Color;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String 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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
findFirstRecord(stmt);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return getSerie() + " " + getSerie();
|
||||
}
|
||||
|
||||
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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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(Calendar.getInstance().getTimeInMillis()) + String.valueOf(Calendar.getInstance().getTimeInMillis());
|
||||
System.out.println(codice);
|
||||
codice = codice.substring(0, 4) + "-" + codice.substring(0, 4) + "-" + codice.substring(4, 8) + "-" + codice.substring(8, 12) + "-" + codice.substring(12, 16);
|
||||
System.out.println("" + i + " " + i);
|
||||
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 = 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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
Vectumerator vec = findRows(stmt, 1, 1);
|
||||
if (vec.hasMoreElements())
|
||||
return true;
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void creaFileCvs(CouponCR CR) {
|
||||
try {
|
||||
DBAdapter.printDebug("--------------------------------- creaFileCsv: " + CR.getDescrizioneCR());
|
||||
Vectumerator<Coupon> list = findByCR(CR, 0, 0);
|
||||
CR.setFileName(getPathTmp() + "reportCoupon_" + getPathTmp() + "_" + getLastUpdTmstForFiles() + "_" + CR.getId_users() + ".csv");
|
||||
String theCvsFile = getDocBase() + getDocBase();
|
||||
String SEP = ";";
|
||||
new File(theCvsFile).delete();
|
||||
FileWr outCvsFile = new FileWr(theCvsFile, false);
|
||||
String s1 = "Criteri di ricerca: " + CR.getDescrizioneCR() + "\nCoupon";
|
||||
outCvsFile.writeLine(s1);
|
||||
while (list.hasMoreElements()) {
|
||||
Coupon row = (Coupon)list.nextElement();
|
||||
s1 = row.getCodice();
|
||||
outCvsFile.writeLine(s1);
|
||||
}
|
||||
outCvsFile.closeFile();
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/CouponCR.java
Normal file
122
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/CouponCR.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.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) ? AB_EMPTY_STRING : 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ResParm;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public class CreaFotoPgCallable implements Callable<ResParm> {
|
||||
private Gara gara;
|
||||
|
||||
private String fileSorgente;
|
||||
|
||||
private String dirRidotte;
|
||||
|
||||
private boolean creaNuovamente;
|
||||
|
||||
private Foto foto;
|
||||
|
||||
public CreaFotoPgCallable(Gara gara, String fileSorgente, String dirRidotte, boolean creaNuovamente) {
|
||||
this.gara = gara;
|
||||
this.fileSorgente = fileSorgente;
|
||||
this.dirRidotte = dirRidotte;
|
||||
this.creaNuovamente = creaNuovamente;
|
||||
}
|
||||
|
||||
public ResParm call() throws Exception {
|
||||
ResParm rp = Foto.creaRiduzioniPerWeb(this.gara, this.fileSorgente, this.dirRidotte, this.creaNuovamente);
|
||||
rp.setReturnObj(getFoto());
|
||||
return rp;
|
||||
}
|
||||
|
||||
public Foto getFoto() {
|
||||
return this.foto;
|
||||
}
|
||||
|
||||
public void setFoto(Foto foto) {
|
||||
this.foto = foto;
|
||||
}
|
||||
}
|
||||
1534
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Foto.java
Normal file
1534
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Foto.java
Normal file
File diff suppressed because it is too large
Load diff
435
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/FotoCR.java
Normal file
435
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/FotoCR.java
Normal file
|
|
@ -0,0 +1,435 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class FotoCR extends CRAdapter {
|
||||
private static final long serialVersionUID = -8282013621414045440L;
|
||||
|
||||
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;
|
||||
|
||||
private long id_fotoS;
|
||||
|
||||
private long flgConPettorali = -1L;
|
||||
|
||||
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) ? AB_EMPTY_STRING : 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) ? AB_EMPTY_STRING : this.localita.trim();
|
||||
}
|
||||
|
||||
public void setLocalita(String localita) {
|
||||
this.localita = localita;
|
||||
}
|
||||
|
||||
public String getLocalitaFE() {
|
||||
return (this.localitaFE == null) ? AB_EMPTY_STRING : this.localitaFE.trim();
|
||||
}
|
||||
|
||||
public void setLocalitaFE(String localitaFE) {
|
||||
this.localitaFE = localitaFE;
|
||||
}
|
||||
|
||||
public String getLocalitaFS() {
|
||||
return (this.localitaFS == null) ? AB_EMPTY_STRING : 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) ? AB_EMPTY_STRING : this.flgVisCompattaS;
|
||||
}
|
||||
|
||||
public void setFlgVisCompattaS(String flgVisCompattaS) {
|
||||
this.flgVisCompattaS = flgVisCompattaS;
|
||||
}
|
||||
|
||||
public String getPettorale() {
|
||||
return (this.pettorale == null) ? AB_EMPTY_STRING : 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;
|
||||
}
|
||||
|
||||
public long getId_fotoS() {
|
||||
return this.id_fotoS;
|
||||
}
|
||||
|
||||
public void setId_fotoS(long id_fotoS) {
|
||||
this.id_fotoS = id_fotoS;
|
||||
}
|
||||
|
||||
public long getFlgConPettorali() {
|
||||
return this.flgConPettorali;
|
||||
}
|
||||
|
||||
public void setFlgConPettorali(long flgConPettorali) {
|
||||
this.flgConPettorali = flgConPettorali;
|
||||
}
|
||||
}
|
||||
996
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Gara.java
Normal file
996
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Gara.java
Normal file
|
|
@ -0,0 +1,996 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.common.CrontabInterface;
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.AddImgInterface;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.FileWr;
|
||||
import it.acxent.util.SimpleDateFormat;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import it.acxent.util.Timer;
|
||||
import it.acxent.util.UploadFile;
|
||||
import it.acxent.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;
|
||||
|
||||
private String testoColore;
|
||||
|
||||
private long testoSize;
|
||||
|
||||
private String testoO;
|
||||
|
||||
private String testoV;
|
||||
|
||||
private String testoFont;
|
||||
|
||||
private long codGara;
|
||||
|
||||
public static final long TIPO_INDEX_MANOLA = 1L;
|
||||
|
||||
public static final long TIPO_INDEX_NO = 0L;
|
||||
|
||||
private long flgTipoIndex;
|
||||
|
||||
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 = this.gara.getPathBaseFoto() + this.gara.getPathBaseFoto();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadInvioEOcr extends Thread {
|
||||
private boolean conOcr = false;
|
||||
|
||||
private Gara gara;
|
||||
|
||||
public ThreadInvioEOcr(Gara gara, boolean conOcr) {
|
||||
if (!Gara.isThreadInvioEOCrAttivo()) {
|
||||
Gara.threadInvioEOcr = true;
|
||||
this.gara = gara;
|
||||
this.conOcr = conOcr;
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
boolean debug = false;
|
||||
String TAG_THREAD_MSG = "INVIO FOTO GARA";
|
||||
if (this.conOcr)
|
||||
TAG_THREAD_MSG = "INVIO FOTO GARA + OCR";
|
||||
ResParm rp = new ResParm(true);
|
||||
Timer timer = new Timer();
|
||||
timer.start();
|
||||
ApplParmFull ap = this.gara.getApFull();
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Avvio thread creazione gara e invio foto.");
|
||||
if (!Gara.threadInvioGaraWww) {
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### AVVIO THREAD exportGaraDa3PianoAWWW ######" + TAG_THREAD_MSG);
|
||||
Gara.threadInvioGaraWww = true;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
Gara.this.exportGaraDa3PianoAWWW(false);
|
||||
Gara.threadInvioGaraWww = false;
|
||||
}
|
||||
}.start();
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Thread export gara su WWW avviato!");
|
||||
} else {
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "ATTENZIONE! Thread export gara su WWW gia' in esecuzione!");
|
||||
sleep(10000L);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Vectumerator<PuntoFoto> vec = this.gara.getPuntiFoto(0, 0);
|
||||
while (vec.hasMoreElements()) {
|
||||
PuntoFoto pf = (PuntoFoto)vec.nextElement();
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### AVVIO THREAD startOcrThread PUNTO FOTO " + TAG_THREAD_MSG + " ######" + pf.getDescrizionePuntoFoto());
|
||||
rp = pf.startOcrThread();
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Avvio thread ocr puntofoto " +
|
||||
pf.getDescrizionePuntoFoto() + " " + rp.getStatus());
|
||||
while (PuntoFoto.isThreadOcrAttivo(pf.getId_puntoFoto())) {
|
||||
try {
|
||||
sleep(10000L);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### FINE CICLO THREAD startOcrThread PUNTO FOTO ######" + TAG_THREAD_MSG);
|
||||
int attesa = 0;
|
||||
while (Gara.threadInvioGaraWww || Foto.threadInvioFotoWww) {
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Attesa conclusione primo invio gara " + attesa + " sec");
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### Attesa conclusione THREAD threadInvioGaraWww e threadInvioFotoWww INIZIALE ######" + TAG_THREAD_MSG);
|
||||
sleep(10000L);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
attesa += 10;
|
||||
}
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### FINE THREAD threadInvioGaraWww INIZIALE ######" + TAG_THREAD_MSG);
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Avvio nuovo thread invio foto con le indicizzazioni");
|
||||
if (!Gara.threadInvioGaraWww) {
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### NUOVO AVVIO THREAD exportGaraDa3PianoAWWW ######" + TAG_THREAD_MSG);
|
||||
Gara.threadInvioGaraWww = true;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
Gara.this.exportGaraDa3PianoAWWW(false);
|
||||
Gara.threadInvioGaraWww = false;
|
||||
}
|
||||
}.start();
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "Secondo Thread export gara su WWW avviato!");
|
||||
} else {
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "ATTENZIONE! Thread export gara su WWW gia' in esecuzione!");
|
||||
sleep(10000L);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (debug)
|
||||
System.out.println(TAG_THREAD_MSG + " ####### FINE DI TUTTO PROBABILE THREAD exportGaraDa3PianoAWWW IN ESECUZIONE !!!! ######" + TAG_THREAD_MSG);
|
||||
timer.stop();
|
||||
StatusMsg.updateMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG, "FINE: DURATA: " + timer.getDurata());
|
||||
try {
|
||||
sleep(15000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(Gara.this.getApFull(), TAG_THREAD_MSG);
|
||||
Gara.threadInvioEOcr = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean threadInvioGaraWww = false;
|
||||
|
||||
public static boolean threadCreaPuntiFoto = false;
|
||||
|
||||
public static boolean threadInvioEOcr = 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;
|
||||
|
||||
private long flgFree;
|
||||
|
||||
private String fileNameExport;
|
||||
|
||||
private boolean fileExportOk;
|
||||
|
||||
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 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(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString());
|
||||
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 getDataFormat().format(getDataGaraInizio()) + " - " + getDataFormat().format(getDataGaraInizio()) + " - " + getDataFormat().format(getDataGaraFine());
|
||||
}
|
||||
|
||||
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 A.* from GARA AS A";
|
||||
String s_Sql_Order = " order by A.flgEventoInLinea, A.dataGaraInizio desc, A.descrizione";
|
||||
WcString wc = new WcString();
|
||||
if (CR.getId_tipoGara() > 0L)
|
||||
s_Sql_Find = 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 static final String getFree(long l_flgFree) {
|
||||
switch ((int)l_flgFree) {
|
||||
case 0:
|
||||
return "No";
|
||||
case 1:
|
||||
return "SI";
|
||||
}
|
||||
return "--";
|
||||
}
|
||||
|
||||
public String getEventoInLinea() {
|
||||
return getEventoInLinea(getFlgEventoInLinea());
|
||||
}
|
||||
|
||||
public ResParm save() {
|
||||
if (!getPathBase().isEmpty() && !getPathBase().endsWith("/"))
|
||||
setPathBase(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("" + year + "/" + year + "/");
|
||||
rp.append(super.save());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public final ResParm startCreaPuntiFoto(Gara l_gara, boolean l_indicizza, long l_id_users) {
|
||||
if (!isThreadAttivo()) {
|
||||
new ThreadCreaPuntiFoto(l_gara, l_indicizza, l_id_users);
|
||||
return new ResParm(true, "Thread Creazione Punti foto avviato");
|
||||
}
|
||||
return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!");
|
||||
}
|
||||
|
||||
public final ResParm startInvioEOcr(Gara l_gara, boolean l_conOcr) {
|
||||
if (!isThreadInvioEOCrAttivo()) {
|
||||
if (threadInvioGaraWww || Foto.threadInvioFotoWww || PuntoFoto.isThreadOcrAttivo())
|
||||
return new ResParm(false, "ATTENZIONE!! Thread Invio gara/foto o OCR in esecuzione separatamente!!!");
|
||||
new ThreadInvioEOcr(l_gara, l_conOcr);
|
||||
return new ResParm(true, "Thread Invio e OCR avviato");
|
||||
}
|
||||
return new ResParm(false, "ATTENZIONE!! Thread Invio e OCR in esecuzione!!!");
|
||||
}
|
||||
|
||||
public static boolean isThreadAttivo() {
|
||||
return threadCreaPuntiFoto;
|
||||
}
|
||||
|
||||
public static boolean isThreadInvioEOCrAttivo() {
|
||||
return threadInvioEOcr;
|
||||
}
|
||||
|
||||
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, totGareNonTrovate = 0L;
|
||||
Vectumerator<Gara> vec = findRows(stmt);
|
||||
while (vec.hasMoreElements()) {
|
||||
Gara row = (Gara)vec.nextElement();
|
||||
bean.findByPrimaryKey(row.getId_gara());
|
||||
if (bean.getId_gara() > 0L) {
|
||||
bean.setNDownload(row.getNDownload());
|
||||
bean.setDataDownload(getToday());
|
||||
bean.save();
|
||||
totDownload += row.getNDownload();
|
||||
continue;
|
||||
}
|
||||
totGareNonTrovate++;
|
||||
}
|
||||
rp.setMsg("Aggiornati " + vec.getTotNumberOfRecords() + " records. Tot. download: " + totDownload + " gare non trovate nei log: " + totGareNonTrovate);
|
||||
} 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 getDocBase() + "csv/" + getDocBase() + ".csv";
|
||||
}
|
||||
|
||||
public ResParm indexFotoPisa(String l_fileName, String TAG_THREAD_MSG) {
|
||||
boolean debug = false;
|
||||
ResParm rp = new ResParm();
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
int i = 0;
|
||||
int nrighe = 0;
|
||||
int fotoTrovate = 0;
|
||||
int fotoNonTrovate = 0;
|
||||
if (debug)
|
||||
System.out.println("indexFotoPisa: start: filename; " + l_fileName);
|
||||
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 = reader.readLine();
|
||||
while ((currentLine = reader.readLine()) != null) {
|
||||
nrighe++;
|
||||
if (debug)
|
||||
System.out.println("indexFotoPisa: currentline: " + currentLine);
|
||||
int firstComma = currentLine.indexOf(",");
|
||||
String nomeFoto = currentLine.substring(0, firstComma);
|
||||
String pettorali = currentLine.substring(firstComma + 1);
|
||||
if (debug)
|
||||
System.out.println("indexFotoPisa: pettorali " + nomeFoto + " - " + pettorali);
|
||||
foto.findByFilenameGara(nomeFoto, getId_gara());
|
||||
if (foto.getDBState() == 1) {
|
||||
fotoTrovate++;
|
||||
pettorali = pettorali.replace("\"", "");
|
||||
if (debug)
|
||||
System.out.println("indexFotoPisa: pettorali con replace" + nomeFoto + " - " + pettorali);
|
||||
Foto.syncAggiornaPettoraleInviato(foto, 0L, 0L, pettorali, 2L);
|
||||
} else {
|
||||
fotoNonTrovate++;
|
||||
}
|
||||
StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "Index csv: n. riga:" + nrighe + " foto trovate:" + fotoTrovate + " NON trovate:" + fotoNonTrovate);
|
||||
i++;
|
||||
if (se1 <= 0 || i % se1 == 0);
|
||||
if (se2 <= 0 || i % se2 == 0);
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "Index csv: Numero righe importate: " + nrighe + " Foto Trovate: " + fotoTrovate + " foto Non trovate: " + fotoNonTrovate);
|
||||
StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG);
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getPathImg() {
|
||||
return "_img/_gara/";
|
||||
}
|
||||
|
||||
public ResParm exportGaraDa3PianoAWWW(boolean soloFoto) {
|
||||
ResParm rp = new ResParm(true);
|
||||
String TAG_THREAD_MSG = "Export gara su www";
|
||||
if (getId_gara() != 0L) {
|
||||
try {
|
||||
System.out.println("Export gara su www 2");
|
||||
ApplParmFull apRemoto = getApRemoto();
|
||||
Gara garaWww = new Gara(apRemoto);
|
||||
garaWww.findByPrimaryKey(getCodGara());
|
||||
System.out.println("Export gara su www 3");
|
||||
String urlServletRicevente = getApFull().getParm("RECEIVE_FILE_SERVLET").getTesto();
|
||||
if (garaWww.getId_gara() == 0L) {
|
||||
System.out.println("Export gara su www 4");
|
||||
StatusMsg.updateMsgByTag(getApFull(), "Export gara su www", "...creo la gara su www piano");
|
||||
garaWww = (Gara)clone();
|
||||
garaWww.setDBState(0);
|
||||
garaWww.setId_gara(0L);
|
||||
garaWww.setApFull(apRemoto);
|
||||
rp = garaWww.save();
|
||||
System.out.println("Export gara su www 5");
|
||||
if (rp.getStatus()) {
|
||||
System.out.println("Export gara su www 6");
|
||||
setCodGara(garaWww.getId_gara());
|
||||
rp = save();
|
||||
System.out.println("Export gara su www 7 " + rp.getMsg());
|
||||
System.out.println("Export gara su www 8");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Export gara su www pre9 gara esistente");
|
||||
}
|
||||
System.out.println("Export gara su www 9");
|
||||
if (rp.getStatus()) {
|
||||
System.out.println("Export gara su www 10");
|
||||
StatusMsg.updateMsgByTag(getApFull(), "Export gara su www", "....trasferisco immagine gara");
|
||||
if (!garaWww.getImgTmst().equals(getImgTmst())) {
|
||||
garaWww.setImgTmst(getImgTmst());
|
||||
garaWww.save();
|
||||
}
|
||||
System.out.println("Export gara su www 11");
|
||||
UploadFile uf = new UploadFile();
|
||||
String percorsoLocale = getDocBase() + "img/gare/";
|
||||
File logoGara = new File(getImgLogoGaraFileName());
|
||||
String percorsoRemoto = garaWww.getDocBase() + garaWww.getDocBase();
|
||||
String fileRemoto = garaWww.getImgFileName(1);
|
||||
System.out.println("Export gara su www 12");
|
||||
if (logoGara.exists()) {
|
||||
System.out.println("Export gara su www 13");
|
||||
System.out.println("trasferisco tramite " + urlServletRicevente + " il logo gara " + getImgLogoGaraFileName() + " su " + percorsoRemoto + " " + fileRemoto);
|
||||
rp = uf.transferFile(urlServletRicevente, logoGara, percorsoRemoto, fileRemoto, false);
|
||||
if (!rp.getStatus()) {
|
||||
StatusMsg.updateMsgByTag(getApFull(), "Export gara su www", "Attenzione!! trasferimento logo fallito! ");
|
||||
System.out.println("Export gara su wwwAttenzione!! trasferimento logo fallito! " + rp.getMsg());
|
||||
rp.setStatus(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rp.getStatus());
|
||||
if (rp.getStatus()) {
|
||||
System.out.println("Export gara su www 14 trasf punti foto");
|
||||
Vectumerator<PuntoFoto> vecPf = getPuntiFoto(0, 0);
|
||||
while (vecPf.hasMoreElements()) {
|
||||
PuntoFoto row = (PuntoFoto)vecPf.nextElement();
|
||||
if (row.getId_puntoFotoExport() > 0L)
|
||||
continue;
|
||||
StatusMsg.updateMsgByTag(getApFull(), "Export gara su www", "... trasferisco punto foto " +
|
||||
row.getGara().getDescrizione() + " " + row.getDescrizione() + " ....");
|
||||
PuntoFoto puntoFotoR = (PuntoFoto)row.clone();
|
||||
puntoFotoR.setDBState(0);
|
||||
puntoFotoR.setId_gara(garaWww.getId_gara());
|
||||
puntoFotoR.setId_puntoFoto(0L);
|
||||
puntoFotoR.setApFull(apRemoto);
|
||||
rp = puntoFotoR.save();
|
||||
if (rp.getStatus()) {
|
||||
row.setId_puntoFotoExport(puntoFotoR.getId_puntoFoto());
|
||||
row.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
System.out.println("Export gara su www 15 startInvioFotoDa3PianoAWwwMT");
|
||||
Foto foto = new Foto(getApFull());
|
||||
foto.startInvioFotoDa3PianoAWwwMT(getId_gara(), soloFoto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Export gara su www ex");
|
||||
e.printStackTrace();
|
||||
rp.setException(e);
|
||||
}
|
||||
} else {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("ERRORE! id gara o codice gara 3 piano non impostato. Contatta marco!!!");
|
||||
}
|
||||
StatusMsg.updateMsgByTag(getApFull(), "Export gara su www", "Export DB gara su 3piano concluso!");
|
||||
System.out.println("OCR #######**** FINE THREAD Export gara su www ######" + String.valueOf(DBAdapter.getNow()));
|
||||
StatusMsg.deleteMsgByTag(getApFull(), "Export gara su www");
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getImgLogoGaraFileName() {
|
||||
String oldLogogara = getDocBase() + "img/gare/" + getDocBase() + "_logoGara.jpg";
|
||||
if (new File(oldLogogara).exists())
|
||||
return oldLogogara;
|
||||
return getDocBase() + getDocBase() + getPathImg();
|
||||
}
|
||||
|
||||
public String getImgLogoGaraName() {
|
||||
String oldLogogara = getDocBase() + "img/gare/" + getDocBase() + "_logoGara.jpg";
|
||||
if (new File(oldLogogara).exists())
|
||||
return "" + getId_gara() + "_logoGara.jpg";
|
||||
return getImgFileName(1);
|
||||
}
|
||||
|
||||
public String getTestoColore() {
|
||||
return (this.testoColore == null) ? "" : this.testoColore.trim();
|
||||
}
|
||||
|
||||
public void setTestoColore(String testoColore) {
|
||||
this.testoColore = testoColore;
|
||||
}
|
||||
|
||||
public long getTestoSize() {
|
||||
return this.testoSize;
|
||||
}
|
||||
|
||||
public void setTestoSize(long testoSize) {
|
||||
this.testoSize = testoSize;
|
||||
}
|
||||
|
||||
public String getTestoO() {
|
||||
return (this.testoO == null) ? "" : this.testoO.trim();
|
||||
}
|
||||
|
||||
public void setTestoO(String testO) {
|
||||
this.testoO = testO;
|
||||
}
|
||||
|
||||
public String getTestoV() {
|
||||
return (this.testoV == null) ? "" : this.testoV.trim();
|
||||
}
|
||||
|
||||
public void setTestoV(String testoV) {
|
||||
this.testoV = testoV;
|
||||
}
|
||||
|
||||
public String getTestoFont() {
|
||||
return (this.testoFont == null) ? "" : this.testoFont.trim();
|
||||
}
|
||||
|
||||
public void setTestoFont(String testoFont) {
|
||||
this.testoFont = testoFont;
|
||||
}
|
||||
|
||||
public long getCodGara() {
|
||||
return this.codGara;
|
||||
}
|
||||
|
||||
public void setCodGara(long codGara) {
|
||||
this.codGara = codGara;
|
||||
}
|
||||
|
||||
public static final String getTipoIndex(long l_flgTipoIndex) {
|
||||
switch ((int)l_flgTipoIndex) {
|
||||
case 1:
|
||||
return "Pettorali (manola)";
|
||||
case 0:
|
||||
return "NO";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public long getFlgTipoIndex() {
|
||||
return this.flgTipoIndex;
|
||||
}
|
||||
|
||||
public void setFlgTipoIndex(long flgTipoIndex) {
|
||||
this.flgTipoIndex = flgTipoIndex;
|
||||
}
|
||||
|
||||
public String getTipoIndex() {
|
||||
return getTipoIndex(getFlgTipoIndex());
|
||||
}
|
||||
|
||||
protected void initFields() {
|
||||
super.initFields();
|
||||
setTestoColore("#fbfe07");
|
||||
setTestoSize(56L);
|
||||
setTestoFont("/home/piero/Documenti/sites/rus/admin/_V4/_font/timesbd.ttf");
|
||||
}
|
||||
|
||||
public long getFlgFree() {
|
||||
return this.flgFree;
|
||||
}
|
||||
|
||||
public void setFlgFree(long flgFree) {
|
||||
this.flgFree = flgFree;
|
||||
}
|
||||
|
||||
public ResParm exportFileIdx(String fileName) {
|
||||
int numRec = 0;
|
||||
String sep = ";";
|
||||
new File(fileName).delete();
|
||||
FileWr outFile = new FileWr(fileName, false);
|
||||
String temp2 = System.getProperty("line.separator");
|
||||
if (temp2.equals("\n"));
|
||||
ResParm rp = new ResParm(false, "Errore in export: " + fileName + "<br>");
|
||||
try {
|
||||
outFile.writeLine("filename;md5;pettorali");
|
||||
FotoCR CR = new FotoCR();
|
||||
CR.setId_gara(getId_gara());
|
||||
CR.setFlgConPettorali(1L);
|
||||
Vectumerator<Foto> vec = new Foto(getApFull()).findByCR(CR, 0, 0);
|
||||
StringBuilder temp = new StringBuilder();
|
||||
while (vec.hasMoreElements()) {
|
||||
Foto currentFoto = (Foto)vec.nextElement();
|
||||
temp.append(currentFoto.getFileName());
|
||||
temp.append(";");
|
||||
temp.append(currentFoto.getMd5());
|
||||
temp.append(";");
|
||||
temp.append(currentFoto.getPettorali());
|
||||
outFile.writeLine(temp.toString());
|
||||
numRec++;
|
||||
temp = new StringBuilder();
|
||||
}
|
||||
outFile.closeFile();
|
||||
rp.setStatus(true);
|
||||
rp.setMsg("Generazione file export avvenuta con successo.<br> n. foto esportate: " + numRec);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
rp.setException(e);
|
||||
rp.setStatus(false);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public String getFileNameExport() {
|
||||
return (this.fileNameExport == null) ? "" : this.fileNameExport.trim();
|
||||
}
|
||||
|
||||
public void setFileNameExport(String fileNameExport) {
|
||||
this.fileNameExport = fileNameExport;
|
||||
}
|
||||
|
||||
public boolean isFileExportOk() {
|
||||
return this.fileExportOk;
|
||||
}
|
||||
|
||||
public void setFileExportOk(boolean fileExportOk) {
|
||||
this.fileExportOk = fileExportOk;
|
||||
}
|
||||
}
|
||||
152
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/GaraCR.java
Normal file
152
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/GaraCR.java
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.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;
|
||||
}
|
||||
|
||||
public boolean isModGara() {
|
||||
if (getApFull() == null)
|
||||
return false;
|
||||
long mg = getParm("MODGARA").getNumeroLong();
|
||||
if (mg > 0L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
135
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/LogFoto.java
Normal file
135
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/LogFoto.java
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.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 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.getIpAddress().isEmpty())
|
||||
wc.addWc("(A.ipAddress like '%" + CR.getIpAddress() + "%') ");
|
||||
if (!CR.getDescrizioneFotoNuove().isEmpty()) {
|
||||
s_Sql_Find = 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
115
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/LogFotoCR.java
Normal file
115
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/LogFotoCR.java
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.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) ? AB_EMPTY_STRING : this.descrizioneFotoNuove.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneFotoNuove(String descrizioneFotoNuove) {
|
||||
this.descrizioneFotoNuove = descrizioneFotoNuove;
|
||||
}
|
||||
}
|
||||
960
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/PuntoFoto.java
Normal file
960
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/PuntoFoto.java
Normal file
|
|
@ -0,0 +1,960 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.common.StatusMsg;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.SimpleDateFormat;
|
||||
import it.acxent.util.Timer;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Stream;
|
||||
import org.apache.commons.exec.CommandLine;
|
||||
import org.apache.commons.exec.DefaultExecuteResultHandler;
|
||||
import org.apache.commons.exec.DefaultExecutor;
|
||||
import org.apache.commons.exec.ExecuteResultHandler;
|
||||
import org.apache.commons.exec.ExecuteStreamHandler;
|
||||
import org.apache.commons.exec.ExecuteWatchdog;
|
||||
import org.apache.commons.exec.PumpStreamHandler;
|
||||
import org.apache.commons.io.output.ByteArrayOutputStream;
|
||||
|
||||
public class PuntoFoto extends _PgAdapter implements Serializable {
|
||||
private static HashSet<Long> hsOcrThread = new HashSet<>();
|
||||
|
||||
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;
|
||||
|
||||
private long id_puntoFotoExport;
|
||||
|
||||
class ThreadIndicizzaPuntofoto extends Thread {
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
public ThreadIndicizzaPuntofoto(PuntoFoto puntoFoto) {
|
||||
this.puntoFoto = puntoFoto;
|
||||
if (!PuntoFoto.isThreadAttivo()) {
|
||||
PuntoFoto.threadPuntoFoto = true;
|
||||
start();
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
boolean debug = false;
|
||||
String TAG_THREAD_MSG = "INDICIZZA PUNTOFOTO " + this.puntoFoto.getDescrizione();
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
int i = 0;
|
||||
int se1 = 10;
|
||||
int se2 = 100;
|
||||
int fotoInviate = 0, fotoErrate = 0;
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "...inizio ...");
|
||||
if (this.puntoFoto.getId_puntoFoto() > 0L) {
|
||||
Foto foto = new Foto(this.puntoFoto.getApFull());
|
||||
FotoCR fotoCR = new FotoCR();
|
||||
fotoCR.setId_puntoFoto(this.puntoFoto.getId_puntoFoto());
|
||||
Vectumerator<Foto> vec = foto.findByCR(fotoCR, 0, 0);
|
||||
while (vec.hasMoreElements()) {
|
||||
Foto row = (Foto)vec.nextElement();
|
||||
Foto.creaRiduzioniPerWeb(this.puntoFoto.getGara(), row.getFileNamePercorsoCompleto(), null, false);
|
||||
i++;
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "create " + i + " riduzioni su " +
|
||||
vec.getTotNumberOfRecords());
|
||||
if (se1 > 0 && i % se1 == 0)
|
||||
System.out.print(".");
|
||||
if (se2 > 0 && i % se2 == 0)
|
||||
System.out.println("" + i + " su " + i);
|
||||
}
|
||||
} else {
|
||||
err.append("ERRORE!! punto foto INESISTENTE");
|
||||
err.append("\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
err.append("ERRORE!! " + e.getMessage());
|
||||
err.append("\n");
|
||||
}
|
||||
rp.setMsg("craete " + i + " preview");
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss ");
|
||||
System.out.println(TAG_THREAD_MSG + " DURATA: " + TAG_THREAD_MSG + "Risultato import:\n" + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n\nCREAZIONE PREVIEW WWW concluso\n****************");
|
||||
System.out.println(TAG_THREAD_MSG + " **************************************** ERRORI EXPORT FOTO SU WWW ****************************************");
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " concluso: DURATA: " +
|
||||
dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "Risultato invio:\n" + rp.getMsg());
|
||||
try {
|
||||
sleep(10000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG);
|
||||
PuntoFoto.threadPuntoFoto = false;
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadOcrPuntofoto extends Thread {
|
||||
private PuntoFoto puntoFoto;
|
||||
|
||||
public ThreadOcrPuntofoto(PuntoFoto puntoFoto) {
|
||||
this.puntoFoto = puntoFoto;
|
||||
if (PuntoFoto.setThreadOcrAttivo(puntoFoto.getId_puntoFoto()))
|
||||
start();
|
||||
}
|
||||
|
||||
public void runPyton() {
|
||||
String TAG_THREAD_MSG = "OCR GARA " + this.puntoFoto.getId_gara() + " " + this.puntoFoto.getGara().getDescrizione() + " PUNTOFOTO " +
|
||||
this.puntoFoto.getId_puntoFoto() + " " + this.puntoFoto.getDescrizionePuntoFoto();
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
String COMANDOSH = "/bin/sh ";
|
||||
String COMANDO_PRODUZIONE = "cd /home/sites/bin/ && /usr/local/bin/python3 /home/sites/bin/det.py -d $1 -c $2 && echo '******* fine indicizzazione OCR'";
|
||||
String COMANDO_TEST = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_TEST").getTesto() + " ";
|
||||
String END_COMMAND_TAG = "******* fine indicizzazione OCR";
|
||||
String COMANDO = "cd /home/sites/bin/ && /usr/local/bin/python3 /home/sites/bin/det.py -d $1 -c $2 && echo '******* fine indicizzazione OCR'";
|
||||
String dirDaIndicizzare = PuntoFoto.this.getPathCompletoFoto();
|
||||
String pathRisultato = PuntoFoto.this.getDocBase() + "_csv/";
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
String dataFile = df.format(DBAdapter.getToday());
|
||||
String nomeFileCsv = "" + PuntoFoto.this.getId_gara() + "-" + PuntoFoto.this.getId_gara() + "_" + PuntoFoto.this.getId_puntoFoto() + ".csv";
|
||||
String TMP_PRODUZIONE_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto();
|
||||
String TMP_TEST_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto();
|
||||
String LINEE_FILE = TMP_PRODUZIONE_LINEE_FILE;
|
||||
String fineNameFinale = pathRisultato + pathRisultato;
|
||||
String comandoParm = nomeFileCsv + " " + nomeFileCsv + " " + dirDaIndicizzare;
|
||||
String comandoCompleto = COMANDO + COMANDO;
|
||||
System.out.println(comandoCompleto);
|
||||
PuntoFoto.this.getApFull().writeLog(comandoCompleto);
|
||||
long lineCount = 0L;
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "eseguo " + comandoCompleto);
|
||||
DefaultExecutor defaultExecutor = new DefaultExecutor();
|
||||
ExecuteWatchdog watchdog = new ExecuteWatchdog(300000L);
|
||||
defaultExecutor.setWatchdog(watchdog);
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
PumpStreamHandler psh = new PumpStreamHandler(stdout);
|
||||
defaultExecutor.setStreamHandler((ExecuteStreamHandler)psh);
|
||||
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
|
||||
CommandLine cl = null;
|
||||
COMANDO = COMANDO.replace("$1", dirDaIndicizzare);
|
||||
LINEE_FILE = pathRisultato + pathRisultato;
|
||||
COMANDO = COMANDO.replace("$2", LINEE_FILE);
|
||||
cl = new CommandLine(COMANDO);
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv);
|
||||
System.out.println("chiamata ocr: " + COMANDO);
|
||||
defaultExecutor.execute(cl, (ExecuteResultHandler)resultHandler);
|
||||
String temp = "";
|
||||
int numeroCicli = 0;
|
||||
File tmpFile = new File(LINEE_FILE);
|
||||
int numTentativi = 0;
|
||||
while (!tmpFile.exists() && numTentativi < 2) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv +
|
||||
DBAdapter.charRight("", numTentativi, "."));
|
||||
sleep(2000L);
|
||||
numTentativi++;
|
||||
}
|
||||
Stream<String> stream = null;
|
||||
if (tmpFile.exists())
|
||||
while (temp.indexOf("******* fine indicizzazione OCR") < 0) {
|
||||
String[] arr;
|
||||
numeroCicli++;
|
||||
temp = stdout.toString().trim();
|
||||
if (temp.indexOf("\n") > 0) {
|
||||
arr = temp.split("\n");
|
||||
} else {
|
||||
arr = temp.split("\r");
|
||||
}
|
||||
System.out.println(arr.length);
|
||||
if (arr != null)
|
||||
temp = arr[arr.length - 1];
|
||||
System.out.println("ultima riga: " + temp);
|
||||
if (tmpFile.exists()) {
|
||||
try {
|
||||
stream = Files.lines(Paths.get(LINEE_FILE), StandardCharsets.UTF_8);
|
||||
lineCount = stream.count() - 1L;
|
||||
} catch (Exception e) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Eccezione file " + nomeFileCsv + ": " + e.getMessage());
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " waiting.... " + numeroCicli + " Trovate " + lineCount + " Foto con numeri - " + temp);
|
||||
System.out.println(TAG_THREAD_MSG + " waiting.... " + TAG_THREAD_MSG + " Trovate " + numeroCicli + " Foto con numeri: " + lineCount);
|
||||
}
|
||||
sleep(2000L);
|
||||
}
|
||||
temp = stdout.toString().trim();
|
||||
System.out.println("stout: " + temp);
|
||||
resultHandler.waitFor();
|
||||
int exitVal = resultHandler.getExitValue();
|
||||
System.out.println(" fine waitfor: exit val= " + exitVal);
|
||||
if (exitVal == 0);
|
||||
} catch (Exception e) {
|
||||
err.append("ERRORE!! " + e.getMessage());
|
||||
err.append("\n");
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "fine OCR. Trovate " + lineCount + " foto con numeri. Importazione indici in corso...");
|
||||
PuntoFoto.this.getApFull().writeLog("\nfine OCR. Importazione indici in corso...");
|
||||
if (new File(fineNameFinale).exists()) {
|
||||
rp = this.puntoFoto.getGara().indexFotoPisa(fineNameFinale, TAG_THREAD_MSG);
|
||||
} else {
|
||||
err.append("ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
err.append("\n");
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
PuntoFoto.this.getApFull().writeLog("\nERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss ");
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " DURATA: " + TAG_THREAD_MSG + "Risultato import:\n" + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n\n ocr concluso\n****************");
|
||||
if (err.length() > 0) {
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " **************************************** ERRORI ocr ****************************************\n" + TAG_THREAD_MSG);
|
||||
rp.appendMsg(" " + err.toString());
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " concluso: DURATA: " +
|
||||
dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n" + rp.getMsg());
|
||||
try {
|
||||
sleep(4000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG);
|
||||
PuntoFoto.removeThreadOcrAttivo(this.puntoFoto.getId_puntoFoto());
|
||||
}
|
||||
|
||||
public void runProcessBuilder() {
|
||||
String TAG_THREAD_MSG = "OCR GARA " + this.puntoFoto.getId_gara() + " " + this.puntoFoto.getGara().getDescrizione() + " PUNTOFOTO " +
|
||||
this.puntoFoto.getId_puntoFoto() + " " + this.puntoFoto.getDescrizionePuntoFoto();
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
String COMANDOSH = "/bin/sh ";
|
||||
String COMANDO_PRODUZIONE = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_PRODUZIONE").getTesto() + " ";
|
||||
String COMANDO_TEST = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_TEST").getTesto() + " ";
|
||||
String COMANDO = COMANDO_PRODUZIONE;
|
||||
String dirDaIndicizzare = PuntoFoto.this.getPathCompletoFoto();
|
||||
String pathRisultato = PuntoFoto.this.getDocBase() + "_csv/";
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
String dataFile = df.format(DBAdapter.getToday());
|
||||
String nomeFileCsv = "" + PuntoFoto.this.getId_gara() + "-" + PuntoFoto.this.getId_gara() + "_" + PuntoFoto.this.getId_puntoFoto() + ".csv";
|
||||
String TMP_PRODUZIONE_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto();
|
||||
String TMP_TEST_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto();
|
||||
String LINEE_FILE = TMP_PRODUZIONE_LINEE_FILE;
|
||||
String fineNameFinale = pathRisultato + pathRisultato;
|
||||
String comandoParm = nomeFileCsv + " " + nomeFileCsv + " " + dirDaIndicizzare;
|
||||
String comandoCompleto = COMANDO + COMANDO;
|
||||
System.out.println(comandoCompleto);
|
||||
PuntoFoto.this.getApFull().writeLog(comandoCompleto);
|
||||
long lineCount = 0L;
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "eseguo " + comandoCompleto);
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(new String[0]);
|
||||
System.out.println("Processbuilder.command: " + COMANDO.trim() + " - " + nomeFileCsv + " - " + dirDaIndicizzare + " - " + pathRisultato);
|
||||
processBuilder.command(COMANDO.trim(), nomeFileCsv, dirDaIndicizzare, pathRisultato);
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv);
|
||||
Process process = processBuilder.start();
|
||||
sleep(2000L);
|
||||
File tmpFile = new File(LINEE_FILE);
|
||||
int numTentativi = 0;
|
||||
while (!tmpFile.exists() && numTentativi < 20) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv +
|
||||
DBAdapter.charRight("", numTentativi, "."));
|
||||
sleep(2000L);
|
||||
numTentativi++;
|
||||
}
|
||||
int numeroCicli = 0;
|
||||
if (tmpFile.exists()) {
|
||||
while (tmpFile.exists()) {
|
||||
numeroCicli++;
|
||||
Stream<String> stream = null;
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "...... " + numeroCicli);
|
||||
System.out.println(TAG_THREAD_MSG + " waiting...... " + TAG_THREAD_MSG + " file tmp: " + numeroCicli);
|
||||
sleep(2000L);
|
||||
}
|
||||
} else {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "File " + nomeFileCsv + " non trovato!!!");
|
||||
sleep(4000L);
|
||||
}
|
||||
System.out.println("waitfor");
|
||||
int exitVal = process.waitFor();
|
||||
System.out.println(" fine waitfor: exit val= " + exitVal);
|
||||
if (exitVal == 0);
|
||||
} catch (Exception e) {
|
||||
err.append("ERRORE!! " + e.getMessage());
|
||||
err.append("\n");
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "fine OCR. Trovate " + lineCount + " foto con numeri. Importazione indici in corso...");
|
||||
PuntoFoto.this.getApFull().writeLog("\nfine OCR. Importazione indici in corso...");
|
||||
if (new File(fineNameFinale).exists()) {
|
||||
rp = this.puntoFoto.getGara().indexFotoPisa(fineNameFinale, TAG_THREAD_MSG);
|
||||
} else {
|
||||
err.append("ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
err.append("\n");
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
PuntoFoto.this.getApFull().writeLog("\nERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss ");
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " DURATA: " + TAG_THREAD_MSG + "Risultato import:\n" + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n\n ocr concluso\n****************");
|
||||
if (err.length() > 0) {
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " **************************************** ERRORI ocr ****************************************\n" + TAG_THREAD_MSG);
|
||||
rp.appendMsg(" " + err.toString());
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " concluso: DURATA: " +
|
||||
dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n" + rp.getMsg());
|
||||
try {
|
||||
sleep(4000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG);
|
||||
PuntoFoto.removeThreadOcrAttivo(this.puntoFoto.getId_puntoFoto());
|
||||
}
|
||||
|
||||
public void run() {
|
||||
String TAG_THREAD_MSG = "OCR GARA " + this.puntoFoto.getId_gara() + " " + this.puntoFoto.getGara().getDescrizione() + " PUNTOFOTO " +
|
||||
this.puntoFoto.getId_puntoFoto() + " " + this.puntoFoto.getDescrizionePuntoFoto();
|
||||
Timer timer = new Timer();
|
||||
timer.start();
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
String COMANDOSH = "/bin/sh ";
|
||||
String COMANDO_PRODUZIONE = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_PRODUZIONE").getTesto() + " ";
|
||||
String COMANDO_TEST = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_TEST").getTesto() + " ";
|
||||
String END_COMMAND_TAG = "******* fine indicizzazione OCR";
|
||||
String COMANDO = COMANDO_PRODUZIONE;
|
||||
String dirDaIndicizzare = PuntoFoto.this.getPathCompletoFoto();
|
||||
String pathRisultato = PuntoFoto.this.getDocBase() + "_csv/";
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
String dataFile = df.format(DBAdapter.getToday());
|
||||
String nomeFileCsv = "" + PuntoFoto.this.getId_gara() + "-" + PuntoFoto.this.getId_gara() + "_" + PuntoFoto.this.getId_puntoFoto() + ".csv";
|
||||
String TMP_PRODUZIONE_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto();
|
||||
String TMP_TEST_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto();
|
||||
String fineNameFinale = pathRisultato + pathRisultato;
|
||||
String LINEE_FILE = TMP_PRODUZIONE_LINEE_FILE;
|
||||
LINEE_FILE = fineNameFinale;
|
||||
String comandoParm = nomeFileCsv + " " + nomeFileCsv + " " + dirDaIndicizzare;
|
||||
String comandoCompleto = COMANDO + COMANDO;
|
||||
System.out.println(TAG_THREAD_MSG + "\n**** eseguo " + TAG_THREAD_MSG);
|
||||
PuntoFoto.this.getApFull().writeLog(comandoCompleto);
|
||||
long lineCount = 0L;
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "eseguo " + comandoCompleto);
|
||||
System.out.println(TAG_THREAD_MSG + " eseguo " + TAG_THREAD_MSG);
|
||||
DefaultExecutor defaultExecutor = new DefaultExecutor();
|
||||
ExecuteWatchdog watchdog = new ExecuteWatchdog(300000L);
|
||||
defaultExecutor.setWatchdog(watchdog);
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
PumpStreamHandler psh = new PumpStreamHandler(stdout);
|
||||
defaultExecutor.setStreamHandler((ExecuteStreamHandler)psh);
|
||||
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
|
||||
CommandLine cl = new CommandLine(COMANDO.trim());
|
||||
cl.addArgument(nomeFileCsv);
|
||||
cl.addArgument(dirDaIndicizzare);
|
||||
cl.addArgument(pathRisultato);
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv);
|
||||
defaultExecutor.execute(cl, (ExecuteResultHandler)resultHandler);
|
||||
String temp = "";
|
||||
int numeroCicli = 0;
|
||||
File tmpFile = new File(LINEE_FILE);
|
||||
int numTentativi = 0;
|
||||
while (!tmpFile.exists() && numTentativi < 20) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... aspetto il file: " + nomeFileCsv +
|
||||
DBAdapter.charRight("", numTentativi, "."));
|
||||
System.out.println(TAG_THREAD_MSG + " Chiamata OCR Python in corso..... aspetto il file: " + TAG_THREAD_MSG + nomeFileCsv);
|
||||
sleep(2000L);
|
||||
numTentativi++;
|
||||
}
|
||||
Stream<String> stream = null;
|
||||
long currentLineCount = 0L;
|
||||
long numLineCountUguali = 0L;
|
||||
long maxNumlineCountUguali = 20L;
|
||||
while (temp.indexOf("******* fine indicizzazione OCR") < 0) {
|
||||
String[] arr;
|
||||
numeroCicli++;
|
||||
temp = stdout.toString().trim();
|
||||
if (temp.indexOf("\n") > 0) {
|
||||
arr = temp.split("\n");
|
||||
} else {
|
||||
arr = temp.split("\r");
|
||||
}
|
||||
if (arr != null)
|
||||
temp = arr[arr.length - 1];
|
||||
if (tmpFile.exists()) {
|
||||
try {
|
||||
stream = Files.lines(Paths.get(LINEE_FILE), StandardCharsets.UTF_8);
|
||||
lineCount = stream.count() - 1L;
|
||||
} catch (Exception e) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Eccezione file " + nomeFileCsv + ": " +
|
||||
e.getMessage());
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " ciclo " + numeroCicli + " - Trovate " + lineCount + " Foto con numeri - " + temp);
|
||||
System.out.println(TAG_THREAD_MSG + " ciclo " + TAG_THREAD_MSG + " - Trovate " + numeroCicli + " Foto con numeri: " + lineCount);
|
||||
}
|
||||
if (currentLineCount == lineCount) {
|
||||
numLineCountUguali++;
|
||||
} else {
|
||||
numLineCountUguali = 0L;
|
||||
currentLineCount = lineCount;
|
||||
}
|
||||
if (numLineCountUguali >= maxNumlineCountUguali) {
|
||||
System.out.println("BREAK!!!");
|
||||
break;
|
||||
}
|
||||
sleep(1000L);
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " Fuori dal ciclo lettura OCR principale..... Foto con numeri - " + temp + " waitfor script ocr......");
|
||||
System.out.println("waitfor....");
|
||||
resultHandler.waitFor();
|
||||
int exitVal = resultHandler.getExitValue();
|
||||
System.out.println(" fine waitfor: exit val= " + exitVal);
|
||||
if (exitVal == 0);
|
||||
} catch (Exception e) {
|
||||
err.append("ERRORE!! " + e.getMessage());
|
||||
err.append("\n");
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "fine OCR. Trovate " + lineCount + " foto con numeri. Importazione indici in corso...");
|
||||
System.out.println(TAG_THREAD_MSG + " fine OCR. Trovate " + TAG_THREAD_MSG + " foto con numeri. Importazione indici in corso...");
|
||||
PuntoFoto.this.getApFull().writeLog("\nfine OCR. Importazione indici in corso...");
|
||||
if (new File(fineNameFinale).exists()) {
|
||||
rp = this.puntoFoto.getGara().indexFotoPisa(fineNameFinale, TAG_THREAD_MSG);
|
||||
} else {
|
||||
err.append("ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
err.append("\n");
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
PuntoFoto.this.getApFull().writeLog("\nERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
}
|
||||
timer.stop();
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " DURATA: " + TAG_THREAD_MSG + " Risultato import:\n" + timer.getDurataHourMin() + "\n\n ocr concluso\n****************");
|
||||
if (err.length() > 0) {
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " **************************************** ERRORI ocr ****************************************\n" + TAG_THREAD_MSG);
|
||||
rp.appendMsg(" " + err.toString());
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " concluso: DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg());
|
||||
System.out.println(TAG_THREAD_MSG + " concluso: DURATA: " + TAG_THREAD_MSG + "\n" + timer.getDurataHourMin());
|
||||
try {
|
||||
sleep(4000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG);
|
||||
PuntoFoto.removeThreadOcrAttivo(this.puntoFoto.getId_puntoFoto());
|
||||
}
|
||||
|
||||
public void runExecSh() {
|
||||
String TAG_THREAD_MSG = "OCR GARA " + this.puntoFoto.getId_gara() + " " + this.puntoFoto.getGara().getDescrizione() + " PUNTOFOTO " +
|
||||
this.puntoFoto.getId_puntoFoto() + " " + this.puntoFoto.getDescrizionePuntoFoto();
|
||||
Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
ResParm rp = new ResParm(true);
|
||||
StringBuffer err = new StringBuffer();
|
||||
String COMANDOSH = "/bin/sh ";
|
||||
String COMANDO_PRODUZIONE = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_PRODUZIONE").getTesto() + " ";
|
||||
String COMANDO_TEST = PuntoFoto.this.getParm("OCR_COMANDO_SHELL_TEST").getTesto() + " ";
|
||||
String END_COMMAND_TAG = "******* fine indicizzazione OCR";
|
||||
String COMANDO = COMANDO_PRODUZIONE;
|
||||
String dirDaIndicizzare = PuntoFoto.this.getPathCompletoFoto();
|
||||
String pathRisultato = PuntoFoto.this.getDocBase() + "_csv/";
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
String dataFile = df.format(DBAdapter.getToday());
|
||||
String nomeFileCsv = "" + PuntoFoto.this.getId_gara() + "-" + PuntoFoto.this.getId_gara() + "_" + PuntoFoto.this.getId_puntoFoto() + ".csv";
|
||||
String TMP_PRODUZIONE_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_PRODUZIONE").getTesto();
|
||||
String TMP_TEST_LINEE_FILE = PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto() + PuntoFoto.this.getParm("OCR_LINEE_FILE_TEST").getTesto();
|
||||
String LINEE_FILE = TMP_PRODUZIONE_LINEE_FILE;
|
||||
String fineNameFinale = pathRisultato + pathRisultato;
|
||||
String comandoParm = nomeFileCsv + " " + nomeFileCsv + " " + dirDaIndicizzare;
|
||||
String comandoCompleto = COMANDO + COMANDO;
|
||||
System.out.println(comandoCompleto);
|
||||
PuntoFoto.this.getApFull().writeLog(comandoCompleto);
|
||||
long lineCount = 0L;
|
||||
try {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "eseguo " + comandoCompleto);
|
||||
DefaultExecutor defaultExecutor = new DefaultExecutor();
|
||||
ExecuteWatchdog watchdog = new ExecuteWatchdog(300000L);
|
||||
defaultExecutor.setWatchdog(watchdog);
|
||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||
PumpStreamHandler psh = new PumpStreamHandler(stdout);
|
||||
defaultExecutor.setStreamHandler((ExecuteStreamHandler)psh);
|
||||
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
|
||||
CommandLine cl = new CommandLine(COMANDO.trim());
|
||||
cl.addArgument(nomeFileCsv);
|
||||
cl.addArgument(dirDaIndicizzare);
|
||||
cl.addArgument(pathRisultato);
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv);
|
||||
defaultExecutor.execute(cl, (ExecuteResultHandler)resultHandler);
|
||||
String temp = "";
|
||||
int numeroCicli = 0;
|
||||
File tmpFile = new File(LINEE_FILE);
|
||||
int numTentativi = 0;
|
||||
while (!tmpFile.exists() && numTentativi < 20) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Chiamata OCR Python in corso..... file: " + nomeFileCsv +
|
||||
DBAdapter.charRight("", numTentativi, "."));
|
||||
sleep(2000L);
|
||||
numTentativi++;
|
||||
}
|
||||
Stream<String> stream = null;
|
||||
while (tmpFile.exists()) {
|
||||
String[] arr;
|
||||
numeroCicli++;
|
||||
temp = stdout.toString().trim();
|
||||
if (temp.indexOf("\n") > 0) {
|
||||
arr = temp.split("\n");
|
||||
} else {
|
||||
arr = temp.split("\r");
|
||||
}
|
||||
System.out.println(arr.length);
|
||||
if (arr != null)
|
||||
temp = arr[arr.length - 1];
|
||||
System.out.println("ultima riga: " + temp);
|
||||
if (tmpFile.exists()) {
|
||||
try {
|
||||
stream = Files.lines(Paths.get(LINEE_FILE), StandardCharsets.UTF_8);
|
||||
lineCount = stream.count() - 1L;
|
||||
} catch (Exception e) {
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "Eccezione file " + nomeFileCsv + ": " +
|
||||
e.getMessage());
|
||||
} finally {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
stream = null;
|
||||
}
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " waiting.... " + numeroCicli + " Trovate " + lineCount + " Foto con numeri - " + temp);
|
||||
System.out.println(TAG_THREAD_MSG + " waiting.... " + TAG_THREAD_MSG + " Trovate " + numeroCicli + " Foto con numeri: " + lineCount);
|
||||
}
|
||||
sleep(2000L);
|
||||
}
|
||||
resultHandler.waitFor();
|
||||
int exitVal = resultHandler.getExitValue();
|
||||
System.out.println(" fine waitfor: exit val= " + exitVal);
|
||||
if (exitVal == 0);
|
||||
} catch (Exception e) {
|
||||
err.append("ERRORE!! " + e.getMessage());
|
||||
err.append("\n");
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "fine OCR. Trovate " + lineCount + " foto con numeri. Importazione indici in corso...");
|
||||
PuntoFoto.this.getApFull().writeLog("\nfine OCR. Importazione indici in corso...");
|
||||
if (new File(fineNameFinale).exists()) {
|
||||
rp = this.puntoFoto.getGara().indexFotoPisa(fineNameFinale, TAG_THREAD_MSG);
|
||||
} else {
|
||||
err.append("ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
err.append("\n");
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, "ERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
PuntoFoto.this.getApFull().writeLog("\nERRORE!! file " + nomeFileCsv + " NON trovato.");
|
||||
}
|
||||
Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis());
|
||||
SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss ");
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " DURATA: " + TAG_THREAD_MSG + "Risultato import:\n" + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n\n ocr concluso\n****************");
|
||||
if (err.length() > 0) {
|
||||
PuntoFoto.this.getApFull().writeLog(TAG_THREAD_MSG + " **************************************** ERRORI ocr ****************************************\n" + TAG_THREAD_MSG);
|
||||
rp.appendMsg(" " + err.toString());
|
||||
}
|
||||
StatusMsg.updateMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG, " concluso: DURATA: " +
|
||||
dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "\n" + rp.getMsg());
|
||||
try {
|
||||
sleep(4000L);
|
||||
} catch (Exception e) {}
|
||||
StatusMsg.deleteMsgByTag(PuntoFoto.this.getApFull(), TAG_THREAD_MSG);
|
||||
PuntoFoto.removeThreadOcrAttivo(this.puntoFoto.getId_puntoFoto());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean threadPuntoFoto = false;
|
||||
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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(s_Sql_Find + s_Sql_Find + wc.toString() + ") as B");
|
||||
return findRows(stmt);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescrizioneCompleta() {
|
||||
return getTipoPuntoFoto() + " " + getTipoPuntoFoto() + "-" + getGara().getDescrizione();
|
||||
}
|
||||
|
||||
public String getPathCompletoFoto() {
|
||||
String temp = getPathBaseFoto() + getPathBaseFoto() + getGara().getPathBase();
|
||||
if (!temp.endsWith(DBAdapter.SEPARATOR))
|
||||
temp = temp + temp;
|
||||
return DBAdapter.convertPathToCurrentFileSystemSeparator(temp);
|
||||
}
|
||||
|
||||
public String getPathCompletoFotoRidotta() {
|
||||
String temp = getPathBaseFotoRidotte() + getPathBaseFotoRidotte() + getGara().getPathBase();
|
||||
if (!temp.endsWith(DBAdapter.SEPARATOR))
|
||||
temp = temp + temp;
|
||||
return DBAdapter.convertPathToCurrentFileSystemSeparator(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 {
|
||||
if (!getTipoPuntoFotoNew().isEmpty())
|
||||
setTipoPuntoFoto(getTipoPuntoFotoNew());
|
||||
if (!getPathRelativoFoto().isEmpty() && !getPathRelativoFoto().endsWith(DBAdapter.SEPARATOR))
|
||||
setPathRelativoFoto(getPathRelativoFoto() + getPathRelativoFoto());
|
||||
super.prepareSave(ps);
|
||||
}
|
||||
|
||||
public void findByGaraPath(long l_id_gara, String l_pathRelativoFoto) {
|
||||
String s_Sql_Find = "select 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(DBAdapter.SEPARATOR))
|
||||
l_pathRelativoFoto = l_pathRelativoFoto + l_pathRelativoFoto;
|
||||
wc.addWc("A.pathRelativoFoto='" + l_pathRelativoFoto.trim() + "'");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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());
|
||||
}
|
||||
|
||||
public long getId_puntoFotoExport() {
|
||||
return this.id_puntoFotoExport;
|
||||
}
|
||||
|
||||
public void setId_puntoFotoExport(long id_puntoFotoExport) {
|
||||
this.id_puntoFotoExport = id_puntoFotoExport;
|
||||
}
|
||||
|
||||
public final ResParm startCreaPreview() {
|
||||
if (!isThreadAttivo()) {
|
||||
new ThreadIndicizzaPuntofoto(this);
|
||||
return new ResParm(true, "Thread INDICIZZA FOTO avviato");
|
||||
}
|
||||
return new ResParm(false, "ATTENZIONE!! Thread INDICIZZA FOTO gia' in esecuzione!!!");
|
||||
}
|
||||
|
||||
public final synchronized ResParm startOcrThread() {
|
||||
if (getId_puntoFoto() > 0L) {
|
||||
if (!isThreadOcrAttivo(getId_puntoFoto())) {
|
||||
new ThreadOcrPuntofoto(this);
|
||||
return new ResParm(true, "Thread OCR FOTO avviato");
|
||||
}
|
||||
return new ResParm(false, "ATTENZIONE!! Thread OCR per questo punto foto gia' in esecuzione!!!");
|
||||
}
|
||||
return new ResParm(false, "ATTENZIONE!! Punto foto non valido!!!");
|
||||
}
|
||||
|
||||
public static boolean isThreadAttivo() {
|
||||
return threadPuntoFoto;
|
||||
}
|
||||
|
||||
public static boolean isThreadOcrAttivo(long l_id_puntofoto) {
|
||||
if (hsOcrThread.contains(new Long(l_id_puntofoto)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isThreadOcrAttivo() {
|
||||
if (hsOcrThread.size() > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean setThreadOcrAttivo(long l_id_puntofoto) {
|
||||
Long key = new Long(l_id_puntofoto);
|
||||
if (hsOcrThread.contains(key))
|
||||
return false;
|
||||
hsOcrThread.add(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean removeThreadOcrAttivo(long l_id_puntofoto) {
|
||||
Long key = new Long(l_id_puntofoto);
|
||||
if (hsOcrThread.contains(key)) {
|
||||
hsOcrThread.remove(key);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ResParm callOcr() {
|
||||
ResParm rp = new ResParm();
|
||||
if (getId_gara() > 0L) {
|
||||
String COMANDO = "sh /home/piero/Documenti/sites/bin/indicizzaR.sh ";
|
||||
String dirDaIndicizzare = getPathCompletoFoto();
|
||||
String pathRisultato = getDocBase() + "_csv/";
|
||||
String comando = "sh /home/piero/Documenti/sites/bin/indicizzaR.sh " + getId_puntoFoto() + " " + dirDaIndicizzare + " " + pathRisultato;
|
||||
System.out.println(comando);
|
||||
getApFull().writeLog(comando);
|
||||
rp.setMsg(comando);
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
|
||||
public Vectumerator<PuntoFoto> findPuntiFotoConFotoOPettoraleNonInviatoByGara(long l_id_gara) {
|
||||
String s_Sql_Find = "select A.* from PUNTO_FOTO AS A INNER JOIN FOTO AS B ON A.id_puntofoto=B.id_puntoFoto";
|
||||
String s_Sql_Order = " ";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("A.id_gara=" + l_id_gara);
|
||||
wc.addWc("(B.flgFotoInviata is null or B.flgFotoInviata=0 or B.flgPettoraleInviato is null or B.flgPettoraleInviato=0)");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt);
|
||||
} catch (SQLException e) {
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm resetPreview() {
|
||||
ResParm rp = new ResParm();
|
||||
if (getId_gara() == 0L || getId_puntoFoto() == 0L) {
|
||||
rp.setMsg("Indicizzazione foto: Bean gara non caricato");
|
||||
rp.setStatus(false);
|
||||
handleDebug("resetPreview pinto foto: Bean gara o punto foto non caricato", 2);
|
||||
return rp;
|
||||
}
|
||||
rp = update("update FOTO set flgFotoInviata=0 where id_puntoFoto=" + getId_puntoFoto());
|
||||
boolean resDel = DBAdapter.deleteDir(new File(getPathCompletoFotoRidotta()));
|
||||
if (!resDel) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Errore! impossibile cancellare " + getPathCompletoFotoRidotta() + " - " + rp.getMsg());
|
||||
} else {
|
||||
rp.setMsg(rp.getMsg() + " - cancellata dir " + rp.getMsg());
|
||||
}
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.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
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/TipoGara.java
Normal file
414
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/TipoGara.java
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.art.Tipo;
|
||||
import it.acxent.db.AddImgInterface;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class 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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 = s_sqlFind + " and id_tipoPadre=" + s_sqlFind;
|
||||
} else {
|
||||
s_sqlFind = 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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
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 {
|
||||
super.prepareSave(ps);
|
||||
}
|
||||
|
||||
public ResParm save() {
|
||||
setFlgFoglia(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 getTipoGaraPadre().getDescrizioneCompleta() + " » " + getTipoGaraPadre().getDescrizioneCompleta();
|
||||
}
|
||||
|
||||
public String getDescrizioneHtml() {
|
||||
return convertStringToHtml(getDescrizione());
|
||||
}
|
||||
|
||||
public String getPathImg() {
|
||||
return "_img/_tipoGara/";
|
||||
}
|
||||
}
|
||||
106
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/TipoGaraCR.java
Normal file
106
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/TipoGaraCR.java
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.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;
|
||||
}
|
||||
}
|
||||
778
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Users.java
Normal file
778
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/Users.java
Normal file
|
|
@ -0,0 +1,778 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.bank.paypal.PayPalReq;
|
||||
import it.acxent.bank.poste.PeReq;
|
||||
import it.acxent.bank.sella.SellaReq;
|
||||
import it.acxent.common.CrontabInterface;
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.mail.MailMessage;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import it.acxent.util.Timer;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Users extends it.acxent.anag.Users implements CrontabInterface {
|
||||
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;
|
||||
|
||||
private static final long TTL_MILLIS = 10000L;
|
||||
|
||||
private static final ConcurrentHashMap<String, Long> rinnovoMailSent = new ConcurrentHashMap<>();
|
||||
|
||||
private static final ConcurrentHashMap<String, Long> scadABreveMailSent = new ConcurrentHashMap<>();
|
||||
|
||||
private static final ConcurrentHashMap<String, Long> couponOmaggioMailSent = new ConcurrentHashMap<>();
|
||||
|
||||
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(s_Sql_Find + s_Sql_Find + wc);
|
||||
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(s_Sql_Find + s_Sql_Find);
|
||||
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 = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5);
|
||||
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(), 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(long nFoto, int anni) {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
String annifoto;
|
||||
String key = "mail-rinnovo-" + getId_users();
|
||||
long now = System.currentTimeMillis();
|
||||
Long lastSent = rinnovoMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
synchronized (rinnovoMailSent) {
|
||||
lastSent = rinnovoMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
rinnovoMailSent.put(key, Long.valueOf(now));
|
||||
}
|
||||
String rinnovoMailMsg = getDocBase() + getDocBase();
|
||||
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());
|
||||
if (anni == 1) {
|
||||
annifoto = "" + anni + " anno e " + anni + " foto";
|
||||
} else {
|
||||
annifoto = "" + anni + " anni e " + anni + " foto";
|
||||
}
|
||||
mf.setString("annifoto", annifoto);
|
||||
rp = mf.sendMailMessageSystem(getEMail(), "Regalami un Sorriso - Rinnovo " + annifoto, 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 getDocBase() + getDocBase();
|
||||
}
|
||||
|
||||
public 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) {
|
||||
boolean lockOk = trySetFlgMailFotoScadenzaToYesIfNo();
|
||||
if (!lockOk)
|
||||
return rp;
|
||||
String userMailMessage = getNoMorePicScadMailMessage();
|
||||
if (!getControlCode().isEmpty())
|
||||
userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5);
|
||||
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(), mf.getMailSubject() + " Account Scaduto ", 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 long getFlgMailFotoScadenza() {
|
||||
return this.flgMailFotoScadenza;
|
||||
}
|
||||
|
||||
public void setFlgMailFotoScadenza(long flgMailFotoScadenza) {
|
||||
this.flgMailFotoScadenza = flgMailFotoScadenza;
|
||||
}
|
||||
|
||||
protected String getNoMorePicScadMailMessage() {
|
||||
return getDocBase() + getDocBase();
|
||||
}
|
||||
|
||||
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("PATHFOTO_RIDOTTE");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("PATHFOTO_RIDOTTE");
|
||||
bean.setDescrizione("PATHFOTO_RIDOTTE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/mnt/foto/catalog/");
|
||||
bean.setNota("Percorso ASSOLUTO dove risiedono tutte le foto RIDOTTE.<BR>Produzione RUS MINT CASA E UFFICIO: /mnt/foto/catalog/<br>");
|
||||
bean.save();
|
||||
bean.findByCodice("MAX_CONCURRENT_THREAD");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MAX_CONCURRENT_THREAD");
|
||||
bean.setDescrizione("MAX_CONCURRENT_THREAD");
|
||||
bean.setFlgTipo(1L);
|
||||
if (bean.getNumero() <= 1.0D)
|
||||
bean.setNumero(10.0D);
|
||||
bean.setNota("Numero thread concorrenti utilizzato per la riduzione foto<br>In locale 10 sembra il valore ottimale");
|
||||
bean.save();
|
||||
bean.findByCodice("MAX_CONCURRENT_UPLOAD_THREAD");
|
||||
bean.setFlgAdmin(0L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MAX_CONCURRENT_UPLOAD_THREAD");
|
||||
bean.setDescrizione("MAX_CONCURRENT_UPLOAD_THREAD");
|
||||
bean.setFlgTipo(1L);
|
||||
if (bean.getNumero() <= 1.0D)
|
||||
bean.setNumero(10.0D);
|
||||
bean.setNota("Numero thread concorrenti utilizzato per L'UPLOAD via http o ftp");
|
||||
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();
|
||||
bean.findByCodice("OCR_COMANDO_SHELL_PRODUZIONE");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("OCR_COMANDO_SHELL_PRODUZIONE");
|
||||
bean.setDescrizione("OCR_COMANDO_SHELL_PRODUZIONE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/home/piero/Documenti/sites/bin/indicizzaR.sh");
|
||||
bean.setNota("/home/piero/Documenti/sites/bin/indicizzaR.sh<BR>/home/sites/bin/indicizzaR.sh");
|
||||
bean.save();
|
||||
bean.findByCodice("OCR_COMANDO_SHELL_TEST");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("OCR_COMANDO_SHELL_TEST");
|
||||
bean.setDescrizione("OCR_COMANDO_SHELL_TEST");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/Users/acolzi/Documents/_ablia/work/PG/bin/test.sh");
|
||||
bean.setNota("/Users/acolzi/Documents/_ablia/work/PG/bin/test.sh<br>/Users/acolzi/Documents/_ablia/work/PG/bin/test.sh");
|
||||
bean.save();
|
||||
bean.findByCodice("OCR_LINEE_FILE_PRODUZIONE");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("OCR_LINEE_FILE_PRODUZIONE");
|
||||
bean.setDescrizione("OCR_LINEE_FILE_PRODUZIONE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/home/piero/Documenti/sites/bin/tmp/");
|
||||
bean.setNota("/home/piero/Documenti/sites/bin/tmp/<br>/home/sites/bin/tmp/");
|
||||
bean.save();
|
||||
bean.findByCodice("OCR_LINEE_FILE_TEST");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("OCR_LINEE_FILE_TEST");
|
||||
bean.setDescrizione("OCR_LINEE_FILE_TEST");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/Users/acolzi/Documents/_ablia/work/PG/bin/tmp/");
|
||||
bean.setNota("/Users/acolzi/Documents/_ablia/work/PG/bin/tmp/<br>/Users/acolzi/Documents/_ablia/work/PG/bin/tmp/");
|
||||
bean.save();
|
||||
bean.findByCodice("NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO");
|
||||
bean.setDescrizione("NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO");
|
||||
bean.setFlgTipo(1L);
|
||||
bean.setNota("Numero di giorni prima da cui è possibile rinnovare l'abbonamento");
|
||||
bean.save();
|
||||
bean.findByCodice("MAIL_MSG_STA_PER_SCADERE");
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice("MAIL_MSG_STA_PER_SCADERE");
|
||||
bean.setDescrizione("MAIL_MSG_STA_PER_SCADERE");
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("mailMessage/perscadereMsg.html");
|
||||
bean.setNota("Percorso RELATIVO messaggio sta per scadere");
|
||||
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();
|
||||
if (row.getPuntoFoto().getGara().getFlgFree() == 0L)
|
||||
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, int l_numAnni) {
|
||||
System.out.println("rinnova anno foto:" + n_foto + " anni:" + l_numAnni + ": cliente: " + getCognomeNome());
|
||||
if (n_foto == 0L)
|
||||
n_foto = 1000L;
|
||||
if (getId_users() == 0L)
|
||||
return new ResParm(false, "ERRORE! Tentativo di rinnovare utente nullo.");
|
||||
if (isDaRinnovare(false) || getNFotoMax() == 1L) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (getDateDiff(getToday(), getDataScadenza()) > 0L)
|
||||
cal.setTime(getDataScadenza());
|
||||
cal.add(1, l_numAnni);
|
||||
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 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 isDaRinnovare(true);
|
||||
}
|
||||
|
||||
public boolean isDaRinnovare(boolean inviaMail) {
|
||||
long ggPrimaScadenza = getParm("NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO").getNumeroLong();
|
||||
return (isScaduto(inviaMail) || DBAdapter.getDateDiff(DBAdapter.getToday(), getDataScadenza()) < ggPrimaScadenza ||
|
||||
isFotoMaxRaggiunto() || getFlgMiniature() == 1L);
|
||||
}
|
||||
|
||||
public boolean isScadutoPerSito(boolean inviaMail) {
|
||||
return (isScaduto(inviaMail) || isFotoMaxRaggiunto() || getFlgMiniature() == 1L);
|
||||
}
|
||||
|
||||
public boolean isScadutoPerSito() {
|
||||
return isScadutoPerSito(true);
|
||||
}
|
||||
|
||||
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) {
|
||||
boolean lockOk = trySetFlgMailFotoMaxToYesIfNo();
|
||||
if (!lockOk)
|
||||
return rp;
|
||||
String userMailMessage = getNoMorePicNumberMailMessage();
|
||||
if (!getControlCode().isEmpty())
|
||||
userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5);
|
||||
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(), mf.getMailSubject() + " Max num. foto raggiunto ", 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;
|
||||
}
|
||||
|
||||
private boolean trySetFlgMailFotoMaxToYesIfNo() {
|
||||
String s_sql_string = "UPDATE USERS SET flgMailFotoMax = 1";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("id_users=" + getId_users());
|
||||
wc.addWc("(flgMailFotoMax = 0 or flgMailFotoMax is null)");
|
||||
ResParm rp = update(s_sql_string + s_sql_string);
|
||||
if (rp.getStatus()) {
|
||||
if (rp.getErrorCode() < 0L)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean trySetFlgMailFotoScadenzaToYesIfNo() {
|
||||
String s_sql_string = "UPDATE USERS SET flgMailFotoScadenza = 1";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("id_users=" + getId_users());
|
||||
wc.addWc("(flgMailFotoScadenza = 0 or flgMailFotoScadenza is null)");
|
||||
ResParm rp = update(s_sql_string + s_sql_string);
|
||||
if (rp.getStatus()) {
|
||||
if (rp.getErrorCode() < 0L)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ResParm sendCouponOmaggioMailMessage() {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
String key = "mail-coupon-" + getId_users();
|
||||
long now = System.currentTimeMillis();
|
||||
Long lastSent = couponOmaggioMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
synchronized (couponOmaggioMailSent) {
|
||||
lastSent = couponOmaggioMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
couponOmaggioMailSent.put(key, Long.valueOf(now));
|
||||
}
|
||||
String rinnovoMailMsg = getDocBase() + getDocBase();
|
||||
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(), 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;
|
||||
}
|
||||
|
||||
public ResParm sendScadeABreveMailMessage() {
|
||||
ResParm rp = new ResParm(true);
|
||||
try {
|
||||
if (getDBState() == 1) {
|
||||
String key = "mail-scadenza-" + getId_users();
|
||||
long now = System.currentTimeMillis();
|
||||
Long lastSent = scadABreveMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
synchronized (scadABreveMailSent) {
|
||||
lastSent = scadABreveMailSent.get(key);
|
||||
if (lastSent != null && now - lastSent < 10000L)
|
||||
return new ResParm(true);
|
||||
scadABreveMailSent.put(key, Long.valueOf(now));
|
||||
}
|
||||
String rinnovoMailMsg = getDocBase() + getDocBase();
|
||||
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());
|
||||
long ggScadenza = DBAdapter.getDateDiff(DBAdapter.getToday(), getDataScadenza());
|
||||
mf.setLong("gg", ggScadenza);
|
||||
rp = mf.sendMailMessageSystem(getEMail(), "Regalami un Sorriso - Rinnovo tra " + ggScadenza + " giorni", 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;
|
||||
}
|
||||
|
||||
public Vectumerator<Users> findInScadenza(int ggPrimaDellaScadenza) {
|
||||
String s_Sql_Find = "select A.* from USERS AS A";
|
||||
WcString wc = new WcString();
|
||||
wc.addWc("dataFineVld is null");
|
||||
wc.addWc("A.flgValido='S'");
|
||||
wc.addWc("A.dataScadenza=?");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
|
||||
int dataCount = 0;
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(6, ggPrimaDellaScadenza);
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, new Date(cal.getTimeInMillis()));
|
||||
return findRows(stmt);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public ResParm crontabJob(ApplParmFull ap) {
|
||||
ResParm rp = new ResParm(true);
|
||||
Timer timer = new Timer();
|
||||
timer.start();
|
||||
System.out.println("RUS User crontab start...");
|
||||
StringBuffer msg = new StringBuffer("\n################# Inizio RUS User crontab (" +
|
||||
DBAdapter.getNow().toString() + ")\n#################");
|
||||
Users user = new Users(ap);
|
||||
int ggPrimaDellaScadenza = ap.getParm("NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO").getNumeroInt();
|
||||
Vectumerator<Users> vec = user.findInScadenza(ggPrimaDellaScadenza);
|
||||
while (vec.hasMoreElements()) {
|
||||
Users row = (Users)vec.nextElement();
|
||||
System.out.println(row.getCognomeNome() + " " + row.getCognomeNome() + " " + row.getEMail());
|
||||
rp = row.sendScadeABreveMailMessage();
|
||||
msg.append(rp.getMsg());
|
||||
msg.append("\n");
|
||||
}
|
||||
msg.append(rp.getMsg());
|
||||
msg.append("\n################# Fine RUS User crontab (" + DBAdapter.getNow().toString() + ")\n#################");
|
||||
timer.stop();
|
||||
msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n");
|
||||
rp.setMsg(msg.toString());
|
||||
System.out.println(msg.toString());
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
35
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/UsersCR.java
Normal file
35
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/UsersCR.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
|
||||
public class UsersCR extends it.acxent.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
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/XFotoGara.java
Normal file
173
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/XFotoGara.java
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.db.WcString;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.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 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(s_Sql_Find + s_Sql_Find + wc.toString());
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
removeCPConnection();
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
198
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/XFotoGaraCR.java
Normal file
198
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/XFotoGaraCR.java
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.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;
|
||||
}
|
||||
}
|
||||
180
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/_PgAdapter.java
Normal file
180
decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/_PgAdapter.java
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
package it.acxent.pg;
|
||||
|
||||
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 it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import java.awt.Color;
|
||||
|
||||
public class _PgAdapter extends DBAdapter {
|
||||
private static final long serialVersionUID = -8378506495945276989L;
|
||||
|
||||
public static final boolean DEBUG_LOCALE = false;
|
||||
|
||||
public static final String P_PATHFOTO = "PATHFOTO";
|
||||
|
||||
public static final String P_PATHFOTO_RIDOTTE = "PATHFOTO_RIDOTTE";
|
||||
|
||||
public static final String P_MAX_CONCURRENT_THREAD = "MAX_CONCURRENT_THREAD";
|
||||
|
||||
public static final String P_MAX_CONCURRENT_UPLOAD_THREAD = "MAX_CONCURRENT_UPLOAD_THREAD";
|
||||
|
||||
public static final String P_MAIL_MSG_RINNOVO = "MAIL_MSG_RINNOVO";
|
||||
|
||||
public static final String P_MAIL_MSG_STA_PER_SCADERE = "MAIL_MSG_STA_PER_SCADERE";
|
||||
|
||||
public static final String P_MAIL_MSG_COUPON_OMAGGIO = "MAIL_MSG_COUPON_OMAGGIO";
|
||||
|
||||
public static final String P_OCR_COMANDO_SHELL_PRODUZIONE = "OCR_COMANDO_SHELL_PRODUZIONE";
|
||||
|
||||
public static final String P_OCR_COMANDO_SHELL_TEST = "OCR_COMANDO_SHELL_TEST";
|
||||
|
||||
public static final String P_OCR_LINEE_FILE_PRODUZIONE = "OCR_LINEE_FILE_PRODUZIONE";
|
||||
|
||||
public static final String P_OCR_LINEE_FILE_TEST = "OCR_LINEE_FILE_TEST";
|
||||
|
||||
public static final String P_NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO = "NUM_GG_PRIMA_DELLA_SCADENZA_RINNOVO";
|
||||
|
||||
public static final String PATH_RIDOTTA = "RIDOTTA/";
|
||||
|
||||
protected PdfPCell blankCell = new PdfPCell();
|
||||
|
||||
protected Document document;
|
||||
|
||||
protected Table pdfcorpo;
|
||||
|
||||
protected PdfPTable pdfPcorpo;
|
||||
|
||||
protected PdfWriter writer;
|
||||
|
||||
protected static ApplParmFull apRemoto;
|
||||
|
||||
public static final String P_WWW_ADDRESS = "P_WWW_ADDRESS";
|
||||
|
||||
public static final String P_WWW_DBDRIVE = "WWW_DBDRIVE";
|
||||
|
||||
public static final String P_WWW_DBNAME = "WWW_DBNAME";
|
||||
|
||||
public static final String P_WWW_PASSWORD = "WWW_PASSWORD";
|
||||
|
||||
public static final String P_WWW_USER = "WWW_USER";
|
||||
|
||||
public static final String P_WWW_CATALOG = "WWW_CATALOG";
|
||||
|
||||
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 DBAdapter.SEPARATOR;
|
||||
return getParm("PATHFOTO").getTesto();
|
||||
}
|
||||
|
||||
public String getPathBaseFotoRidotte() {
|
||||
if (getApFull() == null)
|
||||
return "/";
|
||||
return getParm("PATHFOTO_RIDOTTE").getTesto();
|
||||
}
|
||||
|
||||
public boolean isModGara() {
|
||||
long mg = getParm("MODGARA").getNumeroLong();
|
||||
if (mg > 0L)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isModGara(long l_id_gara) {
|
||||
long mg = getParm("MODGARA").getNumeroLong();
|
||||
if (mg == l_id_gara)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public ApplParmFull getApRemoto() {
|
||||
apRemoto = null;
|
||||
if (apRemoto == null)
|
||||
apRemoto = new ApplParmFull(new ApplParm(getApFull().getParm("WWW_DBDRIVE").getNumeroInt(), getApFull().getParm("WWW_DBNAME").getTesto(), getApFull().getParm("WWW_CATALOG").getTesto(), getApFull().getParm("WWW_USER").getTesto(), getApFull().getParm("WWW_PASSWORD").getTesto()));
|
||||
return apRemoto;
|
||||
}
|
||||
|
||||
public String getImgLogoFileName() {
|
||||
return getDocBase() + "_img/_logo/watermark.png";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.anag.Postazione;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Users;
|
||||
import java.net.InetAddress;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class CartSvlt extends it.acxent.www.servlet.CartSvlt {
|
||||
protected void socialLogin(HttpServletRequest req, HttpServletResponse res, long l_socialType, String l_socialId, String socialEmail, String l_nome, String l_cognome) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
String jspPage = getCal(req);
|
||||
try {
|
||||
Users utente = new Users(apFull);
|
||||
utente.findUsersBySocialId(l_socialId, l_socialType);
|
||||
if (utente.getId_users() == 0L)
|
||||
utente.findUsersByEmail(socialEmail);
|
||||
if (utente.getId_users() > 0L) {
|
||||
if (utente.getFlgValido().equals("S")) {
|
||||
boolean saveUtente = false;
|
||||
if (utente.getSocialId().isEmpty() || !utente.getSocialId().equals(l_socialId)) {
|
||||
utente.setSocialId(l_socialId);
|
||||
utente.setFlgSocialIdType(l_socialType);
|
||||
saveUtente = true;
|
||||
}
|
||||
if (saveUtente)
|
||||
rp = utente.save();
|
||||
HttpSession session = req.getSession();
|
||||
handleDebug("Ok. Recording loginuser_id in the session.");
|
||||
session.setAttribute("loginUser_id", new Long(utente.getId_users()));
|
||||
String ip = req.getRemoteHost();
|
||||
InetAddress ia = InetAddress.getByName(ip);
|
||||
byte[] ipBytes = ia.getAddress();
|
||||
ia = InetAddress.getByAddress(ipBytes);
|
||||
Postazione pos = new Postazione(getApFull(req));
|
||||
if (!ia.getHostName().isEmpty())
|
||||
pos.findByHostname(ia.getHostName());
|
||||
if (pos.getDBState() != 1)
|
||||
pos.findByIp(ip);
|
||||
if (pos.getDBState() == 1)
|
||||
utente.setId_postazione(pos.getId_postazione());
|
||||
System.out.println("socialLoginByEmail: LOGIN EFFETTUATO: user:" + utente.getLogin() + " ip:" + ip + " HOSTNAME:" +
|
||||
ia.getHostName() + " Postazione: " + utente.getPostazione().getDescrizione());
|
||||
utente.setCurrentIp(ip);
|
||||
session.setAttribute("utenteLogon", utente);
|
||||
req.setAttribute("logon", "logonOk");
|
||||
rp.setStatus(true);
|
||||
}
|
||||
} else {
|
||||
utente.setNome(l_nome);
|
||||
utente.setCognome(l_cognome);
|
||||
utente.setLogin(socialEmail);
|
||||
utente.setEMail(socialEmail);
|
||||
utente.setFlgValido("S");
|
||||
utente.setId_userProfile(utente.getIdUserProfileWww());
|
||||
utente.setSocialId(l_socialId);
|
||||
utente.setFlgSocialIdType(l_socialType);
|
||||
if (getParm("GG_VALIDITA").getNumeroInt() > 0) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(6, getParm("GG_VALIDITA").getNumeroInt());
|
||||
utente.setDataScadenza(new Date(cal.getTimeInMillis()));
|
||||
}
|
||||
if (getParm("N_FOTO_MAX").getNumeroInt() > 0)
|
||||
utente.setNFotoMax(getParm("N_FOTO_MAX").getNumeroLong());
|
||||
Clifor cliente = utente.getClifor();
|
||||
cliente.setNome(l_nome);
|
||||
cliente.setCognome(l_cognome);
|
||||
cliente.setEMail(socialEmail);
|
||||
cliente.setFlgAzienda(0L);
|
||||
cliente.setFlgTipo("C");
|
||||
rp = cliente.save();
|
||||
if (rp.getStatus()) {
|
||||
utente.setId_clifor(cliente.getId_clifor());
|
||||
rp.append(utente.save());
|
||||
}
|
||||
if (!rp.getStatus()) {
|
||||
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Impossibile salvare: " + rp.getMsg());
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
HttpSession session = req.getSession();
|
||||
session.setAttribute("loginUser_id", new Long(utente.getId_users()));
|
||||
session.setAttribute("utenteLogon", utente);
|
||||
req.setAttribute("logon", "logonOk");
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {}
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendMessage(req, e.getMessage());
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
public void _googleSignIn(HttpServletRequest req, HttpServletResponse res) {
|
||||
super._googleSignIn(req, res);
|
||||
}
|
||||
|
||||
public void _facebookSignIn(HttpServletRequest req, HttpServletResponse res) {
|
||||
super._facebookSignIn(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Foto;
|
||||
import it.acxent.pg.FotoCR;
|
||||
import it.acxent.pg.PuntoFoto;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.pg.XFotoGara;
|
||||
import it.acxent.util.Vectumerator;
|
||||
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);
|
||||
Vectumerator<Foto> list = new Foto(getApFull()).findByCR(CR, getPageNumber(req), l_pageRow);
|
||||
DBAdapter.printDebug(true, "" + list.getTotNumberOfRecords() + " foto trovate con CR Foto");
|
||||
req.setAttribute("list", list);
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Foto;
|
||||
import it.acxent.pg.FotoCR;
|
||||
import it.acxent.servlet.AblServletSvlt;
|
||||
import it.acxent.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class FotoSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = -8957358666971014311L;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.FotoCR;
|
||||
import it.acxent.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;
|
||||
int pageRow = (int)getRequestLongParameter(req, "pageRowFS");
|
||||
if (pageRow == 0)
|
||||
pageRow = 4;
|
||||
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, pageRow));
|
||||
setJspPage("/garaCRIndex.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package it.acxent.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);
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Users;
|
||||
import java.io.File;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetFileSvlt extends it.acxent.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(File.separator) + 1;
|
||||
String temp = fileName.substring(0, idx) + "tn_" + fileName.substring(0, 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 = getDocBase() + getDocBase();
|
||||
} else {
|
||||
fileName = getDocBase() + getDocBase();
|
||||
}
|
||||
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 it.acxent.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class GetFileTnAdminSvlt extends GetFileTnSvlt {
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileTnAdmin(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
_fileTnAdmin(req, res);
|
||||
}
|
||||
|
||||
protected boolean checkLoginProfile(HttpServletRequest req) {
|
||||
try {
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.pg.Foto;
|
||||
import it.acxent.pg.Users;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
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) {
|
||||
try {
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
boolean inviaFile = true;
|
||||
boolean inviaTn = false;
|
||||
Users bean = new Users(apFull);
|
||||
bean.findByPrimaryKey(getLoginUserId(req));
|
||||
long l_id_foto = getId_foto(req);
|
||||
Foto foto = new Foto(apFull);
|
||||
foto.findByPrimaryKey(l_id_foto);
|
||||
if (bean.getFlgMiniature() == 1L)
|
||||
inviaTn = true;
|
||||
if (foto.getPuntoFoto().getGara().getFlgFree() == 1L) {
|
||||
inviaFile = true;
|
||||
} 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 long getId_foto(HttpServletRequest req) {
|
||||
long l_id_foto = getRequestLongParameter(req, "id_foto");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return l_id_foto;
|
||||
}
|
||||
|
||||
private void inviaFile(boolean inviaTn, HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
String fileName = "";
|
||||
long l_id_foto = getId_foto(req);
|
||||
Foto foto = new Foto(apFull);
|
||||
if (l_id_foto == 0L) {
|
||||
fileName = 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)
|
||||
fileName = null;
|
||||
if (fileName != null && fileName.indexOf("_Y") > 0 && getLoginUser(req).getId_userProfile() != 1L)
|
||||
fileName = null;
|
||||
if (fileName != null && fileName.indexOf("_Z") > 0 && getLoginUser(req).getId_userProfile() != 111L)
|
||||
fileName = null;
|
||||
}
|
||||
} else {
|
||||
fileName = 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);
|
||||
} else {
|
||||
String context = req.getRequestURL().toString().substring(0, req.getRequestURL().toString().lastIndexOf("/fotoOriginali/"));
|
||||
String absPage = context + "/fotoNonPrelevabile.jsp";
|
||||
try {
|
||||
res.sendRedirect(absPage);
|
||||
} catch (Exception e) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if (e.getCause() != null) {
|
||||
msg.append("Causa:\n");
|
||||
msg.append(e.getCause().getMessage());
|
||||
msg.append("\n");
|
||||
}
|
||||
msg.append(e.getMessage());
|
||||
handleDebug(e, 2);
|
||||
forceMessage(req, getJspPage(req));
|
||||
req.setAttribute("errorMsg", msg.toString());
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp");
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void _fileTnAdmin(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();
|
||||
System.out.println("GetFileTnSvlt " + requestURI);
|
||||
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 = getDocBase() + "_img/_imgNotFound.png";
|
||||
} else {
|
||||
foto.findByPrimaryKey(l_id_foto);
|
||||
if (foto.getDBState() == 1) {
|
||||
fileName = foto.getPathCompletoRidottaFile();
|
||||
if (new File(fileName).exists());
|
||||
} else {
|
||||
fileName = getDocBase() + "_img/_imgNotFound.png";
|
||||
}
|
||||
}
|
||||
if (fileName != null && !fileName.isEmpty())
|
||||
sendFile(fileName, req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package it.acxent.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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
|
||||
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;
|
||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||
import com.google.api.client.json.gson.GsonFactory;
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.cc.Attivita;
|
||||
import it.acxent.common.Postazione;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.RigaDocumentoCR;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Users;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
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;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
public class Logon2Svlt extends it.acxent.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 it.acxent.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 if (getCmd(req).equals("googleSignIn")) {
|
||||
_googleSignIn(req, res);
|
||||
} else {
|
||||
super.otherCommands(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _googleSignIn(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
Attivita attivita = Attivita.getDefaultInstance(apFull);
|
||||
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(new NetHttpTransport(), new GsonFactory())
|
||||
|
||||
.setAudience(Collections.singletonList(attivita.getPGoogleSigninClientId()))
|
||||
|
||||
|
||||
|
||||
.build();
|
||||
String l_g_csrf_token = getRequestParameter(req, "g_csrf_token");
|
||||
String l_credential = getRequestParameter(req, "credential");
|
||||
String csrf_token_cookie = getCookie(req, "g_csrf_token").getValue();
|
||||
if (csrf_token_cookie == null || csrf_token_cookie.isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("No CSRF token in Cookie");
|
||||
}
|
||||
if (l_g_csrf_token.isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("No CSRF token in post body");
|
||||
}
|
||||
if (!l_g_csrf_token.equals(csrf_token_cookie)) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Failed to verify double submit cookie");
|
||||
}
|
||||
if (l_credential.isEmpty()) {
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Failed to get credentials");
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
try {
|
||||
GoogleIdToken idToken = verifier.verify(l_credential);
|
||||
if (idToken != null) {
|
||||
GoogleIdToken.Payload payload = idToken.getPayload();
|
||||
String userId = payload.getSubject();
|
||||
String email = payload.getEmail();
|
||||
boolean emailVerified = Boolean.valueOf(payload.getEmailVerified().booleanValue());
|
||||
String cognome = (String)payload.get("family_name");
|
||||
String nome = (String)payload.get("given_name");
|
||||
if (emailVerified)
|
||||
socialLogin(req, res, 0L, userId, email, nome, cognome);
|
||||
} else {
|
||||
System.out.println("Invalid ID token.xx");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
String jspPage = getCal(req);
|
||||
if (jspPage.isEmpty())
|
||||
jspPage = " ";
|
||||
sendMessage(req, rp.getMsg());
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
private void socialLogin(HttpServletRequest req, HttpServletResponse res, long l_socialType, String l_socialId, String socialEmail, String l_nome, String l_cognome) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
ResParm rp = new ResParm(true);
|
||||
String jspPage = getCal(req);
|
||||
try {
|
||||
Users utente = new Users(apFull);
|
||||
utente.findUsersBySocialId(l_socialId, l_socialType);
|
||||
if (utente.getId_users() == 0L)
|
||||
utente.findUsersByEmail(socialEmail);
|
||||
if (utente.getId_users() > 0L) {
|
||||
if (utente.getFlgValido().equals("S")) {
|
||||
boolean saveUtente = false;
|
||||
if (utente.getSocialId().isEmpty() || !utente.getSocialId().equals(l_socialId)) {
|
||||
utente.setSocialId(l_socialId);
|
||||
utente.setFlgSocialIdType(l_socialType);
|
||||
saveUtente = true;
|
||||
}
|
||||
if (saveUtente)
|
||||
rp = utente.save();
|
||||
HttpSession session = req.getSession();
|
||||
handleDebug("Ok. Recording loginuser_id in the session.");
|
||||
session.setAttribute("loginUser_id", new Long(utente.getId_users()));
|
||||
String ip = req.getRemoteHost();
|
||||
InetAddress ia = InetAddress.getByName(ip);
|
||||
byte[] ipBytes = ia.getAddress();
|
||||
ia = InetAddress.getByAddress(ipBytes);
|
||||
Postazione pos = new Postazione(getApFull(req));
|
||||
if (!ia.getHostName().isEmpty())
|
||||
pos.findByHostname(ia.getHostName());
|
||||
if (pos.getDBState() != 1)
|
||||
pos.findByIp(ip);
|
||||
if (pos.getDBState() == 1)
|
||||
utente.setId_postazione(pos.getId_postazione());
|
||||
System.out.println("socialLoginByEmail: LOGIN EFFETTUATO: user:" + utente.getLogin() + " ip:" + ip + " HOSTNAME:" +
|
||||
ia.getHostName() + " Postazione: " + utente.getPostazione().getDescrizione());
|
||||
utente.setCurrentIp(ip);
|
||||
session.setAttribute("utenteLogon", utente);
|
||||
req.setAttribute("logon", "logonOk");
|
||||
rp.setStatus(true);
|
||||
}
|
||||
} else {
|
||||
utente.setNome(l_nome);
|
||||
utente.setCognome(l_cognome);
|
||||
utente.setLogin(socialEmail);
|
||||
utente.setEMail(socialEmail);
|
||||
utente.setFlgValido("S");
|
||||
utente.setId_userProfile(utente.getIdUserProfileWww());
|
||||
utente.setSocialId(l_socialId);
|
||||
utente.setFlgSocialIdType(l_socialType);
|
||||
if (getParm("GG_VALIDITA").getNumeroInt() > 0) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(6, getParm("GG_VALIDITA").getNumeroInt());
|
||||
utente.setDataScadenza(new Date(cal.getTimeInMillis()));
|
||||
}
|
||||
if (getParm("N_FOTO_MAX").getNumeroInt() > 0)
|
||||
utente.setNFotoMax(getParm("N_FOTO_MAX").getNumeroLong());
|
||||
Clifor cliente = utente.getClifor();
|
||||
cliente.setNome(l_nome);
|
||||
cliente.setCognome(l_cognome);
|
||||
cliente.setEMail(socialEmail);
|
||||
cliente.setFlgAzienda(0L);
|
||||
cliente.setFlgTipo("C");
|
||||
rp = cliente.save();
|
||||
if (rp.getStatus()) {
|
||||
utente.setId_clifor(cliente.getId_clifor());
|
||||
rp.append(utente.save());
|
||||
}
|
||||
if (!rp.getStatus()) {
|
||||
sendMessage(req, "Impossibile salvare: " + rp.getMsg());
|
||||
rp.setStatus(false);
|
||||
rp.setMsg("Impossibile salvare: " + rp.getMsg());
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
HttpSession session = req.getSession();
|
||||
session.setAttribute("loginUser_id", new Long(utente.getId_users()));
|
||||
session.setAttribute("utenteLogon", utente);
|
||||
req.setAttribute("logon", "logonOk");
|
||||
}
|
||||
}
|
||||
if (rp.getStatus()) {
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {}
|
||||
} else {
|
||||
sendMessage(req, rp.getMsg());
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendMessage(req, e.getMessage());
|
||||
setJspPageRelative(jspPage, req);
|
||||
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
|
||||
try {
|
||||
rd.forward((ServletRequest)req, (ServletResponse)res);
|
||||
} catch (Exception exception) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.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 it.acxent.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 it.acxent.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.anag.TipoPagamento;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoCR;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.contab.RigaDocumentoCR;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Coupon;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.util.AbMessages;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class OrdineSvlt extends it.acxent.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(false, false));
|
||||
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 = "";
|
||||
if (rp.getStatus());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected void payCc(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
long l_flgTipoPagamento = getRequestLongParameter(req, "flgTipoPagamento");
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
if (rp.getStatus()) {
|
||||
forceJspPageRelative("DocumentoCc.jsp", req);
|
||||
int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0;
|
||||
req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso));
|
||||
callJsp(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento");
|
||||
bean.setId_tipoPagamento(l_id_tipoPagamento);
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
forceJspPageRelative("Documento.jsp", req);
|
||||
callJsp(req, res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancelOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
try {
|
||||
long l_id_documento = getRequestLongParameter(req, "id_documento");
|
||||
Documento bean = new Documento(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id_documento);
|
||||
bean.setFlgStatoOrdineWww(99L);
|
||||
bean.setFlgStatoPrenotazione(100L);
|
||||
ResParm rp = bean.save();
|
||||
String theMsg = "";
|
||||
req.setAttribute("bean", bean);
|
||||
sendMessage(req, "Documento annullato");
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
forceMessage(req, e.getMessage());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendMailOrder(HttpServletRequest req, HttpServletResponse res) {
|
||||
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) {
|
||||
it.acxent.anag.Users user = (it.acxent.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) {
|
||||
it.acxent.anag.Users user = (it.acxent.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(), 1);
|
||||
if (rp.getStatus()) {
|
||||
coupon.setId_rigaDocumento(rd.getId_rigaDocumento());
|
||||
rp = coupon.save();
|
||||
}
|
||||
}
|
||||
if (coupon.getNFoto() == 1000L) {
|
||||
user.sendRinnovoMailMessage(coupon.getNFoto(), 1);
|
||||
} 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));
|
||||
req.setAttribute("id_clifor", Long.valueOf(bean.getId_clifor()));
|
||||
}
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
public void _aggiornaRichiediFattura(HttpServletRequest req, HttpServletResponse res) {
|
||||
it.acxent.anag.Users user = (it.acxent.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,97 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.bank.servlet.paypal.PayPalSvlt;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.contab.DocumentoInterface;
|
||||
import it.acxent.contab.RigaDocumento;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Users;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Deprecated
|
||||
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()) {
|
||||
String s_amt = ppResponse.getAMT().trim();
|
||||
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.setDescrizioneRiga("Rinnovo abbonamento tramite PayPal trans.#" + ppResponse.getTRANSACTIONID());
|
||||
rd.setNr(1.0D);
|
||||
rd.setImponibile(Double.parseDouble(s_amt));
|
||||
rd.setId_iva(3L);
|
||||
rp = Documento.addRigaDocumento((DocumentoInterface)doc, rd);
|
||||
if (rp.getStatus()) {
|
||||
System.out.println("recrod order:amt: " + s_amt + " cliente: " + user.getCognomeNome());
|
||||
if (s_amt.equals("40.00")) {
|
||||
rp = user.rinnovaAnno(3000L, 3);
|
||||
user.sendRinnovoMailMessage(3000L, 3);
|
||||
} else if (s_amt.equals("20.00")) {
|
||||
rp = user.rinnovaAnno(1000L, 1);
|
||||
user.sendRinnovoMailMessage(1000L, 1);
|
||||
} else {
|
||||
rp = user.rinnovaAnno(25L, 1);
|
||||
user.sendRinnovoMailMessage(25L, 1);
|
||||
}
|
||||
}
|
||||
req.setAttribute("bean", doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.bank.paypal.PayPalResp;
|
||||
import it.acxent.bank.servlet.paypal.GetPayPalResponseSvlt;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.pg.Users;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@Deprecated
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.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) {
|
||||
try {
|
||||
return 4L;
|
||||
} 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 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 it.acxent.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.pg.UsersCR;
|
||||
import it.acxent.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 = msg + " Attenzione!! Impossibile mandare email di conferma.";
|
||||
} else {
|
||||
msg = 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 = 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 = 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 = 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 = 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 it.acxent.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.bank.sella.SellaResp;
|
||||
import it.acxent.bank.servlet.sella.GetSellaResponseSvlt;
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.contab.Documento;
|
||||
import it.acxent.db.ApplParm;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class 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) {}
|
||||
}
|
||||
|
|
@ -0,0 +1,452 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.anag.Cliente;
|
||||
import it.acxent.anag.Clifor;
|
||||
import it.acxent.anag.Nazione;
|
||||
import it.acxent.anag.NazioneCR;
|
||||
import it.acxent.cart.CartStatus;
|
||||
import it.acxent.cart.servlet.AcCartSvlt;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.pg.UsersCR;
|
||||
import it.acxent.util.CodiceFiscale;
|
||||
import it.acxent.util.Vectumerator;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class UsersSvlt extends it.acxent.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 "users";
|
||||
}
|
||||
|
||||
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);
|
||||
if (bean.getLogin().contains("@"))
|
||||
bean.setEMail(bean.getLogin());
|
||||
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 = msg + " Login già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(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 = msg + " Email già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
}
|
||||
} else if (bean.isCodFiscDuplicated()) {
|
||||
msg = msg + " Codice Fiscale già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(getBeanPageName(req) + ".jsp", req);
|
||||
cli.setCodFisc("");
|
||||
bean.setCodFisc("");
|
||||
bean.setClifor((Clifor)cli);
|
||||
req.setAttribute("bean", bean);
|
||||
callJsp(req, res);
|
||||
} else if (cli.isPIvaDuplicated()) {
|
||||
msg = msg + " Partita Iva già presente in archivio";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(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 = msg + " Il codice fiscale non è valido:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(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 = msg + " Partita iva non valida:";
|
||||
forceMessage(req, msg);
|
||||
fillComboAfterDetail((DBAdapter)bean, req, res);
|
||||
setJspPageRelative(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 (bean.getLogin().contains("@"))
|
||||
req.setAttribute("eMail", bean.getLogin());
|
||||
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()));
|
||||
}
|
||||
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 = msg + " Email già presente in archivio - " + msg;
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
if (bean.isEmailDuplicatedNoMl()) {
|
||||
rp.setErrorCode(1L);
|
||||
} else {
|
||||
rp.setErrorCode(2L);
|
||||
}
|
||||
req.setAttribute("RP", rp);
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
bean.setFlgValido("N");
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileMailingList());
|
||||
bean.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(req.getRemoteHost() + " " + req.getRemoteHost());
|
||||
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 = msg + " Email già presente in archivio - " + msg;
|
||||
rp.setStatus(false);
|
||||
rp.setMsg(msg);
|
||||
if (bean.isEmailDuplicatedNoMl()) {
|
||||
rp.setErrorCode(1L);
|
||||
} else {
|
||||
rp.setErrorCode(2L);
|
||||
}
|
||||
req.setAttribute("RP", rp);
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
bean.setFlgValido("N");
|
||||
bean.setFlgMl(1L);
|
||||
bean.setId_userProfile(bean.getIdUserProfileMailingList());
|
||||
bean.setLogin("ML_" + bean.getEMail());
|
||||
bean.setCognome("MLC_" + bean.getEMail());
|
||||
bean.setNome("MLN_" + bean.getEMail());
|
||||
rp = bean.save();
|
||||
if (rp.getStatus())
|
||||
bean.sendMLMailMessageOLD(req.getRemoteHost() + " " + req.getRemoteHost());
|
||||
forceJspPageRelative("mailingListUser.jsp", req);
|
||||
callJsp(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected it.acxent.common.Users getUser(HttpServletRequest req) {
|
||||
return new Users(getApFull(req));
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
String msg;
|
||||
Users bean = (Users)beanA;
|
||||
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 = msg + " Attenzione!! Impossibile mandare email di conferma.";
|
||||
bean.setFlgEmailOk(0L);
|
||||
} else {
|
||||
msg = msg + " Inviata mail di conferma.";
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
} else {
|
||||
bean.setFlgEmailOk(1L);
|
||||
}
|
||||
setJspPageRelative(getBeanPageName(req) + "Reg.jsp", req);
|
||||
} else {
|
||||
msg = "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();
|
||||
if (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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package it.acxent.pg.servlet;
|
||||
|
||||
import it.acxent.cart.Cart;
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.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 it.acxent.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getPathImgArticoli() {
|
||||
return getDocBase() + "/" + getDocBase();
|
||||
}
|
||||
|
||||
public long getHomeType() {
|
||||
return getParm("HOME_TYPE").getNumeroLong();
|
||||
}
|
||||
|
||||
protected int getPageRow(HttpServletRequest req) {
|
||||
int pageRow = getParm("PAGE_ROW").getNumeroInt();
|
||||
return (pageRow == 0) ? 4 : pageRow;
|
||||
}
|
||||
|
||||
public NumberFormat getNf0(HttpServletRequest req) {
|
||||
if (nf0 == null) {
|
||||
nf0 = NumberFormat.getInstance(getLocale(req));
|
||||
nf0.setMaximumFractionDigits(0);
|
||||
nf0.setMinimumFractionDigits(0);
|
||||
}
|
||||
return nf0;
|
||||
}
|
||||
|
||||
protected double getDeliveryCost(HttpServletRequest req) {
|
||||
return getParm(Cart.P_DELIVERY_COST).getNumeroDouble();
|
||||
}
|
||||
|
||||
protected double getMoreCost(HttpServletRequest req) {
|
||||
return getParm(Cart.P_MORE_COST).getNumeroDouble();
|
||||
}
|
||||
|
||||
protected 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,94 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Coupon;
|
||||
import it.acxent.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), "stampaCoupon.pdf");
|
||||
}
|
||||
|
||||
public void _couponCsv(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
CouponCR CR = new CouponCR(apFull);
|
||||
fillObject(req, CR);
|
||||
Coupon bean = new Coupon(apFull);
|
||||
bean.creaFileCvs(CR);
|
||||
sendHtmlMsgResponse(req, res, "<a href='../../" + CR.getFileName() + "' target='_blank'>File export in formato cvs (Excel)</a>");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Foto;
|
||||
import it.acxent.pg.FotoCR;
|
||||
import it.acxent.pg.GaraCR;
|
||||
import it.acxent.pg.PuntoFoto;
|
||||
import it.acxent.pg.PuntoFotoCR;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class FotoSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = -7583627968141093970L;
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
if (getCmd(req).equals("foto")) {
|
||||
Foto bean = null;
|
||||
long l_id = getRequestLongParameter(req, "id_foto");
|
||||
bean = new Foto(getApFull());
|
||||
bean.findByPrimaryKey(l_id);
|
||||
req.setAttribute("bean", bean);
|
||||
setJspPageRelative("fotoImg.jsp", req);
|
||||
callJsp(req, res);
|
||||
} else {
|
||||
search(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
Foto bean = (Foto)beanA;
|
||||
PuntoFotoCR CR = new PuntoFotoCR();
|
||||
CR.setId_gara(getId_garaLte(req));
|
||||
CR.setTipoPuntoFoto(getRequestParameter(req, "tipoPuntoFoto"));
|
||||
req.setAttribute("listaPuntiFoto", new PuntoFoto(getApFull()).findByCR(CR, 0, 0));
|
||||
if (CR.getId_gara() > 0L)
|
||||
req.setAttribute("listaTipiPuntoFoto", new PuntoFoto(getApFull()).findTipiPuntoFoto(CR.getId_gara()));
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {
|
||||
GaraCR CRgara = new GaraCR();
|
||||
PuntoFotoCR CR = new PuntoFotoCR();
|
||||
if (getId_garaLte(req) == 0L) {
|
||||
CR.setId_gara(getRequestLongParameter(req, "id_gara"));
|
||||
} else {
|
||||
CRgara.setId_gara(getId_garaLte(req));
|
||||
CR.setId_gara(getId_garaLte(req));
|
||||
}
|
||||
CR.setTipoPuntoFoto(getRequestParameter(req, "tipoPuntoFoto"));
|
||||
if (CR.getId_gara() > 0L) {
|
||||
req.setAttribute("listaPuntiFoto", new PuntoFoto(getApFull()).findByCR(CR, 0, 0));
|
||||
req.setAttribute("listaTipiPuntoFoto", new PuntoFoto(getApFull()).findTipiPuntoFoto(CR.getId_gara()));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
super.prepareNewRecord(req, res);
|
||||
}
|
||||
|
||||
public void _trasferisciCoupon(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.sqlActions(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
FotoCR CR = new FotoCR(getApFull());
|
||||
if (!getAct(req).equals("del") || !getAct(req).equals("back"))
|
||||
fillObject(req, CR);
|
||||
if (getAct(req).equals("back") &&
|
||||
req.getSession().getAttribute(getATTR_CRBEAN(req)) != null) {
|
||||
CR = (FotoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
|
||||
req.setAttribute("id_gara", Long.valueOf(CR.getId_gara()));
|
||||
}
|
||||
if (getId_garaLte(req) == 0L) {
|
||||
CR.setId_gara(getRequestLongParameter(req, "id_gara"));
|
||||
} else {
|
||||
CR.setId_gara(getId_garaLte(req));
|
||||
}
|
||||
req.setAttribute("CR", CR);
|
||||
req.getSession().setAttribute(getATTR_CRBEAN(req), CR);
|
||||
if (CR.getId_gara() > 0L || CR.getId_fotoS() > 0L || !CR.getFile().isEmpty())
|
||||
if (CR.getFlgReport().equals("")) {
|
||||
req.setAttribute("list", new Foto(getApFull()).findByCR(CR, getPageNumber(req), getPageRow(req)));
|
||||
} else {
|
||||
req.setAttribute("list", new Foto(getApFull()).findByCR(CR, 0, 0));
|
||||
}
|
||||
fillComboAfterSearch(CR, req, res);
|
||||
callJsp(req, res);
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
Foto bean = (Foto)beanA;
|
||||
long l_id = bean.getId_foto();
|
||||
if (!getAct2(req).isEmpty()) {
|
||||
FotoCR CR = new FotoCR(getApFull());
|
||||
CR = (FotoCR)req.getSession().getAttribute(getATTR_CRBEAN(req));
|
||||
if (CR == null)
|
||||
CR = new FotoCR(getApFull());
|
||||
if (getAct2(req).equals("next")) {
|
||||
l_id = bean.getNextId_foto(CR);
|
||||
} else if (getAct2(req).equals("prev")) {
|
||||
l_id = bean.getPrevId_foto(CR);
|
||||
}
|
||||
bean.findByPrimaryKey(l_id);
|
||||
req.setAttribute("id_foto", Long.valueOf(l_id));
|
||||
req.setAttribute("bean", bean);
|
||||
}
|
||||
return super.afterSave(beanA, req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,515 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.common.Parm;
|
||||
import it.acxent.common.TtFont;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.pg.Foto;
|
||||
import it.acxent.pg.Gara;
|
||||
import it.acxent.pg.GaraCR;
|
||||
import it.acxent.pg.PuntoFoto;
|
||||
import it.acxent.util.AbMessages;
|
||||
import it.acxent.util.StringTokenizer;
|
||||
import java.io.File;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg_RUS/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 _creaRiduzioniTest(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() == true) {
|
||||
String fileTest = "";
|
||||
String dirRidotte = getPathTmpFull();
|
||||
String fileSorgente = getDocBase() + getDocBase() + bean.getPathImg();
|
||||
rp = Foto.creaRiduzioniPerWeb(bean, fileSorgente, dirRidotte, true);
|
||||
if (rp.getStatus())
|
||||
fileTest = rp.getInfoMsg();
|
||||
fileSorgente = getDocBase() + getDocBase() + bean.getPathImg();
|
||||
rp = Foto.creaRiduzioniPerWeb(bean, fileSorgente, dirRidotte, true);
|
||||
if (rp.getStatus()) {
|
||||
if (!fileTest.isEmpty())
|
||||
fileTest = fileTest + ",";
|
||||
fileTest = fileTest + fileTest;
|
||||
}
|
||||
if (fileTest.length() > 0) {
|
||||
StringTokenizer st = new StringTokenizer(fileTest, ",");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken().trim();
|
||||
sb.append("<a href='../../" + getPathTmp() + token + "' download>File " + token + "</a><br>");
|
||||
}
|
||||
sendHtmlMsgResponse(req, res, sb.toString());
|
||||
} else {
|
||||
sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg());
|
||||
}
|
||||
}
|
||||
} 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() != true) {
|
||||
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);
|
||||
}
|
||||
|
||||
public 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);
|
||||
if (bean.getId_puntoFoto() > 0L) {
|
||||
Foto foto = new Foto(apFull);
|
||||
ResParm rp = foto.startCreaPreviewMT(bean);
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Errore! Punto foto non valido!");
|
||||
}
|
||||
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() == true) {
|
||||
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() == true) {
|
||||
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, "IMPORT CSV PISA: ");
|
||||
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 targetDir = getPathTmpFull();
|
||||
checkAndMakeDir(targetDir);
|
||||
String l_fileName = targetDir + targetDir;
|
||||
if (new File(l_fileName).exists()) {
|
||||
String targetCsvDir = getDocBase() + "csv/";
|
||||
checkAndMakeDir(targetCsvDir);
|
||||
String targetFile = targetCsvDir + targetCsvDir + ".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);
|
||||
}
|
||||
|
||||
public void _annullaModGara(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Parm parm = new Parm(apFull);
|
||||
parm.findByCodice("MODGARA");
|
||||
parm.setNumero(0.0D);
|
||||
ResParm rp = parm.save();
|
||||
apFull.resetCurrentApParms();
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _annullaModGaraCR(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
Parm parm = new Parm(apFull);
|
||||
parm.findByCodice("MODGARA");
|
||||
parm.setNumero(0.0D);
|
||||
ResParm rp = parm.save();
|
||||
apFull.resetCurrentApParms();
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _exportGaraSuWww(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_gara = getRequestLongParameter(req, "id_gara");
|
||||
final Gara bean = new Gara(getApFull());
|
||||
bean.findByPrimaryKey(l_id_gara);
|
||||
if (bean.getId_gara() > 0L) {
|
||||
if (!Gara.threadInvioGaraWww) {
|
||||
Gara.threadInvioGaraWww = true;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
bean.exportGaraDa3PianoAWWW(false);
|
||||
Gara.threadInvioGaraWww = false;
|
||||
}
|
||||
}.start();
|
||||
sendMessage(req, "Threand export gara su WWW avviato!");
|
||||
} else {
|
||||
sendMessage(req, "ATTENZIONE! Threand export gara su WWW gia' in esecuzione!");
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! Codice gara errato");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _exportGaraSuWwwEOcr(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_gara = getRequestLongParameter(req, "id_gara");
|
||||
Gara bean = new Gara(getApFull());
|
||||
ResParm rp = new ResParm(true);
|
||||
bean.findByPrimaryKey(l_id_gara);
|
||||
if (bean.getId_gara() > 0L) {
|
||||
rp = bean.startInvioEOcr(bean, getDebug());
|
||||
if (rp.getStatus()) {
|
||||
sendMessage(req, "Threand export gara + OCR su WWW avviato!");
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! " + rp.getMsg());
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! Codice gara errato");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _exportGaraSuWwwSoloFoto(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_gara = getRequestLongParameter(req, "id_gara");
|
||||
final Gara bean = new Gara(getApFull());
|
||||
bean.findByPrimaryKey(l_id_gara);
|
||||
if (bean.getId_gara() > 0L) {
|
||||
if (!Gara.threadInvioGaraWww) {
|
||||
Gara.threadInvioGaraWww = true;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
bean.exportGaraDa3PianoAWWW(true);
|
||||
Gara.threadInvioGaraWww = false;
|
||||
}
|
||||
}.start();
|
||||
sendMessage(req, "Threand export gara su WWW SOLO FOTO avviato!");
|
||||
} else {
|
||||
sendMessage(req, "ATTENZIONE! Threand export gara su WWW gia' in esecuzione!");
|
||||
}
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! Codice gara errato");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _impostaModGara(HttpServletRequest req, HttpServletResponse res) {
|
||||
ApplParmFull apFull = getApFull(req);
|
||||
long l_id_gara = getRequestLongParameter(req, "id_gara");
|
||||
Gara bean = new Gara(apFull);
|
||||
bean.findByPrimaryKey(l_id_gara);
|
||||
if (bean.getId_gara() > 0L) {
|
||||
Parm parm = new Parm(apFull);
|
||||
parm.findByCodice("MODGARA");
|
||||
parm.setNumero((double)l_id_gara);
|
||||
ResParm rp = parm.save();
|
||||
apFull.resetCurrentApParms();
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "ERRORE! Codice gara errato");
|
||||
}
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id_gara = getId_garaLte(req);
|
||||
if (l_id_gara > 0L) {
|
||||
req.setAttribute("id_gara", Long.valueOf(l_id_gara));
|
||||
showBean(req, res);
|
||||
} else {
|
||||
super.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() == true) {
|
||||
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 _callOcr(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.startOcrThread();
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Impossibile eseguire OCR: codice punto foto =0");
|
||||
}
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _resetPreview(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);
|
||||
if (bean.getId_puntoFoto() > 0L) {
|
||||
ResParm rp = bean.resetPreview();
|
||||
sendMessage(req, rp.getMsg());
|
||||
} else {
|
||||
sendMessage(req, "Errore! Punto foto non valido!");
|
||||
}
|
||||
showBean(req, res);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
sendMessage(req, e.toString());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public void _creaFileExportIdx(HttpServletRequest req, HttpServletResponse res) {
|
||||
Gara bean = new Gara(getApFull());
|
||||
long l_id = getRequestLongParameter(req, "id_gara");
|
||||
bean.findByPrimaryKey(l_id);
|
||||
String targetDir = getPathTmpFull();
|
||||
bean.setFileNameExport("" + getLoginUserId(req) + "_export_" + getLoginUserId(req) + ".txt");
|
||||
ResParm rp = bean.exportFileIdx(targetDir + targetDir);
|
||||
req.setAttribute("fileExportOk", (rp.getStatus() == true) ? "true" : "false");
|
||||
req.setAttribute("fileNameExport", String.valueOf(bean.getFileNameExport()));
|
||||
req.setAttribute("act", "refresh");
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
public class InitUpdateDbSvlt extends it.acxent.servlet.InitUpdateDbSvlt {
|
||||
private static final long serialVersionUID = 2009631091908732636L;
|
||||
|
||||
protected String getProjectVersionTag() {
|
||||
return "cli-rus";
|
||||
}
|
||||
|
||||
protected long getDatabaseVersionNumber() {
|
||||
return 9L;
|
||||
}
|
||||
|
||||
protected String getSubVersionNumber() {
|
||||
return "250611";
|
||||
}
|
||||
|
||||
protected boolean shouldInitCore() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.common.TtFont;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.Gara;
|
||||
import it.acxent.pg.LogFoto;
|
||||
import it.acxent.pg.LogFotoCR;
|
||||
import it.acxent.pg.PuntoFoto;
|
||||
import it.acxent.util.ScaleImages;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg_RUS/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 = getParm("PATHFOTO").getTesto() + getParm("PATHFOTO").getTesto();
|
||||
int scaledWidth = (int)getParm("PREVIEW").getNumero();
|
||||
String rpath = bean.getPathRelativoFoto();
|
||||
if (rpath.lastIndexOf("/") > 0)
|
||||
rpath = rpath.substring(rpath.lastIndexOf("/") + 1);
|
||||
new ScaleImages(apFull, dirFoto, rpath, 0L, scaledWidth, 0, true, false, null, getPathTmpFull(), 10);
|
||||
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,51 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.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 it.acxent.common.Users getUser() {
|
||||
return new Users(getApFull());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.anag.Listino;
|
||||
import it.acxent.art.Reparto;
|
||||
import it.acxent.art.TipoTaglia;
|
||||
import it.acxent.art.TipologiaArticolo;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.pg.TipoGara;
|
||||
import it.acxent.pg.TipoGaraCR;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/pg_RUS/TipoGara.abl"})
|
||||
public class TipoGaraSvlt extends _PgAdminSvlt {
|
||||
private static final long serialVersionUID = 7529084224728549359L;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.common.UserAccess;
|
||||
import it.acxent.db.ApplParmFull;
|
||||
import it.acxent.db.CRAdapter;
|
||||
import it.acxent.db.DBAdapter;
|
||||
import it.acxent.db.ResParm;
|
||||
import it.acxent.newsletter.CodaMessaggi;
|
||||
import it.acxent.newsletter.TemplateMsg;
|
||||
import it.acxent.pg.Users;
|
||||
import it.acxent.pg.UsersCR;
|
||||
import it.acxent.util.AbMessages;
|
||||
import it.acxent.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 it.acxent.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, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Permesso Cancellato");
|
||||
showBean(req, res);
|
||||
} else if (getAct(req).equals("delLog")) {
|
||||
rp = bean.azzeraFotoPrelevate();
|
||||
sendMessage(req, 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(1000L, 1);
|
||||
rp.append(bean.sendRinnovoMailMessage(1000L, 1));
|
||||
sendMessage(req, rp.getMsg());
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
public void _rinnovaAnno3CR(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(3000L, 3);
|
||||
rp.append(bean.sendRinnovoMailMessage(3000L, 3));
|
||||
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(1000L, 1);
|
||||
rp.append(bean.sendRinnovoMailMessage(1000L, 1));
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
|
||||
public void _rinnova25(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(25L, 1);
|
||||
rp.append(bean.sendRinnovoMailMessage(25L, 1));
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
public void _rinnovaAnno3(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(3000L, 3);
|
||||
rp.append(bean.sendRinnovoMailMessage(3000L, 3));
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package it.acxent.pg.servlet.admin;
|
||||
|
||||
import it.acxent.common.Users;
|
||||
import it.acxent.pg.Gara;
|
||||
import it.acxent.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 super.getLoginPage(req, res);
|
||||
}
|
||||
|
||||
protected Users getUser() {
|
||||
return new it.acxent.pg.Users(getApFull());
|
||||
}
|
||||
|
||||
protected boolean useAlwaysSendRedirect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void _aggiornaThreadMsg(HttpServletRequest req, HttpServletResponse res) {
|
||||
sendHtmlMsgResponse(req, res, Gara.threadCreaPuntiFotoMsg.trim());
|
||||
}
|
||||
|
||||
protected long getId_garaLte(HttpServletRequest req) {
|
||||
return getParm("MODGARA").getNumeroLong();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package it.acxent.pg.taglib;
|
||||
|
||||
import it.acxent.pg.FotoCR;
|
||||
import it.acxent.pg.Gara;
|
||||
import it.acxent.taglib.AbstractFillListTag;
|
||||
import it.acxent.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 it.acxent.pg.taglib;
|
||||
|
||||
import it.acxent.pg.TipoGara;
|
||||
import it.acxent.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package it.acxent.pg.taglib;
|
||||
|
||||
import it.acxent.pg.TipoGara;
|
||||
import it.acxent.pg.TipoGaraCR;
|
||||
import it.acxent.taglib.AbstractDbTag;
|
||||
import it.acxent.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,15 @@
|
|||
package it.acxent.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 = "it.acxent.pg.TipoGara";
|
||||
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) };
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue