package it.acxent.face.fr; 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.PreparedStatement; import java.sql.SQLException; public class Facer extends DBAdapter implements Serializable { private static final long serialVersionUID = 1730299088138L; private long id_facer; private long id_faceRecognizer; private String md5; private long label; private String fileAlternativo; private double confidence; private FaceRecognizer faceRecognizer; public static final String PATH_IMG_FACE_RECOGNITION = "_faceRecognition/"; public Facer(ApplParmFull newApplParmFull) { super(newApplParmFull); } public Facer() {} public void setId_facer(long newId_facer) { this.id_facer = newId_facer; } public void setId_faceRecognizer(long newId_faceRecognizer) { this.id_faceRecognizer = newId_faceRecognizer; setFaceRecognizer(null); } public void setMd5(String newMd5) { this.md5 = newMd5; } public void setLabel(long newLabel) { this.label = newLabel; } public long getId_facer() { return this.id_facer; } public long getId_faceRecognizer() { return this.id_faceRecognizer; } public String getMd5() { return (this.md5 == null) ? "" : this.md5.trim(); } public long getLabel() { return this.label; } public void setFaceRecognizer(FaceRecognizer newFaceRecognizer) { this.faceRecognizer = newFaceRecognizer; } public FaceRecognizer getFaceRecognizer() { this.faceRecognizer = (FaceRecognizer)getSecondaryObject(this.faceRecognizer, FaceRecognizer.class, getId_faceRecognizer()); return this.faceRecognizer; } protected ResParm checkDeleteCascade() { return new ResParm(true); } protected void deleteCascade() {} public Vectumerator findByCR(FacerCR CR, int pageNumber, int pageRows) { String s_Sql_Find = "select A.* from FACER AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); if (CR.getLabel() > 0L) wc.addWc("A.label =" + CR.getLabel()); if (!CR.getMd5().isEmpty()) wc.addWc("A.md5 ='" + CR.getMd5() + "'"); 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 getFullFileName() { return getPathFaceImg() + getPathFaceImg() + ".jpg"; } public void findByMd5Recognizer(String l_md5, long l_id_faceRecognizer) { String s_Sql_Find = "select A.* from FACER AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); wc.addWc("A.md5='" + l_md5 + "'"); wc.addWc("A.id_faceRecognizer=" + l_id_faceRecognizer); try { PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); findFirstRecord(stmt); } catch (SQLException e) { removeCPConnection(); handleDebug(e); } } public void findByLabel(long l_label) { String s_Sql_Find = "select A.* from FACER AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); wc.addWc("A.label=" + l_label); try { PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); findFirstRecord(stmt); } catch (SQLException e) { removeCPConnection(); handleDebug(e); } } public String getPathFaceImg() { return getParm("path_img_base").getTesto() + "_faceRecognition/" + getParm("path_img_base").getTesto(); } public String getFileAlternativo() { return (this.fileAlternativo == null) ? "" : this.fileAlternativo.trim(); } public void setFileAlternativo(String fileAlternativo) { this.fileAlternativo = fileAlternativo; } public double getConfidence() { return this.confidence; } public void setConfidence(double confidence) { this.confidence = confidence; } }