Beispiel #1
0
  public void initListeDiplRN() {
    chargerDiplRN();

    // On va se construire un dico des enreg. pour l'année en cours de IP_DIPL_SANS_RN...
    NSArray bindings = new NSArray(new Object[] {getFannKey()});
    EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat("fannKey = %@", bindings);

    // la liste des diplomes qui n'autorisent pas les RN par le Web
    EOFetchSpecification fetchSpec = new EOFetchSpecification("IpDiplSansRn", qualifier, null);
    fetchSpec.setRefreshesRefetchedObjects(true);

    EOEditingContext ec = maSession.defaultEditingContext();
    NSArray res = ec.objectsWithFetchSpecification(fetchSpec);

    listeEOipDiplSansRn = new NSMutableDictionary();

    if (res != null && res.count() > 0) {

      Enumeration e = res.objectEnumerator();
      while (e.hasMoreElements()) {
        IpDiplSansRn eoIpDiplSansRN = (IpDiplSansRn) e.nextElement();
        Integer fspnKey = (Integer) eoIpDiplSansRN.fspnKey();

        listeEOipDiplSansRn.setObjectForKey(eoIpDiplSansRN, fspnKey);
      }
    }
  }
Beispiel #2
0
  // ON veut ajouter ces diplome à la liste des diplomes sans RN...
  public void ajouterRestriction(NSArray listeDipl) {
    EOEditingContext ec = maSession.defaultEditingContext();
    boolean travail = false;

    Enumeration e = listeDipl.objectEnumerator();
    while (e.hasMoreElements()) {
      EOGenericRecord diplSel = (EOGenericRecord) e.nextElement();
      //    		NSLog.out.appendln("A virer : "+diplSel.valueForKey("diplome"));

      // Pas déjà ?
      Integer fspnKey = (Integer) diplSel.valueForKey("fspnKey");
      if (listeEOipDiplSansRn.objectForKey(fspnKey) == null) {

        IpDiplSansRn eoAAjouter = new IpDiplSansRn();
        eoAAjouter.setFannKey((Number) diplSel.valueForKey("fannKey"));
        eoAAjouter.setFspnKey((Number) fspnKey);
        travail = true;
        ec.insertObject(eoAAjouter);
        listeEOipDiplSansRn.setObjectForKey(eoAAjouter, fspnKey);
      }
    }
    if (travail) {
      ec.saveChanges();
      chargerDiplRN();
    }
  }