205 lines
5.1 KiB
Java
205 lines
5.1 KiB
Java
package it.acxent.dm;
|
|
|
|
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.Timestamp;
|
|
|
|
public abstract class FaceRecognizer extends DBAdapter implements Serializable {
|
|
private static final long serialVersionUID = 1701089773600L;
|
|
|
|
private long id_faceRecognizer;
|
|
|
|
private long flgTipo;
|
|
|
|
private String codice;
|
|
|
|
private String descrizione;
|
|
|
|
private String fileName;
|
|
|
|
private long nTrainingImages;
|
|
|
|
private Date dataTraining;
|
|
|
|
private Timestamp tsStart;
|
|
|
|
private Timestamp tsStop;
|
|
|
|
private long faceSize;
|
|
|
|
public static final long RECOGNIZER_LBPH = 0L;
|
|
|
|
public static final long RECOGNIZER_FISH = 1L;
|
|
|
|
public static final long RECOGNIZER_EIGEN = 2L;
|
|
|
|
public static final int TOPT_NUMB_RECOGNIZER = 1;
|
|
|
|
public FaceRecognizer(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public FaceRecognizer() {}
|
|
|
|
public void setId_faceRecognizer(long newId_faceRecognizer) {
|
|
this.id_faceRecognizer = newId_faceRecognizer;
|
|
}
|
|
|
|
public void setFlgTipo(long newFlgTipo) {
|
|
this.flgTipo = newFlgTipo;
|
|
}
|
|
|
|
public void setCodice(String newCodice) {
|
|
this.codice = newCodice;
|
|
}
|
|
|
|
public void setDescrizione(String newDescrizione) {
|
|
this.descrizione = newDescrizione;
|
|
}
|
|
|
|
public void setFileName(String newFileName) {
|
|
this.fileName = newFileName;
|
|
}
|
|
|
|
public void setNTrainingImages(long newNTrainingImages) {
|
|
this.nTrainingImages = newNTrainingImages;
|
|
}
|
|
|
|
public void setDataTraining(Date newDataTraining) {
|
|
this.dataTraining = newDataTraining;
|
|
}
|
|
|
|
public long getId_faceRecognizer() {
|
|
return this.id_faceRecognizer;
|
|
}
|
|
|
|
public long getFlgTipo() {
|
|
return this.flgTipo;
|
|
}
|
|
|
|
public String getCodice() {
|
|
return (this.codice == null) ? "" : this.codice.trim();
|
|
}
|
|
|
|
public String getDescrizione() {
|
|
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
|
}
|
|
|
|
public String getFileName() {
|
|
return (this.fileName == null) ? getCodice() : this.fileName.trim();
|
|
}
|
|
|
|
public long getNTrainingImages() {
|
|
return this.nTrainingImages;
|
|
}
|
|
|
|
public Date getDataTraining() {
|
|
return this.dataTraining;
|
|
}
|
|
|
|
protected ResParm checkDeleteCascade() {
|
|
return new ResParm(true);
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator<FaceRecognizer> findByCR(FaceRecognizerCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from FACE_RECOGNIZER 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 void findByCode(String l_code) {
|
|
String s_Sql_Find = "select A.* from FACE_RECOGNIZER AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.code='" + l_code + "'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public void findBySessionId(String l_sessionId) {
|
|
String s_Sql_Find = "select A.* from FACE_RECOGNIZER AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc("A.sessionId='" + l_sessionId + "'");
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public Timestamp getTsStart() {
|
|
return this.tsStart;
|
|
}
|
|
|
|
public void setTsStart(Timestamp tsStart) {
|
|
this.tsStart = tsStart;
|
|
}
|
|
|
|
public Timestamp getTsStop() {
|
|
return this.tsStop;
|
|
}
|
|
|
|
public void setTsStop(Timestamp tsStop) {
|
|
this.tsStop = tsStop;
|
|
}
|
|
|
|
public static final String getTipo(long l_flgTipo) {
|
|
if (l_flgTipo == 2L)
|
|
return "EIGEN";
|
|
if (l_flgTipo == 0L)
|
|
return "LBPH";
|
|
if (l_flgTipo == 1L)
|
|
return "FISH";
|
|
return "xx";
|
|
}
|
|
|
|
public final String getTipo() {
|
|
return getTipo(getFlgTipo());
|
|
}
|
|
|
|
public long getFaceSize() {
|
|
return (this.faceSize == 0L) ? 96L : this.faceSize;
|
|
}
|
|
|
|
public void setFaceSize(long faceSize) {
|
|
this.faceSize = faceSize;
|
|
}
|
|
}
|