Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversa.java

296 lines
8 KiB
Java

package it.acxent.anag;
import it.acxent.db.ApplParmFull;
import it.acxent.db.ResParm;
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 DestinazioneDiversa extends _AnagAdapter implements Serializable {
private static final long serialVersionUID = 2321576096013980457L;
private long id_destinazioneDiversa;
private long id_clifor;
private long id_comuneDD;
private String id_nazioneDD;
private String descrizioneDD;
private String pressoDD;
private String indirizzoDD;
private String numeroCivicoDD;
private String capZonaDD;
private String telefonoDD;
private String faxDD;
private String eMailDD;
private Clifor clifor;
private Comune comuneDD;
private Nazione nazioneDD;
private String capComuneDD;
private String descrizioneComuneDD;
private String provinciaComuneDD;
private long flgDDDefault;
public DestinazioneDiversa(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DestinazioneDiversa() {}
public void setId_destinazioneDiversa(long newId_destinazioneDiversa) {
this.id_destinazioneDiversa = newId_destinazioneDiversa;
}
public void setId_clifor(long newId_clifor) {
this.id_clifor = newId_clifor;
setClifor(null);
}
public void setId_comuneDD(long newId_comuneDD) {
this.id_comuneDD = newId_comuneDD;
setComuneDD(null);
}
public void setId_nazioneDD(String newId_nazioneDD) {
this.id_nazioneDD = newId_nazioneDD;
setNazioneDD(null);
}
public void setDescrizioneDD(String newDescrizione) {
this.descrizioneDD = newDescrizione;
}
public void setPressoDD(String newPresso) {
this.pressoDD = newPresso;
}
public void setIndirizzoDD(String newIndirizzoDD) {
this.indirizzoDD = newIndirizzoDD;
}
public void setNumeroCivicoDD(String newNumeroCivicoDD) {
this.numeroCivicoDD = newNumeroCivicoDD;
}
public void setCapZonaDD(String newCapZonaDD) {
this.capZonaDD = newCapZonaDD;
}
public void setTelefonoDD(String newTelefonoDD) {
this.telefonoDD = newTelefonoDD;
}
public void setFaxDD(String newFaxDD) {
this.faxDD = newFaxDD;
}
public void setEMailDD(String newEMailDD) {
this.eMailDD = newEMailDD;
}
public long getId_destinazioneDiversa() {
return this.id_destinazioneDiversa;
}
public long getId_clifor() {
return this.id_clifor;
}
public long getId_comuneDD() {
return this.id_comuneDD;
}
public String getId_nazioneDD() {
return (this.id_nazioneDD == null) ? "" : this.id_nazioneDD.trim();
}
public String getDescrizioneDD() {
return (this.descrizioneDD == null) ? "" : this.descrizioneDD.trim();
}
public String getPressoDD() {
return (this.pressoDD == null) ? "" : this.pressoDD.trim();
}
public String getIndirizzoDD() {
return (this.indirizzoDD == null) ? "" : this.indirizzoDD.trim();
}
public String getNumeroCivicoDD() {
return (this.numeroCivicoDD == null) ? "" : this.numeroCivicoDD.trim();
}
public String getCapZonaDD() {
return (this.capZonaDD == null) ? "" : this.capZonaDD.trim();
}
public String getTelefonoDD() {
return (this.telefonoDD == null) ? "" : this.telefonoDD.trim();
}
public String getFaxDD() {
return (this.faxDD == null) ? "" : this.faxDD.trim();
}
public String getEMailDD() {
return (this.eMailDD == null) ? "" : this.eMailDD.trim();
}
public void setClifor(Clifor newClifor) {
this.clifor = newClifor;
}
public Clifor getClifor() {
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
return this.clifor;
}
public void setComuneDD(Comune newComune) {
this.comuneDD = newComune;
}
public Comune getComuneDD() {
this.comuneDD = (Comune)getSecondaryObject(this.comuneDD, Comune.class, getId_comuneDD());
return this.comuneDD;
}
public void setNazioneDD(Nazione newNazione) {
this.nazioneDD = newNazione;
}
public Nazione getNazioneDD() {
this.nazioneDD = (Nazione)getSecondaryObject(this.nazioneDD, Nazione.class, getId_nazioneDD());
return this.nazioneDD;
}
protected void deleteCascade() {}
public Vectumerator<DestinazioneDiversa> findByCR(DestinazioneDiversaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA 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 String getIndirizzoCompleto() {
return getIndirizzoDD() + " n." + getIndirizzoDD() + " - " + getNumeroCivicoDD() + " " + (getCapZonaDD().isEmpty() ? getCapComuneDD() : getCapZonaDD()) + " (" +
getDescrizioneComuneDD() + ")";
}
public String getContatti() {
return (this.faxDD == null) ? "" : this.faxDD.trim();
}
public Vectumerator<DestinazioneDiversa> findByClifor(long l_id_clifor, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA AS A";
String s_Sql_Order = " order by A.descrizioneDD";
WcString wc = new WcString();
wc.addWc("A.id_clifor=" + l_id_clifor);
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 seteMailDD(String eMailDD) {
this.eMailDD = eMailDD;
}
public String getCapComuneDD() {
if (this.id_comuneDD != 0L)
return getComuneDD().getCap();
return (this.capComuneDD == null) ? "" : this.capComuneDD.trim();
}
public void setCapComuneDD(String capComuneDD) {
this.capComuneDD = capComuneDD;
}
public String getDescrizioneComuneDD() {
if (this.id_comuneDD != 0L)
return getComuneDD().getDescrizione();
return (this.descrizioneComuneDD == null) ? "" : this.descrizioneComuneDD.trim();
}
public void setDescrizioneComuneDD(String descrizioneComuneDD) {
this.descrizioneComuneDD = descrizioneComuneDD;
}
public String getProvinciaComuneDD() {
if (this.id_comuneDD != 0L)
return getComuneDD().getProvincia();
return (this.provinciaComuneDD == null) ? "" : this.provinciaComuneDD.trim();
}
public void setProvinciaComuneDD(String provinciaComuneDD) {
this.provinciaComuneDD = provinciaComuneDD;
}
public long getFlgDDDefault() {
return this.flgDDDefault;
}
public void setFlgDDDefault(long flgDDDefault) {
this.flgDDDefault = flgDDDefault;
}
public void findDefaultByClifor(long l_id_clifor) {
String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA AS A";
String s_Sql_Order = " order by A.descrizioneDD";
WcString wc = new WcString();
wc.addWc("A.id_clifor=" + l_id_clifor);
wc.addWc("A.flgDDDefault=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public ResParm save() {
if (getFlgDDDefault() == 1L)
update("update DESTINAZIONE_DIVERSA SET flgDDDefault=0 where id_clifor=" + getId_clifor());
return super.save();
}
}