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 MeseEscluso extends _AnagAdapter implements Serializable { private static final long serialVersionUID = 3164023737083124440L; private long id_meseEscluso; private long id_tipoPagamento; private long meseEscluso; private long giornoEscluso; private TipoPagamento tipoPagamento; public MeseEscluso(ApplParmFull newApplParmFull) { super(newApplParmFull); } public MeseEscluso() {} public void setId_meseEscluso(long newId_vettore) { this.id_meseEscluso = newId_vettore; } public long getId_meseEscluso() { return this.id_meseEscluso; } protected void deleteCascade() {} public Vectumerator findByCR(MeseEsclusoCR CR, int pageNumber, int pageRows) { String s_Sql_Find = "select A.* from MESE_ESCLUSO 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()); } if (CR.getId_tipoPagamento() > 0L) wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamento()); 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 long getId_tipoPagamento() { return this.id_tipoPagamento; } public void setId_tipoPagamento(long id_tipoPagamento) { this.id_tipoPagamento = id_tipoPagamento; setTipoPagamento(null); } public long getMeseEscluso() { return this.meseEscluso; } public void setMeseEscluso(long meseEscluso) { this.meseEscluso = meseEscluso; } public long getGiornoEscluso() { return this.giornoEscluso; } public void setGiornoEscluso(long giornoEscluso) { this.giornoEscluso = giornoEscluso; } public TipoPagamento getTipoPagamento() { this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); return this.tipoPagamento; } public void setTipoPagamento(TipoPagamento tipoPagamento) { this.tipoPagamento = tipoPagamento; } public String getDescrizioneMese() { return getDescrizioneMese(getMeseEscluso()); } public String getDescrizioneMese(long id_mese) { return MONTH_DES[(int)id_mese - 1]; } }