152 lines
4.3 KiB
Java
152 lines
4.3 KiB
Java
package it.acxent.art;
|
|
|
|
import it.acxent.anag.Clifor;
|
|
import it.acxent.anag._AnagAdapter;
|
|
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 ArticoloProgettista extends _AnagAdapter implements Serializable {
|
|
private static final long serialVersionUID = 463336863212137063L;
|
|
|
|
private long id_articoloProgettista;
|
|
|
|
private double percProvvigione;
|
|
|
|
private long id_progettista;
|
|
|
|
private long id_articolo;
|
|
|
|
private String nota;
|
|
|
|
private Clifor progettista;
|
|
|
|
private Articolo articolo;
|
|
|
|
public ArticoloProgettista(ApplParmFull newApplParm) {
|
|
super(newApplParm);
|
|
}
|
|
|
|
public ArticoloProgettista() {}
|
|
|
|
public long getId_articoloProgettista() {
|
|
return this.id_articoloProgettista;
|
|
}
|
|
|
|
public void setId_articoloProgettista(long id_cliforArticolo) {
|
|
this.id_articoloProgettista = id_cliforArticolo;
|
|
}
|
|
|
|
public double getPercProvvigione() {
|
|
return this.percProvvigione;
|
|
}
|
|
|
|
public void setPercProvvigione(double percArticolo) {
|
|
this.percProvvigione = percArticolo;
|
|
}
|
|
|
|
public long getId_progettista() {
|
|
return this.id_progettista;
|
|
}
|
|
|
|
public void setId_progettista(long id_clifor) {
|
|
this.id_progettista = id_clifor;
|
|
}
|
|
|
|
public long getId_articolo() {
|
|
return this.id_articolo;
|
|
}
|
|
|
|
public void setId_articolo(long id_articolo) {
|
|
this.id_articolo = id_articolo;
|
|
}
|
|
|
|
public Clifor getProgettista() {
|
|
this.progettista = new Clifor(getApFull());
|
|
this.progettista.findByPrimaryKey(getId_progettista());
|
|
return this.progettista;
|
|
}
|
|
|
|
public void setProgettista(Clifor clifor) {
|
|
this.progettista = clifor;
|
|
}
|
|
|
|
public Articolo getArticolo() {
|
|
this.articolo = new Articolo(getApFull());
|
|
this.articolo.findByPrimaryKey(getId_articolo());
|
|
return this.articolo;
|
|
}
|
|
|
|
public void setArticolo(Articolo articolo) {
|
|
this.articolo = articolo;
|
|
}
|
|
|
|
public Vectumerator findByCR(ArticoloProgettistaCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA 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.descrizione like '%" + token + "%' or A.descrizione like '%" + token + "%')");
|
|
if (st.hasMoreTokens())
|
|
txt.append(" and ");
|
|
}
|
|
txt.append(")");
|
|
wc.addWc(txt.toString());
|
|
}
|
|
if (CR.getId_articolo() != 0L)
|
|
wc.addWc(" A.id_articolo = " + CR.getId_articolo());
|
|
if (CR.getId_progettista() != 0L)
|
|
wc.addWc(" A.id_clifor = " + CR.getId_progettista());
|
|
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 findByProgettistaArticolo(long id_clifor, long id_articolo) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc(" A.id_articolo = " + id_articolo);
|
|
wc.addWc(" A.id_progettista= " + id_clifor);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public Vectumerator findByArticolo(long id_articolo) {
|
|
String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc(" A.id_articolo = " + id_articolo);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
return findRows(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public String getNota() {
|
|
return (this.nota == null) ? "" : this.nota.trim();
|
|
}
|
|
|
|
public void setNota(String nota) {
|
|
this.nota = nota;
|
|
}
|
|
}
|