コード例 #1
0
 // Edit Capacite
 public WOActionResults editCapacite() {
   if (selectedCapacite() != null) {
     checkDomaines = null;
     removedDomaines = null;
     wocomponent().setCapacite(selectedCapacite());
     EOCapacite capacite = wocomponent().capacite();
     if (capacite.repartDomCapacites().count() > 0) {
       for (EORepartDomCapacite rdc : capacite.repartDomCapacites()) {
         checkDomaines().addObject(rdc.domaine());
       }
     }
     setActivUpdateCapacite(true);
     setLockFieldCapacite(true);
   } else {
     FactoryCapacite fp = new FactoryCapacite(wocomponent().edc());
     EOCapacite capacite = fp.creerCapaciteVierge(persId());
     wocomponent().resetUneCapaciteField();
     wocomponent().setCapacite(capacite);
     setActivUpdateCapacite(false);
     setLockFieldCapacite(false);
     checkDomaines = null;
     removedDomaines = null;
   }
   return wocomponent().submit();
 }
コード例 #2
0
 /** @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;
 }