64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
package it.acxent.anag;
|
|
|
|
import it.acxent.db.ApplParmFull;
|
|
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 Esercizio extends _AnagAdapter implements Serializable {
|
|
private long id_esercizio;
|
|
|
|
private long flgStato;
|
|
|
|
public Esercizio(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public Esercizio() {}
|
|
|
|
public void setId_esercizio(long newId_esercizio) {
|
|
this.id_esercizio = newId_esercizio;
|
|
}
|
|
|
|
public void setFlgStato(long newFlgStato) {
|
|
this.flgStato = newFlgStato;
|
|
}
|
|
|
|
public long getId_esercizio() {
|
|
return this.id_esercizio;
|
|
}
|
|
|
|
public long getFlgStato() {
|
|
return this.flgStato;
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator findByCR(EsercizioCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from ESERCIZIO 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) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
}
|