/**
  * @param pObject l'objet à remplir
  * @param pForm le formulaire à lire.
  * @throws WTransformerException si un pb apparait.
  */
 public void formToObj(WActionForm pForm, Object[] pObject) throws WTransformerException {
   ProjectForm form = (ProjectForm) pForm;
   ComponentDTO dto = (ComponentDTO) pObject[0];
   dto.setID(form.getId());
   dto.setIDParent(form.getParentId());
   dto.setName(form.getProjectName());
   dto.setLanguage(form.getLanguage());
 }
  /**
   * This methods retrieve the statistics which are linked the component given in argument
   *
   * @param session The hibernate session
   * @param component The component for which the method searches the statistics
   * @return The list of statistics linked to the segmentation
   * @throws JrafEnterpriseException Exception occurs during the retrieve work
   */
  public static List<SharedRepoStatsDTO> retrieveStats(ISession session, ComponentDTO component)
      throws JrafEnterpriseException {
    List<SharedRepoStatsDTO> listStatsDto = new ArrayList<SharedRepoStatsDTO>();
    try {
      // The method retrieves the segment linked to the component
      SegmentDAOImpl segmentDao = SegmentDAOImpl.getInstance();
      List<SegmentBO> segmentlist = segmentDao.findModuleSegments(session, component.getID());

      // The method retrieves the segmentation corresponding to the list of segment
      SegmentationDAOImpl dao = SegmentationDAOImpl.getInstance();
      List<SegmentationBO> segmentList =
          (List<SegmentationBO>) dao.findContainsSegments(session, segmentlist);

      if (segmentList.size() > 0) {
        SegmentationBO segmentationBo = segmentList.get(0);
        Set<SharedRepoStatsBO> statsBoList = segmentationBo.getStatsList();
        for (SharedRepoStatsBO statsBo : statsBoList) {
          listStatsDto.add(SharedRepoStatsTransform.bo2dto(statsBo));
        }
      }
    } catch (JrafDaoException e) {
      FacadeHelper.convertException(e, "retrieveStats");
    } finally {
      FacadeHelper.closeSession(session, SharedRepoStatsFacade.class.getName() + ".retrieveStats");
    }
    return listStatsDto;
  }
 /**
  * Construit le fichier XML avec une pratique contenant une liste de composants à corriger
  *
  * @param root la racine du fichier XML
  * @param actionPlan la pratique à corriger
  */
 private void fillWithPracticeResults(Element root, ActionPlanDTO actionPlan) {
   Set components = actionPlan.getResultsDTO().getResultMap().keySet();
   components.remove(null);
   for (Iterator it = components.iterator(); it.hasNext(); ) {
     ComponentDTO component = (ComponentDTO) it.next();
     Element transgression = getDocument().createElement("transgression");
     // Le nom de la règle
     String ruleName =
         WebMessages.getString(request, actionPlan.getQualityResultDTO().getRule().getName());
     transgression.setAttribute("description", ruleName);
     // On découpe le nom du fichier du composant dans lequel se trouve le composant concerné
     // pour modifier les attributs "resource" et "folder"
     cutFileName(component.getFullName(), component.getFileName(), transgression);
     // La ligne
     transgression.setAttribute("location", component.getStartLine());
     root.appendChild(transgression);
   }
 }
 /**
  * @param pObject l'objet à transformer
  * @param pForm le formulaire à remplir.
  * @throws WTransformerException si un pb apparait.
  */
 public void objToForm(Object[] pObject, WActionForm pForm) throws WTransformerException {
   ComponentDTO dto = (ComponentDTO) pObject[0];
   ProjectForm form = (ProjectForm) pForm;
   form.setId(dto.getID());
   form.setProjectName(dto.getName());
   form.setApplicationId("" + dto.getIDParent());
   form.setHasTerminatedAudit(dto.getHasResults());
   form.setLanguage(dto.getLanguage());
   // Si le tableau d'objets passé en paramètre contient 2 objets
   // alors le deuxième est la liste des applications stockées en session.
   // Cela arrive dans les cas où l'on veut récupérer le nom de l'application
   // associée au projet.
   if (pObject.length == 2) {
     Collection applications = (Collection) pObject[1];
     String applicationName = TransformerUtils.getApplicationName(dto.getIDParent(), applications);
     form.setApplicationName(applicationName);
   }
 }