package it.acxent.face; 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 SelfieFoto extends DBAdapter implements Serializable { private static final long serialVersionUID = 1734518684722L; private long id_selfieFoto; private long id_selfie; private long id_foto; private long label; private String confidence; private Selfie selfie; private Foto foto; public SelfieFoto(ApplParmFull newApplParmFull) { super(newApplParmFull); } public SelfieFoto() {} public void setId_selfieFoto(long newId_selfieFoto) { this.id_selfieFoto = newId_selfieFoto; } public void setId_selfie(long newId_selfie) { this.id_selfie = newId_selfie; setSelfie(null); } public void setId_foto(long newId_foto) { this.id_foto = newId_foto; setFoto(null); } public void setLabel(long newLabel) { this.label = newLabel; } public void setConfidence(String newConfidence) { this.confidence = newConfidence; } public long getId_selfieFoto() { return this.id_selfieFoto; } public long getId_selfie() { return this.id_selfie; } public long getId_foto() { return this.id_foto; } public long getLabel() { return this.label; } public String getConfidence() { return (this.confidence == null) ? "" : this.confidence.trim(); } public void setSelfie(Selfie newSelfie) { this.selfie = newSelfie; } public Selfie getSelfie() { this.selfie = (Selfie)getSecondaryObject(this.selfie, Selfie.class, getId_selfie()); return this.selfie; } 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(SelfieFotoCR CR, int pageNumber, int pageRows) { String s_Sql_Find = "select A.* from SELFIE_FOTO AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); if (!CR.getSearchTxt().trim().isEmpty()) { StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); StringBuffer txt = new StringBuffer("("); while (st.hasMoreTokens()) { String token = st.nextToken(); txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); if (st.hasMoreTokens()) txt.append(" and "); } txt.append(")"); wc.addWc(txt.toString()); } try { PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); return findRows(stmt, pageNumber, pageRows); } catch (SQLException e) { removeCPConnection(); handleDebug(e); return AB_EMPTY_VECTUMERATOR; } } public Vectumerator findBySelfie(long l_id_selfie) { String s_Sql_Find = "select A.* from SELFIE_FOTO AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); wc.addWc("A.id_Selfie=" + l_id_selfie); 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; } } }