154 lines
4.2 KiB
Java
154 lines
4.2 KiB
Java
package it.acxent.anag;
|
|
|
|
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.Date;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class CliforLog extends DBAdapter implements Serializable {
|
|
private static final long serialVersionUID = 1698338319657L;
|
|
|
|
private long id_cliforLog;
|
|
|
|
private long id_clifor;
|
|
|
|
private long id_users;
|
|
|
|
private Date dataCliforlog;
|
|
|
|
private String descrizioneCliforlog;
|
|
|
|
private Clifor clifor;
|
|
|
|
private Users users;
|
|
|
|
public CliforLog(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public CliforLog() {}
|
|
|
|
public void setId_cliforLog(long newId_cliforLog) {
|
|
this.id_cliforLog = newId_cliforLog;
|
|
}
|
|
|
|
public void setId_clifor(long newId_clifor) {
|
|
this.id_clifor = newId_clifor;
|
|
setClifor(null);
|
|
}
|
|
|
|
public void setId_users(long newId_users) {
|
|
this.id_users = newId_users;
|
|
setUsers(null);
|
|
}
|
|
|
|
public void setDataCliforlog(Date newDataCliforlog) {
|
|
this.dataCliforlog = newDataCliforlog;
|
|
}
|
|
|
|
public void setDescrizioneCliforlog(String newDescrizioneCliforlog) {
|
|
this.descrizioneCliforlog = newDescrizioneCliforlog;
|
|
}
|
|
|
|
public long getId_cliforLog() {
|
|
return this.id_cliforLog;
|
|
}
|
|
|
|
public long getId_clifor() {
|
|
return this.id_clifor;
|
|
}
|
|
|
|
public long getId_users() {
|
|
return this.id_users;
|
|
}
|
|
|
|
public Date getDataCliforlog() {
|
|
return this.dataCliforlog;
|
|
}
|
|
|
|
public String getDescrizioneCliforlog() {
|
|
return (this.descrizioneCliforlog == null) ? "" : this.descrizioneCliforlog.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 setUsers(Users newUsers) {
|
|
this.users = newUsers;
|
|
}
|
|
|
|
public Users getUsers() {
|
|
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
|
return this.users;
|
|
}
|
|
|
|
protected ResParm checkDeleteCascade() {
|
|
return new ResParm(true);
|
|
}
|
|
|
|
protected void deleteCascade() {}
|
|
|
|
public Vectumerator<CliforLog> findByCR(CliforLogCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from CLIFOR_LOG AS A";
|
|
String s_Sql_Order = " order by A.lastUpdTmst desc";
|
|
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 Vectumerator<CliforLog> findByClifor(long l_id_clifor, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from CLIFOR_LOG AS A";
|
|
String s_Sql_Order = " order by A.lastUpdTmst desc";
|
|
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) {
|
|
removeCPConnection();
|
|
handleDebug(e);
|
|
return AB_EMPTY_VECTUMERATOR;
|
|
}
|
|
}
|
|
|
|
public ResParm save() {
|
|
if (getDBState() == 0)
|
|
setDataCliforlog(getToday());
|
|
return super.save();
|
|
}
|
|
|
|
public ResParm save(long l_flgStatoConfermaDatiDb) {
|
|
setDescrizioneCliforlog(Clifor.getStatoConfermaDati(l_flgStatoConfermaDatiDb) + "-->" + Clifor.getStatoConfermaDati(l_flgStatoConfermaDatiDb) + ": " + getClifor().getStatoConfermaDati());
|
|
return save();
|
|
}
|
|
}
|