1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
public class RechercherTiers{
/**
* Constructeur de la classe
*/
public RechercherTiers() {
}
.
.
.
.
.
.
.
List listeTiersTransiant = new ArrayList(fechtsize);
listeTiersTransiant = rechercherTiersEnCoursDeNavigation(connection, oids,tiersForm, fechtsize);
Collections.sort(listeTiersTransiant,new MonComparator());
tiersForm.setListeTiers(listeTiersTransiant);
private List rechercherTiersEnCoursDeNavigation( Connection connection, Collection oids, TiersForm tiersForm,int fechtsize) throws MAECliTechnicalException {
List listeTiersTransiant = new ArrayList(oids.size());
TiersValue tiersValueTransiant = null;
Adresse adresseTransiant = null;
TiersValue tiersValue = null;
Adresse adresse = null;
for (Iterator iter = oids.iterator(); iter.hasNext();) {
String oid = (String) iter.next();
log.debug("========================================== Chargement du tiers id = " + oid);
tiersValueTransiant = new TiersValue();
//on charge le tiers correspondant a l'oid de la base
tiersValue = TiersFactory.getInstance().rechercherTiers(connection, Long.parseLong(oid)).consulterTiers();
adresse = tiersValue.getAdresse();
if (adresse == null) {
adresse = new Adresse();
}
//tiersValueTransiant.setPays((Pays) connection.clone(tiersValue.getPays(), true));
tiersValueTransiant.setId(tiersValue.getId());
tiersValueTransiant.setPays(tiersValue.getPays());
tiersValueTransiant.setCodeTiers(tiersValue.getCodeTiers());
tiersValueTransiant.setNom(tiersValue.getNom());
tiersValueTransiant.setPrenom(tiersValue.getPrenom());
if (tiersValue.getEnseigneRoleTiers() != null) {
tiersValueTransiant.setEnseigneRoleTiers((RoleTiers) connection.clone(tiersValue.getEnseigneRoleTiers(), true));
}
adresseTransiant = new Adresse();
adresseTransiant.setVoie(adresse.getVoie());
adresseTransiant.setCodePostal(adresse.getCodePostal());
adresseTransiant.setVille(adresse.getVille());
adresseTransiant.setCodeFoyer(adresse.getCodeFoyer());
adresseTransiant.setPays((Pays) connection.clone(adresse.getPays(), true));
tiersValueTransiant.setAdresse(adresseTransiant);
//on ajoute le tiers copié a la liste des tiers chargés
listeTiersTransiant.add(tiersValueTransiant);
}
return listeTiersTransiant;
} |