108 lines
3 KiB
Java
108 lines
3 KiB
Java
package it.acxent.tex;
|
|
|
|
import it.acxent.db.ApplParmFull;
|
|
import it.acxent.db.DBAdapter;
|
|
import it.acxent.db.ResParm;
|
|
import it.acxent.db.WcString;
|
|
import it.acxent.tex.anag.ArticoloTessuto;
|
|
import it.acxent.util.StringTokenizer;
|
|
import it.acxent.util.Vectumerator;
|
|
import java.io.Serializable;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class MovimentoTessuto extends DBAdapter implements Serializable {
|
|
private static final long serialVersionUID = 1468228168145L;
|
|
|
|
private long id_movimentoTessuto;
|
|
|
|
private long id_articoloTessuto;
|
|
|
|
private String serie;
|
|
|
|
private String colore;
|
|
|
|
private ArticoloTessuto articoloTessuto;
|
|
|
|
public MovimentoTessuto(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public MovimentoTessuto() {}
|
|
|
|
public void setId_movimentoTessuto(long newId_movimentoTessuto) {
|
|
this.id_movimentoTessuto = newId_movimentoTessuto;
|
|
}
|
|
|
|
public void setId_articoloTessuto(long newId_articoloTessuto) {
|
|
this.id_articoloTessuto = newId_articoloTessuto;
|
|
setArticoloTessuto(null);
|
|
}
|
|
|
|
public void setSerie(String newSerie) {
|
|
this.serie = newSerie;
|
|
}
|
|
|
|
public void setColore(String newColore) {
|
|
this.colore = newColore;
|
|
}
|
|
|
|
public long getId_movimentoTessuto() {
|
|
return this.id_movimentoTessuto;
|
|
}
|
|
|
|
public long getId_articoloTessuto() {
|
|
return this.id_articoloTessuto;
|
|
}
|
|
|
|
public String getSerie() {
|
|
return (this.serie == null) ? "" : this.serie.trim();
|
|
}
|
|
|
|
public String getColore() {
|
|
return (this.colore == null) ? "" : this.colore.trim();
|
|
}
|
|
|
|
public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) {
|
|
this.articoloTessuto = newArticoloTessuto;
|
|
}
|
|
|
|
public ArticoloTessuto getArticoloTessuto() {
|
|
this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class,
|
|
|
|
getId_articoloTessuto());
|
|
return this.articoloTessuto;
|
|
}
|
|
|
|
protected ResParm checkDeleteCascade() {
|
|
return new ResParm(true);
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator<MovimentoTessuto> findByCR(MovimentoTessutoCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from MOVIMENTO_TESSUTO 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;
|
|
}
|
|
}
|
|
}
|