/* d'abord recherche du client */
Client cli;
try {
cli = fcli.rechercherClient(idClient);
} catch (SQLException e) {
throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
} catch (FactoriesException e) {
// le client n'existe pas
throw new MetierException(e.getMessage());
}
// liste des commandes
ArrayList<Commande> sesCommandes = new ArrayList<Commande>();
for(Iterator<String> it = cli.getLesCommandes().iterator(); it.hasNext(); ){
String refCde = it.next();
try {
Commande cde = fc.rechercherCommande(refCde, idClient);
// ajout de la commande trouvee dans la liste
sesCommandes.add(cde);
} catch (SQLException e) {
// Coupure du reseau ou plantage serveur BD
e.printStackTrace();
throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
}
}
return sesCommandes;
}