Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponente.java

121 lines
3.8 KiB
Java

package it.acxent.art;
import it.acxent.db.ApplParmFull;
import it.acxent.db.WcString;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class ArticoloArticoloComponente extends _ArtAdapter implements Serializable {
private long id_articoloArticoloComponente;
private long id_articoloComponente;
private Articolo articolo;
private Articolo articoloComponente;
private long id_articolo;
public ArticoloArticoloComponente(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public ArticoloArticoloComponente() {}
public long getId_articoloArticoloComponente() {
return this.id_articoloArticoloComponente;
}
public void setId_articoloArticoloComponente(long id_articoloComponente) {
this.id_articoloArticoloComponente = id_articoloComponente;
}
public long getId_articolo() {
return this.id_articolo;
}
public void setId_articolo(long id_articolo) {
this.id_articolo = id_articolo;
}
public Articolo getArticolo() {
this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo());
return this.articolo;
}
public Vectumerator findByArticolo(long id_articolo) {
String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("id_articolo = " + id_articolo);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, 0, 0);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByArticoloArticoloComponente(long id_articolo, long id_articoloComponente) {
String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("id_articolo = " + id_articolo);
wc.addWc("id_articoloComponente = " + id_articoloComponente);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public double getPercTotale(long id_articolo) {
String s_Sql_Find = "select SUM(A.perc) AS _sum from ARTICOLO_COMPONENTE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("id_articolo = " + id_articolo);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return getSum(stmt);
} catch (SQLException e) {
handleDebug(e);
return 0.0D;
}
}
public long getId_articoloComponente() {
return this.id_articoloComponente;
}
public void setId_articoloComponente(long id_articoloComponente) {
this.id_articoloComponente = id_articoloComponente;
setArticoloComponente(null);
}
public Articolo getArticoloComponente() {
this.articoloComponente = (Articolo)getSecondaryObject(this.articoloComponente, Articolo.class, getId_articoloComponente());
return this.articoloComponente;
}
public void setArticoloComponente(Articolo articoloComponente) {
this.articoloComponente = articoloComponente;
}
public Vectumerator findByArticoloComponente(long l_id_articoloComponente) {
String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("id_articoloComponente = " + l_id_articoloComponente);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, 0, 0);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}