120 lines
3.1 KiB
Java
120 lines
3.1 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.Vectumerator;
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
|
|
public class UserClifor extends _AnagAdapter {
|
|
private static final long serialVersionUID = -8722609970886488948L;
|
|
|
|
private long id_userClifor;
|
|
|
|
private long id_users;
|
|
|
|
private long id_clifor;
|
|
|
|
private Users users;
|
|
|
|
private Clifor clifor;
|
|
|
|
public UserClifor() {}
|
|
|
|
public UserClifor(ApplParmFull newApplParmFull) {
|
|
super(newApplParmFull);
|
|
}
|
|
|
|
public long getId_userClifor() {
|
|
return this.id_userClifor;
|
|
}
|
|
|
|
public void setId_userClifor(long id_userClifor) {
|
|
this.id_userClifor = id_userClifor;
|
|
}
|
|
|
|
public long getId_users() {
|
|
return this.id_users;
|
|
}
|
|
|
|
public void setId_users(long id_users) {
|
|
this.id_users = id_users;
|
|
}
|
|
|
|
public long getId_clifor() {
|
|
return this.id_clifor;
|
|
}
|
|
|
|
public void setId_clifor(long id_clifor) {
|
|
this.id_clifor = id_clifor;
|
|
}
|
|
|
|
public Vectumerator<UserClifor> findByUser(long l_id_users) {
|
|
String s_Sql_Find = "select A.* from USER_CLIFOR AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc(" A.id_users = " + l_id_users);
|
|
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 void findByUserClifor(long l_id_users, long l_id_clifor) {
|
|
String s_Sql_Find = "select A.* from USER_CLIFOR AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
wc.addWc(" A.id_users = " + l_id_users);
|
|
wc.addWc(" A.id_clifor = " + l_id_clifor);
|
|
try {
|
|
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
|
|
findFirstRecord(stmt);
|
|
} catch (SQLException e) {
|
|
handleDebug(e);
|
|
}
|
|
}
|
|
|
|
public Users getUsers() {
|
|
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
|
|
return this.users;
|
|
}
|
|
|
|
public void setUsers(Users users) {
|
|
this.users = users;
|
|
}
|
|
|
|
public Clifor getClifor() {
|
|
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
|
|
return this.clifor;
|
|
}
|
|
|
|
public void setClifor(Clifor clifor) {
|
|
this.clifor = clifor;
|
|
}
|
|
|
|
public ResParm save() {
|
|
UserClifor uc = new UserClifor(getApFull());
|
|
uc.findByUserClifor(getId_users(), getId_clifor());
|
|
if (uc.getDBState() == 0)
|
|
return super.save();
|
|
return new ResParm(true);
|
|
}
|
|
|
|
public Vectumerator findByCR(UserCliforCR CR, int pageNumber, int pageRows) {
|
|
String s_Sql_Find = "select A.* from USER_CLIFOR AS A";
|
|
String s_Sql_Order = "";
|
|
WcString wc = new WcString();
|
|
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;
|
|
}
|
|
}
|
|
}
|