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