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; }
/** * Overriden to contruct a valid SQL92 JOIN clause as opposed to the Oracle-like SQL the * superclass produces. * * <p>kieran copied from PostgresqlExpression */ @Override public String joinClauseString() { NSMutableDictionary<String, Boolean> seenIt = new NSMutableDictionary<String, Boolean>(); StringBuilder sb = new StringBuilder(); JoinClauseDefinition jc; EOSortOrdering.sortArrayUsingKeyOrderArray( _alreadyJoined, new NSArray<EOSortOrdering>( EOSortOrdering.sortOrderingWithKey("sortKey", EOSortOrdering.CompareAscending))); if (_alreadyJoined.count() > 0) { jc = _alreadyJoined.objectAtIndex(0); sb.append(jc); seenIt.setObjectForKey(Boolean.TRUE, jc._table1); seenIt.setObjectForKey(Boolean.TRUE, jc._table2); } for (int i = 1; i < _alreadyJoined.count(); i++) { jc = _alreadyJoined.objectAtIndex(i); sb.append(jc._op); if (seenIt.objectForKey(jc._table1) == null) { sb.append(jc._table1); seenIt.setObjectForKey(Boolean.TRUE, jc._table1); } else if (seenIt.objectForKey(jc._table2) == null) { sb.append(jc._table2); seenIt.setObjectForKey(Boolean.TRUE, jc._table2); } sb.append(jc._joinCondition); } return sb.toString(); }
private void updateCbParcours() { myView.getCbParcours().removeAllItems(); if (eodHabilitations.selectedObjects() != null && eodHabilitations.selectedObjects().count() == 1) { FormationHabilitation selectedHabilitation = (FormationHabilitation) eodHabilitations.selectedObject(); int niveau = selectedHabilitation.fhabNiveau().intValue(); int ordre1 = niveau * 2 - 1; int ordre2 = ordre1 + 1; EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat( "(" + MaquetteRepartitionSem.SEMESTRE_KEY + "." + MaquetteSemestre.MSEM_ORDRE_KEY + " = %@ or " + MaquetteRepartitionSem.SEMESTRE_KEY + "." + MaquetteSemestre.MSEM_ORDRE_KEY + " = %@) and " + MaquetteRepartitionSem.PARCOURS_KEY + "." + MaquetteParcours.FORMATION_SPECIALISATION_KEY + " = %@ and " + MaquetteRepartitionSem.FANN_KEY_KEY + " = %@", new NSArray<Object>( new Object[] { new Integer(ordre1), new Integer(ordre2), selectedHabilitation.formationSpecialisation(), selectedHabilitation.fannKey() })); EOSortOrdering sortSemestres = EOSortOrdering.sortOrderingWithKey( MaquetteRepartitionSem.SEMESTRE_KEY + "." + MaquetteSemestre.MSEM_ORDRE_KEY, EOSortOrdering.CompareCaseInsensitiveAscending); EOSortOrdering sortParcours = EOSortOrdering.sortOrderingWithKey( MaquetteRepartitionSem.PARCOURS_KEY + "." + MaquetteParcours.MPAR_LIBELLE_KEY, EOSortOrdering.CompareCaseInsensitiveAscending); NSArray<MaquetteRepartitionSem> semestres = MaquetteRepartitionSem.fetchMaquetteRepartitionSems( ec, qualifier, new NSArray<EOSortOrdering>(new EOSortOrdering[] {sortSemestres, sortParcours})); myView.getCbParcours().addItem(null); for (int i = 0; i < semestres.count(); i++) { myView.getCbParcours().addItem(semestres.objectAtIndex(i)); } } }
public NSArray sortedClosedChildren() { Object orderings[] = { EOSortOrdering.sortOrderingWithKey("version", EOSortOrdering.CompareAscending), EOSortOrdering.sortOrderingWithKey("targetMilestone", EOSortOrdering.CompareAscending), EOSortOrdering.sortOrderingWithKey( "priority", EOSortOrdering.CompareCaseInsensitiveAscending), EOSortOrdering.sortOrderingWithKey( "bugSeverity", EOSortOrdering.CompareCaseInsensitiveAscending), }; return EOSortOrdering.sortedArrayUsingKeyOrderArray( (NSArray) anIssue.valueForKey("closedChildren"), new NSArray(orderings)); }
public void initCustomerIssues() { EOFetchSpecification fs; NSDictionary bindings = null; Session s = (Session) session(); NSMutableArray qual = new NSMutableArray(); NSMutableArray qual1 = new NSMutableArray(); EOQualifier qualifier; // 'Open items' // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='CLOSED'", null)); // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='RESOLVED'", null)); // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='VERIFIED'", null)); // Taser qual1.addObject(EOQualifier.qualifierWithQualifierFormat("type = 'Prospect'", null)); qual1.addObject(EOQualifier.qualifierWithQualifierFormat("type = 'Customer'", null)); qual.addObject(new EOOrQualifier(qual1)); // Single Customer if (customerId() != null) { qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugId=" + customerId(), null)); showProductSelector = true; } else { // Products if (selectedProducts.count() == 1) { if (selectedProducts.contains("Trusted Access")) { qual.addObject( EOQualifier.qualifierWithQualifierFormat( "product.productName = 'Device: Trusted Access'", null)); } else if (selectedProducts.contains("Secure Storage")) { qual.addObject( EOQualifier.qualifierWithQualifierFormat( "product.productName = 'Device: Secure Storage'", null)); } } } Object orderings[] = { EOSortOrdering.sortOrderingWithKey("version", EOSortOrdering.CompareAscending), EOSortOrdering.sortOrderingWithKey("targetMilestone", EOSortOrdering.CompareAscending), EOSortOrdering.sortOrderingWithKey( "priority", EOSortOrdering.CompareCaseInsensitiveAscending), EOSortOrdering.sortOrderingWithKey( "bugSeverity", EOSortOrdering.CompareCaseInsensitiveAscending), }; fs = new EOFetchSpecification("Item", new EOAndQualifier(qual), new NSArray(orderings)); fs.setRefreshesRefetchedObjects(true); ((EODatabaseDataSource) customerIssueDisplayGroup.dataSource()).setFetchSpecification(fs); customerIssueDisplayGroup.fetch(); }
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; }
public NSArray tosIntervention(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) { NSArray results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( org.cocktail.dt.server.metier.EOIntervention.TO_ACTIVITES_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = org.cocktail.dt.server.metier.EOIntervention.fetchAll( editingContext(), fullQualifier, sortOrderings); } else { results = tosIntervention(); if (qualifier != null) { results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
public NSArray scolMaquetteRepartitionAps( EOQualifier qualifier, NSArray sortOrderings, boolean fetch) { NSArray results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( org.cocktail.groupescol.client.eof.ScolMaquetteRepartitionAp.SCOL_MAQUETTE_AP_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = org.cocktail.groupescol.client.eof.ScolMaquetteRepartitionAp .fetchScolMaquetteRepartitionAps(editingContext(), fullQualifier, sortOrderings); } else { results = scolMaquetteRepartitionAps(); if (qualifier != null) { results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
public NSArray salless(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) { NSArray results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( org.cocktail.superplan.server.metier.Salles.LOCAL_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = org.cocktail.superplan.server.metier.Salles.fetchSalleses( editingContext(), fullQualifier, sortOrderings); } else { results = salless(); if (qualifier != null) { results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
public NSArray repartValidations(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) { NSArray results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( fr.univlr.cri.conges.eos.modele.conges.EORepartValidation.OCCUPATION_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = fr.univlr.cri.conges.eos.modele.conges.EORepartValidation.fetchRepartValidations( editingContext(), fullQualifier, sortOrderings); } else { results = repartValidations(); if (qualifier != null) { results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
public NSArray<org.pachyderm.foundation.eof.PDBScreen> everyScreen( EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) { NSArray<org.pachyderm.foundation.eof.PDBScreen> results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = ERXQ.equals(org.pachyderm.foundation.eof.PDBScreen.PRESENTATION_KEY, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { fullQualifier = ERXQ.and(qualifier, inverseQualifier); } results = org.pachyderm.foundation.eof.PDBScreen.fetchPDBScreens( editingContext(), fullQualifier, sortOrderings); } else { results = everyScreen(); if (qualifier != null) { results = (NSArray<org.pachyderm.foundation.eof.PDBScreen>) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<org.pachyderm.foundation.eof.PDBScreen>) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
public NSArray localList() { if (indexItem == null) return null; NSDictionary local = (NSDictionary) indexItem.valueForKey("local"); if (local == null) return null; NSArray result = (NSArray) local.valueForKey("list"); if (result != null) return result; String entityName = (String) local.valueForKey("entityName"); if (entityName != null) { EOQualifier qual = null; String qualifier = (String) local.valueForKey("qualifier"); if (qualifier != null) { NSArray args = (NSArray) local.valueForKey("args"); if (args != null && args.count() > 0) { Object[] a = new Object[args.count()]; for (int i = 0; i < a.length; i++) { a[i] = DisplayAny.ValueReader.evaluateValue(args.objectAtIndex(i), plist, this); } args = new NSArray(a); } qual = EOQualifier.qualifierWithQualifierFormat(qualifier, args); } NSArray sorter = (NSArray) local.valueForKey("sorter"); if (sorter != null && sorter.count() > 0) { Object[] s = new Object[sorter.count()]; for (int i = 0; i < s.length; i++) { Object sort = sorter.objectAtIndex(i); if (sort instanceof String) { s[i] = new EOSortOrdering((String) sort, EOSortOrdering.CompareAscending); } else { NSDictionary so = (NSDictionary) sort; String key = (String) so.valueForKey("key"); String order = (String) so.valueForKey("order"); s[i] = new EOSortOrdering(key, EOSortOrdering._operatorSelectorForString(order)); } } sorter = new NSArray(s); } EOFetchSpecification fs = new EOFetchSpecification(entityName, qual, sorter); result = ec.objectsWithFetchSpecification(fs); } else if (local.valueForKey("methodName") != null) result = (NSArray) DisplayAny.ValueReader.evaluateDict(local, plist, this); if (result != null) { String uniq = (String) local.valueForKey("uniqueAttribute"); if (uniq != null) { NSMutableArray res = new NSMutableArray(); for (int i = 0; i < result.count(); i++) { Object obj = NSKeyValueCodingAdditions.Utility.valueForKeyPath(result.objectAtIndex(i), uniq); if (obj instanceof String) obj = WOMessage.stringByEscapingHTMLString((String) obj); if (!res.containsObject(obj)) res.addObject(obj); } result = res; } } local.takeValueForKey(result, "list"); return result; }
protected static NSArray prepareJournalZPU( Enumeration substitutes, Enumeration variations, SchoolSection section) { NSMutableArray result = new NSMutableArray(); NSMutableSet lessons = new NSMutableSet(); if (variations != null) { while (variations.hasMoreElements()) { Variation var = (Variation) variations.nextElement(); if (section != null && !section.equals(var.valueForKeyPath("course.cycle.section"))) continue; EduLesson lesson = var.relatedLesson(); if (lesson != null) { if (lessons.containsObject(lesson)) continue; lessons.addObject(lesson); } NSMutableDictionary dict = convertEvent(var); NSArray multiply = (NSArray) dict.valueForKey("multiply"); if (multiply != null) { Enumeration mul = multiply.objectEnumerator(); while (mul.hasMoreElements()) { Substitute sub = (Substitute) mul.nextElement(); NSMutableDictionary clon = dict.mutableClone(); clon.takeValueForKey(sub.teacher(), "plusTeacher"); clon.takeValueForKey(sub.value(), "value"); result.addObject(clon); } } else { result.addObject(dict); } } } if (substitutes != null) { while (substitutes.hasMoreElements()) { Substitute sub = (Substitute) substitutes.nextElement(); EduLesson lesson = sub.lesson(); if (lessons.containsObject(lesson)) continue; if (section != null && !section.equals(lesson.valueForKeyPath("course.cycle.section"))) continue; // lessons.addObject(sub.lesson()); NSMutableDictionary dict = convertEvent(sub); result.addObject(dict); } } NSArray sorter = new NSArray( new EOSortOrdering[] { new EOSortOrdering("date", EOSortOrdering.CompareAscending), new EOSortOrdering("minusTeacher", EOSortOrdering.CompareAscending), new EOSortOrdering("grade", EOSortOrdering.CompareAscending), new EOSortOrdering("eduGroup", EOSortOrdering.CompareAscending), new EOSortOrdering("plusTeacher", EOSortOrdering.CompareAscending) }); EOSortOrdering.sortArrayUsingKeyOrderArray(result, sorter); return result; }
public NSArray repartStructures(EOQualifier qualifier, NSArray sortOrderings) { NSArray results; results = repartStructures(); if (qualifier != null) { results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } return results; }
public NSArray sortedCriteriaList() { if (_sortedArray == null) { _sortedArrayBase = EOSortOrdering.sortedArrayUsingKeyOrderArray(criteriaList(), _ordering); NSMutableArray sortedArray2 = new NSMutableArray(_sortedArrayBase); sortedArray2.addObject(DRCriteria.asTotalWithMasterCriteria(_masterCriteria)); _sortedArray = new NSArray(sortedArray2); } if (_useGroupTotal) { return _sortedArray; } return _sortedArrayBase; }
public NSArray<er.rbac.eof.ERPrivilege> privileges( EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { NSArray<er.rbac.eof.ERPrivilege> results; results = privileges(); if (qualifier != null) { results = (NSArray<er.rbac.eof.ERPrivilege>) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<er.rbac.eof.ERPrivilege>) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } return results; }
public NSArray<er.sync.eo.ERSyncClientApp> applications( EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings) { NSArray<er.sync.eo.ERSyncClientApp> results; results = applications(); if (qualifier != null) { results = (NSArray<er.sync.eo.ERSyncClientApp>) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<er.sync.eo.ERSyncClientApp>) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } return results; }
public void search() { try { found = Person.Utility.search(ec, entity(), searchString); if ((found == null || found.count() == 0) && alterEntity() != null) found = Person.Utility.search(ec, alterEntity(), searchString); } catch (Exception e) { searchMessage = e.getMessage(); canCreate = false; return; } if (found.count() < 1) { searchMessage = (String) session().valueForKeyPath("strings.Strings.messages.nothingFound"); canCreate = Various.boolForObject(session().valueForKeyPath("readAccess.create." + entity())); return; } NSMutableArray fullList = (NSMutableArray) session().valueForKey("personList"); NSMutableArray tmp = found.mutableClone(); tmp.removeObjectsInArray(fullList); fullList.addObjectsFromArray(tmp); if (fullList.count() > 1) EOSortOrdering.sortArrayUsingKeyOrderArray(fullList, Person.sorter); searchMessage = null; }
public NSArray<edu.umich.marketplace.eof.Advert> adverts( EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) { NSArray<edu.umich.marketplace.eof.Advert> results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( edu.umich.marketplace.eof.Advert.CATEGORY_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = edu.umich.marketplace.eof.Advert.fetchAdverts( editingContext(), fullQualifier, sortOrderings); } else { results = adverts(); if (qualifier != null) { results = (NSArray<edu.umich.marketplace.eof.Advert>) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<edu.umich.marketplace.eof.Advert>) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
// Préviens de charger la liste des diplomes avec RN ... et celle sans RN, pour l'année en cours // à chaque refetch, on raffraichit avec les datas de la base... public void chargerDiplRN() { NSArray bindings = new NSArray(new Object[] {cptLogin, getFannKey()}); EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat("cptLogin = %@ and fannKey = %@", bindings); EOSortOrdering ordreDipl = EOSortOrdering.sortOrderingWithKey("diplome", EOSortOrdering.CompareAscending); NSArray sortOrderings = new NSArray(new Object[] {ordreDipl}); // la liste des diplomes qui n'autorisent pas les RN par le Web EOFetchSpecification fetchSpec = new EOFetchSpecification("VDiplomeSansRn", qualifier, sortOrderings); fetchSpec.setRefreshesRefetchedObjects(true); EOEditingContext ec = maSession.defaultEditingContext(); listeDiplSansRN = ec.objectsWithFetchSpecification(fetchSpec); // la liste des diplomes qui autorisent les RN par le Web fetchSpec = new EOFetchSpecification("VDiplomeAvecRn", qualifier, sortOrderings); fetchSpec.setRefreshesRefetchedObjects(true); listeDiplAvecRN = ec.objectsWithFetchSpecification(fetchSpec); }
public NSArray<er.sync.eo.ERSyncPrincipal> principals( EOQualifier qualifier, NSArray<EOSortOrdering> sortOrderings, boolean fetch) { NSArray<er.sync.eo.ERSyncPrincipal> results; if (fetch) { EOQualifier fullQualifier; EOQualifier inverseQualifier = new EOKeyValueQualifier( er.sync.eo.ERSyncPrincipal.DEVICE_TYPE_KEY, EOQualifier.QualifierOperatorEqual, this); if (qualifier == null) { fullQualifier = inverseQualifier; } else { NSMutableArray qualifiers = new NSMutableArray(); qualifiers.addObject(qualifier); qualifiers.addObject(inverseQualifier); fullQualifier = new EOAndQualifier(qualifiers); } results = er.sync.eo.ERSyncPrincipal.fetchERSyncPrincipals( editingContext(), fullQualifier, sortOrderings); } else { results = principals(); if (qualifier != null) { results = (NSArray<er.sync.eo.ERSyncPrincipal>) EOQualifier.filteredArrayWithQualifier(results, qualifier); } if (sortOrderings != null) { results = (NSArray<er.sync.eo.ERSyncPrincipal>) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings); } } return results; }
@SuppressWarnings("all") public class EOIndividu extends _EOIndividu { /** */ private static final long serialVersionUID = 5812982879122485011L; private static Logger log = Logger.getLogger(EOIndividu.class); private static Session sess = new Session(); public static String ETAT_VALIDE = "VALIDE"; public static String ETAT_SUPPRIME = "SUPPRIME"; public static EditionSQL sql = new EditionSQL(); // ORDER BY sur l'ID public static final EOSortOrdering SORT_ID_ASC = EOSortOrdering.sortOrderingWithKey("indivId", EOSortOrdering.CompareAscending); // ORDER BY sur le NOM public static final EOSortOrdering SORT_NOM_ASC = EOSortOrdering.sortOrderingWithKey("nom", EOSortOrdering.CompareAscending); // ORDER BY sur le PRENOM public static final EOSortOrdering SORT_PRENOM_ASC = EOSortOrdering.sortOrderingWithKey("prenom", EOSortOrdering.CompareAscending); public static final NSMutableArray ARGSUV = new NSMutableArray(); public static String ANUNIV = null; public static String PRDUNIV = null; private NSDictionary dataEtudiant; private NSDictionary dataIndividu; public EOIndividu() { // TODO Auto-generated constructor stub } public static Application myApp() { return (Application) WOApplication.application(); } /** @return the dataEtudiant */ public NSDictionary getDataEtudiant() { return dataEtudiant; } /** @param dataEtudiant the dataEtudiant to set */ public void setDataEtudiant(NSDictionary dataEtudiant) { this.dataEtudiant = dataEtudiant; } /** @return the dataIndividu */ public NSDictionary getDataIndividu() { return dataIndividu; } /** @param dataIndividu the dataIndividu to set */ public void setDataIndividu(NSDictionary dataIndividu) { this.dataIndividu = dataIndividu; } /** @return the sess */ public Session getSess() { return sess; } /** @param sess the sess to set */ public void setSess(Session sess) { this.sess = sess; } public boolean isValide() { return true; } public static boolean isEtudiant(EOEditingContext myContext, EOIndividu aIndividu) { boolean isEtudiant = false; NSArray etudiants = null; if (aIndividu != null) { etudiants = lesEtudiants(myContext, aIndividu); } return !etudiants.isEmpty(); } // Affichage Nom, Pr�nom public String nomAndPrenom() { return nom() + " " + prenom(); } // Numero de s�curit� social public String numSecu() { return nni() + " " + nniCle(); } // V�rification afin de savoir si le user connect� est conseill� d'un // �tudiant public static NSArray lesConseillers(EOEditingContext myContext, String conseil) { NSArray cons = new NSArray(); if (conseil != null) { EOQualifier qalCons = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.CONSEILLER_ID).eq(Long.valueOf(conseil)); EOFetchSpecification spec = new EOFetchSpecification( "EOIndividu", qalCons, new NSArray(new Object[] {SORT_NOM_ASC, SORT_PRENOM_ASC})); spec.setUsesDistinct(true); cons = myContext.objectsWithFetchSpecification(spec); } return cons; } // V�rification afin de savoir si le user connect� est un �tudiant private static NSArray lesEtudiants(EOEditingContext myContext, EOIndividu etudiant) { EOQualifier qalCons = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID).eq(etudiant.indivId()); EOFetchSpecification spec = new EOFetchSpecification( "EOIndividu", qalCons, new NSArray(new Object[] {SORT_NOM_ASC, SORT_PRENOM_ASC})); spec.setUsesDistinct(true); NSArray etu = myContext.objectsWithFetchSpecification(spec); return etu; } /** Qualifier conditionner */ // CLAUSE WHERE "NOM LIKE ..." private static EOQualifier qualForNomLike(String nom) { String nom_b = StringCtrl.chaineSansAccents(nom, "?").toUpperCase(); // EOQualifier quaNom = // EOQualifier.qualifierWithQualifierFormat(StringCtrl.chaineSansAccents(NOM_KEY)+" LIKE %@", // new NSArray(nom_b)); // return quaNom; return NOM.ilike(nom_b); } private static EOQualifier qualForNomNaisLike(String nom) { String nom_b = StringCtrl.chaineSansAccents(nom, "?").toUpperCase(); // EOQualifier quaNom = // EOQualifier.qualifierWithQualifierFormat(StringCtrl.chaineSansAccents(NOM_KEY)+" LIKE %@", // new NSArray(nom_b)); // return quaNom; return NOM_NAIS.ilike(nom_b); } // CLAUSE WHERE "PRENOM LIKE ..." private static EOQualifier qualForPrenomLike(String prenom) { // String prenom_a = StringCtrl.chaineSansAccents(prenom, // "?").toUpperCase(); // EOQualifier quaPrenom = // EOQualifier.qualifierWithQualifierFormat(PRENOM_KEY+" LIKE %@", new // NSArray(prenom)); // return quaPrenom; return PRENOM.ilike(prenom); } // CLAUSE WHERE "ANUNIV||PRDUNIV = ..." private static EOQualifier qualForPeriode(String periode) { NSMutableArray args = new NSMutableArray(); int y = periode.length(); if (y == 5) { ANUNIV = periode.substring(0, y - 1); PRDUNIV = periode.substring(y - 1, y); } if (y == 6) { ANUNIV = periode.substring(0, y - 2); PRDUNIV = periode.substring(y - 2, y); } args.addObject(ANUNIV); args.addObject(PRDUNIV); ARGSUV.addObject(ANUNIV); ARGSUV.addObject(PRDUNIV); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.AN_UNIV) .eq(ANUNIV) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.PRD_UNIV).eq(PRDUNIV)); } // CLAUSE WHERE "EIA.DIPLOMEC = ..." Dipl�me non soumis � une p�riode private static EOQualifier qualDiplome(String diplome) { return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.DIPLOMEC).eq(diplome); // return new EOKeyValueQualifier("etuInscrAdms.diplomec", // EOQualifier.QualifierOperatorEqual, diplome); } // CLAUSE WHERE "EIA.DIPLOMEC = ..." Dipl�me soumis � une p�riode private static EOQualifier qualPrdDiplome(String prdDiplome) { return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.DIPLOMEC).eq(prdDiplome); } // CLAUSE WHERE "EIA.NIVEAUADM = ..." Niveau non Master private static EOQualifier qualNonMST(String niveau) { NSMutableArray lNiveau = new NSMutableArray(); String checkIt = niveau; if (checkIt.length() == 8) { checkIt = checkIt.substring(5); } else { checkIt = checkIt.substring(1); } int z = niveau.length(); if (stringContains(checkIt, "-M1") || stringContains(checkIt, "-M2")) { if (stringContains(checkIt, "-M1")) { lNiveau = new NSMutableArray(); String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } // lNiveau.addObject(pSpec); lNiveau.addObject("1"); lNiveau.addObject("2"); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau)); } else if (stringContains(checkIt, "-M2")) { lNiveau = new NSMutableArray(); String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } // lNiveau.addObject(pSpec); lNiveau.addObject("3"); lNiveau.addObject("4"); lNiveau.addObject("5"); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau)); } } else { if (stringContains(niveau, "M1") || stringContains(niveau, "M2")) { if (stringContains(niveau, "M1")) { lNiveau = new NSMutableArray(); lNiveau.addObject('1'); lNiveau.addObject('2'); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.NIVEAU_ADM) .eq("1") .or(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).eq("2")); } else if (stringContains(niveau, "M2")) { lNiveau = new NSMutableArray(); lNiveau.addObject("3"); lNiveau.addObject("4"); lNiveau.addObject("5"); return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau); } } else { lNiveau = new NSMutableArray(); String pSpec = null; String pniveau = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 1).trim(); pniveau = niveau.substring(z - 2, z); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); pniveau = niveau.substring(z - 3, z); } else if (z == 8) { pSpec = pSpeci.substring(0, z - 5).trim(); pniveau = niveau.substring(z - 4, z); } else { pSpec = pSpeci; pniveau = niveau.substring(z - 1, z); } lNiveau.addObject(pSpec); lNiveau.addObject(pniveau); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).eq(pniveau)); } } String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } String pniveau = niveau.substring(z - 1, z); lNiveau.addObject(pSpec); lNiveau.addObject(pniveau); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).eq(pniveau)); } // CLAUSE WHERE "EIA.NIVEAUADM = ..." Niveau Master private static EOQualifier qualMST(String niveau, String diplome, String prdDiplome) { NSMutableArray lNiveau = new NSMutableArray(); String checkIt = niveau; checkIt = checkIt.substring(5); int z = niveau.length(); if (stringContains(checkIt, "-M1") || stringContains(checkIt, "-M2")) { if (stringContains(checkIt, "-M1")) { lNiveau = new NSMutableArray(); String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } lNiveau.addObject(pSpec); lNiveau.addObject("1"); lNiveau.addObject("2"); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau)); } else if (stringContains(checkIt, "-M2")) { lNiveau = new NSMutableArray(); String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } lNiveau.addObject("3"); lNiveau.addObject("4"); lNiveau.addObject("5"); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau)); } } else { if (stringContains(niveau, "M1") || stringContains(niveau, "M2")) { if (stringContains(niveau, "M1")) { lNiveau = new NSMutableArray(); lNiveau.addObject("1"); lNiveau.addObject("2"); return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau); } else if (stringContains(niveau, "M2")) { lNiveau = new NSMutableArray(); lNiveau.addObject("3"); lNiveau.addObject("4"); lNiveau.addObject("5"); return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).in(lNiveau); } } else { if ((diplome != null && diplome.equals("MST")) || (prdDiplome != null && prdDiplome.equals("MST"))) { EOQualifier qualOpt = null; lNiveau = new NSMutableArray(); String pSpec = null; String diplopt = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); diplopt = pSpeci.substring(pSpeci.length() - 2, pSpeci.length()).trim(); if (diplopt.equals("**")) { diplopt = " "; } } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); diplopt = pSpeci.substring(pSpeci.length() - 3, pSpeci.length()).trim(); if (diplopt.equals("**")) { diplopt = " "; } } else { pSpec = pSpeci.substring(0, z - 5).trim(); diplopt = pSpeci.substring(z - 5, pSpeci.length()).trim(); if (diplopt.equals("**")) { diplopt = null; } } String pniveau = niveau.substring(z - 1, z); lNiveau.addObject(pSpec); if (!diplopt.equals(" ") || diplopt != null) { lNiveau.addObject(diplopt); qualOpt = new EOKeyValueQualifier( "etuInscrAdms.diplOptc", EOQualifier.QualifierOperatorEqual, diplopt); } else { qualOpt = new EOKeyValueQualifier( "etuInscrAdms.diplOptc", EOQualifier.QualifierOperatorEqual, NSKeyValueCoding.NullValue); } lNiveau.addObject(pniveau); NSMutableArray qualfin = new NSMutableArray(); EOQualifier qualSpec = new EOKeyValueQualifier( "etuInscrAdms.diplSpecc", EOQualifier.QualifierOperatorEqual, pSpec); EOQualifier qualNvieau = new EOKeyValueQualifier( "etuInscrAdms.niveauAdm", EOQualifier.QualifierOperatorEqual, pniveau); qualfin.addObject(qualSpec); qualfin.addObject(qualOpt); qualfin.addObject(qualNvieau); return new EOAndQualifier(qualfin); } else { lNiveau = new NSMutableArray(); String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } String pniveau = niveau.substring(z - 1, z); lNiveau.addObject(pSpec); lNiveau.addObject(pniveau); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).eq(pniveau)); } } } String pSpec = null; String pSpeci = niveau.substring(0, z - 1); if (z == 5) { pSpec = pSpeci.substring(0, pSpeci.length() - 2).trim(); } else if (z == 6) { pSpec = pSpeci.substring(0, pSpeci.length() - 3).trim(); } else { pSpec = pSpeci.substring(0, z - 5).trim(); } String pniveau = niveau.substring(z - 1, z); lNiveau.addObject(pSpec); lNiveau.addObject(pniveau); return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.DIPL_SPECC) .eq(pSpec) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.NIVEAU_ADM).eq(pniveau)); } // CLAUSE WHERE "EIA.ETUID = ..." Recherche d'un �tudiant private static EOQualifier qualNumero(String numero) { Long nombre = Long.parseLong(numero); return ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID).eq(nombre); // return new EOKeyValueQualifier("etuInscrAdms.etuId", // EOQualifier.QualifierOperatorEqual, nombre); } // CLAUSE WHERE "UV.ANUNIV || UV.PRDUNIV = ... AND UV.UVC = ... // AND UV.ANUNIV || UV.PRDUNIV = EIA.ANUNIV || EIA.PRDUNIV" UV o� est // inscris l'�tudiant private static EOQualifier qualForUv(String uv, String periode) { // ARGSUV.addObject(uv); NSMutableArray quals = new NSMutableArray(); EOEditingContext myContext = ERXEC.newEditingContext(); EOQualifier qalUv = EOVueInsuv.UVC .eq(uv) .and( EOVueInsuv.EO_ETUDIANT_INSCR_ADM .dot(EOEtudiantInscrAdm.ETU_ID) .eq(EOVueInsuv.ETU_ID)); quals.addObject(qalUv); if (periode != null) { EOQualifier qualPer = EOQualifier.qualifierWithQualifierFormat("anUniv=%@ AND prdUniv=%@", ARGSUV); quals.addObject(qualPer); } EOFetchSpecification spec = null; if (quals.count() == 2) { EOQualifier qual = new EOAndQualifier(quals); spec = new EOFetchSpecification("EOVueInsuv", qual, null); } else { spec = new EOFetchSpecification("EOVueInsuv", qalUv, null); } spec.setUsesDistinct(true); NSArray uvs = myContext.objectsWithFetchSpecification(spec); NSMutableArray etuids = new NSMutableArray(); for (int i = 0; i < uvs.count(); i++) { EOVueInsuv luv = (EOVueInsuv) uvs.objectAtIndex(i); Long etu_id = luv.etuId(); etuids.addObject(etu_id); } EOQualifier fin = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID).in(etuids.immutableClone()); return fin; } // CLAUSE WHERE "EIA.Conseiller_ID = ..." Conseiller de l'�tudiant private static EOQualifier qualForConseiller(EOEditingContext myContext, String conseil) { String periode = null; NSMutableDictionary tmpper = (NSMutableDictionary) reWriteListDico(selectRawRowcourant(myContext)).lastObject(); periode = (String) tmpper.valueForKey("PERIODE"); int y = periode.length(); if (y == 5) { ANUNIV = periode.substring(0, y - 1); PRDUNIV = periode.substring(y - 1, y); } if (y == 6) { ANUNIV = periode.substring(0, y - 2); PRDUNIV = periode.substring(y - 2, y); } return ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.CONSEILLER_ID) .eq(Long.valueOf(conseil)) .and( ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.AN_UNIV) .eq(ANUNIV) .and(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.PRD_UNIV).eq(PRDUNIV))); // return new EOKeyValueQualifier("etuInscrAdms.conseillerId", // EOQualifier.QualifierOperatorEqual, Long.valueOf((conseil))); } /** Jointures par d�faut suite aux cl�s �trang�res entre les diff�rentes tables */ // JOINTURE SUR INDMAILS private static EOQualifier typeEmail1() { return new EOKeyValueQualifier( "indEmails.emailTypec", EOQualifier.QualifierOperatorEqual, "UTT"); } private static EOQualifier typeEmail() { EOQualifier mail = INDIV_ID .eq(IND_EMAILS.dot(EOIndEmail.INDIV_ID)) .and(IND_EMAILS.dot(EOIndEmail.EMAIL_TYPEC).eq("UTT")); return mail; } // JOINTURE SUR LA CIVILITE private static EOQualifier qualCivilite1() { return new EOKeyValueQualifier( "refCivilite.civilitec", EOQualifier.QualifierOperatorNotEqual, NSKeyValueCoding.NullValue); } private static EOQualifier qualCivilite() { EOQualifier civilite = CIVILITEC.eq(REF_CIVILITE.dot(EORefCivilite.CIVILITEC)); return civilite; } // JOINTURE SUR L'EIA private static EOQualifier qualEia1() { return new EOKeyValueQualifier( "etuInscrAdms.etuId", EOQualifier.QualifierOperatorNotEqual, NSKeyValueCoding.NullValue); } private static EOQualifier qualEia() { EOAndQualifier and = null; NSMutableArray qua = new NSMutableArray(); ERXKeyValueQualifier PERS_UV = null; if (myApp().persUv()) { PERS_UV = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.DIPL_SPECC).isNot("03"); qua.add(PERS_UV); } EOQualifier eia = INDIV_ID .eq(ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID)) .and( ETU_INSCR_ADMS .dot(EOEtudiantInscrAdm.ETU_ID) .eq(IND_EMAILS.dot(EOIndEmail.INDIV_ID))); if (PERS_UV != null) { qua.add(eia); and = new EOAndQualifier(qua); return and; } return eia; } private static EOQualifier refMail() { return new EOKeyValueQualifier( "indEmails.indivId", EOQualifier.QualifierOperatorNotEqual, NSKeyValueCoding.NullValue); } // SELECT sur la vue parcours des etudiants private static NSArray<String> preFetch() { NSMutableArray preFetching = new NSMutableArray(); preFetching.addObject("eoVueAfficherparcourses"); preFetching.addObject("mineurs"); preFetching.addObject("refCivilite"); preFetching.addObject("indEmails"); preFetching.addObject("etudiants1"); preFetching.addObject("etuInscrAdms"); return preFetching.immutableClone(); } // SELECT des �tudiants non master public static NSArray EtudiantsNonMST( EOEditingContext myContext, NSDictionary bindinds, Recherche searchMsg) { String periode = (String) bindinds.valueForKey("periode"); String diplome = (String) bindinds.valueForKey("diplome"); String prdDiplome = (String) bindinds.valueForKey("prdDiplome"); String niveau = (String) bindinds.valueForKey("niveau"); String uv = (String) bindinds.valueForKey("uv"); String nom = (String) bindinds.valueForKey("nom"); String prenom = (String) bindinds.valueForKey("prenom"); String numero = (String) bindinds.valueForKey("numero"); String idConseiller = (String) bindinds.valueForKey("idConseiller"); NSMutableArray quals = new NSMutableArray(); quals.addObject(typeEmail()); quals.addObject(qualCivilite()); quals.addObject(qualEia()); // quals.addObject(refMail()); if ((StringCtrl.isEmpty(nom)) && (StringCtrl.isEmpty(prenom)) && ((StringCtrl.isEmpty(numero))) && (periode == null || (StringCtrl.isEmpty(periode))) && (diplome == null || (StringCtrl.isEmpty(diplome))) && (niveau == null || (StringCtrl.isEmpty(niveau))) && (uv == null || (StringCtrl.isEmpty(uv))) && ((StringCtrl.isEmpty(idConseiller)))) { searchMsg.setSearchMsg("Veuillez affiner la recherche, trop de donn�es remont�es"); return NSArray.EmptyArray; } if (lesConseillers(myContext, idConseiller).count() != 0) { quals.addObject(qualForConseiller(myContext, idConseiller)); } else { if (!(StringCtrl.isEmpty(nom))) { NSMutableArray qua = new NSMutableArray(); qua.addObject(qualForNomLike(nom)); qua.addObject(qualForNomNaisLike(nom)); EOQualifier nor = new EOOrQualifier(qua); quals.addObject(nor); } if (!(StringCtrl.isEmpty(prenom))) { String deb = prenom.substring(0).toUpperCase(); String rest = prenom.substring(1, prenom.length()).toLowerCase(); prenom = deb + rest; quals.addObject(qualForPrenomLike(prenom)); } if (!(StringCtrl.isEmpty(numero))) { quals.addObject(qualNumero(numero)); } if (periode != null && !(StringCtrl.isEmpty(periode))) { quals.addObject(qualForPeriode(periode)); } if (diplome != null && !(StringCtrl.isEmpty(diplome))) { quals.addObject(qualDiplome(diplome)); } if (prdDiplome != null && !(StringCtrl.isEmpty(prdDiplome))) { quals.addObject(qualPrdDiplome(prdDiplome)); } if (niveau != null && !(StringCtrl.isEmpty(niveau))) { quals.addObject(qualNonMST(niveau)); } if (uv != null && !(StringCtrl.isEmpty(uv))) { quals.addObject(qualForUv(uv, periode)); } } EOQualifier qual = new EOAndQualifier(quals); EOFetchSpecification spec = new EOFetchSpecification( "EOIndividu", qual, new NSArray(new Object[] {SORT_NOM_ASC, SORT_PRENOM_ASC})); // spec.setFetchLimit(fetchLimit); spec.setPrefetchingRelationshipKeyPaths(preFetch()); spec.setUsesDistinct(true); NSArray disp = myContext.objectsWithFetchSpecification(spec); return disp; } // SELECT des �tudiants master public static NSArray EtudiantsMST( EOEditingContext myContext, NSDictionary bindinds, Recherche searchMsg) { String periode = (String) bindinds.valueForKey("periode"); String diplome = (String) bindinds.valueForKey("diplome"); String prdDiplome = (String) bindinds.valueForKey("prdDiplome"); String niveau = (String) bindinds.valueForKey("niveau"); String uv = (String) bindinds.valueForKey("uv"); String nom = (String) bindinds.valueForKey("nom"); String prenom = (String) bindinds.valueForKey("prenom"); String numero = (String) bindinds.valueForKey("numero"); String idConseiller = (String) bindinds.valueForKey("idConseiller"); NSMutableArray quals = new NSMutableArray(); quals.addObject(typeEmail()); quals.addObject(qualCivilite()); quals.addObject(qualEia()); // quals.addObject(refMail()); if ((StringCtrl.isEmpty(nom)) && (StringCtrl.isEmpty(prenom)) && ((StringCtrl.isEmpty(numero))) && (periode == null || (StringCtrl.isEmpty(periode))) && (diplome == null || (StringCtrl.isEmpty(diplome))) && (niveau == null || (StringCtrl.isEmpty(niveau))) && (uv == null || (StringCtrl.isEmpty(uv))) && ((StringCtrl.isEmpty(idConseiller)))) { searchMsg.setSearchMsg("Veuillez affiner la recherche, trop de donn�es remont�es"); return NSArray.EmptyArray; } if (lesConseillers(myContext, idConseiller).count() != 0) { quals.addObject(qualForConseiller(myContext, idConseiller)); } else { if (!(StringCtrl.isEmpty(nom))) { NSMutableArray qua = new NSMutableArray(); qua.addObject(qualForNomLike(nom)); qua.addObject(qualForNomNaisLike(nom)); EOQualifier nor = new EOOrQualifier(qua); quals.addObject(nor); } if (!(StringCtrl.isEmpty(prenom))) { String deb = prenom.substring(0, 1).toUpperCase(); String rest = prenom.substring(1, prenom.length()).toLowerCase(); prenom = deb + rest; quals.addObject(qualForPrenomLike(prenom)); } if (!(StringCtrl.isEmpty(numero))) { quals.addObject(qualNumero(numero)); } if (periode != null && !(StringCtrl.isEmpty(periode))) { quals.addObject(qualForPeriode(periode)); } if (diplome != null && !(StringCtrl.isEmpty(diplome))) { quals.addObject(qualDiplome(diplome)); } if (prdDiplome != null && !(StringCtrl.isEmpty(prdDiplome))) { quals.addObject(qualPrdDiplome(prdDiplome)); } if (niveau != null && !(StringCtrl.isEmpty(niveau))) { quals.addObject(qualMST(niveau, diplome, prdDiplome)); } if (uv != null && !(StringCtrl.isEmpty(uv))) { quals.addObject(qualForUv(uv, periode)); } } EOQualifier qual = new EOAndQualifier(quals); EOFetchSpecification spec = new EOFetchSpecification( "EOIndividu", qual, new NSArray(new Object[] {SORT_NOM_ASC, SORT_PRENOM_ASC})); spec.setPrefetchingRelationshipKeyPaths(preFetch()); spec.setUsesDistinct(true); NSArray disp = myContext.objectsWithFetchSpecification(spec); return disp; } public static boolean stringContains(String str, String searchStr) { if (str == null || searchStr == null) { return false; } return str.indexOf(searchStr) >= 0; } protected static NSArray selectRawRowcourant(EOEditingContext ed) { NSArray result = null; try { result = EOUtilities.rawRowsForSQL(ed, "EtudiantEoGerry", sql.periodeCourante(), null); } catch (Exception e) { e.printStackTrace(); } return result; } // Dictionnary Null value decoder protected static NSMutableArray reWriteListDico(NSArray dicoList) { NSMutableArray listDico = new NSMutableArray(); for (int j = 0; j < dicoList.count(); j++) { NSMutableDictionary tinyDico = new NSMutableDictionary(); tinyDico = (NSMutableDictionary) dicoList.objectAtIndex(j); reWriteDico(tinyDico); listDico.addObject(tinyDico); } return listDico; } protected static void reWriteDico(NSMutableDictionary dico) { for (int i = 0; i < dico.size(); i++) { Object value = dico.allValues().objectAtIndex(i); if (value.toString().equals("<com.webobjects.foundation.NSKeyValueCoding$Null>")) { String key = (String) dico.allKeys().objectAtIndex(i); dico.setObjectForKey(" ", key); // NSLog.out.appendln(dico); } } } }
/** * Takes an unordered set and creates a sorted array from its elements. * * @param <T> type of set contents * @param set the set containing the elements to sort * @param orderings the sort orderings * @return an array with sorted elements */ public static <T> NSArray<T> sortedArrayFromSet(NSSet<T> set, NSArray<EOSortOrdering> orderings) { return EOSortOrdering.sortedArrayUsingKeyOrderArray(set.allObjects(), orderings); }
private void init() { myView .getBtChercher() .addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { updateEodHabilitations(); } }); myView.getBtAjouter().setIcon(WidgetHandler.imageIcon("down")); myView .getBtAjouter() .addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ajouterPreference(); } }); myView.getBtSupprimer().setIcon(WidgetHandler.imageIcon("up")); myView .getBtSupprimer() .addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { retirerPreference(); } }); NSArray<FormationAnnee> formationAnnee = app.getFormationAnnees(); myView.getCbAnnee().removeAllItems(); for (int i = 0; i < formationAnnee.count(); i++) { FormationAnnee fAnnee = formationAnnee.objectAtIndex(i); myView.getCbAnnee().addItem(fAnnee); if (fAnnee.fannCourante().equals("O")) { myView.getCbAnnee().setSelectedItem(fAnnee); } } myView.getCbParcours().removeAllItems(); RechercheListener myRechercheListener = new RechercheListener(); myView.getBtChercher().addActionListener(myRechercheListener); myView.getTfGrade().addActionListener(myRechercheListener); myView.getTfDiplome().addActionListener(myRechercheListener); myView.getCbAnnee().addActionListener(new ChangementAnneeListener()); myView.getMyEOTableHabilitations().addListener(new ListenerTableHabilitations()); EOSortOrdering sortDiplome = EOSortOrdering.sortOrderingWithKey( FormationHabilitation.FORMATION_SPECIALISATION_KEY + "." + FormationSpecialisation.SCOL_FORMATION_DIPLOME_KEY + "." + FormationDiplome.FDIP_ABREVIATION_KEY, EOSortOrdering.CompareCaseInsensitiveAscending); EOSortOrdering sortNiveau = EOSortOrdering.sortOrderingWithKey( FormationHabilitation.FHAB_NIVEAU_KEY, EOSortOrdering.CompareAscending); eodHabilitations.setSortOrderings( new NSArray<EOSortOrdering>(new EOSortOrdering[] {sortDiplome, sortNiveau})); EOSortOrdering sortDiplomePref = EOSortOrdering.sortOrderingWithKey( PrefScol.HABILITATION_KEY + "." + FormationHabilitation.FORMATION_SPECIALISATION_KEY + "." + FormationSpecialisation.SCOL_FORMATION_DIPLOME_KEY + "." + FormationDiplome.FDIP_ABREVIATION_KEY, EOSortOrdering.CompareAscending); EOSortOrdering sortNiveauPref = EOSortOrdering.sortOrderingWithKey( PrefScol.HABILITATION_KEY + "." + FormationHabilitation.FHAB_NIVEAU_KEY, EOSortOrdering.CompareAscending); eodHabilitationsChoisies.setSortOrderings( new NSArray<EOSortOrdering>(new EOSortOrdering[] {sortDiplomePref, sortNiveauPref})); updateEodHabilitations(); updatePreferences(); }