コード例 #1
0
  /**
   * Vérifie si la tâche passée en paramètre appartient bien à l'itération en cours Vérifie si la
   * tâche passée en paramètre peut passer à l'état prête Ajoute la tâche à la liste des tâches à
   * afficher si elle appartient à l'itération en cours
   *
   * @throws ServletException -
   */
  public void verifierTache(MTache pTache) throws ServletException {
    int cond; // booléen de validité de la condition
    int ltacheSansCondition; // booléen pour savoir si on est sur une tache sans condition
    try {
      // initialisation du booléen de validité de la condition
      cond = 1;
      // par defaut on est sur une tache sans conditions
      ltacheSansCondition = 1;
      // Si la tache correspond à l'itération sélectionnée
      if (pTache.getIteration().getId() == mSession.getIteration().getId()) {

        // si la tache n'est pas encore prete on verifie si on ne peut pas la faire passer a
        // prete
        if (pTache.getEtat() == -1) {
          // pour chaque condition
          for (int j = 0; j < pTache.getNbConditions(); j++) {
            ltacheSansCondition = 0; // on est sur une tache avec condition
            MCondition lCondition = pTache.getCondition(j);

            // si la condition est fausse
            if (lCondition.getTachePrecedente().getEtat() < lCondition.getEtat()) {
              cond = 0;
            }
          }
        }
        if (ltacheSansCondition == 0) {
          // si les conditions sont vérifiées, on met l'état à prêt
          if (cond == 1) pTache.setEtat(0);
          else pTache.setEtat(-1);
        }
        lListeTaches.add(pTache);
      }
    } catch (Exception eException) {
      eException.printStackTrace();
      throw new ServletException(CConstante.EXC_TRAITEMENT);
    }
  }