164 lines
5 KiB
Java
164 lines
5 KiB
Java
|
|
package it.acxent.contab;
|
||
|
|
|
||
|
|
import it.acxent.db.ApplParmFull;
|
||
|
|
import it.acxent.db.DBAdapter;
|
||
|
|
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 DocFiglioPadre extends DBAdapter implements Serializable {
|
||
|
|
private static final long serialVersionUID = 1564387437366L;
|
||
|
|
|
||
|
|
private long id_docFiglioPadre;
|
||
|
|
|
||
|
|
private long id_documentoPadre;
|
||
|
|
|
||
|
|
private long id_documentoFiglio;
|
||
|
|
|
||
|
|
private Documento documentoPadre;
|
||
|
|
|
||
|
|
private Documento documentoFiglio;
|
||
|
|
|
||
|
|
public DocFiglioPadre(ApplParmFull newApplParmFull) {
|
||
|
|
super(newApplParmFull);
|
||
|
|
}
|
||
|
|
|
||
|
|
public DocFiglioPadre() {}
|
||
|
|
|
||
|
|
public void setId_docFiglioPadre(long newId_documentoPF) {
|
||
|
|
this.id_docFiglioPadre = newId_documentoPF;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setId_documentoPadre(long newId_documentoPadre) {
|
||
|
|
this.id_documentoPadre = newId_documentoPadre;
|
||
|
|
setDocumentoPadre(null);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setId_documentoFiglio(long newId_documentoFiglio) {
|
||
|
|
this.id_documentoFiglio = newId_documentoFiglio;
|
||
|
|
setDocumentoFiglio(null);
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getId_docFiglioPadre() {
|
||
|
|
return this.id_docFiglioPadre;
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getId_documentoPadre() {
|
||
|
|
return this.id_documentoPadre;
|
||
|
|
}
|
||
|
|
|
||
|
|
public long getId_documentoFiglio() {
|
||
|
|
return this.id_documentoFiglio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setDocumentoPadre(Documento newDocumentoPadre) {
|
||
|
|
this.documentoPadre = newDocumentoPadre;
|
||
|
|
}
|
||
|
|
|
||
|
|
public Documento getDocumentoPadre() {
|
||
|
|
this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, getId_documentoPadre());
|
||
|
|
return this.documentoPadre;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setDocumentoFiglio(Documento newDocumentoFiglio) {
|
||
|
|
this.documentoFiglio = newDocumentoFiglio;
|
||
|
|
}
|
||
|
|
|
||
|
|
public Documento getDocumentoFiglio() {
|
||
|
|
this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, getId_documentoFiglio());
|
||
|
|
return this.documentoFiglio;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected ResParm checkDeleteCascade() {
|
||
|
|
return new ResParm(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
protected void deleteCascade() {}
|
||
|
|
|
||
|
|
public Vectumerator<DocFiglioPadre> findByCR(DocFiglioPadreCR CR, int pageNumber, int pageRows) {
|
||
|
|
String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE 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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void findByFiglioPadre(long l_id_documentoFiglio, long l_id_documentoPadre) {
|
||
|
|
String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A";
|
||
|
|
String s_Sql_Order = "";
|
||
|
|
WcString wc = new WcString();
|
||
|
|
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
|
||
|
|
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
|
||
|
|
try {
|
||
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||
|
|
findFirstRecord(stmt);
|
||
|
|
} catch (SQLException e) {
|
||
|
|
removeCPConnection();
|
||
|
|
handleDebug(e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public Vectumerator<DocFiglioPadre> findByFiglio(long l_id_documentoFiglio) {
|
||
|
|
String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A";
|
||
|
|
String s_Sql_Order = "";
|
||
|
|
WcString wc = new WcString();
|
||
|
|
wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio);
|
||
|
|
try {
|
||
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||
|
|
return findRows(stmt);
|
||
|
|
} catch (SQLException e) {
|
||
|
|
removeCPConnection();
|
||
|
|
handleDebug(e);
|
||
|
|
return AB_EMPTY_VECTUMERATOR;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public Vectumerator<DocFiglioPadre> findByPadre(long l_id_documentoPadre) {
|
||
|
|
String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A";
|
||
|
|
String s_Sql_Order = "";
|
||
|
|
WcString wc = new WcString();
|
||
|
|
wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre);
|
||
|
|
try {
|
||
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
||
|
|
return findRows(stmt);
|
||
|
|
} catch (SQLException e) {
|
||
|
|
removeCPConnection();
|
||
|
|
handleDebug(e);
|
||
|
|
return AB_EMPTY_VECTUMERATOR;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public ResParm delete() {
|
||
|
|
if (getDocumentoFiglio().getTipoDocumento().getFlgTipologia() == 210L) {
|
||
|
|
getDocumentoFiglio().setFlgStatoLavorazione(0L);
|
||
|
|
getDocumentoFiglio().superSave();
|
||
|
|
}
|
||
|
|
return super.delete();
|
||
|
|
}
|
||
|
|
|
||
|
|
protected void afterDelete() {
|
||
|
|
super.afterDelete();
|
||
|
|
}
|
||
|
|
}
|