/**
  * Conversion d'une formule
  *
  * @param pFormula formule
  * @return formule
  */
 public static AbstractFormulaDTO bo2Dto(AbstractFormulaBO pFormula) {
   AbstractFormulaDTO result =
       (AbstractFormulaDTO) pFormula.accept(new AbstractFormulaTransform(), null);
   result.setId(pFormula.getId());
   result.setType(pFormula.getType());
   return result;
 }
      /**
       * @param p le résultat de la pratique
       * @throws JrafDaoException si erreur JRAF
       * @return le coût
       * @throws NumberFormatException si erreur de format
       */
      private Integer getCost(PracticeResultBO p) throws JrafDaoException, NumberFormatException {

        if (!mCache.containsKey(p)) {
          MarkDAOImpl markDAO = MarkDAOImpl.getInstance();
          MeasureDAOImpl measureDAO = MeasureDAOImpl.getInstance();
          int nbcorrections = 0;
          PracticeRuleBO rule =
              (PracticeRuleBO)
                  PracticeRuleAPDAOImpl.getInstance().load(pSession, new Long(p.getRule().getId()));
          // Rulechecking ?
          if ((rule.getFormula() != null)
              && rule.getFormula().getComponentLevel().equals("project")) {
            // Récupération des types de mesure traités par la formule
            AbstractFormulaBO formula = rule.getFormula();
            // Pour chaque type de mesure, on va récupérer le nom de sa classe
            String[] measureKinds = new String[formula.getMeasureKinds().size()];
            formula.getMeasureKinds().toArray(measureKinds);
            for (int i = 0; i < measureKinds.length; i++) {
              Class currentClass =
                  Mapping.getMeasureClass(measureKinds[i] + "." + formula.getComponentLevel());
              if (currentClass.getSuperclass().equals(RuleCheckingTransgressionBO.class)) {
                RuleCheckingTransgressionBO trans =
                    (RuleCheckingTransgressionBO)
                        measureDAO.load(
                            pSession,
                            new Long(Long.parseLong(pProjectId)),
                            new Long(Long.parseLong(pAuditId)),
                            currentClass);
                nbcorrections +=
                    trans.getTotalInfoNumberForCategory(rule.getName())
                        + trans.getTotalWarningNumberForCategory(rule.getName())
                        + trans.getTotalErrorNumberForCategory(rule.getName());
              }
            }
          } else {
            // On récupère les plus mauvais composants pour cette pratiques
            /*
             * We retrieve, for a given practice, the number of technical component which have a worst
             * practice mark than the mark of the same practice at the project level
             */
            nbcorrections = markDAO.countWorstWhere(pSession, new Long(p.getId()), p.getMeanMark());
          }
          mCache.put(p, new Integer(nbcorrections * rule.getEffort()));
        }
        return (Integer) mCache.get(p);
      }
 /**
  * @param pFormulaDTO la formule à transformer
  * @return la formule sous forme BO
  */
 public static AbstractFormulaBO dto2Bo(AbstractFormulaDTO pFormulaDTO) {
   AbstractFormulaBO result =
       (AbstractFormulaBO) pFormulaDTO.accept(new AbstractFormulaTransform());
   result.setId(pFormulaDTO.getId());
   return result;
 }
 /**
  * @param pFormulaBO formule
  * @param pFormulaDTO formule
  */
 private void setAttributes(AbstractFormulaBO pFormulaBO, AbstractFormulaDTO pFormulaDTO) {
   pFormulaDTO.setComponentLevel(pFormulaBO.getComponentLevel());
   pFormulaDTO.setTriggerCondition(pFormulaBO.getTriggerCondition());
   pFormulaDTO.setMeasureKinds(pFormulaBO.getMeasureKinds());
 }