Package interfaces.exceptions

Examples of interfaces.exceptions.MetierException


    try
      // recuperation du produit a l'aide de la fabrique.
      p = fp.rechercherProduit(reference);
     
    }catch(SQLException se){
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    }

    return p;
  }
View Full Code Here


    throws RemoteException, MetierException {
    try {
      return fp.getDelai(ref, dispo);
     
    } catch (SQLException e) {
      throw new MetierException(MetierException.PRODUIT_INEXISTANT);
    } catch (FactoriesException e) {
      // le produit n'a pas ete trouve, erreur metier.
      throw new MetierException(MetierException.PRODUIT_INEXISTANT);
    }
  }
View Full Code Here

     
     
      // Mise a jour de la base de donnees:
     
    }catch(SQLException se){
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    }
   
  }
View Full Code Here

        // mise a jour du max(Delai disponible)
        if(p.getDelaiDisponible() > delai)
          delai = p.getDelaiDisponible();
       
      } catch (SQLException e) {
        throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
      }
     
    }
   
    return delai;
View Full Code Here

 
    try {
      fc.creerCommande(c);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    } catch (FactoriesException e) {
      if(e.getMessage().equals(FactoriesException.COMMANDE_EXISTE_DEJA)){
        // renvoi du message
        throw new MetierException(e.getMessage());
      }
    } 
  }
View Full Code Here

    /* 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;
  }
View Full Code Here

    int res;
    // suppression de la commande de la base
    try {
      res = fc.supprimerCommande(c);
    } catch (SQLException e) {
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    } catch (FactoriesException e) {
      // la commande n'existe pas dans la base!
      throw new MetierException(e.getMessage());
    }
   
    // mise  a jour des stocks
    // recuperation de tous les produits concernes
    for(Iterator<String> it = c.getLesProduits().keySet().iterator();
View Full Code Here

    // s'assurer que la fabrique a bien une connexion a la base de donnees.
    if(! fp.hasConnection()){
      try{           
        fp.setConnection(GestionConnection.getInstance().getConnection());
      }catch(SQLException se){
        throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
      }
    }
  }
View Full Code Here

    try {
      // recuperation du produit et renvoi de sa quantite en stock.
      Produit p = fp.rechercherProduit(ref);
      return p.getQteStock();
    } catch (SQLException e) {
      throw new MetierException(MetierException.PRODUIT_INEXISTANT);
    }catch(NullPointerException npe){
      throw new MetierException(MetierException.PRODUIT_INEXISTANT);
    }
  }
View Full Code Here

   
    // si l'on souhaite expedier des produits:
    if(expedier){
      // si la quantite demandee est superieure a la quantite disponible:
      if(quantite > qte){
        throw new MetierException(MetierException.QUANTITE_INSUFFISANTE);
      }
      // sinon on effectue la mise a jour
      p.setQteStock(qte - quantite);
    }else{
      // sinon on alimente les stocks:
      p.setQteStock(qte + quantite);
    }
   
    // Synchroniser le produit avec la base de donnees.
    try
      // Mise a jour de la base de donnees:
      fp.updateStock(p);
     
    }catch(SQLException se){
      throw new MetierException(MetierException.CONNEXION_IMPOSSIBLE);
    }
    // Retourne le delai de livraison si le produit est disponible.
    return p.getDelaiDisponible();
  }
View Full Code Here

TOP

Related Classes of interfaces.exceptions.MetierException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.