public CtrlRecherchePreDossier(RecherchePreDossier component) {
   super();
   this.component = component;
   if (component != null) {
     edc = component.edc();
   }
 }
 public WOActionResults inscrire() {
   ERXRedirect redirectPage = null;
   NouveauDossierPreEtudiant page =
       (NouveauDossierPreEtudiant)
           component.pageWithName(NouveauDossierPreEtudiant.class.getName());
   try {
     page.ctrl.initDossier(unPreEtudiant());
     redirectPage = new ERXRedirect(component.context());
     redirectPage.setComponent(page);
     component.session().setErreur(null);
   } catch (CtrlInscriptionException e) {
     component.session().defaultEditingContext().revert();
     component.session().defaultEditingContext().invalidateAllObjects();
     WOResponse response = new WOResponse();
     response.setStatus(500);
     component.session().setErreur(e.getMessageJS());
     return response;
   }
   return redirectPage;
 }
 public WOActionResults rechercherLesPreEtudiants() {
   setLeEtudiant(null);
   try {
     // if (component.qbe().allKeys().count() > 0) {
     EOSortOrdering nomPatronymiqueOrdering =
         EOSortOrdering.sortOrderingWithKey(
             EOPreEtudiant.TO_PRE_INDIVIDU_KEY + "." + EOPreIndividu.NOM_PATRONYMIQUE_KEY,
             EOSortOrdering.CompareCaseInsensitiveAscending);
     EOSortOrdering prenomOrdering =
         EOSortOrdering.sortOrderingWithKey(
             EOPreEtudiant.TO_PRE_INDIVIDU_KEY + "." + EOPreIndividu.PRENOM_KEY,
             EOSortOrdering.CompareCaseInsensitiveAscending);
     NSArray<EOSortOrdering> sortOrderings =
         new NSArray<EOSortOrdering>(
             new EOSortOrdering[] {nomPatronymiqueOrdering, prenomOrdering});
     BigDecimal etudNumeroBG = (BigDecimal) component.qbe().valueForKey("etudNumero");
     preEtudiants =
         FinderPreEtudiant.getPreEtudiants(
             edc,
             etudNumeroBG == null ? null : new Integer(etudNumeroBG.intValue()),
             (String) component.qbe().valueForKey("etudCodeIne"),
             (String) component.qbe().valueForKey("nomPatronymique"),
             (String) component.qbe().valueForKey("prenom"),
             (NSTimestamp) component.qbe().valueForKey("dNaissance"),
             sortOrderings);
     if (preEtudiants == null || preEtudiants.count() == 0) {
       component.session().addSimpleInfoMessage("Pfff...", "Aucun pré-étudiant trouvé...");
     }
     // }
   } catch (CtrlInscriptionException e) {
     component.session().addSimpleErrorMessage("Erreur", e.getMessage());
   }
   return null;
 }
  public WOComponent afficherLeDossier() {

    if (unPreEtudiant() != null) {
      EOEditingContext edc = component.session().defaultEditingContext();

      EORne rne = unPreEtudiant().rne();
      if (rne == null) {
        component
            .session()
            .addSimpleErrorMessage(
                "Erreur", "Impossible de déterminer l'établissement du pré-étudiant !");
        return null;
      }

      IEtudiant etudiant = null;
      try {
        edc.revert();
        edc.invalidateAllObjects();
        EOPreEtudiant preEtudiant =
            EOPreEtudiant.fetchByKeyValue(
                edc, EOPreEtudiant.ETUD_NUMERO_KEY, unPreEtudiant().etudNumero());
        Method m =
            component
                .session()
                .finder(rne.cRne())
                .getDeclaredMethod(
                    "getEtudiantPreEtudiant",
                    new Class[] {
                      EOEditingContext.class,
                      EOPreEtudiant.class,
                      String.class,
                      component.session().interfaceEtudiant(rne.cRne())
                    });
        etudiant = (IEtudiant) m.invoke(null, new Object[] {edc, preEtudiant, rne.cRne(), null});
      } catch (SecurityException e1) {
        e1.printStackTrace();
      } catch (NoSuchMethodException e2) {
        e2.printStackTrace();
      } catch (IllegalArgumentException e3) {
        e3.printStackTrace();
      } catch (IllegalAccessException e4) {
        e4.printStackTrace();
      } catch (EtudiantException e6) {
        e6.printStackTrace();
      } catch (InvocationTargetException e5) {
        if (e5.getCause().getClass().equals(EtudiantException.class)) {
          EtudiantException exception = (EtudiantException) e5.getCause();
          component.session().addSimpleErrorMessage("Erreur", exception.getMessage());
          return null;
        }
      }

      if (etudiant != null) {
        EOHistorique historique = etudiant.historiquePlusRecent(new Integer(3000));
        etudiant.setAnneeInscriptionEnCours(historique.histAnneeScol());
        etudiant.setEtudType(EOEtudiant.ETUD_TYPE_INSCRIPTION);
        etudiant.setRne(rne);

        setLeEtudiant(etudiant);
        setLeDossier(historique);

        NSArray<EtudiantException> userInfos = etudiant.userInfos();
        if (userInfos != null && userInfos.count() > 0) {
          String messages = "";
          Enumeration<EtudiantException> enumUserInfos = userInfos.objectEnumerator();
          while (enumUserInfos.hasMoreElements()) {
            EtudiantException exception = enumUserInfos.nextElement();
            messages += exception.getMessageJS() + "\\n";
          }
          component.session().addSimpleErrorMessage("Erreur", messages);
        }
      }
    }

    return null;
  }
 public WOActionResults annulerLaRecherche() {
   reset();
   component.qbe().removeAllObjects();
   return null;
 }