62 lines
2.2 KiB
Java
62 lines
2.2 KiB
Java
|
|
package it.acxent.face;
|
||
|
|
|
||
|
|
import it.acxent.common.StatusMsg;
|
||
|
|
import it.acxent.db.ApplParmFull;
|
||
|
|
import it.acxent.db.ResParm;
|
||
|
|
import it.acxent.db.WcString;
|
||
|
|
import it.acxent.face.api.FaceRecognitionApi;
|
||
|
|
import it.acxent.face.api.FaceRecognitionApiResult;
|
||
|
|
import it.acxent.util.StringTokenizer;
|
||
|
|
import it.acxent.util.Vectumerator;
|
||
|
|
import java.io.Serializable;
|
||
|
|
import java.sql.PreparedStatement;
|
||
|
|
import java.sql.SQLException;
|
||
|
|
|
||
|
|
public class FaceRecognizer extends it.acxent.dm.FaceRecognizer implements Serializable {
|
||
|
|
private static final long serialVersionUID = 1701089333600L;
|
||
|
|
|
||
|
|
public FaceRecognizer(ApplParmFull newApplParmFull) {
|
||
|
|
super(newApplParmFull);
|
||
|
|
}
|
||
|
|
|
||
|
|
public FaceRecognizer() {}
|
||
|
|
|
||
|
|
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 ResParm resetInvioTraining() {
|
||
|
|
FotoFace fotoFace = new FotoFace(getApFull());
|
||
|
|
ResParm rp = fotoFace.resetTsTraingFace();
|
||
|
|
if (getId_faceRecognizer() == 0L)
|
||
|
|
return new ResParm(false, "Errore! id nullo");
|
||
|
|
FaceRecognitionApi fra = new FaceRecognitionApi(getApFull());
|
||
|
|
FaceRecognitionApiResult fraRes = fra.__resetTraining(getId_faceRecognizer());
|
||
|
|
FotoFace.threadBuildRecognizer = false;
|
||
|
|
StatusMsg.deleteAllMsg(getApFull());
|
||
|
|
rp.appendMsg(fraRes.getMsg());
|
||
|
|
return rp;
|
||
|
|
}
|
||
|
|
}
|