protected NSMutableArray<EODomaine> filtreDomaine(NSArray<EODomaine> Domaines) {
    NSMutableArray<EODomaine> domaines = new NSMutableArray<EODomaine>();
    for (EODomaine domaine : Domaines) {
      if (wocomponent().accesDomaineEnseignement() && domaine.isIndividu()) {
        if (!domaines.contains(domaine)) domaines.addObject(domaine);
      }

      if (wocomponent().accesDomaineRecherche() && domaine.isIndividu()) {
        if (!domaines.contains(domaine)) domaines.addObject(domaine);
      }

      if (wocomponent().accesDomaineEntreprise() && domaine.isStructure()) {
        if (!domaines.contains(domaine)) domaines.addObject(domaine);
      }

      if (wocomponent().accesDomaineUv() && domaine.isUv()) {
        if (!domaines.contains(domaine)) domaines.addObject(domaine);
      }
    }
    return domaines;
  }
Exemple #2
0
  public NSArray customerIssues() {
    NSMutableArray allChildren = new NSMutableArray();
    NSMutableArray qual = new NSMutableArray();
    Item customer;
    Item child;

    if (customerIssues == null) {

      if (bugId() != null) {
        qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugId=" + bugId(), null));
        EOFetchSpecification spec =
            new EOFetchSpecification("Item", new EOAndQualifier(qual), null);

        // Perform actual fetch
        customerIssues =
            (NSArray) session().defaultEditingContext().objectsWithFetchSpecification(spec);

      } else {

        Enumeration enumer = ((NSArray) customerIssueDisplayGroup.allObjects()).objectEnumerator();
        // For each Customer
        while (enumer.hasMoreElements()) {
          customer = (Item) enumer.nextElement();
          NSArray children = (NSArray) customer.valueForKey("allChildren");

          // Add all of their issues (if they haven't been added already
          Enumeration enumer2 = children.objectEnumerator();
          while (enumer2.hasMoreElements()) {
            child = (Item) enumer2.nextElement();
            if (!allChildren.contains(child)) {
              allChildren.addObject(child);
            }
          }
        }
        Object orderings[] = {
          EOSortOrdering.sortOrderingWithKey("version", EOSortOrdering.CompareAscending),
          EOSortOrdering.sortOrderingWithKey("targetMilestone", EOSortOrdering.CompareAscending),
          EOSortOrdering.sortOrderingWithKey(
              "priority", EOSortOrdering.CompareCaseInsensitiveAscending),
          EOSortOrdering.sortOrderingWithKey(
              "bugSeverity", EOSortOrdering.CompareCaseInsensitiveAscending),
        };

        // Sort the issues
        customerIssues =
            EOSortOrdering.sortedArrayUsingKeyOrderArray(allChildren, new NSArray(orderings));
      }
    }
    return customerIssues;
  }
 /** @return the lesCapacites */
 public NSArray lesCapacites() {
   if (lesCapacites == null) {
     NSMutableArray<EOCapacite> tmp = new NSMutableArray<EOCapacite>();
     NSMutableArray<EOCapacite> tmp2 = new NSMutableArray<EOCapacite>();
     NSArray<EODomaine> domaines = null;
     NSArray<EORepartDomCapacite> rdcs = null;
     domaines = EODomaine.fetchDomaines(ec, wocomponent().mySession().TODAY);
     if (!wocomponent().droitTout()) domaines = filtreDomaine(domaines).immutableClone();
     domaines =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(
             domaines, EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         (NSArray<EORepartDomCapacite>) domaines.valueForKey(EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(rdcs, EORepartDomCapacite.CAPACITE_KEY);
     if (rdcs != null && rdcs.count() > 0 && verifCap(rdcs)) {
       NSArray tt = (NSArray<EOCapacite>) rdcs.valueForKey(EORepartDomCapacite.CAPACITE_KEY);
       for (int t = 0; t < tt.count(); t++) {
         Object obj = (NSMutableArray) tt.objectAtIndex(t);
         // Correction bug plusieur objet dans un objet
         if (((NSMutableArray) obj).count() > 1) {
           for (Object ob : (NSMutableArray) obj) {
             EOCapacite cp = (EOCapacite) ob;
             if (cp != null) tmp2.addObject(cp);
           }
         } else {
           EOCapacite cp = (EOCapacite) ((NSMutableArray) obj).lastObject();
           if (cp != null) tmp2.addObject(cp);
         }
       }
       NSArray tmp3 = tmp2.immutableClone();
       tmp.addObjectsFromArray(tmp3);
     } else {
       tmp.addObjectsFromArray(EOCapacite.fetchCapacites(ec, wocomponent().mySession().TODAY));
     }
     EOCapacite capacite = selectedCapacite();
     if (capacite != null && !tmp.contains(capacite)) {
       tmp.addObject(capacite);
     }
     if (tmp != null && tmp.count() > 0) {
       ERXArrayUtilities.sortArrayWithKey(tmp, EOCapacite.LBL_COURT_KEY);
       lesCapacites = ERXArrayUtilities.arrayWithoutDuplicates(tmp);
     }
   }
   return lesCapacites;
 }
Exemple #4
0
 public NSArray personList() {
   NSArray forcedList = (NSArray) valueForBinding("forcedList");
   NSMutableArray result =
       (forcedList == null)
           ? new NSMutableArray()
           : EOUtilities.localInstancesOfObjects(ec, forcedList).mutableClone();
   NSArray personList = (NSArray) session().valueForKey("personList");
   if (personList != null && personList.count() > 0) {
     Enumeration enu = personList.objectEnumerator();
     while (enu.hasMoreElements()) {
       EOEnterpriseObject pers = (EOEnterpriseObject) enu.nextElement();
       if (!result.contains(pers)
           && (entity().equals(pers.entityName()) || pers.entityName().equals(alterEntity())))
         result.addObject(pers);
     }
   }
   return result;
 }