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 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; } } }