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 Postazione extends it.acxent.common.Postazione implements Serializable { private static final long serialVersionUID = -8882732861262606524L; private long id_regCassa; private RegCassa regCassa; public Postazione(ApplParmFull newApplParmFull) { super(newApplParmFull); } public Postazione() {} public void setId_regCassa(long newId_regCassa) { this.id_regCassa = newId_regCassa; setRegCassa(null); } public long getId_regCassa() { return this.id_regCassa; } public void setRegCassa(RegCassa newRegCassa) { this.regCassa = newRegCassa; } public RegCassa getRegCassa() { this.regCassa = (RegCassa)getSecondaryObject(this.regCassa, RegCassa.class, getId_regCassa()); return this.regCassa; } protected void deleteCascade() {} public Vectumerator findByCR(PostazioneCR CR, int pageNumber, int pageRows) { String s_Sql_Find = "select A.* from POSTAZIONE 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; } } public void findByIp(String l_ip) { String s_Sql_Find = "select A.* from POSTAZIONE AS A"; String s_Sql_Order = ""; WcString wc = new WcString(); wc.addWc("A.ipAddress='" + l_ip + "'"); try { PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); findFirstRecord(stmt); } catch (SQLException e) { handleDebug(e); } } }